Change the switch class to freeswitch.

This commit is contained in:
markjcrane
2016-04-02 19:37:37 -06:00
parent 637a3fadb5
commit b5fbf389dd
3 changed files with 11 additions and 13 deletions
+3 -3
View File
@@ -28,9 +28,9 @@
if ($domains_processed == 1) { if ($domains_processed == 1) {
//add missing switch directories in default settings //add missing switch directories in default settings
$switch = new switch; $obj = new freeswitch;
$switch->settings(); $obj->settings();
unset($switch); unset($obj);
//use the module class to get the list of modules from the db and add any missing modules //use the module class to get the list of modules from the db and add any missing modules
if (isset($_SESSION['switch']['mod']['dir'])) { if (isset($_SESSION['switch']['mod']['dir'])) {
+3 -3
View File
@@ -1,6 +1,6 @@
<?php <?php
class Buffer { class buffer {
private $content; private $content;
private $eol; private $eol;
@@ -37,7 +37,7 @@ class Buffer {
return $tmp; return $tmp;
} }
} }
//$b = new Buffer; //$b = new buffer;
//$b->append("hello\nworld\n"); //$b->append("hello\nworld\n");
//print($b->read_line()); //print($b->read_line());
//print($b->read_line()); //print($b->read_line());
@@ -47,7 +47,7 @@ class event_socket {
private $fp; private $fp;
public function __construct($fp = false) { public function __construct($fp = false) {
$this->buffer = new Buffer; $this->buffer = new buffer;
$this->fp = $fp; $this->fp = $fp;
} }
@@ -1,11 +1,11 @@
<?php <?php
/** /**
* switch class provides access methods related to FreeSWITCH * freeswitch class provides access methods related to FreeSWITCH
* *
* @method settings will add missing switch directories to default settings * @method settings will add missing switch directories to default settings
*/ */
class switch { class freeswitch {
public $event_socket_ip_address; public $event_socket_ip_address;
public $event_socket_port; public $event_socket_port;
@@ -45,13 +45,11 @@ class switch {
} }
//connect to event socket //connect to event socket
$fp = event_socket_create($this->event_socket_ip_address, $this->event_socket_port, $this->event_socket_password); $esl = new event_socket;
if ($fp === false) { $esl->connect($this->event_socket_ip_address, $this->event_socket_port, $this->event_socket_password);
return false;
}
//run the api command //run the api command
$result = event_socket_request($fp, 'api global_getvar'); $result = $esl->request('api global_getvar');
//close event socket //close event socket
fclose($fp); fclose($fp);