1

我在我的网站上设置了 plivo 直拨应用程序,现在正尝试开始对拨出电话进行录音,但我遇到了一个我无法解决的错误。

在操作网址中,我实际上什么也没做。有人可以指出我正确的方向吗?

    <?php
include_once( $_SERVER['DOCUMENT_ROOT'] . "/app/libraries/plivo.php");
$dst = $_REQUEST['ForwardTo'];
if(! $dst)
    $dst = $_REQUEST['To'];
$src = $_REQUEST['CLID'];
if(! $src)
    $src = $_REQUEST['From'] or "";
$cname = $_REQUEST['CallerName'] or "";
$hangup = $_REQUEST['HangupCause'];
$dial_music = $_REQUEST['DialMusic'];
$disable_call = $_REQUEST['DisableCall'];

$r = new Response();

if($dst) {
    $dial_params = array();
    $record_params = array(
                   'action' => '*****/record-onanswer.php', 
                   'startOnDialAnswer' => 'true',
                   'time_limit' => '600'
                   );
    if($src)
        $dial_params['callerId'] = $src;
    if($cname)
        $dial_params['callerName'] = $cname;
    if(substr($dst, 0,4) == "sip:")
        $is_sip_user = TRUE;
    else
        $is_sip_user = FALSE;
    if($is_sip_user and in_array($disable_call, array("all", "sip"))) {
        $r->addHangup(array("reason" => "busy"));
    } elseif (! $is_sip_user and in_array($disable_call, array("all", "number"))) {
        $r->addHangup(array("reason" => "busy"));
    } else {
        if($dial_music)  {
            $dial_params["dialMusic"] = $dial_music;            
            $d = $r->addDial($dial_params);
            $r->addRecord($record_params); 
        } else
            $d = $r->addDial($dial_params);
            $r->addRecord($record_params); 
        if($is_sip_user)
            $d->addUser($dst);
        else
            $d->addNumber($dst);
    }
 } else {
     $r->addHangup();
     $r->stop_record($params);
 }
header("Content-Type: text/xml");
echo($r->toXML());
?>
4

0 回答 0