Redirect custom destination to external number with timeout

Hi Everyone,

Currently I’m working on a script for a custom destination.
This script uses the users input from an incomming call and a PHP Agi script to retrieve an external redirect number from a database and should forward the incomming call to the external number.
This all works without any problems, but I’m now stuck on forwarding the incomming call with an time-out. I need a time-out on the forwarde so I can redirect the call if the external number is not available.

Here is my code, forwarder variable is holding the external number the call should be forwarded to.

[ivr-bkt]
exten => s,1,Answer
exten => s,n,AGI(getforward.php)
exten => s,n,Goto(from-internal,${forwarder},1)
exten => s,n,Hangup()

This example works, but if the call is not answered the script stops.
What is the best way to transfer te call to a external number with an time-out of 15 seconds and the redirect the call to another number?

Thank you

More complex, but instead of using goto, use Dial to:

 local/${forwarder}@from-internal

The dial gives you timeout options. After the dial you can check the value of ${DIALSTATUS} and do something else if value is not ANSWER.

1 Like

Thanks Lorne,

That solved my issue, i’ve tried a lot with the Dial function but could not manage to initiatea call.
Using the local/#@from-internal did the trick.

1 Like