On 12/29/2009 3:54 PM, Danny Nicholas wrote:
> You could do a System(core show channels) and grep out 911 and kill
> everything else;  probably easier as an AGI call that a dialplan function,
> but both can be done.

my end result just feels ugly.  the loop is due to the fact that I 
have more than one FXO port on vgw1 and I cant identify which is FXO 
port 0 (my land line).

anyone have anything better?


[nineoneone]
exten => s,1,Set(SET_EMERG_FLAG=0)
exten => s,n,Set(CALLERID(num)=${EMERGENCY_FROM})
exten => s,n,GotoIf($["${EMERGENCY}" = "1"]?lastresort,1)
exten => s,n,Set(EMERGENCY=1,g)
exten => s,n,Set(SET_EMERG_FLAG=1)
exten => s,n(kill),Set(CHAN=${SHELL(asterisk -rx "core show channels 
concise" |  awk -F! '/^SIP\/vgw1-/ { print $1 }' | head -1)})
exten => s,n,GotoIf($["${CHAN}" = ""]?dial)
exten => s,n,SoftHangup(${CHAN})
exten => s,n,Goto(kill)
exten => s,n(dial),Wait(3)
exten => 
s,n,Dial(SIP/${emergency_trunk}${emergency_n...@${emergency_host})
exten => s,n,GotoIf($[${DIALSTATUS} != "ANSWER" & ${DIALSTATUS} != 
"CANCEL"]?lastresort,1)

exten => h,1,GotoIf($[${SET_EMERG_FLAG} = 1]?unset,1)

exten => unset,1,Set(EMERGENCY=0,g)
exten => unset,n,Set(SET_EMERG_FLAG=0)

exten => lastresort,1,Macro(SaferSIPDial,${EMERGENCY_NUM})


-- 

Jeremy Kister
http://jeremy.kister.net./

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to