Esempio n. 1
0
 public function processAction(&$controller, $params)
 {
     $this->checkRequiredParams('processAction', $params);
     $this->assignEmptyParams($params, 1);
     list($uuid) = $params;
     $callManagerObj = new callManager();
     $channelDetail_view = new View('callmanager/channeldetail');
     $channelDetail_view->detailfields = freeswitch_callmanager_Driver::getDetailFields();
     try {
         $channelDetail_view->channeldata = $callManagerObj->getChannelInfo($uuid, true);
         if ($channelDetail_view->channeldata) {
             foreach (freeswitch_callmanager_Driver::getDetailDatetimeFields() as $fieldname) {
                 if (isset($channelDetail_view->channeldata[$fieldname]) && !$channelDetail_view->channeldata[$fieldname] == 0) {
                     $channelDetail_view->channeldata[$fieldname] = date('r', $channelDetail_view->channeldata[$fieldname]);
                 } else {
                     $channelDetail_view->channeldata[$fieldname] = '';
                 }
             }
         }
         $channelDetail_view->render(TRUE);
     } catch (ESL_Exception $e) {
         echo '<div class="error">An error has occured: ' . $e->getMessage() . '<br>';
         if (strpos($e->getMessage(), 'Not connected')) {
             echo 'This indicates that Freeswitch is not running, mod_event_socket is not configured, or the system is unable to log in.';
         }
         echo '</div>';
     } catch (callmanagerException $e) {
         $controller->template->content = new View('callmanager/commandresponse');
         echo 'An error has occured: ' . $e->getMessage();
     }
     exit;
 }
Esempio n. 2
0
 public function executeAction($params)
 {
     $eslCon = freeswitch_callmanager_Driver::getESL();
     try {
         $responsestr = $eslCon->sendRecv('api show channels as xml')->getBody();
     } catch (ESLException $e) {
         if (strpos($e->getMessage(), 'Not connected')) {
             echo '<div class="error">Unable to connect to the switch console.  This usually means that mod_event_socket is not running, or that the password that you entered during the setup process has changed. The error message was:<br>' . $e->getMessage() . '</span>';
             exit;
         } else {
             throw $e;
         }
     }
     if (trim($responsestr) == '0 total.' || trim($responsestr) == '+OK' || trim($responsestr) == '<result row_count="0"/>') {
         return array();
     }
     if (substr(trim($responsestr), 0, 4) == '-ERR') {
         $this->_throwError($responsestr);
     }
     $channelStatus = xml::xmlstrtoarr($responsestr);
     if (count($channelStatus) == 0) {
         return $channelStatus;
     } else {
         if (isset($channelStatus['row']['uuid'])) {
             return array($channelStatus['row']);
         } else {
             return $channelStatus['row'];
         }
     }
 }
Esempio n. 3
0
 public function executeAction($params)
 {
     $this->checkRequiredParams('executeAction', $params);
     $this->assignEmptyParams($params, 2, array(null, false));
     list($uuid, $details) = $params;
     $eslCon = freeswitch_callmanager_Driver::getESL();
     try {
         if (!$details) {
             $responsestr = $eslCon->sendRecv('api show channels like ' . $uuid . ' as xml')->getBody();
         } else {
             $responsestr = $eslCon->sendRecv('api uuid_dump ' . $uuid . ' xml')->getBody();
         }
     } catch (ESLException $e) {
         if (strpos($e->getMessage(), 'Not connected')) {
             echo '<div class="error">Unable to connect to the switch console.  This usually means that mod_event_socket is not running, or that the password that you entered during the setup process has changed. The error message was:<br>' . $e->getMessage() . '</div>';
             exit;
         } else {
             throw $e;
         }
     }
     if (trim($responsestr) == '0 total.' || trim($responsestr) == '+OK' || trim($responsestr) == '<result row_count="0"/>') {
         return array();
     }
     if (substr(trim($responsestr), 0, 4) == '-ERR') {
         $this->_throwError($responsestr);
     }
     $xmlarr = xml::xmlstrtoarr($responsestr);
     if (!$xmlarr || count($xmlarr) == 0) {
         return array();
     } else {
         if (!$details) {
             if (isset($xmlarr['row']['uuid'])) {
                 return array($xmlarr['row']);
             } else {
                 return $xmlarr['row'];
             }
         } else {
             return $xmlarr['headers'];
         }
     }
 }
