public function getCallStatus($request) { $phonecallsid = $request->get('callid'); $recordModel = PBXManager_Record_Model::getInstanceById($phonecallsid); $response = new Vtiger_Response(); $response->setResult($recordModel->get('callstatus')); $response->emit(); }
public function process(Vtiger_Request $request) { $pbxRecordModel = PBXManager_Record_Model::getInstanceById($request->get('record')); header("Location: " . $pbxRecordModel->get('recordingurl')); die; }
/** * Function to retrieve display value for a field * @param $fieldName * @param bool $recordId * @return bool|string <String> * @internal param $ <String> $fieldName - field name for which values need to get */ public function getDisplayValue($fieldName, $recordId = false) { if (empty($recordId)) { $recordId = $this->getId(); } $fieldModel = $this->getModule()->getField($fieldName); if (!$fieldModel) { return false; } // Replace RecordingUrl by Icon if ($fieldName == 'recordingurl') { $value = $fieldModel->getDisplayValue($this->get($fieldName), $recordId, $this); $recordingUrl = explode('>', $value); $url = explode('<', $recordingUrl[1]); if ($url[0] != '' && $this->get('callstatus') == 'completed') { // SalesPlatform.ru begin return '<audio src="index.php?module=PBXManager&action=ListenRecord&record=' . $recordId . '" controls> <a href="index.php?module=PBXManager&action=ListenRecord&record=' . $recordId . '" ><i class="icon-volume-up"></i></a> </audio>'; //return $recordingUrl[0] . '>' . '<i class="icon-volume-up"></i>' . '</a>'; // SalesPlatform.ru end } else { return ''; } } // Display custom call status if ($fieldName == 'callstatus') { $callStatus = ''; $value = $fieldModel->getDisplayValue($this->get($fieldName), $recordId, $this); $recordInstance = PBXManager_Record_Model::getInstanceById($recordId); if ($recordInstance->get('direction') == 'outbound') { if ($this->get('callstatus') == 'ringing' || $this->get('callstatus') == 'in-progress') { $callStatus = '<span class="label label-info"><i class="icon-arrow-up icon-white"></i> ' . vtranslate($value, $this->getModuleName()) . '</span>'; } else { if ($this->get('callstatus') == 'completed') { $callStatus = '<span class="label label-success"><i class="icon-arrow-up icon-white"></i> ' . vtranslate($value, $this->getModuleName()) . '</span>'; } else { if ($this->get('callstatus') == 'no-answer') { $callStatus = '<span class="label label-important"><i class="icon-arrow-up icon-white"></i> ' . vtranslate($value, $this->getModuleName()) . '</span>'; } else { $callStatus = '<span class="label label-warning"><i class="icon-arrow-up icon-white"></i> ' . vtranslate($value, $this->getModuleName()) . '</span>'; } } } } else { if ($recordInstance->get('direction') == 'inbound') { if ($this->get('callstatus') == 'ringing' || $this->get('callstatus') == 'in-progress') { $callStatus = '<span class="label label-info"><i class="icon-arrow-down icon-white"></i> ' . vtranslate($value, $this->getModuleName()) . '</span>'; } else { if ($this->get('callstatus') == 'completed') { $callStatus = '<span class="label label-success"><i class="icon-arrow-down icon-white"></i> ' . vtranslate($value, $this->getModuleName()) . '</span>'; } else { if ($this->get('callstatus') == 'no-answer') { $callStatus = '<span class="label label-important"><i class="icon-arrow-down icon-white"></i> ' . vtranslate($value, $this->getModuleName()) . '</span>'; } else { $callStatus = '<span class="label label-warning"><i class="icon-arrow-down icon-white"></i> ' . vtranslate($value, $this->getModuleName()) . '</span>'; } } } } } return $callStatus; } return $fieldModel->getDisplayValue($this->get($fieldName), $recordId, $this); }