laforge
/
openbts-osmo
Archived
1
0
Fork 0

Make "from" address for bounce messages configurable.

This commit is contained in:
Alexander Chemeris 2010-11-05 15:11:16 +03:00 committed by Thomas Tsou
parent d54e4d82fd
commit 49b8ffd2d8
2 changed files with 15 additions and 12 deletions

View File

@ -52,8 +52,11 @@ SMS.FakeSrcSMSC 0000
# return SMS messages # return SMS messages
BounceMessage.IMSILookupFailed Cannot determine return address; bouncing message. Text your phone number to 101 to register and try again. Bounce.Message.IMSILookupFailed Cannot determine return address; bouncing message. Text your phone number to 101 to register and try again.
BounceMessage.NotRegistered Phone not registered here. Bounce.Message.NotRegistered Phone not registered here.
# Bounce from address
Bounce.Code 411

View File

@ -1173,19 +1173,19 @@ SMq::bounce_message(short_msg_pending *sent_msg, const char *errstr)
else else
errmsg << "can't send: " << thetext; errmsg << "can't send: " << thetext;
// Don't bounce a message from 411, makes endless loops. // Don't bounce a message from us - it makes endless loops.
status = 1; status = 1;
if (0 != strcmp("411", sent_msg->parsed->from->url->username)) { if (0 != strcmp(gConfig.getStr("Bounce.Code"), sent_msg->parsed->from->url->username))
{
// But do bounce anything else. // But do bounce anything else.
char *bounceto = sent_msg->parsed->from->url->username; char *bounceto = sent_msg->parsed->from->url->username;
bool bounce_to_imsi = 0 == strncmp("IMSI", bounceto, 4) bool bounce_to_imsi = 0 == strncmp("IMSI", bounceto, 4)
|| 0 == strncmp("imsi", bounceto, 4); || 0 == strncmp("imsi", bounceto, 4);
status = originate_sm("411", // from "411"? FIXME? status = originate_sm(gConfig.getStr("Bounce.Code"), // Read from a config
bounceto, // to his phonenum or IMSI bounceto, // to his phonenum or IMSI
errmsg.str().c_str(), // error msg errmsg.str().c_str(), // error msg
bounce_to_imsi? bounce_to_imsi? REQUEST_DESTINATION_SIPURL: // dest is IMSI
REQUEST_DESTINATION_SIPURL: // dest is IMSI REQUEST_DESTINATION_IMSI); // dest is phonenum
REQUEST_DESTINATION_IMSI); // dest is phonenum
} }
if (status == 0) { if (status == 0) {
return DELETE_ME_STATE; return DELETE_ME_STATE;
@ -1513,7 +1513,7 @@ SMq::lookup_from_address (short_msg_pending *qmsg)
<< "> to phonenum failed."; << "> to phonenum failed.";
LOG(DEBUG) << qmsg->text; LOG(DEBUG) << qmsg->text;
return bounce_message (qmsg, return bounce_message (qmsg,
gConfig.getStr("BounceMessage.IMSILookupFailed") gConfig.getStr("Bounce.Message.IMSILookupFailed")
); );
// return NO_STATE; // Put it into limbo for debug. // return NO_STATE; // Put it into limbo for debug.
} }
@ -1592,7 +1592,7 @@ SMq::lookup_uri_imsi (short_msg_pending *qmsg)
|| !my_hlr.useGateway(username)) { || !my_hlr.useGateway(username)) {
// There's no global relay -- or the HLR says not to // There's no global relay -- or the HLR says not to
// use the global relay for it -- so send a bounce. // use the global relay for it -- so send a bounce.
return bounce_message (qmsg, gConfig.getStr("BounceMessage.NotRegistered")); return bounce_message (qmsg, gConfig.getStr("Bounce.Message.NotRegistered"));
} else { } else {
// Send the message to our global relay. // Send the message to our global relay.
// We leave the username as a phone number, and // We leave the username as a phone number, and