我有一个Asterisk出站IVR系统设置,我希望它能在另一台服务器上与我的LAMP堆栈进行通信。 我已经build立了PHP端来接收来自IVR服务器的数据并将其logging在MySQL中,但我不知道如何让Asterisk结束去php的URL,我还没有想出如何从PHP服务器input一个variables到IVR脚本中。
在我目前的设置中,一个PHP脚本向星号服务器进行身份validation,然后发送一个出站呼叫命令。 出站呼叫然后转到extensions.conf中列出的呼叫脚本。 我的第一个问题是,如何通过URL将variables发送到extensions.conf,比如我打电话的人的姓名? 我是否必须每次都创build一个带有名称的.call文件,并将其FTP到Asterisk服务器中?
在调用脚本的某些地方,我想让Asterisk打开一个URL(格式为192.168.123.123/ivr/record?question=$question&answer=$answer)。 它不需要处理来自URL的任何数据,它只是告诉PHP将IVR呼叫数据集成到现有的LAMP系统中。 有没有办法做到这一点? 如果是这样,我该怎么做?
<?php //IVR controller on the PHP server. Our employee clicks a button and IVR makes a call. //... curl_setopt($ch, CURLOPT_URL, $call_url = $asterisk_server ."/rawman" . "?action=originate&channel=". $sip_trunk . $outbound_prefix . $next_call['phone_number'] . "&extension=$extension&context=outgoingIVR&priority=1"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt ($ch, CURLOPT_COOKIEFILE, $auth_cookie); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $urlresult = curl_exec($ch); curl_close($ch); //... ?> ;Extensions.conf on the IVR server [outgoingIVR] exten => 500,1,Wait(0.25) exten => 500,n,Answer() exten => 500,n,Wait(0.75) exten => 500,n,Festival("Hi. This is company name. We are the guys that do the thing.") exten => 500,n, Goto(question1,s,1) [question1] exten => s,1(start),Wait(0.5) ;@TODO: read variable into festival here. exten=> s,n, festival("Are You Jane Doe") same => n,WaitExten() exten => 1,1, Goto(are-you-sure,s,1) ;@TODO: save yes response here exten => 2,1, goto(get-jane,s,1) ;@TODO: save no response here
你在寻找func_curl 。 它可能不是默认构build在你的系统上,但是我引用的页面有指令来构build它。 以下是提供的示例:
exten => s,1,Set(foo=${CURL(http://somewhere.com/somepage.html?x=5&y=4)})