]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
MWI NOTIFY contains a wrong URI if Asterisk listens to non-standard port and transport
authorDavid Vossel <dvossel@digium.com>
Tue, 23 Jun 2009 16:28:46 +0000 (16:28 +0000)
committerDavid Vossel <dvossel@digium.com>
Tue, 23 Jun 2009 16:28:46 +0000 (16:28 +0000)
(closes issue #14659)
Reported by: klaus3000
Patches:
      patch_chan_sip_fixMWIuri_1.4.txt uploaded by klaus3000 (license 65)
      mwi_port-transport_trunk.diff uploaded by dvossel (license 671)
Tested by: dvossel, klaus3000

Review: https://reviewboard.asterisk.org/r/288/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@202671 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 0b0650e3053d2a5afdeec24c5ba189ad786d0f52..9498b635297d33b50207d3abb5e25dfc15d5e0ae 100644 (file)
@@ -7636,8 +7636,16 @@ static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs,
        add_header(&req, "Content-Type", default_notifymime);
 
        ast_build_string(&t, &maxbytes, "Messages-Waiting: %s\r\n", newmsgs ? "yes" : "no");
-       ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n",
+       /* if we listen to non-standard SIP port we have to specify the SIP port
+       in the URI, except domains are used - in this case the SRV records should be
+       used to redirect the client to the non-standard SIP port */
+       if ((ourport != STANDARD_SIP_PORT) && ast_strlen_zero(p->fromdomain)) {
+               ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s:%d\r\n",
+               S_OR(vmexten, default_vmexten), ast_inet_ntoa(p->ourip), ourport);
+       } else {
+               ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n",
                S_OR(vmexten, default_vmexten), S_OR(p->fromdomain, ast_inet_ntoa(p->ourip)));
+       }
        /* Cisco has a bug in the SIP stack where it can't accept the
                (0/0) notification. This can temporarily be disabled in
                sip.conf with the "buggymwi" option */