]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
let modules see the filename they were called as
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 Dec 2005 18:31:49 +0000 (18:31 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 Dec 2005 18:31:49 +0000 (18:31 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@94 d0543943-73ff-0310-b7d9-9358b9ac24b2

16 files changed:
src/mod/mod_bridgecall/mod_bridgecall.c
src/mod/mod_dialplan_demo/mod_dialplan_demo.c
src/mod/mod_exosip/mod_exosip.c
src/mod/mod_exosip/mod_exosip_ccrtp.c
src/mod/mod_exosip/mod_exosip_ucl.c
src/mod/mod_g711codec/mod_g711codec.c
src/mod/mod_iaxchan/mod_iaxchan.c
src/mod/mod_opalchan/mod_opalchan.c
src/mod/mod_playback/mod_playback.c
src/mod/mod_rawaudio/mod_rawaudio.c
src/mod/mod_skel/mod_skel.c
src/mod/mod_softtimer/mod_softtimer.c
src/mod/mod_speexcodec/mod_speexcodec.c
src/mod/mod_wanchan/mod_wanchan.c
src/mod/mod_woomerachan/mod_woomerachan.c
src/switch_loadable_module.c

index 3cb8faec85b81371167beed3b3bfbc89651daa11..2ea72d50dd0ff1aff644514638c6ad2894830afb 100644 (file)
@@ -258,7 +258,7 @@ static const switch_loadable_module_interface mod_bridgecall_module_interface =
        /*.application_interface*/      &bridge_application_interface
 };
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
        
        /* connect my internal structure to the blank pointer passed to me */
        *interface = &mod_bridgecall_module_interface;
index 2cd50132e0781e8134f777e2b1b010269c97590a..27742716f2f7fc4651a11cf46836291a74cb9d60 100644 (file)
@@ -114,7 +114,7 @@ static const switch_loadable_module_interface demo_dialplan_module_interface = {
        /*.application_interface =*/ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
        
        /* connect my internal structure to the blank pointer passed to me */
        *interface = &demo_dialplan_module_interface;
index 128fb38130047815ce19cac4afda06feffd3cbec..07bda55065d91376666f9da9881886e6a1294f0d 100644 (file)
@@ -754,7 +754,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
        /* NOTE:  **interface is **_interface because the common lib redefines interface to struct in some situations */
 
        if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
index 00dad1cda4fa3bfe2f24cf2d6a310e535f13b778..4d895ca0fcf80fce871411c872280644860b9d2c 100644 (file)
@@ -738,7 +738,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
        /* NOTE:  **interface is **_interface because the common lib redefines interface to struct in some situations */
 
        if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
index 567a94bdbe77eca95ac954d3b76914f5d183ac69..54c3b0364cfa6c6fd56a3a967f766de266955e0a 100644 (file)
@@ -805,7 +805,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **_interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **_interface, char *filename) {
        /* NOTE:  **interface is **_interface because the common lib redefines interface to struct in some situations */
 
        if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
index c9fca245742cdbc35110a5cd5b736a81ade949a5..5ce8d8000a795014b91785eb6d7c3794a1bbc607 100644 (file)
@@ -281,7 +281,7 @@ static switch_loadable_module_interface g711_module_interface = {
 };
 
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
        /* connect my internal structure to the blank pointer passed to me */
        *interface = &g711_module_interface;
 
index b2a598f6400f4f8d39beadb7d994fe2b22f32c05..2a64a386a0cc01400c088d70dac0038cfc6f59c7 100644 (file)
@@ -710,7 +710,7 @@ static const switch_loadable_module_interface channel_module_interface = {
 };
 
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
 
        if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
@@ -785,8 +785,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
        int netfd;
        int refresh;
        struct iax_event *iaxevent = 0;
-       struct private_object *tech_pvt = NULL;
-       
+
        load_config();
 
        if ((res = iax_init(globals.port) < 0)) {
@@ -810,6 +809,8 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
                if (!(iaxevent = iax_get_event(0))) {
                        switch_yield(100);
                } else {
+                       struct private_object *tech_pvt = iax_get_private(iaxevent->session);
+
                        if (globals.debug && iaxevent->etype != IAX_EVENT_VOICE) {
                                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Event %d [%s]!\n",
                                                                          iaxevent->etype, IAXNAMES[iaxevent->etype]);
@@ -825,7 +826,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
                    case IAX_EVENT_TIMEOUT:
                                break;
                    case IAX_EVENT_ACCEPT:
-                               if ((tech_pvt = iax_get_private(iaxevent->session))) {                                  
+                               if (tech_pvt) {                                 
                                        unsigned int cap =  iax_session_get_capability(iaxevent->session);
                                        unsigned int format = iaxevent->ies.format;
                                
@@ -845,7 +846,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
                                break;
                    case IAX_EVENT_ANSWER:
                                // the other side answered our call
-                               if ((tech_pvt = iax_get_private(iaxevent->session))) {
+                               if (tech_pvt) {
                                        switch_channel *channel;
                                        if ((channel = switch_core_session_get_channel(tech_pvt->session))) {
                                                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Answer %s\n", switch_channel_get_name(channel));
@@ -916,7 +917,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
                                break;
                    case IAX_EVENT_BUSY:
                    case IAX_EVENT_HANGUP:
-                               if ((tech_pvt = iax_get_private(iaxevent->session))) {
+                               if (tech_pvt) {
                                        switch_channel *channel;
 
                                        switch_clear_flag(tech_pvt, TFLAG_IO);
@@ -937,8 +938,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
                                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "sending silence\n");
                                break;
                    case IAX_EVENT_VOICE:
-                               if ((tech_pvt = iax_get_private(iaxevent->session)) && 
-                                       (tech_pvt->read_frame.datalen = iaxevent->datalen)) {
+                               if (tech_pvt && (tech_pvt->read_frame.datalen = iaxevent->datalen)) {
 
                                        memcpy(tech_pvt->read_frame.data, iaxevent->data, iaxevent->datalen);
 
@@ -955,7 +955,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
                                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Rejected call.\n");
                                break;
                    case IAX_EVENT_DTMF:
-                               if ((tech_pvt = iax_get_private(iaxevent->session))) {
+                               if (tech_pvt) {
                                        switch_channel *channel;
                                        if ((channel = switch_core_session_get_channel(tech_pvt->session))) {
                                                char str[2] = {iaxevent->subclass};
@@ -989,6 +989,8 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
 
        running = -1;
 
+       iax_shutdown();
+
        while (running) {
                if (x++ > 1000) {
                        break;
index 33e889db467e27dc1671a7580b3bcf0b24216e24..8aae7ecb7deed69108408f0d69d3beb68ee45ac8 100644 (file)
@@ -337,7 +337,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
 }
 */
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
 
        switch_config cfg;
        char *var, *val;
index 4f2f83d1d925c9436a7f83f4f7cfc840863f7802..b5220043e8ab5d7d9b7c1a541b6e38e4d11a7b7a 100644 (file)
@@ -160,7 +160,7 @@ static const switch_loadable_module_interface mod_playback_module_interface = {
        /*.application_interface*/      &playback_application_interface
 };
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
        
        /* connect my internal structure to the blank pointer passed to me */
        *interface = &mod_playback_module_interface;
index fa9e5cb2dfd1868bb314d289025f2a7d13f08764..13bf549eeb2382e48aee0598eb0e39936deca060 100644 (file)
@@ -171,7 +171,7 @@ static switch_loadable_module_interface raw_module_interface = {
 };
 
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
        /* connect my internal structure to the blank pointer passed to me */ 
        *interface = &raw_module_interface;
 
index 289d07215f891abd6a94d482e56205aaa425ed6f..21126d1f3e8295995e8672d470a571b1e1327554 100644 (file)
@@ -42,7 +42,7 @@ static switch_loadable_module_interface skel_module_interface = {
        /*.application_interface*/      NULL
 };
 
-switch_status switch_module_load(switch_loadable_module_interface **interface) {
+switch_status switch_module_load(switch_loadable_module_interface **interface, char *filename) {
        /* connect my internal structure to the blank pointer passed to me */
        *interface = &skel_module_interface;
 
index d63ab444a28d5d0f6aaee27e03393d29cef73928..c379436ab33cd6402d1acb17a1c178dbfa9bddcd 100644 (file)
@@ -113,7 +113,7 @@ static const switch_loadable_module_interface mod_timers_module_interface = {
        /*.switch_application_interface*/       NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
        
        /* connect my internal structure to the blank pointer passed to me */
        *interface = &mod_timers_module_interface;
index 71439ef3199d427ffae3b0d544586c0878c8ebe7..28e2ab9d50b85c6ef82bb49fb7a321098c73fad1 100644 (file)
@@ -329,7 +329,7 @@ static switch_loadable_module_interface speex_module_interface = {
        /*.application_interface*/      NULL
 };
 
-switch_status switch_module_load(switch_loadable_module_interface **interface) {
+switch_status switch_module_load(switch_loadable_module_interface **interface, char *filename) {
        /* connect my internal structure to the blank pointer passed to me */
        *interface = &speex_module_interface;
 
index a034b147d44de198396879d7b1652bb8dfec299f..3fd80800847f0554b2c8c06c9a0c7e131d99633f 100644 (file)
@@ -385,7 +385,7 @@ static const switch_loadable_module_interface wanchan_module_interface = {
        /*.application_interface*/      NULL
 };
 
-Public switch_status switch_module_load(const switch_loadable_module_interface **interface) {
+Public switch_status switch_module_load(const switch_loadable_module_interface **interface, chanr *filename) {
 
 
        if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
index c4d029b98cb1208134128d3fc1c91f3f8403af66..0985162ea2c04716270deb687ee9a88c5aff9714 100644 (file)
@@ -1304,7 +1304,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface) {
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) {
 
        switch_config cfg;
        char *var, *val;
index 1d0ea912c61d83e13734352b9e4dddadcd86536c..a8e473dea2e7e7ff58e9179c6f8c1936f004e55e 100644 (file)
@@ -43,7 +43,7 @@ struct switch_loadable_module {
        char *filename;
        const switch_loadable_module_interface *interface;
        void *lib;
-       switch_status (*switch_module_load) (switch_loadable_module_interface **);
+       switch_status (*switch_module_load) (switch_loadable_module_interface **, char *);
        switch_status (*switch_module_reload) (void);
        switch_status (*switch_module_pause) (void);
        switch_status (*switch_module_resume) (void);
@@ -87,7 +87,7 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem
        apr_dso_handle_t *dso = NULL;
        apr_status_t status;
        apr_dso_handle_sym_t function_handle = NULL;
-       switch_status (*load_func_ptr) (switch_loadable_module_interface **) = NULL;
+       switch_status (*load_func_ptr) (switch_loadable_module_interface **, char *) = NULL;
        int loading = 1;
        const char *err = NULL;
        switch_loadable_module_interface *interface = NULL;
@@ -113,7 +113,7 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem
                        break;
                }
 
-               if (load_func_ptr(&interface) != SWITCH_STATUS_SUCCESS) {
+               if (load_func_ptr(&interface, filename) != SWITCH_STATUS_SUCCESS) {
                        err = "Module load routine returned an error";
                        interface = NULL;
                        break;
@@ -243,7 +243,7 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
                                                                                        (void *) ptr);
                                }
                        }
-
+                       
                        if (new_module->interface->codec_interface) {
                                const switch_codec_implementation *impl;
                                const switch_codec_interface *ptr;