[asterisk-commits] elguero: branch 11 r378559 - in /branches/11: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 4 15:18:22 CST 2013


Author: elguero
Date: Fri Jan  4 15:18:18 2013
New Revision: 378559

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378559
Log:
Fix SIP Notify Messages To Have The Proper IP Address In The FROM Field

On a multihomed server when sending a NOTIFY message, we were not figuring out
which network should be used to contact the peer.

This patch fixes the problem by calling ast_sip_ouraddrfor() and then
build_via() so that our NOTIFY message contains the correct IP address.

Also, a debug message is being added to help follow the call-id changes that
occur.  This was helpful for confirming that the IP address was set properly
since the call-id contains the IP address.  It also will be helpful for
troubleshooting purposes when following a call in the debug logs.

(closes issue ASTERISK-20805)
Reported by: Bryan Hunt
Tested by: Bryan Hunt, Michael L. Young
Patches:
    asterisk-20805-notify-ip-v2.diff uploaded by Michael L. Young (license 5026)

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

Merged revisions 378554 from http://svn.asterisk.org/svn/asterisk/branches/1.8

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

Propchange: branches/11/
------------------------------------------------------------------------------
--- branch-1.8-merged (original)
+++ branch-1.8-merged Fri Jan  4 15:18:18 2013
@@ -1,1 +1,1 @@
-/branches/1.8:1-378147,378164,378356,378375,378427,378455-378456,378486,378514,378553
+/branches/1.8:1-378147,378164,378356,378375,378427,378455-378456,378486,378514,378554

Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=378559&r1=378558&r2=378559
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Fri Jan  4 15:18:18 2013
@@ -8494,6 +8494,7 @@
 {
 	int in_dialog_container;
 	int in_rtp_container;
+	char *oldid = ast_strdupa(pvt->callid);
 
 	ao2_lock(dialogs);
 	ao2_lock(dialogs_rtpcheck);
@@ -8514,6 +8515,10 @@
 	}
 	ao2_unlock(dialogs_rtpcheck);
 	ao2_unlock(dialogs);
+
+	if (strcmp(oldid, pvt->callid)) {
+		ast_debug(1, "SIP call-id changed from '%s' to '%s'\n", oldid, pvt->callid);
+	}
 }
 
 /*! \brief Build SIP Call-ID value for a REGISTER transaction */
@@ -21401,7 +21406,12 @@
 			}
 		}
 
-		/* Recalculate our side, and recalculate Call ID */
+		/* Now that we have the peer's address, set our ip and change callid */
+		ast_sip_ouraddrfor(&p->sa, &p->ourip, p);
+		build_via(p);
+
+		change_callid_pvt(p, NULL);
+
 		ast_cli(a->fd, "Sending NOTIFY of type '%s' to '%s'\n", a->argv[2], a->argv[i]);
 		sip_scheddestroy(p, SIP_TRANS_TIMEOUT);
 		transmit_invite(p, SIP_NOTIFY, 0, 2, NULL);




More information about the asterisk-commits mailing list