ダイヤル プランから php スクリプトを実行するために AGI(Asterisk Gateway Interface) を使用しています。
私のダイヤルプランは次のようになります
exten =>2600,1,Playback(hello-world)
same =>n,AGI(agiscript.php)
same =>n,Hangup()
agiscript.phpは次のようになります
`#!/usr/bin/php -q
<?php
require_once('dbconnect.php');
db_connect();
$sql = "update oicall_main set balance='100' where username='100';";
$result = mysql_query($sql);
?>`
agi set debug on の cli 出力は
` -- <SIP/example-00000001> Playing 'hello-world.gsm' (language 'en')
-- Executing [2600@demo:2] AGI("SIP/example-00000001", "agiscript.php") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/agiscript.php
<SIP/example-00000001>AGI Tx >> agi_request: agiscript.php
<SIP/example-00000001>AGI Tx >> agi_channel: SIP/example-00000001
<SIP/example-00000001>AGI Tx >> agi_language: en
<SIP/example-00000001>AGI Tx >> agi_type: SIP
<SIP/example-00000001>AGI Tx >> agi_uniqueid: 1435426730.1
<SIP/example-00000001>AGI Tx >> agi_version: 13.2.0
<SIP/example-00000001>AGI Tx >> agi_callerid: example
<SIP/example-00000001>AGI Tx >> agi_calleridname: unknown
<SIP/example-00000001>AGI Tx >> agi_callingpres: 0
<SIP/example-00000001>AGI Tx >> agi_callingani2: 0
<SIP/example-00000001>AGI Tx >> agi_callington: 0
<SIP/example-00000001>AGI Tx >> agi_callingtns: 0
<SIP/example-00000001>AGI Tx >> agi_dnid: 2600
<SIP/example-00000001>AGI Tx >> agi_rdnis: unknown
<SIP/example-00000001>AGI Tx >> agi_context: demo
<SIP/example-00000001>AGI Tx >> agi_extension: 2600
<SIP/example-00000001>AGI Tx >> agi_priority: 2
<SIP/example-00000001>AGI Tx >> agi_enhanced: 0.0
<SIP/example-00000001>AGI Tx >> agi_accountcode:
<SIP/example-00000001>AGI Tx >> agi_threadid: 140718795228928
<SIP/example-00000001>AGI Tx >>
<SIP/example-00000001>AGI Rx << verbose "Failed to execute '/var/lib/asterisk/agi-bin/agiscript.php': No such file or directory" 1
agiscript.php: Failed to execute '/var/lib/asterisk/agi-bin/agiscript.php': No such file or directory
<SIP/example-00000001>AGI Tx >> 200 result=1`