On 14 September 2010 13:37, rentmycoder rentmycoder <rentmycoder@gmail.com> wrote:
Ahoy guys, FS rocks!

I'm trying to dial out on a gateway and send call into different
dialplan based on if it gets bridged or not.

I do:
bgapi originate {api_hangup_hook='lua
predictive_noanswer.lua',ignore_early_media=true,hangup_after_bridge=true,continue_on_fail=false,bypass_media=false}sofia/gateway/gwname/phoneno
'&lua(predictive_bridge.lua)'
This works, but when the gatway is down, the channel has not been
created, so neither script gets called...

[ERR] switch_ivr_originate.c:2430 Cannot create outgoing channel of
type [sofia] cause: [NETWORK_OUT_OF_ORDER]

I can add a second gateway to try if first is down and send the call
to dialplan extension using loopback, like:
... }sofia/gateway/gwname/phoneno,loopback/gw_error/default/XML 'lua(...
and add a gw_error extension to the dialplan, but how to get the
originate disposition of the first call, eg: NETWORK_OUT_OF_ORDER???


sip_profile/some_profile/your_gateway.xml
<param name="ping" value="25"/>

this pings the remote GW with SIP OPTIONS and if no response, it marks it down...
You can evaluate the status and originate calls towards a working GW.