I am new to Asterisk. I am building an application in which callers call a queue number (in my condition the queue number is 5555). The queue transfers the calls to the avaliable agent. (agents logs in to the queue through AgentLogin() function.)
It all works fine.
I want to run a PHP code when the agent gets a call through queue. For Direct calls the PHP code runs fine. Please see both the cases described below. CASE:1 is fine, the problem is in CASE:2.
My extensions.conf has got:
[b]
extensions.conf:
PROBLEM: No problem, every thing is working as expected.
CASE 2: (ext:6789 dials queue:5555, where ext:1234 is logged in as agent)
1234 is logged in and music is playing in the headset.
6789 calls 5555
5555 transfers the call to 1234
1234 listens a beep
1234 automatically answers the call
6789 and 1234 are now talking to each other.
PROBLEM: in this CASE agiThePhpCode.php didnt execute.
If any body can please let me know how to execute the agiThePhpCode.php in the CASE:2 Senario.
6789 calls 1234
php code executes
php code receives a value of 6789 in source through ${CDR(src)}
php code receives a value of 1234 in destination ${CDR(dst)}
1234 phone rings
if 6789 calls 5555 and 5555 directs the call to 1234, the senario is:
6789 calls 5555
php code executes
php code receives a value of 6789 in source through ${CDR(src)}
php code receives a value of 5555 in destination through ${CDR(dst)}
5555 directs the call to 1234
1234 music on hold stops
1234 answers automatically.
the reason i wanted my php code to work, was to get the agent number to whom the queue (5555) will forward the call. The solution you provided did work, but it doesn’t sends the agent number to the php code. it send the queue number i.e. 5555 to the php.
is there any way i can get the number of the agent to whom the call will be forwarded by the queue. or even after the call is forwarded can i get the number of the agent who just got the call from the queue.???
In queues.conf, add this parameter in the general section.
setinterfacevar=yes
Then in your php, grab the MEMBERINTERFACE channel variable for the agent the queue is connecting to. We use this for screen pops for some of our clients.
You mean I should first add the following line under general in my queues.conf:
setinterfacevar=yes
and then when i call the php script through agi i should send a channel variable MEMBERINTERFACE which makes the whole statement in extensions.conf like this:
and then i read the values in php as i did for src and dst,
the php code executes, i get the values of src and dst, but the mmbetinterface is empty.
The perl code you provided i tried that, but i think that wont work as it is in php, thats why the php code didnt executed at all when i tried it.
i dont know its php counterpart, so googled a bit for it and foud some thing else. please have a look at it.
“That is highly dependent on when you attempt to get the value. The
MEMBERINTERFACE variable is set once a member has answered the call, so if you
are running your AGI before that, then MEMBERINTERFACE will be empty. One option
you have is to pass the name of an AGI script as the sixth argument to Queue().
This AGI will run between when the member answers the call and when the call is
bridged. At that point, the MEMBERINTERFACE variable will be populated with the
correct string.”
WHT does he mean by SIXTH ARGUMENT???..doest that make any sense…???
let me know if u get hand on your perl code’s php counterpart.
and if the message above i got from google search makes any sense then please let me knoe how to apply it.
Your problem is that you are using ${CDR(memberinterface)} as a parameter to the agi… That value doesn’t exist so it won’t work. The agent the queue is sending the call into is not known at the time the caller enters the queue. So you will not be able to pass it into the queue application. The AGI application is executed when the bridge between the Agent and the Caller is made (In easier terms, when the agent answers the phone). You need to read in the MEMBERINTERFACE variable inside your php script when it is looking for the agent the call was connected to.
RESULT: php code does not execute. (Probably a syntax error)
I looked out at google…found some one with the same problem. but no body has given any answers to it.
I know this might not be the right place to ask about this syntax/php issus…but if you, or any one else who comes here and read this post, please let me know HOW I CAN RETRIEVE MBERINTERFACE VALUE IN PHP CODE.
Once again thanks allot for your help and consideration.