[Home]

Summary:ASTERISK-11040: [patch] ChannelRedirect causes the channel executing it to terminate if any form of error occurs.
Reporter:Johan Wilfer (johan)Labels:
Date Opened:2007-12-14 11:05:04.000-0600Date Closed:2008-02-19 12:36:56.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_channelredirect
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_channelredirect-20080219.patch
( 1) CHANGES.channelredirect.patch
( 2) UPGRADE.txt.channelredirect.patch
Description:When you use ChannelRedirect on a channel that does not exist the call will be terminated, and the execution of the dial plan will end. Instead only the error message should be returned, and the execution of the dial plan can then continue as it should.

The enclosed patch change the behaviour of ChannelRedirect to set the channel variable CR_STATUS to either SUCCESS, NOARGS, BADARGS, NOCHANNEL, BADEXTENSION or FAIL, so that your dial plan does not have to crash and burn in agony.
Comments:By: Tilghman Lesher (tilghman) 2007-12-27 17:37:39.000-0600

Okay:

1) the name of the status variable should be CHANNELREDIRECT_STATUS.

2) The help text should wrap at 80 columns.

3) This needs to be patched against trunk, not 1.4.

4) You need to document these changes in the CHANGES and UPGRADE.txt files.

By: Johan Wilfer (johan) 2008-01-12 16:27:53.000-0600

Finally I've made the changes, please rename app_channelredirect.patch to reflect that this is a patch for 1.4-trunk, I guess Asterisk version could be changed to trunk as well.

I have tested the patch the best I could - however - it seems to a problem with the function ast_parseable_goto that does the actual work. I can't get either the original ChannelRedirect or my patched version to behave as it does in 1.4. I thought I was implementing this badly, but the same problem exists with the original version. See issue 0011753.

So this will work if we get ast_parseable_goto fixed!



By: Johan Wilfer (johan) 2008-01-30 20:37:42.000-0600

Please test this patch, and the related 0011753.
I've used this patch for 1.4 and it is working great but I've had much trouble when porting it to svn. For me this patch works as good (bad) as ChannelRedirect works originally.

I really don't know where to look..

The problem (described in 0011753) - is that a channel waiting, playing or so is "stuck" on priority 0 until the current command is finished, then the right priority is executed.

I'm so confused...

By: Johan Wilfer (johan) 2008-02-04 19:24:52.000-0600

Maybe you could add a relationship to 0011753, that is the main issue here.
Also right now this needs to be merged manualy because some changes after this patch to app_channelredirect.c

However I have one question. In revision 76703 the following test was removed, that I have reintroduced. Am I in error here?
- res = ast_parseable_goto(chan2, args.label);
+ if (!ast_parseable_goto(chan2, args.label)) {
+ ast_log(LOG_WARNING, "%s failed for %s\n", app, args.channel);
+ pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "FAIL");
+ } else {
+ pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "SUCCESS");
+ }

By: jmls (jmls) 2008-02-17 13:01:07.000-0600

Corydon76, any further comments ?

By: Tilghman Lesher (tilghman) 2008-02-18 15:30:01.000-0600

jmls: someone else needs to respond whether that code is necessary.

By: Johan Wilfer (johan) 2008-02-19 10:35:30.000-0600

That code isn't necessary, reading the code shows that ast_async_parseable_goto always returns 0, so I simplified the patch.

Please delete the two older patches: app_channelredirect.c.trunk.patch and app_channelredirect.patch

I also removed the NOARGS, BADARGS, BADEXTENSION an FAIL as results leaving only
NOCHANNEL and SUCCESS. This is because everything else could be done in dialplan.

That means a minimum of changes, but still the relevant and important one.
Catch the possibility that the channel has gone away...

By: Digium Subversion (svnbot) 2008-02-19 12:36:55.000-0600

Repository: asterisk
Revision: 103819

U   trunk/CHANGES
U   trunk/UPGRADE.txt
U   trunk/apps/app_channelredirect.c

------------------------------------------------------------------------
r103819 | file | 2008-02-19 12:36:55 -0600 (Tue, 19 Feb 2008) | 8 lines

Add CHANNELREDIRECT_STATUS variable to ChannelRedirect() dialplan application. This will either be set to NOCHANNEL if the given channel was not found or SUCCESS if it worked.
(closes issue ASTERISK-11040)
Reported by: johan
Patches:
     UPGRADE.txt.channelredirect.patch uploaded by johan (license 334)
     CHANGES.channelredirect.patch uploaded by johan (license 334)
     app_channelredirect-20080219.patch uploaded by johan (license 334)

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

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