public function updateCustomerInPhoneCalls($customer, $request)
 {
     $id = vtws_getIdComponents($customer['id']);
     $sourceuuid = $request->get('callid');
     $module = $request->get('modulename');
     $recordModel = PBXManager_Record_Model::getInstanceBySourceUUID($sourceuuid);
     $recordModel->updateCallDetails(array('customer' => $id[1], 'customertype' => $module));
 }
Example #2
0
 /**
  * Function to respond for incoming calls
  * @param <Vtiger_Request> $details 
  */
 public function respondToIncomingCall($details)
 {
     $current_user = vglobal('current_user');
     self::$NUMBERS = PBXManager_Record_Model::getUserNumbers();
     header("Content-type: text/xml; charset=utf-8");
     $response = '<?xml version="1.0" encoding="utf-8"?>';
     $response .= '<Response><Dial><Authentication>';
     $response .= 'Success</Authentication>';
     if (self::$NUMBERS) {
         foreach (self::$NUMBERS as $userId => $number) {
             $userInstance = Users_Privileges_Model::getInstanceById($userId);
             $current_user = $userInstance;
             $callPermission = Users_Privileges_Model::isPermitted('PBXManager', 'ReceiveIncomingCalls');
             if ($number != $details->get('callerIdNumber') && $callPermission) {
                 if (preg_match("/sip/", $number) || preg_match("/@/", $number)) {
                     $number = trim($number, "/sip:/");
                     $response .= '<Number>SIP/';
                     $response .= $number;
                     $response .= '</Number>';
                 } else {
                     $response .= '<Number>SIP/';
                     $response .= $number;
                     $response .= '</Number>';
                 }
             }
         }
     } else {
         $response .= '<ConfiguredNumber>empty</ConfiguredNumber>';
         $date = date('Y/m/d H:i:s');
         $params['callstatus'] = 'no-answer';
         $params['starttime'] = $date;
         $params['endtime'] = $date;
         $recordModel = PBXManager_Record_Model::getInstanceBySourceUUID($details->get('callUUID'));
         $recordModel->updateCallDetails($params);
     }
     $response .= '</Dial></Response>';
     echo $response;
 }
 public function updateCustomerInPhoneCalls($customer, $request)
 {
     $id = vtws_getIdComponents($customer['id']);
     $sourceuuid = $request->get('callid');
     $module = $request->get('modulename');
     //SalesPlatform.ru begin
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $user = array('id' => $currentUser->id);
     $recordModel = PBXManager_Record_Model::getInstanceBySourceUUID($sourceuuid, $user);
     $recordModel->updateCallDetails(array('customer' => $id[1], 'customertype' => $module), $user);
     //$recordModel = PBXManager_Record_Model::getInstanceBySourceUUID($sourceuuid);
     //$recordModel->updateCallDetails(array('customer'=>$id[1], 'customertype'=>$module));
     //SalesPlatform.ru end
 }