Hello
At some point in extensions.conf, I need to check if the FXO card is off-hook, but didn’t find an example of how to do this.
Here’s the code, where HERE shows where I’d like to put the GotoIf():
exten => s,1,Wait(2)
exten => s,n,GotoIf($[${LEN(${CALLERID(num)})} = 0]?nocid,1:cid,1)
;Prompt user for CID number
exten => nocid,1,Read(CALLERID(num),no_cid,10)
;At least 10 digits
exten => nocid,n,GotoIf($[${LEN(${CALLERID(num)})} < 10]?cid,1)
exten => nocid,n,Wait(1)
exten => nocid,n,Hangup()
;If found in DB, rewrite CID name on the fly
exten => cid,1,AGI(check_cid.phpcli|${CALLERID(num)}|${CALLERID(name)})
exten => cid,n,Goto(main_menu,s,1)
[main_menu]
;HERE : Check for channel status: If on-hook, go off-hook
exten => s,n,Answer()
exten => s,n,Background(main_menu)
exten => s,n,WaitExten(5)
exten => s,n,Hangup()
Thank you.