Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asterisk Server Pass Variable from Dialplan to AGI Script

My Dialplan is like this

[dial-plan]
exten => s,1,Answer()
exten => s,n,Noop(exten = ${EXTEN}
exten => s,n,Macro(dumpvars)
exten => s,n,Macro(record-enable)
exten => s,n,AGI(success.php)
exten => i,1,Noop(REASON = ${REASON})
exten => i,n,Macro(dumpvars)
exten => i,n,AGI(faile.php)
exten => failed,1,Noop(REASON = ${REASON})
exten => failed,n,Macro(dumpvars)
exten => failed,n,AGI(faile.php)

I want to catch from where faile.php called , It may be called from failed or from i . How can I check this

I need to make like this is faile.php

if($some_var == 1){
     //Invalid
}
elsif($some_var == 2){
    //Failed
}
like image 323
Miqdad Ali Avatar asked Jun 23 '26 00:06

Miqdad Ali


1 Answers

The agi will be called with some standard paramaters, include the called-from extension (in your case, that will be i or failed). Make sure you are parsing the arguments being passed to your script (via stdin)!

like image 74
Mbrevda Avatar answered Jun 24 '26 14:06

Mbrevda