From: Joshua Colp Date: Mon, 24 Mar 2014 21:36:27 +0000 (+0000) Subject: chan_sip: Always use fromdomain if set for domain, even if callerid is set to restricted. X-Git-Tag: 1.8.27.0-rc1~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c7ed786e5348266a2711405d8de0438bb09cb9e;p=thirdparty%2Fasterisk.git chan_sip: Always use fromdomain if set for domain, even if callerid is set to restricted. (closes issue ASTERISK-20841) Reported by: Kelly Goedert git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@411021 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index fcd53c7cc1..13bf1c0d0a 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -12498,7 +12498,9 @@ 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_sockaddr_stringify_host_remote(&p->ourip)); + if (ast_strlen_zero(p->fromdomain)) { + d = ast_sockaddr_stringify_host_remote(&p->ourip); + } if (p->owner) { if ((ast_party_id_presentation(&p->owner->connected.id) & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) { l = p->owner->connected.id.number.valid ? p->owner->connected.id.number.str : NULL; @@ -12538,6 +12540,12 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho else /* Save for any further attempts */ ast_string_field_set(p, fromname, n); + /* Allow domain to be overridden */ + if (!ast_strlen_zero(p->fromdomain)) + d = p->fromdomain; + else /* Save for any further attempts */ + ast_string_field_set(p, fromdomain, d); + ast_copy_string(tmp_l, l, sizeof(tmp_l)); if (sip_cfg.pedanticsipchecking) { ast_escape_quoted(n, tmp_n, sizeof(tmp_n));