示例#1
0
     } else {
         echo CUtil::PhpToJsObject(array('HASH' => $result, 'ERROR' => ''));
     }
 } else {
     if ($_POST['COMMAND'] == 'authorize_error') {
         $ViMain = new CVoxImplantMain($userId);
         $ViMain->ClearUserInfo();
         $ViMain->ClearAccountInfo();
     } else {
         if ($_POST['COMMAND'] == 'init') {
             $ViMain = new CVoxImplantMain($userId);
             $result = $ViMain->GetDialogInfo($_POST['NUMBER']);
             if ($result) {
                 echo CUtil::PhpToJsObject(array('DIALOG_ID' => $result['DIALOG_ID'], 'HR_PHOTO' => $result['HR_PHOTO'], 'ERROR' => ''));
             } else {
                 echo CUtil::PhpToJsObject(array('CODE' => $ViMain->GetError()->code, 'ERROR' => $ViMain->GetError()->msg));
             }
         } else {
             if ($_POST['COMMAND'] == 'deviceStartCall') {
                 $_POST['PARAMS'] = CUtil::JsObjectToPhp($_POST['PARAMS']);
                 if (CVoxImplantUser::GetPhoneActive($USER->GetId())) {
                     CVoxImplantOutgoing::StartCall($USER->GetId(), $_POST['PARAMS']['NUMBER']);
                 }
             } else {
                 if ($_POST['COMMAND'] == 'deviceHungup') {
                     $_POST['PARAMS'] = CUtil::JsObjectToPhp($_POST['PARAMS']);
                     CVoxImplantIncoming::SendCommand(array('CALL_ID' => $_POST['PARAMS']['CALL_ID'], 'COMMAND' => CVoxImplantIncoming::RULE_HUNGUP));
                 } else {
                     if ($_POST['COMMAND'] == 'wait') {
                         $_POST['PARAMS'] = CUtil::JsObjectToPhp($_POST['PARAMS']);
                         CVoxImplantIncoming::SendCommand(array('CALL_ID' => $_POST['PARAMS']['CALL_ID'], 'COMMAND' => CVoxImplantIncoming::RULE_WAIT));
示例#2
0
 public static function Answer($callId)
 {
     $res = VI\CallTable::getList(array('select' => array('ID', 'ACCESS_URL'), 'filter' => array('=CALL_ID' => $callId)));
     $call = $res->fetch();
     if (!$call) {
         return false;
     }
     global $USER;
     $ViMain = new CVoxImplantMain($USER->GetId());
     $result = $ViMain->GetDialogInfo($_POST['NUMBER']);
     if ($result) {
         echo CUtil::PhpToJsObject(array('DIALOG_ID' => $result['DIALOG_ID'], 'HR_PHOTO' => $result['HR_PHOTO'], 'ERROR' => ''));
     } else {
         echo CUtil::PhpToJsObject(array('CODE' => $ViMain->GetError()->code, 'ERROR' => $ViMain->GetError()->msg));
     }
 }