mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
update esl
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12111 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
+44
-38
@@ -27,141 +27,147 @@ if (!extension_loaded("ESL")) {
|
||||
|
||||
|
||||
|
||||
abstract class ESL {
|
||||
static function eslSetLogLevel($level) {
|
||||
eslSetLogLevel($level);
|
||||
}
|
||||
}
|
||||
|
||||
/* PHP Proxy Classes */
|
||||
class eslEvent {
|
||||
class ESLevent {
|
||||
public $_cPtr=null;
|
||||
|
||||
function __set($var,$value) {
|
||||
$func = 'eslEvent_'.$var.'_set';
|
||||
$func = 'ESLevent_'.$var.'_set';
|
||||
if (function_exists($func)) call_user_func($func,$this->_cPtr,$value);
|
||||
}
|
||||
|
||||
function __isset($var) {
|
||||
return function_exists('eslEvent_'.$var.'_set');
|
||||
return function_exists('ESLevent_'.$var.'_set');
|
||||
}
|
||||
|
||||
function __get($var) {
|
||||
$func = 'eslEvent_'.$var.'_get';
|
||||
$func = 'ESLevent_'.$var.'_get';
|
||||
if (function_exists($func)) return call_user_func($func,$this->_cPtr);
|
||||
return null;
|
||||
}
|
||||
|
||||
function __construct($type_or_wrap_me,$subclass_name_or_free_me=null) {
|
||||
switch (func_num_args()) {
|
||||
case 1: $r=new_eslEvent($type_or_wrap_me); break;
|
||||
default: $r=new_eslEvent($type_or_wrap_me,$subclass_name_or_free_me);
|
||||
case 1: $r=new_ESLevent($type_or_wrap_me); break;
|
||||
default: $r=new_ESLevent($type_or_wrap_me,$subclass_name_or_free_me);
|
||||
}
|
||||
$this->_cPtr=$r;
|
||||
}
|
||||
|
||||
function serialize($format=null) {
|
||||
switch (func_num_args()) {
|
||||
case 0: $r=eslEvent_serialize($this->_cPtr); break;
|
||||
default: $r=eslEvent_serialize($this->_cPtr,$format);
|
||||
case 0: $r=ESLevent_serialize($this->_cPtr); break;
|
||||
default: $r=ESLevent_serialize($this->_cPtr,$format);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function setPriority($priority=null) {
|
||||
switch (func_num_args()) {
|
||||
case 0: $r=eslEvent_setPriority($this->_cPtr); break;
|
||||
default: $r=eslEvent_setPriority($this->_cPtr,$priority);
|
||||
case 0: $r=ESLevent_setPriority($this->_cPtr); break;
|
||||
default: $r=ESLevent_setPriority($this->_cPtr,$priority);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function getHeader($header_name) {
|
||||
return eslEvent_getHeader($this->_cPtr,$header_name);
|
||||
return ESLevent_getHeader($this->_cPtr,$header_name);
|
||||
}
|
||||
|
||||
function getBody() {
|
||||
return eslEvent_getBody($this->_cPtr);
|
||||
return ESLevent_getBody($this->_cPtr);
|
||||
}
|
||||
|
||||
function getType() {
|
||||
return eslEvent_getType($this->_cPtr);
|
||||
return ESLevent_getType($this->_cPtr);
|
||||
}
|
||||
|
||||
function addBody($value) {
|
||||
return eslEvent_addBody($this->_cPtr,$value);
|
||||
return ESLevent_addBody($this->_cPtr,$value);
|
||||
}
|
||||
|
||||
function addHeader($header_name,$value) {
|
||||
return eslEvent_addHeader($this->_cPtr,$header_name,$value);
|
||||
return ESLevent_addHeader($this->_cPtr,$header_name,$value);
|
||||
}
|
||||
|
||||
function delHeader($header_name) {
|
||||
return eslEvent_delHeader($this->_cPtr,$header_name);
|
||||
return ESLevent_delHeader($this->_cPtr,$header_name);
|
||||
}
|
||||
}
|
||||
|
||||
class eslConnection {
|
||||
class ESLconnection {
|
||||
public $_cPtr=null;
|
||||
|
||||
function __construct($host_or_socket,$port=null,$password=null) {
|
||||
switch (func_num_args()) {
|
||||
case 1: $r=new_eslConnection($host_or_socket); break;
|
||||
case 2: $r=new_eslConnection($host_or_socket,$port); break;
|
||||
default: $r=new_eslConnection($host_or_socket,$port,$password);
|
||||
case 1: $r=new_ESLconnection($host_or_socket); break;
|
||||
case 2: $r=new_ESLconnection($host_or_socket,$port); break;
|
||||
default: $r=new_ESLconnection($host_or_socket,$port,$password);
|
||||
}
|
||||
$this->_cPtr=$r;
|
||||
}
|
||||
|
||||
function connected() {
|
||||
return eslConnection_connected($this->_cPtr);
|
||||
return ESLconnection_connected($this->_cPtr);
|
||||
}
|
||||
|
||||
function getInfo() {
|
||||
$r=eslConnection_getInfo($this->_cPtr);
|
||||
return is_resource($r) ? new eslEvent($r) : $r;
|
||||
$r=ESLconnection_getInfo($this->_cPtr);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
}
|
||||
|
||||
function send($cmd) {
|
||||
return eslConnection_send($this->_cPtr,$cmd);
|
||||
return ESLconnection_send($this->_cPtr,$cmd);
|
||||
}
|
||||
|
||||
function sendRecv($cmd) {
|
||||
$r=eslConnection_sendRecv($this->_cPtr,$cmd);
|
||||
return is_resource($r) ? new eslEvent($r) : $r;
|
||||
$r=ESLconnection_sendRecv($this->_cPtr,$cmd);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
}
|
||||
|
||||
function sendEvent($send_me) {
|
||||
return eslConnection_sendEvent($this->_cPtr,$send_me);
|
||||
return ESLconnection_sendEvent($this->_cPtr,$send_me);
|
||||
}
|
||||
|
||||
function recvEvent() {
|
||||
$r=eslConnection_recvEvent($this->_cPtr);
|
||||
return is_resource($r) ? new eslEvent($r) : $r;
|
||||
$r=ESLconnection_recvEvent($this->_cPtr);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
}
|
||||
|
||||
function recvEventTimed($ms) {
|
||||
$r=eslConnection_recvEventTimed($this->_cPtr,$ms);
|
||||
return is_resource($r) ? new eslEvent($r) : $r;
|
||||
$r=ESLconnection_recvEventTimed($this->_cPtr,$ms);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
}
|
||||
|
||||
function filter($header,$value) {
|
||||
return eslConnection_filter($this->_cPtr,$header,$value);
|
||||
return ESLconnection_filter($this->_cPtr,$header,$value);
|
||||
}
|
||||
|
||||
function events($etype,$value) {
|
||||
return eslConnection_events($this->_cPtr,$etype,$value);
|
||||
return ESLconnection_events($this->_cPtr,$etype,$value);
|
||||
}
|
||||
|
||||
function execute($app,$arg=null,$uuid=null) {
|
||||
switch (func_num_args()) {
|
||||
case 1: $r=eslConnection_execute($this->_cPtr,$app); break;
|
||||
case 2: $r=eslConnection_execute($this->_cPtr,$app,$arg); break;
|
||||
default: $r=eslConnection_execute($this->_cPtr,$app,$arg,$uuid);
|
||||
case 1: $r=ESLconnection_execute($this->_cPtr,$app); break;
|
||||
case 2: $r=ESLconnection_execute($this->_cPtr,$app,$arg); break;
|
||||
default: $r=ESLconnection_execute($this->_cPtr,$app,$arg,$uuid);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function setBlockingExecute($val) {
|
||||
return eslConnection_setBlockingExecute($this->_cPtr,$val);
|
||||
return ESLconnection_setBlockingExecute($this->_cPtr,$val);
|
||||
}
|
||||
|
||||
function setEventLock($val) {
|
||||
return eslConnection_setEventLock($this->_cPtr,$val);
|
||||
return ESLconnection_setEventLock($this->_cPtr,$val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user