Hi Team,
We have the following senario:
Main Server:
Centos 6.4
Asterisk 1.8.5
Remote Server:
Centos 6.4
Apache/2.2.15
and
Asterisk 1.8.5
I am trying to setup a service where it is required to call the remote webserver through AGI php script.
We have the below in the .conf file for this service:
exten => s,1,Set(soundpath=/var/lib/asterisk/sounds/unlist/prompt/ar/)
exten => s,n,Set(LANGUAGE=ar)
exten => s,n,goto(selectservice,s,1)
exten => h,1,Set(x=${CDR(billsec)})
exten => h,n,AGI(agi://192.168.153.40:80/unlist/callEnd.php)
exten => h,n,Hangup
and the callEnd.php is as below:
#!/usr/bin/php -q
<?php include ("connection2.php"); $agiobj = new AGI; $STARTID = $agiobj->get_variable("STARTID"); $ID = $STARTID['data']; $duration = $agiobj->get_variable("x"); $DURATIONS = $duration['data']; $DURATIONM=($DURATIONS/60); $DURATIONM=ceil($DURATIONM); $sp = mssql_init("N_UPDATE_IN_CALL", $sqlconnect) or die("Couldn't call stored procedure"); mssql_bind($sp, '@ID', $ID , SQLINT4, FALSE); mssql_bind($sp, '@DurationM', $DURATIONM , SQLINT4, FALSE); mssql_bind($sp, '@durationS', $DURATIONS , SQLINT4, FALSE); $test = mssql_execute ($sp) or die(mssql_get_last_message()); ?>We have a problem that the we are not able to receive the parameters from the remote end.
I have run “agi set debug on” on the local server and got the below error:
– Executing [h@selectservice:2] AGI(“SIP/9611693505-00000030”, “agi://192.168.153.40:80/unlist/callEnd.php”) in new stack
AGI Tx >> agi_network: yes
AGI Tx >> agi_network_script: unlist/callEnd.php
<SIP/9611693505-00000030>AGI Tx >> agi_request: agi://192.168.153.40:80/unlist/callEnd.php
<SIP/9611693505-00000030>AGI Tx >> agi_channel: SIP/9611693505-00000030
<SIP/9611693505-00000030>AGI Tx >> agi_language: en
<SIP/9611693505-00000030>AGI Tx >> agi_type: SIP
<SIP/9611693505-00000030>AGI Tx >> agi_uniqueid: 1384183813.48
<SIP/9611693505-00000030>AGI Tx >> agi_version: 1.8.5.0
<SIP/9611693505-00000030>AGI Tx >> agi_callerid: 9611693505
<SIP/9611693505-00000030>AGI Tx >> agi_calleridname: 9611693505
<SIP/9611693505-00000030>AGI Tx >> agi_callingpres: 0
<SIP/9611693505-00000030>AGI Tx >> agi_callingani2: 0
<SIP/9611693505-00000030>AGI Tx >> agi_callington: 0
<SIP/9611693505-00000030>AGI Tx >> agi_callingtns: 0
<SIP/9611693505-00000030>AGI Tx >> agi_dnid: 555888
<SIP/9611693505-00000030>AGI Tx >> agi_rdnis: unknown
<SIP/9611693505-00000030>AGI Tx >> agi_context: selectservice
<SIP/9611693505-00000030>AGI Tx >> agi_extension: h
<SIP/9611693505-00000030>AGI Tx >> agi_priority: 2
<SIP/9611693505-00000030>AGI Tx >> agi_enhanced: 0.0
<SIP/9611693505-00000030>AGI Tx >> agi_accountcode:
<SIP/9611693505-00000030>AGI Tx >> agi_threadid: 139936069220096
<SIP/9611693505-00000030>AGI Tx >>
<SIP/9611693505-00000030>AGI Rx <<
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx <<
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx << 400 Bad Request
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx <<
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx <<
Bad Request
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx <<
Your browser sent a request that this server could not understand.
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx <<
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx <<
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx << Apache/2.2.15 (CentOS) Server at centosivr2.inmobiles.local Port 80
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
<SIP/9611693505-00000030>AGI Rx <<
<SIP/9611693505-00000030>AGI Tx >> 510 Invalid or unknown command
– <SIP/9611693505-00000030>AGI Script agi://192.168.153.40:80/unlist/callEnd.php completed, returning 0
– Executing [h@selectservice:3] Hangup(“SIP/9611693505-00000030”, “”) in new stack
== Spawn extension (selectservice, h, 3) exited non-zero on ‘SIP/9611693505-00000030’
Can you please support me on how to solve this issue and how to connect to remote agi and get the needed parametes?
This works fine if i point to a local file
exten => h,n,AGI(/unlist/callEnd.php)
so i know the issue is not with my php script.
Regards