Summary:ASTERISK-09207: [PATCH] SIP Redirect through Transfer() app does not work properly
Reporter:Terry Wilson (twilson)Labels:
Date Opened:2007-04-05 22:22:32Date Closed:2007-07-11 19:58:56
Versions:Frequency of
Environment:Attachments:( 0) fix_transfer.patch.txt
Description:There are two problems 1) TRANSFERSTATUS always reports a failure after Transfer() is called from the dialplan and 2) after Transfer completes the dialplan continues and when Hangup is called (or autofallthrough happens) additional SIP messages are sent after the 302 Redirect, which isn't RFC compliant (603 in the case of a Hangup) and cuasing lots of retransmissions.

****** STEPS TO REPRODUCE ******

Register a device to asterisk with following dialplan
exten => 123,1,Transfer(SIP/${EXTEN}@
exten => 123,n,NoOp(After Transfer: ${TRANSFERSTATUS})
exten => 123.,n,Hangup

Set up a second asterisk box (in this example @ that Answers and plays back a message

Do 'sip set debug' and watch the errors and also notice that TRANSFERSTATUS is FAILED.


Attatched is a patch that fixes both problems.  sip_sipredirect is only called in the case of the Transfer app from what I can tell, and app_transfer takes a negative return and converts it to a 0 so it won't cause a hangup anyway, so this change shouldn't cause any other problems.
Comments:By: Leif Madsen (lmadsen) 2007-04-06 11:00:21

Confirmed and tested by me.

By: Terry Wilson (twilson) 2007-04-10 01:02:55

Anyone need anything else from me?

By: Olle Johansson (oej) 2007-04-10 02:11:19

ANother issue is that the transfer() dialplan app is broken, there's no way to signal an error back if the REFER was declined.

Will look into this.

By: Terry Wilson (twilson) 2007-04-10 11:22:54

Yeah, but this part doesn't do anything with the REFER part of the code, just the 302 stuff.  Since there is no way to signal a failure, this code basically tells asterisk to assume that it succeeded, since always assuming failure is a bad thing.  :-)

By: Terry Wilson (twilson) 2007-04-13 16:32:06

Any chance of getting this committed as it at least fixes one problem with the chan_sip interfacing with the Transfer() app that is completely broken in the released code?  Especially since it might be a lot more common for people to use the Transfer app for redirection (what this patch fixes) than with REFERs anyway since nearly all SIP phones have native ability to transfer anyway.

By: Olle Johansson (oej) 2007-04-16 09:44:40

Why the "sip_alreadygone" ?

By: Terry Wilson (twilson) 2007-04-28 09:24:37

Because if we don't mark sip_alreadygone, then we try to send a 603 after we complete the transfer.  You don't want to send any other messages to a phone after you send it a 302.

By: Olle Johansson (oej) 2007-05-16 05:06:39

Committed to 1.4 rev 64578, thanks!