[asterisk-commits] dvossel: branch 1.6.1 r202674 - in /branches/1.6.1: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 23 11:34:49 CDT 2009


Author: dvossel
Date: Tue Jun 23 11:34:45 2009
New Revision: 202674

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=202674
Log:
Merged revisions 202672 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r202672 | dvossel | 2009-06-23 11:31:30 -0500 (Tue, 23 Jun 2009) | 18 lines
  
  Merged revisions 202671 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r202671 | dvossel | 2009-06-23 11:28:46 -0500 (Tue, 23 Jun 2009) | 12 lines
    
    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/
  ........
................

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/channels/chan_sip.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/channels/chan_sip.c?view=diff&rev=202674&r1=202673&r2=202674
==============================================================================
--- branches/1.6.1/channels/chan_sip.c (original)
+++ branches/1.6.1/channels/chan_sip.c Tue Jun 23 11:34:45 2009
@@ -9904,14 +9904,29 @@
 {
 	struct sip_request req;
 	struct ast_str *out = ast_str_alloca(500);
-	
+	int ourport = ntohs(p->ourip.sin_port);
+	const char *exten = S_OR(vmexten, default_vmexten);
+
 	initreqprep(&req, p, SIP_NOTIFY);
 	add_header(&req, "Event", "message-summary");
 	add_header(&req, "Content-Type", default_notifymime);
-
 	ast_str_append(&out, 0, "Messages-Waiting: %s\r\n", newmsgs ? "yes" : "no");
-	ast_str_append(&out, 0, "Message-Account: sip:%s@%s\r\n",
-		S_OR(vmexten, default_vmexten), S_OR(p->fromdomain, ast_inet_ntoa(p->ourip.sin_addr)));
+
+	if (!ast_strlen_zero(p->fromdomain)) {
+		ast_str_append(&out, 0, "Message-Account: sip:%s@%s\r\n", exten, p->fromdomain);
+	} else if (!sip_standard_port(p->socket.type, ourport)) {
+		if (p->socket.type == SIP_TRANSPORT_UDP) {
+			ast_str_append(&out, 0, "Message-Account: sip:%s@%s:%d\r\n", exten, ast_inet_ntoa(p->ourip.sin_addr), ourport);
+		} else {
+			ast_str_append(&out, 0, "Message-Account: sip:%s@%s:%d;transport=%s\r\n", exten, ast_inet_ntoa(p->ourip.sin_addr), ourport, get_transport(p->socket.type));
+		}
+	} else {
+		if (p->socket.type == SIP_TRANSPORT_UDP) {
+			ast_str_append(&out, 0, "Message-Account: sip:%s@%s\r\n", exten, ast_inet_ntoa(p->ourip.sin_addr));
+		} else {
+			ast_str_append(&out, 0, "Message-Account: sip:%s@%s;transport=%s\r\n", exten, ast_inet_ntoa(p->ourip.sin_addr), get_transport(p->socket.type));
+		}
+	}
 	/* 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 */




More information about the asterisk-commits mailing list