let modules see the filename they were called as
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@94 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
e6cdee481c
commit
e85eefe7f2
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue