]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Yet another fix. PHP now doesnt crash :)
authorBrian Fertig <bfertig@gmail.com>
Mon, 11 Sep 2006 11:23:56 +0000 (11:23 +0000)
committerBrian Fertig <bfertig@gmail.com>
Mon, 11 Sep 2006 11:23:56 +0000 (11:23 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2638 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_php/Makefile
src/mod/languages/mod_php/apptest.php
src/mod/languages/mod_php/classFreeswitch.php
src/mod/languages/mod_php/mod_php.c
src/mod/languages/mod_php/switch_swig.c
src/mod/languages/mod_php/switch_swig_wrap.c

index bc15b2e49c2fed3fa06f4f72677236d4d116f88a..f1c07d6a19690db78df06a4628e9d861d9f84168 100644 (file)
@@ -2,7 +2,7 @@
 PCFG=$(PREFIX)/bin/php-config
 
 LCFLAGS=-fPIC -DZTS -DPTHREADS
-CFLAGS += `$(PCFG) --includes`
+CFLAGS += `$(PCFG) --includes` -g3
 MDIR += `$(PCFG) --extension-dir`
 PHPMOD=freeswitch
 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
 all:   depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PHPMOD).$(DYNAMIC_LIB_EXTEN)
 
 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
        $(CC) $(LCFLAGS) $(CFLAGS) -c $< -o $@
 
@@ -41,3 +41,7 @@ install:
        cp -f php_$(PHPMOD).$(DYNAMIC_LIB_EXTEN) $(MDIR)
        cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod
        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
index 31d086975027e5047880e21673ce76ac7a569387..b0f253d33a38082f1e7f86a21bbfe7b260f8fba4 100644 (file)
@@ -8,10 +8,12 @@
 */
 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");
 
 ?>
index c05ad375e2a87d635f3c0860c997c7aff14c777f..b15ddb95ca4283c6a904ebaa06d0449b2a23a067 100644 (file)
  *
  */
 require("freeswitch.php");  // Required for freeswitch driver to be loaded
-global $sessn;
+
 class fs_class_api {
+       Private $uuid;
+
        function fs_class_api() {
-               if($sessn = $this->fs_getsessn($uuid)){}
-               else{
-                  echo "Couldnt get sessn!\n";
-               }
+               $this->uuid = $uuid;
        
        }
        
@@ -62,99 +61,88 @@ class fs_class_api {
                
        }
 
-       function fs_getsessn($uuid){
-               
-               return fs_core_sessn_locate($uuid);
-       
-       }
 
        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){
                
-               fs_channel_hangup($sessn, $cause);
+               fs_channel_hangup($this->uuid, $cause);
                
        }
 
        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){
                
-               return fs_channel_get_var($sessn, $var);
+               return fs_channel_get_var($this->uuid, $var);
                
        }
 
        function fs_set_channel_state($state){
                
-               fs_channel_set_state($sessn, $state);
+               fs_channel_set_state($this->uuid, $state);
                
        }
        
        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){
                
-               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){
                
-               return fs_switch_ivr_sleep($sessn, $ms);
+               return fs_switch_ivr_sleep($this->uuid, $ms);
                
        }
        
        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){
                
-               return fs_switch_ivr_collect_digits_count($sessn, 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);
+               return fs_switch_ivr_collect_digits_count($this->uuid, NULL, NULL, $maxdigits, NULL, $terminator, $timeout);
                
        }
 
        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){
                
-               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){
                
-               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);
                
        }
 
index 5d96f58ec6da2c83e5db1934392f333d571f10ad..a53375b26fb2fd0c937bdcde320b653e67e55136 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthmct@yahoo.com>
  * Brian Fertig <brian.fertig@convergencetek.com>
  *
  *
  */
 
-#if !defined(ZTS)
-#error "ZTS Needs to be defined."
-#endif
-
 
 #ifndef _REENTRANT
 #define _REENTRANT
 #endif
 
 #include <sapi/embed/php_embed.h>
-//#include "php.h"
-//#include "php_variables.h"
-//#include "ext/standard/info.h"
-//#include "php_ini.h"
-//#include "php_globals.h"
-//#include "SAPI.h"
-//#include "php_main.h"
-//#include "php_version.h"
-//#include "TSRM.h"
-//#include "ext/standard/php_standard.h"
+
+#ifdef ZTS
+        zend_compiler_globals *compiler_globals;
+        zend_executor_globals *executor_globals;
+        php_core_globals *core_globals;
+        sapi_globals_struct *sapi_globals;
+#endif
 
 
 #include <switch.h>
 
 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)
-{ // This function partly based on code from asterisk_php
+{
 
   FILE *fp = fopen("mod_php.log", "a");
   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
 
                 if(PG(log_errors)) {
                         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);
                         php_log_err(log_buffer TSRMLS_CC);
                         efree(log_buffer);
@@ -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 *append_string = INI_STR("error_append_string");
                         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, 
-STR_PRINT(append_string));
+                        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));
                 }
         }
 
-        /* Bail out if we can't recover */
+        // Bail out if we can't recover 
         switch(type) {
                 case E_CORE_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_USER_ERROR:
                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "\nPHP: %s exiting\n", error_filename);
                         EG(exit_status) = 255;
 #if MEMORY_LIMIT
-                        /* restore memory limit */
+                        // restore memory limit 
                         AG(memory_limit) = PG(memory_limit);
 #endif
                         efree(buffer);
                         zend_bailout();
                         return;
-                        break;
+
         }
 
-        /* Log if necessary */
+        // Log if necessary 
         if(PG(track_errors) && EG(active_symbol_table)) {
                 pval *tmp;
 
@@ -307,87 +172,134 @@ STR_PRINT(append_string));
         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)
-{
-        return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int sapi_mod_php_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
-        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)
 {
          switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s\n", message);
 }
 
+typedef void (*sapi_error_function_t)(int type, const char *error_msg, ...);
 
-static char *sapi_mod_php_read_cookies(TSRMLS_D)
-{
-        return NULL;
-}
-
-static int mod_php_startup(sapi_module_struct *sapi_module);
-
-sapi_module_struct mod_php_sapi_module = {
-   "mod_php",                                  /* name */
-   "mod_php",                                  /* pretty name */
-
-   mod_php_startup,                        /* startup */
-   NULL,                 /* shutdown */
 
-   NULL,                                        /* activate */
-   NULL,                                        /* deactivate */
 
-   sapi_mod_php_ub_write,                      /* unbuffered write */
-   NULL,                                        /* flush */
-   NULL,                                        /* get uid */
-   NULL,                                        /* getenv */
+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;
 
-   php_error,                                   /* error handler */
+        snprintf(mydata, len, "%s %s", uuid, data);
 
-   sapi_mod_php_header_handler,                /* header handler */
-   sapi_mod_php_send_headers,                  /* send headers handler */
-   NULL,                                        /* send header handler */
+        argc = switch_separate_string(mydata, ' ',argv,(sizeof(argv) / sizeof(argv[0])));
 
-   sapi_mod_php_read_post,                     /* read POST data */
-   sapi_mod_php_read_cookies,                  /* read Cookies */
+        sprintf(php_code, "uuid=\"%s\"; include(\"%s\");\n", argv[0], argv[1]);
+        //sprintf(php_code, "include('%s');", argv[1]);
+       
+       sprintf(php_code, "%s %s", data, uuid);
+
+        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");
+
+       // Initialize PHPs CORE
+       php_embed_init(argc, argv, &tsrm_ls);
+
+       // Return All of the DEBUG crap to the console and/or a log file
+        php_embed_module.ub_write = sapi_mod_php_ub_write;
+        php_embed_module.log_message = mod_php_log_message;
+        php_embed_module.sapi_error = (sapi_error_function_t)mod_php_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);
+
+       // Force $uuid and $session to exist in PHPs memory space
+       zval *php_uuid;
+       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);
+
+       // Clean up after PHP and such
+        php_embed_shutdown(tsrm_ls);
+
+       // Return back to the Dialplan
+        return;
 
