add 2 fixes backported from asterisk svn related to pickup & transfer (should close...
[openwrt/svn-archive/archive.git] / net / asterisk-1.4.x / patches / 802-bug_14611.patch
1 https://issues.asterisk.org/view.php?id=14611
2
3 --- a/channels/chan_sip.c
4 +++ b/channels/chan_sip.c
5 @@ -9119,6 +9119,9 @@ static struct sip_pvt *get_sip_pvt_byid_
6 if (!strcmp(sip_pvt_ptr->callid, callid)) {
7 int match = 1;
8
9 + if (option_debug > 3)
10 + ast_log(LOG_DEBUG, "Found call with callid %s (ourtag=%s, theirtag=%s)\n", callid, sip_pvt_ptr->tag, sip_pvt_ptr->theirtag);
11 +
12 /* Go ahead and lock it (and its owner) before returning */
13 ast_mutex_lock(&sip_pvt_ptr->lock);
14
15 @@ -9129,16 +9132,21 @@ static struct sip_pvt *get_sip_pvt_byid_
16 if (pedanticsipchecking) {
17 const char *pvt_fromtag, *pvt_totag;
18
19 - if (ast_test_flag(&sip_pvt_ptr->flags[1], SIP_PAGE2_OUTGOING_CALL)) {
20 - /* Outgoing call tags : from is "our", to is "their" */
21 - pvt_fromtag = sip_pvt_ptr->tag ;
22 - pvt_totag = sip_pvt_ptr->theirtag ;
23 - } else {
24 - /* Incoming call tags : from is "their", to is "our" */
25 - pvt_fromtag = sip_pvt_ptr->theirtag ;
26 - pvt_totag = sip_pvt_ptr->tag ;
27 - }
28 - if (ast_strlen_zero(fromtag) || strcmp(fromtag, pvt_fromtag) || (!ast_strlen_zero(totag) && strcmp(totag, pvt_totag)))
29 + /* RFC 3891
30 + > 3. User Agent Server Behavior: Receiving a Replaces Header
31 + > The Replaces header contains information used to match an existing
32 + > SIP dialog (call-id, to-tag, and from-tag). Upon receiving an INVITE
33 + > with a Replaces header, the User Agent (UA) attempts to match this
34 + > information with a confirmed or early dialog. The User Agent Server
35 + > (UAS) matches the to-tag and from-tag parameters as if they were tags
36 + > present in an incoming request. In other words, the to-tag parameter
37 + > is compared to the local tag, and the from-tag parameter is compared
38 + > to the remote tag.
39 +
40 + Thus, the totag is always compared to the local tag, regardless if
41 + this our call is an incoming or outgoing call.
42 + */
43 + if (ast_strlen_zero(fromtag) || strcmp(fromtag, sip_pvt_ptr->theirtag) || (!ast_strlen_zero(totag) && strcmp(totag, sip_pvt_ptr->tag)))
44 match = 0;
45 }
46