Build contact without @ sign if there is no extension
authorMark Spencer <markster@digium.com>
Thu, 15 Jul 2004 14:31:20 +0000 (14:31 +0000)
committerMark Spencer <markster@digium.com>
Thu, 15 Jul 2004 14:31:20 +0000 (14:31 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3440 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index bca25b6..7037ee6 100755 (executable)
@@ -3590,9 +3590,9 @@ static void build_contact(struct sip_pvt *p)
        char iabuf[INET_ADDRSTRLEN];
        /* Construct Contact: header */
        if (ourport != 5060)
        char iabuf[INET_ADDRSTRLEN];
        /* Construct Contact: header */
        if (ourport != 5060)
-               snprintf(p->our_contact, sizeof(p->our_contact), "<sip:%s@%s:%d>", p->exten, ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport);
+               snprintf(p->our_contact, sizeof(p->our_contact), "<sip:%s%s%s:%d>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport);
        else
        else
-               snprintf(p->our_contact, sizeof(p->our_contact), "<sip:%s@%s>", p->exten, ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip));
+               snprintf(p->our_contact, sizeof(p->our_contact), "<sip:%s%s%s>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip));
 }
 
 /*--- initreqprep: Initiate SIP request to peer/user ---*/
 }
 
 /*--- initreqprep: Initiate SIP request to peer/user ---*/