[Home]

Summary:ASTERISK-12623: [patch] check correct tags during REFER in pedantic mode
Reporter:Frederic LE FOLL (flefoll)Labels:
Date Opened:2008-08-21 03:14:45Date Closed:2008-08-27 14:40:14
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Transfers
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_sip.c.br14.139015.patch-refer-pedantic
( 1) chan_sip.c.br160.139017.patch-refer-pedantic
Description:Half of REFER request for attended transfers are rejected in pedantic mode, depending on calls directions.
Indeed, function get_sip_pvt_byid_locked() includes a comment that says that one should take care of call direction when checking from/to tags against our/their tags, but nothing is done in code (neither in function, nor in calling code) to do this.

I propose a patch that checks call direction before comparing from/to tags (input parameters) and our/their tags (stored in pvt data structures).
The patch also fixes an error in a trace that checks SIP_OUTGOING flag (last transaction direction) instead of SIP_PAGE2_OUTGOING_CALL (call direction).
Comments:By: Mark Michelson (mmichelson) 2008-08-26 11:47:39

The patch you supplied seems correct logically. The one question I have is regarding the check of the sip_pvt's outgoing_call variable. It seems like the tag checking should be made based on the direction of the current transaction, not the current call. I wonder if it should be changed to check the SIP_OUTGOING flag instead. Let me know what you think.

By: Frederic LE FOLL (flefoll) 2008-08-27 08:52:40

Frankly, I first tried to check SIP_OUTGOING first, since it was the flag that was tested in get_sip_pvt_byid_locked() debug trace. But it did not work.

Thus, I checked all 4 scenarios :
- incoming + outgoing + attended xfer
- outgoing + outgoing + attended xfer
- outgoing + incoming + attended xfer
- incoming + incoming + attended xfer
And it was clear that get_sip_pvt_byid_locked() receives fromtag and totag as they were in REFER ReferTo:<...?Replaces> header, and these tags came from initial INVITE for the call that was REFER'ed to, i.e. the right thing to do was to check the *call* direction, in order to re-match from/to against our/their tags that are stored in pvt structures.

I think this is consistent with RFC 3891 "The Session Initiation Protocol (SIP) "Replaces" Header".
As far as I can understand, it also seems consistent with draft-ietf-sipping-cc-transfer-09, 7.3. Attended Transfer.

By: Mark Michelson (mmichelson) 2008-08-27 09:31:22

Ah, thanks for the explanation. It makes much better sense to me now. I'll take one more look over it for sanity's sake. I'll commit it soon.

Thanks for contributing!

By: Digium Subversion (svnbot) 2008-08-27 14:40:12

Repository: asterisk
Revision: 140299

U   branches/1.4/channels/chan_sip.c

------------------------------------------------------------------------
r140299 | mmichelson | 2008-08-27 14:40:11 -0500 (Wed, 27 Aug 2008) | 11 lines

Fix tag checking in get_sip_pvt_byid_locked when
in pedantic mode. The problem was that the wrong
tags would be compared depending on the direction
of the call.

(closes issue ASTERISK-12623)
Reported by: flefoll
Patches:
     chan_sip.c.br14.139015.patch-refer-pedantic uploaded by flefoll (license 244)


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=140299