static switch_status_t switch_loadable_module_process(char *key, switch_loadable_module_t *new_module)
{
switch_event_t *event;
+ int added = 0;
new_module->key = switch_core_strdup(new_module->pool, key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
}
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
}
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.dialplan_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.timer_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.application_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.chat_application_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.api_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.file_hash, ptr->extens[i], (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.speech_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.asr_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.directory_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.chat_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
switch_core_hash_insert(loadable_modules.say_hash, ptr->interface_name, (const void *) ptr);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
switch_event_fire(&event);
+ added++;
}
}
}
}
+ if (!added) {
+ if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "generic");
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", new_module->key);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
+ switch_event_fire(&event);
+ added++;
+ }
+ }
+
switch_mutex_unlock(loadable_modules.mutex);
return SWITCH_STATUS_SUCCESS;
static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t *old_module)
{
switch_event_t *event;
+ int removed = 0;
switch_mutex_lock(loadable_modules.mutex);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "endpoint");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.endpoint_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "codec");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
}
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "dialplan");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.dialplan_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "timer");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.timer_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->short_desc));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax));
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.application_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->short_desc));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax));
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.chat_application_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->desc));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax));
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.api_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "file");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->extens[i]);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.file_hash, ptr->extens[i]);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "speech");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.speech_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "asr");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.asr_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "directory");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.directory_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "chat");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.chat_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "say");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
switch_core_hash_delete(loadable_modules.say_hash, ptr->interface_name);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "management");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->relative_oid);
switch_event_fire(&event);
+ removed++;
}
}
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "limit");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
switch_event_fire(&event);
+ removed++;
}
}
}
}
+ if (!removed) {
+ if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "generic");
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", old_module->key);
+ switch_event_fire(&event);
+ removed++;
+ }
+ }
switch_mutex_unlock(loadable_modules.mutex);
return SWITCH_STATUS_SUCCESS;