From: David Vossel Date: Fri, 17 Jul 2009 16:05:06 +0000 (+0000) Subject: SIP incorrect From: header information when callpres is prohib X-Git-Tag: 1.4.26.2~4^2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c82de7d7edb32b8768690f518f2778722f860d9;p=thirdparty%2Fasterisk.git SIP incorrect From: header information when callpres is prohib Some ITSP make use of the "Anonymous" display name to detect a requirement to withhold caller id across the PSTN. This does not work if the display name is "Unknown". (closes issue #14465) Reported by: Nick_Lewis Patches: chan_sip.c-callerpres.patch uploaded by Nick (license 657) chan_sip.c-callerpres_trunk.patch uploaded by dvossel (license 671) Tested by: Nick_Lewis, dvossel git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@206938 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 0c403ea2c9..63b303211b 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -198,7 +198,8 @@ static char seen_lastms = 0; #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif -#define CALLERID_UNKNOWN "Unknown" +#define CALLERID_UNKNOWN "Anonymous" +#define FROMDOMAIN_INVALID "anonymous.invalid" #define DEFAULT_MAXMS 2000 /*!< Qualification: Must be faster than 2 seconds by default */ #define DEFAULT_FREQ_OK 60 * 1000 /*!< Qualification: How often to check for the host to be up */ @@ -7218,7 +7219,7 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho char to[256]; char tmp[SIPBUFSIZE/2]; char tmp2[SIPBUFSIZE/2]; - const char *l = NULL, *n = NULL; + const char *l = NULL, *n = NULL, *d = NULL; const char *urioptions = ""; if (ast_test_flag(&p->flags[0], SIP_USEREQPHONE)) { @@ -7243,6 +7244,7 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho snprintf(p->lastmsg, sizeof(p->lastmsg), "Init: %s", sip_methods[sipmethod].text); + d = S_OR(p->fromdomain, ast_inet_ntoa(p->ourip)); if (p->owner) { l = p->owner->cid.cid_num; n = p->owner->cid.cid_name; @@ -7252,6 +7254,7 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho ((p->callingpres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED)) { l = CALLERID_UNKNOWN; n = l; + d = FROMDOMAIN_INVALID; } if (ast_strlen_zero(l)) l = default_callerid; @@ -7277,9 +7280,9 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho } if (ourport != STANDARD_SIP_PORT && ast_strlen_zero(p->fromdomain)) - snprintf(from, sizeof(from), "\"%s\" ;tag=%s", n, l, S_OR(p->fromdomain, ast_inet_ntoa(p->ourip)), ourport, p->tag); + snprintf(from, sizeof(from), "\"%s\" ;tag=%s", n, l, d, ourport, p->tag); else - snprintf(from, sizeof(from), "\"%s\" ;tag=%s", n, l, S_OR(p->fromdomain, ast_inet_ntoa(p->ourip)), p->tag); + snprintf(from, sizeof(from), "\"%s\" ;tag=%s", n, l, d, p->tag); /* If we're calling a registered SIP peer, use the fullcontact to dial to the peer */ if (!ast_strlen_zero(p->fullcontact)) {