summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefanEng86 <stefanen@kth.se>2016-01-29 14:39:06 +0100
committerJoshua Colp <jcolp@digium.com>2016-01-31 10:25:05 -0600
commitaa9348ab9aa0069e5992be38321f7849697206f1 (patch)
treea1038ffefa33975f2a2be049d071c8225a130a80
parent9711ad0de6535055c97cd833811ff055223c2cd4 (diff)
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@192.168.1.227:8060> whereas b) produces a contact header like <sip:asterisk@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@192.168.1.227:8060> Reported by: Stefan Engström Tested by: Stefan Engström Change-Id: I86af5e209db64aab82c25417de6c768fb645f476
-rw-r--r--channels/chan_sip.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 684431740..60ff451c1 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -15159,6 +15159,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.");