Esempio n. 4
0
 public function executeAction($params)
 {
     $this->checkRequiredParams('executeAction', $params);
     $this->assignEmptyParams($params, 5);
     list($uuid, $destination, $parties, $dialplan, $context) = $params;
     $eslCon = freeswitch_callmanager_Driver::getESL();
     try {
         $responsestr = $eslCon->sendRecv('api uuid_transfer ' . $uuid . ($parties ? ' -' . $parties : '') . ' ' . $destination)->getBody();
     } catch (ESLException $e) {
         if (strpos($e->getMessage(), 'Not connected')) {
             echo '<div class="error">Unable to connect to the switch console.  This usually means that mod_event_socket is not running, or that the password that you entered during the setup process has changed. The error message was:<br>' . $e->getMessage() . '</span>';
             exit;
         } else {
             throw $e;
         }
     }
     if (substr(trim($responsestr), 0, 4) == '-ERR') {
         $this->_throwError($responsestr);
     }
     return $responsestr;
 }
Esempio n. 5
0
 public function executeAction($params)
 {
     $this->checkRequiredParams('executeAction', $params);
     $this->assignEmptyParams($params, 1);
     list($uuid) = $params;
     $eslCon = freeswitch_callmanager_Driver::getESL();
     try {
         $getchannelvardriver = new freeswitch_cmgetchannelvar_Driver();
         $responsestr = $eslCon->sendRecv('api uuid_record ' . $uuid . ' stop ' . $getchannelvardriver->executeAction(array($uuid, 'recording_file')))->getBody();
         $eslCon->send('api uuid_setvar ' . $uuid . ' recording_file');
     } catch (ESLException $e) {
         if (strpos($e->getMessage(), 'Not connected')) {
             echo '<div class="error">Unable to connect to the switch console.  This usually means that mod_event_socket is not running, or that the password that you entered during the setup process has changed. The error message was:<br>' . $e->getMessage() . '</div>';
             exit;
         } else {
             throw $e;
         }
     }
     if (substr(trim($responsestr), 0, 4) == '-ERR') {
         $this->_throwError($responsestr);
     }
     return $responsestr;
 }
Esempio n. 6
0
 public function executeAction($params)
 {
     $this->checkRequiredParams('executeAction', $params);
     $this->assignEmptyParams($params, 4, array('', '', '', true));
     list($dest, $srcext, $options, $waitforresponse) = $params;
     //sofia/default/2001@yourvsp.com
     $cmdstr = 'api originate ' . $dest . ' ';
     if ($srcext != null) {
         $cmdstr .= $srcext;
     }
     if ($options != null) {
         $cmdstr .= $options;
     }
     $eslCon = freeswitch_callmanager_Driver::getESL();
     try {
         if ($waitforresponse) {
             $responsestr = $eslCon->sendRecv($cmdstr)->getBody();
         } else {
             $eslCon->send($cmdstr);
             $responsestr = '';
         }
     } catch (ESLException $e) {
         if (strpos($e->getMessage(), 'Not connected')) {
             echo '<div class="error">Unable to connect to the switch console.  This usually means that mod_event_socket is not running, or that the password that you entered during the setup process has changed. The error message was:<br>' . $e->getMessage() . '</div>';
             exit;
         } else {
             throw $e;
         }
     }
     if (trim($responsestr) == '0 total.' || trim($responsestr) == '+OK' || trim($responsestr) == '<result row_count="0"/>') {
         return true;
     }
     if (substr(trim($responsestr), 0, 4) == '-ERR') {
         $this->_throwError($responsestr);
     }
     return $responsestr;
 }
Esempio n. 7
0
 public function executeAction($params)
 {
     $this->checkRequiredParams('executeAction', $params);
     $this->assignEmptyParams($params, 2);
     list($uuid, $varname) = $params;
     $eslCon = freeswitch_callmanager_Driver::getESL();
     try {
         $responsestr = $eslCon->sendRecv('api uuid_getvar ' . $uuid . ' ' . $varname)->getBody();
     } catch (ESLException $e) {
         if (strpos($e->getMessage(), 'Not connected')) {
             echo '<div class="error">Unable to connect to the switch console.  This usually means that mod_event_socket is not running, or that the password that you entered during the setup process has changed. The error message was:<br>' . $e->getMessage() . '</div>';
             exit;
         } else {
             throw $e;
         }
     }
     if (trim($responsestr) == '0 total.' || trim($responsestr) == '+OK' || trim($responsestr) == '<result row_count="0"/>') {
         return array();
     }
     if (substr(trim($responsestr), 0, 4) == '-ERR') {
         $this->_throwError($responsestr);
     }
     return $responsestr;
 }