Recover call if ChannelRedirect/Dial fails

Our scenario:
A call comes to an agent, and when necessary, the agent redirects the call (ChannelRedirect, then Dial) using a feature. Dialplan is below:

[macro-transferxyz]
exten => s,1,ChannelRedirect(${DYNAMIC_PEERNAME},transfer-channel-xyz,s,1)
same => n,Verbose(2,exit)

[transfer-channel-xyz]
exten => s,1,Dial(SIP/xyz/5678,10)
same => n,Verbose(2,exit)

We would like to get the call back to the agent if redirect fails. How can we do that?

Thanks,
Matt

I thought Macro was removed in Asterisk 21.

DYNAMIC_PEERNAME is a confusing name, as ChannelRedirect takes a channel, not a peer.

As the redirect destination appears to be static, the only time the redirect could fail is if there is no longer a channel there to redirect, in which case there is no longer a channel to restore.

ChannelRedirect can be run on a channel that is not “in the dialplan”, so in the general case, there may be nowhere to return the channel.

If the redirected channel was connected to the Agent, the Agent will be hung up when the bridge is broken by the redirect.

Basically if you want to recover, you need to set up variables on the channel, indicating what to do an a failure, test for Dial failures, and then act on those variables.

If you don’t want to disconnect the agent on the redirect, you would need to use AMI, not dialplan, so you can redirect both, simultaneously.

Thanks David. We use an older version of Asterisk. DYNAMIC_PEERNAME is the caller’s channel name.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.