-   NULL,                                       /* register server variables */
-   mod_php_log_message,                        /* Log message */
-   NULL,                                        /* Get request time */
+// Buh bye now!
+}
 
-   NULL,                                        /* Block interruptions */
-   NULL,                                        /* Unblock interruptions */
+static const switch_application_interface_t php_application_interface = {
+        /*.interface_name */ "php",
+        /*.application_function */ php_function
+};
 
-   STANDARD_SAPI_MODULE_PROPERTIES
+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)
 {
+void*** tsrm_ls = NULL;
+
         /* 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");
 
+#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 */
         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;
+  }
+*/
+
index ee6c7b4a369ca9c4f780f668c74653e27d336185..24e7b32a3407f24b660bbfbbafa610e898b53875 100644 (file)
@@ -112,38 +112,57 @@ switch_core_session_t *fs_core_session_locate(char *uuid)
        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);
 }
 
-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_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_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_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_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_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)
 IVR Routines!  You can do IVR in PHP NOW!
 */
 
-int fs_ivr_play_file(switch_core_session_t *session,
-                                        char *file,
-                                        char *timer_name,
-                                        switch_input_callback_function_t dtmf_callback,
-                                        void *buf,
-                                        unsigned int buflen)
+int fs_ivr_play_file(char *uuid,
+                        char *file,
+                        char *timer_name,
+                        switch_input_callback_function_t dtmf_callback,
+                        void *buf,
+                        unsigned int buflen)
 {
+        switch_core_session_t *session;
+        session = fs_core_session_locate(uuid);
+
        switch_status_t status;
        if (switch_strlen_zero(timer_name)) {
                timer_name = NULL;
@@ -173,31 +195,40 @@ int fs_ivr_play_file(switch_core_session_t *session,
        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
-int fs_switch_ivr_record_file(switch_core_session_t *session,
-                                               switch_file_handle_t *fh,
-                                               char *file,
-                                               switch_input_callback_function_t dtmf_callback,
-                                               void *buf,
-                                               unsigned int buflen)
+int fs_switch_ivr_record_file(char *uuid,
+                               switch_file_handle_t *fh,
+                               char *file,
+                               switch_input_callback_function_t dtmf_callback,
+                               void *buf,
+                               unsigned int buflen)
 {  
+        switch_core_session_t *session;
+        session = fs_core_session_locate(uuid);
+
        switch_status_t status;
        
         status = switch_ivr_record_file(session, fh, file, dtmf_callback, buf, buflen);
         return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
-int fs_switch_ivr_sleep(switch_core_session_t *session,
-                                       uint32_t ms)
+int fs_switch_ivr_sleep(char *uuid,
+                               uint32_t ms)
 {
+        switch_core_session_t *session;
+        session = fs_core_session_locate(uuid);
+
        switch_status_t status;
        status = switch_ivr_sleep(session, ms);
        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
-int fs_ivr_play_file2(switch_core_session_t *session,
-                                         char *file)
+int fs_ivr_play_file2(char *uuid,
+                         char *file)
 
 {
+        switch_core_session_t *session;
+        session = fs_core_session_locate(uuid);
+
        switch_status_t status;
        
        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,
 }
 
 
-int fs_switch_ivr_collect_digits_callback (switch_core_session_t *session,
-                                                       switch_input_callback_function_t dtmf_callback,
-                                                       void *buf,
-                                                       unsigned int buflen)
+int fs_switch_ivr_collect_digits_callback (char *uuid,
+                                               switch_input_callback_function_t dtmf_callback,
+                                               void *buf,
+                                               unsigned int buflen)
 {
+        switch_core_session_t *session;
+        session = fs_core_session_locate(uuid);
+
         switch_status_t status;
 
         status = switch_ivr_collect_digits_callback(session, dtmf_callback, buf, buflen);
         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,
                                        unsigned int buflen,
                                        unsigned int maxdigits,
@@ -224,6 +258,9 @@ int fs_switch_ivr_collect_digits_count      (switch_core_session_t *session,
                                        char *terminator,
                                        unsigned int timeout)  
 {
+        switch_core_session_t *session;
+        session = fs_core_session_locate(uuid);
+
         switch_status_t status;
 
         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,
 }
 */
 
-int fs_switch_ivr_originate       (switch_core_session_t *session,
+int fs_switch_ivr_originate(char *uuid,
                                switch_core_session_t **bleg,
                                char *          bridgeto,
                                uint32_t        timelimit_sec)
@@ -252,6 +289,8 @@ int fs_switch_ivr_originate       (switch_core_session_t *session,
                                char *          cid_num_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_core_session_t *peer_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 *dialplan,
                                char *context)  
 {
+        switch_core_session_t *session;
+        session = fs_core_session_locate(uuid);
+
         switch_status_t status;
 
         status = switch_ivr_session_transfer(session,extension,dialplan,context);
         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 *voice_name,
                                char *timer_name,
@@ -297,6 +339,9 @@ int fs_switch_ivr_speak_text      (switch_core_session_t *session,
                                void *buf,
                                unsigned int buflen)  
 {
+        switch_core_session_t *session;
+        session = fs_core_session_locate(uuid);
+
         switch_status_t status;
 
         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,
 
 */
 
-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);
 }
 
 
-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);
         return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }  
 
+//char* 
index 7aad79205fdb79d81da380da843d2013db3d9c71..c9acc7dac8bf031c67e72007090df16cc50ad159 100644 (file)
@@ -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_void swig_types[1]
-#define SWIGTYPE_p_switch_channel_t swig_types[2]
-#define SWIGTYPE_p_switch_core_session_t swig_types[3]
-#define SWIGTYPE_p_switch_file_handle_t swig_types[4]
-#define SWIGTYPE_p_switch_input_callback_function_t swig_types[5]
-#define SWIGTYPE_p_uint32_t swig_types[6]
-static swig_type_info *swig_types[8];
-static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
+#define SWIGTYPE_p_switch_core_session_t swig_types[2]
+#define SWIGTYPE_p_switch_file_handle_t swig_types[3]
+#define SWIGTYPE_p_switch_input_callback_function_t swig_types[4]
+#define SWIGTYPE_p_uint32_t swig_types[5]
+static swig_type_info *swig_types[7];
+static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&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;
 
 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_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_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};
@@ -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[] = {
   &_swigt__p_p_switch_core_session_t,
   &_swigt__p_p_void,
-  &_swigt__p_switch_channel_t,
   &_swigt__p_switch_core_session_t,
   &_swigt__p_switch_file_handle_t,
   &_swigt__p_switch_input_callback_function_t,
@@ -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_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_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}};
@@ -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[] = {
   _swigc__p_p_switch_core_session_t,
   _swigc__p_p_void,
-  _swigc__p_switch_channel_t,
   _swigc__p_switch_core_session_t,
   _swigc__p_switch_file_handle_t,
   _swigc__p_switch_input_callback_function_t,
@@ -1052,7 +1047,6 @@ static swig_cast_info *swig_cast_initial[] = {
 
 /* end header section */
 /* 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_core_session_t=0; /* handle for  */
 static int le_swig__p_p_switch_core_session_t=0; /* handle for  */
@@ -1259,7 +1253,7 @@ fail:
 
 
 ZEND_NAMED_FUNCTION(_wrap_fs_channel_answer) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg1 = (char *) 0 ;
   zval **args[1];
   
   SWIG_ResetError();
@@ -1268,10 +1262,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_answer) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_answer. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   fs_channel_answer(arg1);
   
@@ -1282,7 +1276,7 @@ fail:
 
 
 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];
   
   SWIG_ResetError();
@@ -1291,10 +1285,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_pre_answer) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_pre_answer. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   fs_channel_pre_answer(arg1);
   
@@ -1305,7 +1299,7 @@ fail:
 
 
 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 ;
   zval **args[2];
   
@@ -1315,10 +1309,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_hangup) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_hangup. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1335,7 +1329,7 @@ fail:
 
 
 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 *arg3 = (char *) 0 ;
   zval **args[3];
@@ -1346,10 +1340,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_variable) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_set_variable. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1372,7 +1366,7 @@ fail:
 
 
 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 ;
   zval **args[2];
   
