提交 dd704bca authored 作者: Brian Fertig's avatar Brian Fertig

Yet another fix. PHP now doesnt crash :)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2638 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 5e0ed731
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
PCFG=$(PREFIX)/bin/php-config PCFG=$(PREFIX)/bin/php-config
LCFLAGS=-fPIC -DZTS -DPTHREADS LCFLAGS=-fPIC -DZTS -DPTHREADS
CFLAGS += `$(PCFG) --includes` CFLAGS += `$(PCFG) --includes` -g3
MDIR += `$(PCFG) --extension-dir` MDIR += `$(PCFG) --extension-dir`
PHPMOD=freeswitch PHPMOD=freeswitch
PHPLDFLAGS = `$(PCFG) --ldflags` -lcrypt -lresolv -lm -ldl -lnsl -lxml2 -lz -lphp5 PHPLDFLAGS = `$(PCFG) --ldflags` -lcrypt -lresolv -lm -ldl -lnsl -lxml2 -lz -lphp5
...@@ -10,7 +10,7 @@ PHPLDFLAGS = `$(PCFG) --ldflags` -lcrypt -lresolv -lm -ldl -lnsl -lxml2 -lz -lph ...@@ -10,7 +10,7 @@ PHPLDFLAGS = `$(PCFG) --ldflags` -lcrypt -lresolv -lm -ldl -lnsl -lxml2 -lz -lph
all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PHPMOD).$(DYNAMIC_LIB_EXTEN) all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PHPMOD).$(DYNAMIC_LIB_EXTEN)
depends: depends:
MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install php-5.1.6.tar.gz --prefix=$(PREFIX) --enable-embed=static --enable-static --with-pic --with-mysql --with-curl MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install php-5.1.6.tar.gz --prefix=$(PREFIX) --enable-embed=shared --enable-shared --with-pic --with-mysql --with-curl --enable-maintainer-zts --with-tsrm-pthreads
%.o: %.c %.o: %.c
$(CC) $(LCFLAGS) $(CFLAGS) -c $< -o $@ $(CC) $(LCFLAGS) $(CFLAGS) -c $< -o $@
...@@ -41,3 +41,7 @@ install: ...@@ -41,3 +41,7 @@ install:
cp -f php_$(PHPMOD).$(DYNAMIC_LIB_EXTEN) $(MDIR) cp -f php_$(PHPMOD).$(DYNAMIC_LIB_EXTEN) $(MDIR)
cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod
cp -f $(PHPMOD).php $(PREFIX)/lib/php cp -f $(PHPMOD).php $(PREFIX)/lib/php
cp -f classFreeswitch.php $(PREFIX)/lib/php
cp -f freeswitch.php $(PREFIX)/lib/php
cp -f apptest.php $(PREFIX)/scripts
cp -f test.php $(PREFIX)/scripts
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
*/ */
require("classFreeswitch.php"); require("classFreeswitch.php");
$fs = new fs_class_api; echo "uuid: $uuid\n";
$fs->fs_answer($session); $fs = new fs_class_api();
$fs->fs_play_file($session, "/ram/sr8k.wav"); $fs->fs_answer();
$fs->fs_play_file("/ram/sr8k.wav");
?> ?>
...@@ -31,13 +31,12 @@ ...@@ -31,13 +31,12 @@
* *
*/ */
require("freeswitch.php"); // Required for freeswitch driver to be loaded require("freeswitch.php"); // Required for freeswitch driver to be loaded
global $sessn;
class fs_class_api { class fs_class_api {
Private $uuid;
function fs_class_api() { function fs_class_api() {
if($sessn = $this->fs_getsessn($uuid)){} $this->uuid = $uuid;
else{
echo "Couldnt get sessn!\n";
}
} }
...@@ -62,99 +61,88 @@ class fs_class_api { ...@@ -62,99 +61,88 @@ class fs_class_api {
} }
function fs_getsessn($uuid){
return fs_core_sessn_locate($uuid);
}
function fs_answer(){ function fs_answer(){
fs_channel_answer($sessn); fs_channel_answer($this->uuid);
} }
function fs_early_media($sessn){ function fs_early_media(){
fs_channel_pre_answer($sessn); fs_channel_pre_answer($this->uuid);
} }
function fs_hangup($cause){ function fs_hangup($cause){
fs_channel_hangup($sessn, $cause); fs_channel_hangup($this->uuid, $cause);
} }
function fs_set_variable($var, $val){ function fs_set_variable($var, $val){
fs_channel_set_variable($sessn, $var, $val); fs_channel_set_variable($this->uuid, $var, $val);
} }
function fs_get_variable($var){ function fs_get_variable($var){
return fs_channel_get_var($sessn, $var); return fs_channel_get_var($this->uuid, $var);
} }
function fs_set_channel_state($state){ function fs_set_channel_state($state){
fs_channel_set_state($sessn, $state); fs_channel_set_state($this->uuid, $state);
} }
function fs_play_file($file){ function fs_play_file($file){
return fs_ivr_play_file($sessn, $file, NULL, NULL, NULL, 0); return fs_ivr_play_file($this->uuid, $file, NULL, NULL, NULL, 0);
} }
function record_file($file){ function record_file($file){
return fs_switch_ivr_record_file($sessn, NULL, $file, NULL, NULL, 0); return fs_switch_ivr_record_file($this->uuid, NULL, $file, NULL, NULL, 0);
} }
function fs_wait($ms){ function fs_wait($ms){
return fs_switch_ivr_sleep($sessn, $ms); return fs_switch_ivr_sleep($this->uuid, $ms);
} }
function fs_get_dtmf_callback($len){ function fs_get_dtmf_callback($len){
return fs_switch_ivr_collect_digits_callback($sessn, NULL, NULL, $len); return fs_switch_ivr_collect_digits_callback($this->uuid, NULL, NULL, $len);
} }
function fs_get_digit_count ($maxdigits, $terminator, $timeout){ function fs_get_digit_count ($maxdigits, $terminator, $timeout){
return fs_switch_ivr_collect_digits_count($sessn, NULL, NULL, $maxdigits, NULL, $terminator, $timeout); return fs_switch_ivr_collect_digits_count($this->uuid, NULL, NULL, $maxdigits, NULL, $terminator, $timeout);
}
function fs_x_way($peer_sessn, $dtmf, $sessn_data, $peer_data){
return fs_switch_ivr_multi_threaded_bridge ($sessn, $peer_sessn, $dtmf, $sessn_data, $peer_data);
} }
function fs_dial($data, $timelimit){ function fs_dial($data, $timelimit){
return fs_switch_ivr_originate(sessn, NULL, $data, $timelimit, NULL, NULL, NULL, NULL); return fs_switch_ivr_originate($this->uuid, NULL, $data, $timelimit, NULL, NULL, NULL, NULL);
} }
function fs_transfer($exten, $dialplan, $context){ function fs_transfer($exten, $dialplan, $context){
return fs_switch_ivr_sessn_transfer($sessn, $exten, $dialplan, $context); return fs_switch_ivr_sessn_transfer($this->uuid, $exten, $dialplan, $context);
} }
function fs_speak($ttsName, $voice, $text, $dtmf=NULL){ function fs_speak($ttsName, $voice, $text, $dtmf=NULL){
return fs_switch_ivr_speak_text($sessn, $ttsName, NULL, NULL, $dtmf, $text, NULL, 0); return fs_switch_ivr_speak_text($this->uuid, $ttsName, NULL, NULL, $dtmf, $text, NULL, 0);
} }
......
...@@ -30,10 +30,6 @@ ...@@ -30,10 +30,6 @@
* *
*/ */
#if !defined(ZTS)
#error "ZTS Needs to be defined."
#endif
#ifndef _REENTRANT #ifndef _REENTRANT
#define _REENTRANT #define _REENTRANT
...@@ -44,146 +40,21 @@ ...@@ -44,146 +40,21 @@
#endif #endif
#include <sapi/embed/php_embed.h> #include <sapi/embed/php_embed.h>
//#include "php.h"
//#include "php_variables.h" #ifdef ZTS
//#include "ext/standard/info.h" zend_compiler_globals *compiler_globals;
//#include "php_ini.h" zend_executor_globals *executor_globals;
//#include "php_globals.h" php_core_globals *core_globals;
//#include "SAPI.h" sapi_globals_struct *sapi_globals;
//#include "php_main.h" #endif
//#include "php_version.h"
//#include "TSRM.h"
//#include "ext/standard/php_standard.h"
#include <switch.h> #include <switch.h>
const char modname[] = "mod_php"; const char modname[] = "mod_php";
static void php_function(switch_core_session_t *session, char *data)
{
char *uuid = switch_core_session_get_uuid(session);
uint32_t ulen = strlen(uuid);
uint32_t len = strlen((char *) data) + ulen + 2;
char *mydata = switch_core_session_alloc(session, len);
int argc, retval;
char *argv[5];
char php_code[1024];
void*** tsrm_ls = NULL;
snprintf(mydata, len, "%s %s", uuid, data);
argc = 1; //switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
//sprintf(php_code, "$uuid=\"%s\"; include(\"%s\");\n", argv[0], argv[1]);
sprintf(php_code, "include('%s');", argv[1]);
zend_file_handle script;
script.type = ZEND_HANDLE_FP;
script.filename = data;
script.opened_path = NULL;
script.free_filename = 0;
script.handle.fp = fopen(script.filename, "rb");
//php_embed_init(argc, argv, &tsrm_ls);
if (php_request_startup(TSRMLS_C) == FAILURE) {
return;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Starting Script %s\n",data);
retval = php_execute_script(&script TSRMLS_CC);
php_request_shutdown(NULL);
return;
//PHP_EMBED_START_BLOCK(argc, argv);
//void*** tsrm_ls = NULL;
//zend_error_cb = myapp_php_error_cb;
//zend_eval_string(php_code, NULL, "MOD_PHP" TSRMLS_CC);
// zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 1, &script);
//if (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 1, &script) == SUCCESS)
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "There was a problem with the file\n");
//PHP_EMBED_END_BLOCK();
// php_embed_shutdown(tsrm_ls);
//}else{
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "There was a problem with the file\n");
//}
}
static const switch_application_interface_t php_application_interface = {
/*.interface_name */ "php",
/*.application_function */ php_function
};
static switch_loadable_module_interface_t php_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ NULL,
/*.application_interface */ &php_application_interface,
/*.api_interface */ NULL,
/*.file_interface */ NULL,
/*.speech_interface */ NULL,
/*.directory_interface */ NULL
};
/*SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
// connect my internal structure to the blank pointer passed to me
*module_interface = &php_module_interface;
sapi_startup(&mod_php_sapi_module);
mod_php_sapi_module.startup(&mod_php_sapi_module);
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
// indicate that the module should continue to be loaded
return SWITCH_STATUS_SUCCESS;
}
*/
/*
Called when the system shuts down
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
{
return SWITCH_STATUS_SUCCESS;
}
*/
/*
If it exists, this is called in it's own thread when the module-load completes
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
{
return SWITCH_STATUS_SUCCESS;
}
*/
zend_module_entry mod_php_module_entry = {
STANDARD_MODULE_HEADER,
"mod_php",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};
static int sapi_mod_php_ub_write(const char *str, unsigned int str_length TSRMLS_DC) static int sapi_mod_php_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
{ // This function partly based on code from asterisk_php {
FILE *fp = fopen("mod_php.log", "a"); FILE *fp = fopen("mod_php.log", "a");
fwrite(str, str_length, sizeof(char), fp); fwrite(str, str_length, sizeof(char), fp);
...@@ -255,11 +126,6 @@ void mod_php_error_handler(int type, const char *error_filename, const uint erro ...@@ -255,11 +126,6 @@ void mod_php_error_handler(int type, const char *error_filename, const uint erro
if(PG(log_errors)) { if(PG(log_errors)) {
char *log_buffer; char *log_buffer;
#ifdef PHP_WIN32
if(type == E_CORE_ERROR || type == E_CORE_WARNING) {
MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE);
}
#endif
spprintf(&log_buffer, 0, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno); spprintf(&log_buffer, 0, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
php_log_err(log_buffer TSRMLS_CC); php_log_err(log_buffer TSRMLS_CC);
efree(log_buffer); efree(log_buffer);
...@@ -269,31 +135,30 @@ void mod_php_error_handler(int type, const char *error_filename, const uint erro ...@@ -269,31 +135,30 @@ void mod_php_error_handler(int type, const char *error_filename, const uint erro
char *prepend_string = INI_STR("error_prepend_string"); char *prepend_string = INI_STR("error_prepend_string");
char *append_string = INI_STR("error_append_string"); char *append_string = INI_STR("error_append_string");
char *error_format = "%s\n%s: %s in %s on line %d\n%s"; char *error_format = "%s\n%s: %s in %s on line %d\n%s";
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, error_format, STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, error_format, STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string));
STR_PRINT(append_string));
} }
} }
/* Bail out if we can't recover */ // Bail out if we can't recover
switch(type) { switch(type) {
case E_CORE_ERROR: case E_CORE_ERROR:
case E_ERROR: case E_ERROR:
/*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */ //case E_PARSE: the parser would return 1 (failure), we can bail out nicely
case E_COMPILE_ERROR: case E_COMPILE_ERROR:
case E_USER_ERROR: case E_USER_ERROR:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "\nPHP: %s exiting\n", error_filename); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "\nPHP: %s exiting\n", error_filename);
EG(exit_status) = 255; EG(exit_status) = 255;
#if MEMORY_LIMIT #if MEMORY_LIMIT
/* restore memory limit */ // restore memory limit
AG(memory_limit) = PG(memory_limit); AG(memory_limit) = PG(memory_limit);
#endif #endif
efree(buffer); efree(buffer);
zend_bailout(); zend_bailout();
return; return;
break;
} }
/* Log if necessary */ // Log if necessary
if(PG(track_errors) && EG(active_symbol_table)) { if(PG(track_errors) && EG(active_symbol_table)) {
pval *tmp; pval *tmp;
...@@ -307,87 +172,134 @@ STR_PRINT(append_string)); ...@@ -307,87 +172,134 @@ STR_PRINT(append_string));
efree(buffer); efree(buffer);
} }
static int sapi_mod_php_header_handler(sapi_header_struct * sapi_header, sapi_headers_struct * sapi_headers TSRMLS_DC)
{
return 0;
}
static int sapi_mod_php_send_headers(sapi_headers_struct * sapi_headers TSRMLS_DC) static void mod_php_log_message(char *message)
{ {
return SAPI_HEADER_SENT_SUCCESSFULLY; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s\n", message);
} }
static int sapi_mod_php_read_post(char *buffer, uint count_bytes TSRMLS_DC) typedef void (*sapi_error_function_t)(int type, const char *error_msg, ...);
{
return 0;
}
static int mod_php_startup(sapi_module_struct *sapi_module)
{
if(php_module_startup(sapi_module, &mod_php_module_entry, 1) == FAILURE) {
return FAILURE;
}
return SUCCESS;
}
static void mod_php_log_message(char *message)
static void php_function(switch_core_session_t *session, char *data)
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s\n", message); char *uuid = switch_core_session_get_uuid(session);
} uint32_t ulen = strlen(uuid);
uint32_t len = strlen((char *) data) + ulen + 2;
char *mydata = switch_core_session_alloc(session, len);
int argc, retval;
char *argv[5];
char php_code[1024];
void*** tsrm_ls = NULL;
snprintf(mydata, len, "%s %s", uuid, data);
static char *sapi_mod_php_read_cookies(TSRMLS_D) argc = switch_separate_string(mydata, ' ',argv,(sizeof(argv) / sizeof(argv[0])));
{
return NULL;
}
static int mod_php_startup(sapi_module_struct *sapi_module); sprintf(php_code, "uuid=\"%s\"; include(\"%s\");\n", argv[0], argv[1]);
//sprintf(php_code, "include('%s');", argv[1]);
sapi_module_struct mod_php_sapi_module = { sprintf(php_code, "%s %s", data, uuid);
"mod_php", /* name */
"mod_php", /* pretty name */
mod_php_startup, /* startup */ zend_file_handle script;
NULL, /* shutdown */ script.type = ZEND_HANDLE_FP;
script.filename = data;
script.opened_path = NULL;
script.free_filename = 0;
script.handle.fp = fopen(script.filename, "rb");
NULL, /* activate */ // Initialize PHPs CORE
NULL, /* deactivate */ php_embed_init(argc, argv, &tsrm_ls);
sapi_mod_php_ub_write, /* unbuffered write */ // Return All of the DEBUG crap to the console and/or a log file
NULL, /* flush */ php_embed_module.ub_write = sapi_mod_php_ub_write;
NULL, /* get uid */ php_embed_module.log_message = mod_php_log_message;
NULL, /* getenv */ php_embed_module.sapi_error = (sapi_error_function_t)mod_php_error_handler;
php_error, /* error handler */ // Let the nice people know we are about to start their script
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Starting Script %s\n",data);
sapi_mod_php_header_handler, /* header handler */ // Force $uuid and $session to exist in PHPs memory space
sapi_mod_php_send_headers, /* send headers handler */ zval *php_uuid;
NULL, /* send header handler */ MAKE_STD_ZVAL(php_uuid);
//MAKE_STD_ZVAL(php_session);
//php_uuid->type = IS_STRING;
//php_uuid->value.str.len = strlen(uuid);
//php_uuid->value.str.val = estrdup(uuid);
ZVAL_STRING(php_uuid, uuid , 1);
//ZVAL_STRING(php_session, session , 1);
ZEND_SET_SYMBOL(&EG(symbol_table), "uuid", php_uuid);
//ZEND_SET_SYMBOL(&EG(active_symbol_table), "session", php_session);
// Force Some INI entries weather the user likes it or not
zend_alter_ini_entry("register_globals",sizeof("register_globals"),"1", sizeof("1") - 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME);
// Execute the bloody script
retval = php_execute_script(&script TSRMLS_CC);
sapi_mod_php_read_post, /* read POST data */ // Clean up after PHP and such
sapi_mod_php_read_cookies, /* read Cookies */ php_embed_shutdown(tsrm_ls);
NULL, /* register server variables */ // Return back to the Dialplan
mod_php_log_message, /* Log message */ return;
NULL, /* Get request time */
NULL, /* Block interruptions */ // Buh bye now!
NULL, /* Unblock interruptions */ }
STANDARD_SAPI_MODULE_PROPERTIES static const switch_application_interface_t php_application_interface = {
/*.interface_name */ "php",
/*.application_function */ php_function
};
static switch_loadable_module_interface_t php_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ NULL,
/*.application_interface */ &php_application_interface,
/*.api_interface */ NULL,
/*.file_interface */ NULL,
/*.speech_interface */ NULL,
/*.directory_interface */ NULL
}; };
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename) SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{ {
void*** tsrm_ls = NULL;
/* connect my internal structure to the blank pointer passed to me */ /* connect my internal structure to the blank pointer passed to me */
*module_interface = &php_module_interface; *module_interface = &php_module_interface;
sapi_startup(&mod_php_sapi_module);
mod_php_sapi_module.startup(&mod_php_sapi_module);
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n"); //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
compiler_globals = ts_resource(compiler_globals_id);
executor_globals = ts_resource(executor_globals_id);
core_globals = ts_resource(core_globals_id);
sapi_globals = ts_resource(sapi_globals_id);
tsrm_ls = ts_resource(0);
#endif
/* indicate that the module should continue to be loaded */ /* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
/*
Called when the system shuts down
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
{
return SWITCH_STATUS_SUCCESS;
}
*/
/*
If it exists, this is called in it's own thread when the module-load completes
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
{
return SWITCH_STATUS_SUCCESS;
}
*/
...@@ -112,38 +112,57 @@ switch_core_session_t *fs_core_session_locate(char *uuid) ...@@ -112,38 +112,57 @@ switch_core_session_t *fs_core_session_locate(char *uuid)
return session; return session;
} }
void fs_channel_answer(switch_core_session_t *session) void fs_channel_answer(char *uuid)
{ {
switch_channel_t *channel = switch_core_session_get_channel(session); switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
switch_channel_answer(channel); switch_channel_answer(channel);
} }
void fs_channel_pre_answer(switch_core_session_t *session) void fs_channel_pre_answer(char *uuid)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_pre_answer(channel); switch_channel_pre_answer(channel);
} }
void fs_channel_hangup(switch_core_session_t *session, char *cause) void fs_channel_hangup(char *uuid, char *cause)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_hangup(channel, switch_channel_str2cause(cause)); switch_channel_hangup(channel, switch_channel_str2cause(cause));
} }
void fs_channel_set_variable(switch_core_session_t *session, char *var, char *val) void fs_channel_set_variable(char *uuid, char *var, char *val)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_set_variable(channel, var, val); switch_channel_set_variable(channel, var, val);
} }
void fs_channel_get_variable(switch_core_session_t *session, char *var) void fs_channel_get_variable(char *uuid, char *var)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_get_variable(channel, var); switch_channel_get_variable(channel, var);
} }
void fs_channel_set_state(switch_core_session_t *session, char *state) void fs_channel_set_state(char *uuid, char *state)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_state_t fs_state = switch_channel_get_state(channel); switch_channel_state_t fs_state = switch_channel_get_state(channel);
...@@ -157,13 +176,16 @@ void fs_channel_set_state(switch_core_session_t *session, char *state) ...@@ -157,13 +176,16 @@ void fs_channel_set_state(switch_core_session_t *session, char *state)
IVR Routines! You can do IVR in PHP NOW! IVR Routines! You can do IVR in PHP NOW!
*/ */
int fs_ivr_play_file(switch_core_session_t *session, int fs_ivr_play_file(char *uuid,
char *file, char *file,
char *timer_name, char *timer_name,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen) unsigned int buflen)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
if (switch_strlen_zero(timer_name)) { if (switch_strlen_zero(timer_name)) {
timer_name = NULL; timer_name = NULL;
...@@ -173,31 +195,40 @@ int fs_ivr_play_file(switch_core_session_t *session, ...@@ -173,31 +195,40 @@ int fs_ivr_play_file(switch_core_session_t *session,
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_switch_ivr_record_file(switch_core_session_t *session, int fs_switch_ivr_record_file(char *uuid,
switch_file_handle_t *fh, switch_file_handle_t *fh,
char *file, char *file,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen) unsigned int buflen)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_record_file(session, fh, file, dtmf_callback, buf, buflen); status = switch_ivr_record_file(session, fh, file, dtmf_callback, buf, buflen);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_switch_ivr_sleep(switch_core_session_t *session, int fs_switch_ivr_sleep(char *uuid,
uint32_t ms) uint32_t ms)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_sleep(session, ms); status = switch_ivr_sleep(session, ms);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_ivr_play_file2(switch_core_session_t *session, int fs_ivr_play_file2(char *uuid,
char *file) char *file)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_play_file(session, NULL, file, NULL, NULL, NULL, 0); status = switch_ivr_play_file(session, NULL, file, NULL, NULL, NULL, 0);
...@@ -205,18 +236,21 @@ int fs_ivr_play_file2(switch_core_session_t *session, ...@@ -205,18 +236,21 @@ int fs_ivr_play_file2(switch_core_session_t *session,
} }
int fs_switch_ivr_collect_digits_callback (switch_core_session_t *session, int fs_switch_ivr_collect_digits_callback (char *uuid,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen) unsigned int buflen)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_collect_digits_callback(session, dtmf_callback, buf, buflen); status = switch_ivr_collect_digits_callback(session, dtmf_callback, buf, buflen);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_switch_ivr_collect_digits_count (switch_core_session_t *session, int fs_switch_ivr_collect_digits_count(char *uuid,
char *buf, char *buf,
unsigned int buflen, unsigned int buflen,
unsigned int maxdigits, unsigned int maxdigits,
...@@ -224,6 +258,9 @@ int fs_switch_ivr_collect_digits_count (switch_core_session_t *session, ...@@ -224,6 +258,9 @@ int fs_switch_ivr_collect_digits_count (switch_core_session_t *session,
char *terminator, char *terminator,
unsigned int timeout) unsigned int timeout)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_collect_digits_count(session, buf, buflen, maxdigits, terminators, terminator, timeout); status = switch_ivr_collect_digits_count(session, buf, buflen, maxdigits, terminators, terminator, timeout);
...@@ -243,7 +280,7 @@ int fs_switch_ivr_collect_digits_count (switch_core_session_t *session, ...@@ -243,7 +280,7 @@ int fs_switch_ivr_collect_digits_count (switch_core_session_t *session,
} }
*/ */
int fs_switch_ivr_originate (switch_core_session_t *session, int fs_switch_ivr_originate(char *uuid,
switch_core_session_t **bleg, switch_core_session_t **bleg,
char * bridgeto, char * bridgeto,
uint32_t timelimit_sec) uint32_t timelimit_sec)
...@@ -252,6 +289,8 @@ int fs_switch_ivr_originate (switch_core_session_t *session, ...@@ -252,6 +289,8 @@ int fs_switch_ivr_originate (switch_core_session_t *session,
char * cid_num_override, char * cid_num_override,
switch_caller_profile_t *caller_profile_override) */ switch_caller_profile_t *caller_profile_override) */
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *caller_channel; switch_channel_t *caller_channel;
switch_core_session_t *peer_session; switch_core_session_t *peer_session;
...@@ -276,18 +315,21 @@ int fs_switch_ivr_originate (switch_core_session_t *session, ...@@ -276,18 +315,21 @@ int fs_switch_ivr_originate (switch_core_session_t *session,
} }
int fs_switch_ivr_session_transfer(switch_core_session_t *session, int fs_switch_ivr_session_transfer(char *uuid,
char *extension, char *extension,
char *dialplan, char *dialplan,
char *context) char *context)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_session_transfer(session,extension,dialplan,context); status = switch_ivr_session_transfer(session,extension,dialplan,context);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_switch_ivr_speak_text (switch_core_session_t *session, int fs_switch_ivr_speak_text (char *uuid,
char *tts_name, char *tts_name,
char *voice_name, char *voice_name,
char *timer_name, char *timer_name,
...@@ -297,6 +339,9 @@ int fs_switch_ivr_speak_text (switch_core_session_t *session, ...@@ -297,6 +339,9 @@ int fs_switch_ivr_speak_text (switch_core_session_t *session,
void *buf, void *buf,
unsigned int buflen) unsigned int buflen)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen); status = switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen);
...@@ -310,17 +355,28 @@ int fs_switch_ivr_speak_text (switch_core_session_t *session, ...@@ -310,17 +355,28 @@ int fs_switch_ivr_speak_text (switch_core_session_t *session,
*/ */
char* fs_switch_channel_get_variable(switch_channel_t *channel, char *varname) char* fs_switch_channel_get_variable(char *uuid, char *varname)
{ {
switch_channel_t *channel;
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
channel = switch_core_session_get_channel(session);
return switch_channel_get_variable(channel, varname); return switch_channel_get_variable(channel, varname);
} }
int fs_switch_channel_set_variable(switch_channel_t *channel, char *varname, char *value) int fs_switch_channel_set_variable(char *uuid, char *varname, char *value)
{ {
switch_status_t status; switch_channel_t *channel;
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status;
channel = switch_core_session_get_channel(session);
status = switch_channel_set_variable(channel, varname, value); status = switch_channel_set_variable(channel, varname, value);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
//char*
...@@ -885,13 +885,12 @@ static void SWIG_Php4_SetModule(swig_module_info *pointer) { ...@@ -885,13 +885,12 @@ static void SWIG_Php4_SetModule(swig_module_info *pointer) {
#define SWIGTYPE_p_p_switch_core_session_t swig_types[0] #define SWIGTYPE_p_p_switch_core_session_t swig_types[0]
#define SWIGTYPE_p_p_void swig_types[1] #define SWIGTYPE_p_p_void swig_types[1]
#define SWIGTYPE_p_switch_channel_t swig_types[2] #define SWIGTYPE_p_switch_core_session_t swig_types[2]
#define SWIGTYPE_p_switch_core_session_t swig_types[3] #define SWIGTYPE_p_switch_file_handle_t swig_types[3]
#define SWIGTYPE_p_switch_file_handle_t swig_types[4] #define SWIGTYPE_p_switch_input_callback_function_t swig_types[4]
#define SWIGTYPE_p_switch_input_callback_function_t swig_types[5] #define SWIGTYPE_p_uint32_t swig_types[5]
#define SWIGTYPE_p_uint32_t swig_types[6] static swig_type_info *swig_types[7];
static swig_type_info *swig_types[8]; static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0};
static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
...@@ -1013,7 +1012,6 @@ zend_module_entry* SWIG_module_entry = &freeswitch_module_entry; ...@@ -1013,7 +1012,6 @@ zend_module_entry* SWIG_module_entry = &freeswitch_module_entry;
static swig_type_info _swigt__p_p_switch_core_session_t = {"_p_p_switch_core_session_t", "switch_core_session_t **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_switch_core_session_t = {"_p_p_switch_core_session_t", "switch_core_session_t **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_void = {"_p_p_void", "void **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_void = {"_p_p_void", "void **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_file_handle_t = {"_p_switch_file_handle_t", "switch_file_handle_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_file_handle_t = {"_p_switch_file_handle_t", "switch_file_handle_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_input_callback_function_t = {"_p_switch_input_callback_function_t", "switch_input_callback_function_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_callback_function_t = {"_p_switch_input_callback_function_t", "switch_input_callback_function_t *", 0, 0, (void*)0, 0};
...@@ -1022,7 +1020,6 @@ static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, ( ...@@ -1022,7 +1020,6 @@ static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (
static swig_type_info *swig_type_initial[] = { static swig_type_info *swig_type_initial[] = {
&_swigt__p_p_switch_core_session_t, &_swigt__p_p_switch_core_session_t,
&_swigt__p_p_void, &_swigt__p_p_void,
&_swigt__p_switch_channel_t,
&_swigt__p_switch_core_session_t, &_swigt__p_switch_core_session_t,
&_swigt__p_switch_file_handle_t, &_swigt__p_switch_file_handle_t,
&_swigt__p_switch_input_callback_function_t, &_swigt__p_switch_input_callback_function_t,
...@@ -1031,7 +1028,6 @@ static swig_type_info *swig_type_initial[] = { ...@@ -1031,7 +1028,6 @@ static swig_type_info *swig_type_initial[] = {
static swig_cast_info _swigc__p_p_switch_core_session_t[] = { {&_swigt__p_p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_switch_core_session_t[] = { {&_swigt__p_p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_void[] = { {&_swigt__p_p_void, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_void[] = { {&_swigt__p_p_void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_file_handle_t[] = { {&_swigt__p_switch_file_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_file_handle_t[] = { {&_swigt__p_switch_file_handle_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_input_callback_function_t[] = { {&_swigt__p_switch_input_callback_function_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_callback_function_t[] = { {&_swigt__p_switch_input_callback_function_t, 0, 0, 0},{0, 0, 0, 0}};
...@@ -1040,7 +1036,6 @@ static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{ ...@@ -1040,7 +1036,6 @@ static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{
static swig_cast_info *swig_cast_initial[] = { static swig_cast_info *swig_cast_initial[] = {
_swigc__p_p_switch_core_session_t, _swigc__p_p_switch_core_session_t,
_swigc__p_p_void, _swigc__p_p_void,
_swigc__p_switch_channel_t,
_swigc__p_switch_core_session_t, _swigc__p_switch_core_session_t,
_swigc__p_switch_file_handle_t, _swigc__p_switch_file_handle_t,
_swigc__p_switch_input_callback_function_t, _swigc__p_switch_input_callback_function_t,
...@@ -1052,7 +1047,6 @@ static swig_cast_info *swig_cast_initial[] = { ...@@ -1052,7 +1047,6 @@ static swig_cast_info *swig_cast_initial[] = {
/* end header section */ /* end header section */
/* vdecl subsection */ /* vdecl subsection */
static int le_swig__p_switch_channel_t=0; /* handle for */
static int le_swig__p_switch_file_handle_t=0; /* handle for */ static int le_swig__p_switch_file_handle_t=0; /* handle for */
static int le_swig__p_switch_core_session_t=0; /* handle for */ static int le_swig__p_switch_core_session_t=0; /* handle for */
static int le_swig__p_p_switch_core_session_t=0; /* handle for */ static int le_swig__p_p_switch_core_session_t=0; /* handle for */
...@@ -1259,7 +1253,7 @@ fail: ...@@ -1259,7 +1253,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_channel_answer) { ZEND_NAMED_FUNCTION(_wrap_fs_channel_answer) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
zval **args[1]; zval **args[1];
SWIG_ResetError(); SWIG_ResetError();
...@@ -1268,10 +1262,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_answer) { ...@@ -1268,10 +1262,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_answer) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_answer. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
fs_channel_answer(arg1); fs_channel_answer(arg1);
...@@ -1282,7 +1276,7 @@ fail: ...@@ -1282,7 +1276,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_channel_pre_answer) { ZEND_NAMED_FUNCTION(_wrap_fs_channel_pre_answer) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
zval **args[1]; zval **args[1];
SWIG_ResetError(); SWIG_ResetError();
...@@ -1291,10 +1285,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_pre_answer) { ...@@ -1291,10 +1285,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_pre_answer) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_pre_answer. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
fs_channel_pre_answer(arg1); fs_channel_pre_answer(arg1);
...@@ -1305,7 +1299,7 @@ fail: ...@@ -1305,7 +1299,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_channel_hangup) { ZEND_NAMED_FUNCTION(_wrap_fs_channel_hangup) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
zval **args[2]; zval **args[2];
...@@ -1315,10 +1309,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_hangup) { ...@@ -1315,10 +1309,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_hangup) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_hangup. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1335,7 +1329,7 @@ fail: ...@@ -1335,7 +1329,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_variable) { ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_variable) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ; char *arg3 = (char *) 0 ;
zval **args[3]; zval **args[3];
...@@ -1346,10 +1340,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_variable) { ...@@ -1346,10 +1340,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_variable) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_set_variable. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1372,7 +1366,7 @@ fail: ...@@ -1372,7 +1366,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_channel_get_variable) { ZEND_NAMED_FUNCTION(_wrap_fs_channel_get_variable) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
zval **args[2]; zval **args[2];
...@@ -1382,10 +1376,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_get_variable) { ...@@ -1382,10 +1376,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_get_variable) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_get_variable. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1402,7 +1396,7 @@ fail: ...@@ -1402,7 +1396,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_state) { ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_state) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
zval **args[2]; zval **args[2];
...@@ -1412,10 +1406,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_state) { ...@@ -1412,10 +1406,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_state) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_set_state. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1432,7 +1426,7 @@ fail: ...@@ -1432,7 +1426,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) { ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ; char *arg3 = (char *) 0 ;
switch_input_callback_function_t arg4 ; switch_input_callback_function_t arg4 ;
...@@ -1448,10 +1442,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) { ...@@ -1448,10 +1442,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_ivr_play_file. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1496,7 +1490,7 @@ fail: ...@@ -1496,7 +1490,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_record_file) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_record_file) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ; switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
char *arg3 = (char *) 0 ; char *arg3 = (char *) 0 ;
switch_input_callback_function_t arg4 ; switch_input_callback_function_t arg4 ;
...@@ -1512,10 +1506,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_record_file) { ...@@ -1512,10 +1506,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_record_file) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_record_file. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/* typemap(in) SWIGTYPE * */ /* typemap(in) SWIGTYPE * */
...@@ -1560,7 +1554,7 @@ fail: ...@@ -1560,7 +1554,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_sleep) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_sleep) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
uint32_t arg2 ; uint32_t arg2 ;
int result; int result;
uint32_t *tmp2 ; uint32_t *tmp2 ;
...@@ -1572,10 +1566,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_sleep) { ...@@ -1572,10 +1566,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_sleep) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_sleep. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
if(SWIG_ConvertPtr(*args[1], (void **) &tmp2, SWIGTYPE_p_uint32_t, 0) < 0) { if(SWIG_ConvertPtr(*args[1], (void **) &tmp2, SWIGTYPE_p_uint32_t, 0) < 0) {
...@@ -1594,7 +1588,7 @@ fail: ...@@ -1594,7 +1588,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file2) { ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file2) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
int result; int result;
zval **args[2]; zval **args[2];
...@@ -1605,10 +1599,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file2) { ...@@ -1605,10 +1599,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file2) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_ivr_play_file2. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1627,7 +1621,7 @@ fail: ...@@ -1627,7 +1621,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_callback) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_callback) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
switch_input_callback_function_t arg2 ; switch_input_callback_function_t arg2 ;
void *arg3 = (void *) 0 ; void *arg3 = (void *) 0 ;
unsigned int arg4 ; unsigned int arg4 ;
...@@ -1641,10 +1635,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_callback) { ...@@ -1641,10 +1635,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_callback) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_collect_digits_callback. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
if(SWIG_ConvertPtr(*args[1], (void **) &tmp2, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) { if(SWIG_ConvertPtr(*args[1], (void **) &tmp2, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) {
...@@ -1677,7 +1671,7 @@ fail: ...@@ -1677,7 +1671,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_count) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_count) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
unsigned int arg3 ; unsigned int arg3 ;
unsigned int arg4 ; unsigned int arg4 ;
...@@ -1693,10 +1687,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_count) { ...@@ -1693,10 +1687,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_count) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_collect_digits_count. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1745,7 +1739,7 @@ fail: ...@@ -1745,7 +1739,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_originate) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_originate) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
switch_core_session_t **arg2 = (switch_core_session_t **) 0 ; switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
char *arg3 = (char *) 0 ; char *arg3 = (char *) 0 ;
uint32_t arg4 ; uint32_t arg4 ;
...@@ -1759,10 +1753,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_originate) { ...@@ -1759,10 +1753,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_originate) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_originate. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/* typemap(in) SWIGTYPE * */ /* typemap(in) SWIGTYPE * */
...@@ -1793,7 +1787,7 @@ fail: ...@@ -1793,7 +1787,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_session_transfer) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_session_transfer) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ; char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ; char *arg4 = (char *) 0 ;
...@@ -1806,10 +1800,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_session_transfer) { ...@@ -1806,10 +1800,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_session_transfer) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_session_transfer. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1840,7 +1834,7 @@ fail: ...@@ -1840,7 +1834,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ; char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ; char *arg4 = (char *) 0 ;
...@@ -1860,10 +1854,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) { ...@@ -1860,10 +1854,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_speak_text. Expected SWIGTYPE_p_switch_core_session_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1926,7 +1920,7 @@ fail: ...@@ -1926,7 +1920,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_get_variable) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_get_variable) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
char *result = 0 ; char *result = 0 ;
zval **args[2]; zval **args[2];
...@@ -1937,10 +1931,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_get_variable) { ...@@ -1937,10 +1931,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_get_variable) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_channel_get_variable. Expected SWIGTYPE_p_switch_channel_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -1963,7 +1957,7 @@ fail: ...@@ -1963,7 +1957,7 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_set_variable) { ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_set_variable) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ; char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ; char *arg3 = (char *) 0 ;
int result; int result;
...@@ -1975,10 +1969,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_set_variable) { ...@@ -1975,10 +1969,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_set_variable) {
} }
{ {
/* typemap(in) SWIGTYPE * */ /*@SWIG:CONVERT_STRING_IN@*/
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) { convert_to_string_ex(args[0]);
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_channel_set_variable. Expected SWIGTYPE_p_switch_channel_t"); arg1 = (char *) Z_STRVAL_PP(args[0]);
} /*@SWIG@*/;
} }
{ {
/*@SWIG:CONVERT_STRING_IN@*/ /*@SWIG:CONVERT_STRING_IN@*/
...@@ -2002,10 +1996,6 @@ fail: ...@@ -2002,10 +1996,6 @@ fail:
} }
/* NEW Destructor style */
static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_switch_channel_t) {
/* bah! No destructor for this simple type!! */
}
/* NEW Destructor style */ /* NEW Destructor style */
static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_switch_file_handle_t) { static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_switch_file_handle_t) {
/* bah! No destructor for this simple type!! */ /* bah! No destructor for this simple type!! */
...@@ -2260,8 +2250,6 @@ SWIG_PropagateClientData(void) { ...@@ -2260,8 +2250,6 @@ SWIG_PropagateClientData(void) {
ZEND_INIT_MODULE_GLOBALS(freeswitch, freeswitch_init_globals, freeswitch_destroy_globals); ZEND_INIT_MODULE_GLOBALS(freeswitch, freeswitch_init_globals, freeswitch_destroy_globals);
/* Register resource destructors for pointer types */ /* Register resource destructors for pointer types */
le_swig__p_switch_channel_t=zend_register_list_destructors_ex(_wrap_destroy_p_switch_channel_t,NULL,(char *)(SWIGTYPE_p_switch_channel_t->name),module_number);
SWIG_TypeClientData(SWIGTYPE_p_switch_channel_t,&le_swig__p_switch_channel_t);
le_swig__p_switch_file_handle_t=zend_register_list_destructors_ex(_wrap_destroy_p_switch_file_handle_t,NULL,(char *)(SWIGTYPE_p_switch_file_handle_t->name),module_number); le_swig__p_switch_file_handle_t=zend_register_list_destructors_ex(_wrap_destroy_p_switch_file_handle_t,NULL,(char *)(SWIGTYPE_p_switch_file_handle_t->name),module_number);
SWIG_TypeClientData(SWIGTYPE_p_switch_file_handle_t,&le_swig__p_switch_file_handle_t); SWIG_TypeClientData(SWIGTYPE_p_switch_file_handle_t,&le_swig__p_switch_file_handle_t);
le_swig__p_switch_core_session_t=zend_register_list_destructors_ex(_wrap_destroy_p_switch_core_session_t,NULL,(char *)(SWIGTYPE_p_switch_core_session_t->name),module_number); le_swig__p_switch_core_session_t=zend_register_list_destructors_ex(_wrap_destroy_p_switch_core_session_t,NULL,(char *)(SWIGTYPE_p_switch_core_session_t->name),module_number);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论