From: David Vossel Date: Tue, 23 Jun 2009 16:28:46 +0000 (+0000) Subject: MWI NOTIFY contains a wrong URI if Asterisk listens to non-standard port and transport X-Git-Tag: 1.4.26-rc4~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6106936cb1c464ae80fd6788a123e9ea526e74a;p=thirdparty%2Fasterisk.git MWI NOTIFY contains a wrong URI if Asterisk listens to non-standard port and transport (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 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 0b0650e305..9498b63529 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -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 */