@@ -1382,10 +1376,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_get_variable) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_get_variable. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1402,7 +1396,7 @@ fail:
 
 
 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 ;
   zval **args[2];
   
@@ -1412,10 +1406,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_state) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_channel_set_state. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1432,7 +1426,7 @@ fail:
 
 
 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 *arg3 = (char *) 0 ;
   switch_input_callback_function_t arg4 ;
@@ -1448,10 +1442,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_ivr_play_file. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1496,7 +1490,7 @@ fail:
 
 
 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 ;
   char *arg3 = (char *) 0 ;
   switch_input_callback_function_t arg4 ;
@@ -1512,10 +1506,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_record_file) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_record_file. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /* typemap(in) SWIGTYPE * */
@@ -1560,7 +1554,7 @@ fail:
 
 
 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 ;
   int result;
   uint32_t *tmp2 ;
@@ -1572,10 +1566,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_sleep) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_sleep. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     if(SWIG_ConvertPtr(*args[1], (void **) &tmp2, SWIGTYPE_p_uint32_t, 0) < 0) {
@@ -1594,7 +1588,7 @@ fail:
 
 
 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 ;
   int result;
   zval **args[2];
@@ -1605,10 +1599,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file2) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_ivr_play_file2. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1627,7 +1621,7 @@ fail:
 
 
 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 ;
   void *arg3 = (void *) 0 ;
   unsigned int arg4 ;
