[Asterisk-code-review] chan sip.c: AMI & CLI notify methods get different values of... (asterisk[master])

Mark Michelson asteriskteam at digium.com
Tue Feb 2 15:58:50 CST 2016


Mark Michelson has submitted this change and it was merged.

Change subject: chan_sip.c: AMI & CLI notify methods get different values of asterisk's own ip.
......................................................................


chan_sip.c: AMI & CLI notify methods get different values of asterisk's own ip.

When I ask asterisk to send a SIP NOTIFY message to a sip peer using either a)
AMI action: SIPnotify or b) cli command: sip notify <cmd> <peer>, I expect
asterisk to include the same value for its own ip in both cases a) and b),
but it seems a) produces a contact header like Contact:
<sip:asterisk at 192.168.1.227:8060> whereas b) produces a contact header like
<sip:asterisk at 127.0.0.1:8060>. 0.0.0.0:8060 is my udpbindaddr in sip.conf

My guess is that manager_sipnotify should call
ast_sip_ouraddrfor(&p->sa, &p->ourip, p) the same way sip_cli_notify does,
because after applying this patch, both cases a) and b) produce
the contact header that I expect: <sip:asterisk at 192.168.1.227:8060>

Reported by: Stefan Engström
Tested by: Stefan Engström

Change-Id: I86af5e209db64aab82c25417de6c768fb645f476
---
M channels/chan_sip.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a3c6fb2..10b0d23 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -15160,6 +15160,12 @@
 		}
 	}
 
+	/* 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);
+
 	sip_scheddestroy(p, SIP_TRANS_TIMEOUT);
 	transmit_invite(p, SIP_NOTIFY, 0, 2, NULL);
 	dialog_unref(p, "bump down the count of p since we're done with it.");

-- 
To view, visit https://gerrit.asterisk.org/2126
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I86af5e209db64aab82c25417de6c768fb645f476
Gerrit-PatchSet: 4
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Stefan Engström <stefanen at kth.se>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Stefan Engström <stefanen at kth.se>



More information about the asterisk-code-review mailing list