git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4834 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-04-02 21:31:03 +00:00
parent db22cc416f
commit 1eafc86063
1 changed files with 23 additions and 1 deletions

View File

@ -2651,7 +2651,7 @@ static void js_parse_and_execute(switch_core_session_t *session, char *input_cod
if ((arg = strchr(script, ' '))) {
*arg++ = '\0';
argc = switch_separate_string(arg, ':', argv, (sizeof(argv) / sizeof(argv[0])));
argc = switch_separate_string(arg, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (argc) { /* create a js doppleganger of this argc/argv */
@ -2757,6 +2757,22 @@ static switch_loadable_module_interface_t spidermonkey_module_interface = {
/*.directory_interface */ NULL
};
static void message_query_handler(switch_event_t *event)
{
char *account = switch_event_get_header(event, "message-account");
if (account) {
char *text;
text = switch_mprintf("mwi.js %s", account);
assert(text != NULL);
js_thread_launch(text);
free(text);
}
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
switch_status_t status;
@ -2765,6 +2781,12 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
return status;
}
if (switch_event_bind((char *) modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL)
!= SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
return SWITCH_STATUS_GENERR;
}
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &spidermonkey_module_interface;