[asterisk-users] identifying channel for softhangup

Jeremy Kister asterisk-01 at jeremykister.com
Tue Dec 29 21:33:23 CST 2009


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_NUM}@${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./



More information about the asterisk-users mailing list