From e6c4a926c2e83aa86b6a21db74493bd1fde2443e Mon Sep 17 00:00:00 2001 From: StefanEng86 Date: Fri, 29 Jan 2016 14:39:06 +0100 Subject: [PATCH] chan_sip.c: AMI & CLI notify methods get different values of asterisk's own ip. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 , 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: whereas b) produces a contact header like . 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: Reported by: Stefan Engström Tested by: Stefan Engström Change-Id: I86af5e209db64aab82c25417de6c768fb645f476 --- channels/chan_sip.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 5436ab3f4c..6ebdd94ad7 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -15010,6 +15010,12 @@ static int manager_sipnotify(struct mansession *s, const struct message *m) } } + /* 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."); -- 2.47.2