@@ -1641,10 +1635,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_callback) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 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");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     if(SWIG_ConvertPtr(*args[1], (void **) &tmp2, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) {
@@ -1677,7 +1671,7 @@ fail:
 
 
 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 ;
   unsigned int arg3 ;
   unsigned int arg4 ;
@@ -1693,10 +1687,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_collect_digits_count) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 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");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1745,7 +1739,7 @@ fail:
 
 
 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 ;
   char *arg3 = (char *) 0 ;
   uint32_t arg4 ;
@@ -1759,10 +1753,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_originate) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_originate. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /* typemap(in) SWIGTYPE * */
@@ -1793,7 +1787,7 @@ fail:
 
 
 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 *arg3 = (char *) 0 ;
   char *arg4 = (char *) 0 ;
@@ -1806,10 +1800,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_session_transfer) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_session_transfer. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1840,7 +1834,7 @@ fail:
 
 
 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 *arg3 = (char *) 0 ;
   char *arg4 = (char *) 0 ;
@@ -1860,10 +1854,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_ivr_speak_text. Expected SWIGTYPE_p_switch_core_session_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1926,7 +1920,7 @@ fail:
 
 
 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 *result = 0 ;
   zval **args[2];
@@ -1937,10 +1931,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_get_variable) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_channel_get_variable. Expected SWIGTYPE_p_switch_channel_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -1963,7 +1957,7 @@ fail:
 
 
 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 *arg3 = (char *) 0 ;
   int result;
@@ -1975,10 +1969,10 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_channel_set_variable) {
   }
   
   {
-    /* typemap(in) SWIGTYPE * */
-    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) {
-      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of fs_switch_channel_set_variable. Expected SWIGTYPE_p_switch_channel_t");
-    }
+    /*@SWIG:CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[0]);
+    arg1 = (char *) Z_STRVAL_PP(args[0]);
+    /*@SWIG@*/;
   }
   {
     /*@SWIG:CONVERT_STRING_IN@*/
@@ -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 */
 static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_switch_file_handle_t) {
   /* bah! No destructor for this simple type!! */
@@ -2260,8 +2250,6 @@ SWIG_PropagateClientData(void) {
 ZEND_INIT_MODULE_GLOBALS(freeswitch, freeswitch_init_globals, freeswitch_destroy_globals);
 
 /* 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);
 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);