mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-02 19:40:08 +00:00
mod_voicemail_ivr: Initial support for settings parameters
This commit is contained in:
parent
08e6e8bc38
commit
f993cac1a9
@ -36,7 +36,7 @@
|
|||||||
const char *global_cf = "voicemail_ivr.conf";
|
const char *global_cf = "voicemail_ivr.conf";
|
||||||
|
|
||||||
void populate_profile_menu_event(vmivr_profile_t *profile, vmivr_menu_profile_t *menu) {
|
void populate_profile_menu_event(vmivr_profile_t *profile, vmivr_menu_profile_t *menu) {
|
||||||
switch_xml_t cfg, xml, x_profiles, x_profile, x_keys, x_phrases, x_menus, x_menu;
|
switch_xml_t cfg, xml, x_profiles, x_profile, x_keys, x_phrases, x_menus, x_menu, x_settings;
|
||||||
|
|
||||||
free_profile_menu_event(menu);
|
free_profile_menu_event(menu);
|
||||||
|
|
||||||
@ -48,6 +48,12 @@ void populate_profile_menu_event(vmivr_profile_t *profile, vmivr_menu_profile_t
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (profile->event_settings) {
|
||||||
|
switch_event_create(&menu->event_settings, SWITCH_EVENT_REQUEST_PARAMS);
|
||||||
|
switch_event_merge(menu->event_settings, profile->event_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile->name))) {
|
if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile->name))) {
|
||||||
if ((x_menus = switch_xml_child(x_profile, "menus"))) {
|
if ((x_menus = switch_xml_child(x_profile, "menus"))) {
|
||||||
if ((x_menu = switch_xml_find_child(x_menus, "menu", "name", menu->name))) {
|
if ((x_menu = switch_xml_find_child(x_menus, "menu", "name", menu->name))) {
|
||||||
@ -59,6 +65,10 @@ void populate_profile_menu_event(vmivr_profile_t *profile, vmivr_menu_profile_t
|
|||||||
if ((x_phrases = switch_xml_child(x_menu, "phrases"))) {
|
if ((x_phrases = switch_xml_child(x_menu, "phrases"))) {
|
||||||
switch_event_import_xml(switch_xml_child(x_phrases, "phrase"), "name", "value", &menu->event_phrases);
|
switch_event_import_xml(switch_xml_child(x_phrases, "phrase"), "name", "value", &menu->event_phrases);
|
||||||
}
|
}
|
||||||
|
if ((x_settings = switch_xml_child(x_profile, "settings"))) {
|
||||||
|
switch_event_import_xml(switch_xml_child(x_settings, "param"), "name", "value", &menu->event_settings);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,12 +93,16 @@ void free_profile_menu_event(vmivr_menu_profile_t *menu) {
|
|||||||
if (menu->event_phrases) {
|
if (menu->event_phrases) {
|
||||||
switch_event_destroy(&menu->event_phrases);
|
switch_event_destroy(&menu->event_phrases);
|
||||||
}
|
}
|
||||||
|
if (menu->event_settings) {
|
||||||
|
switch_event_destroy(&menu->event_settings);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile_name)
|
vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile_name)
|
||||||
{
|
{
|
||||||
vmivr_profile_t *profile = NULL;
|
vmivr_profile_t *profile = NULL;
|
||||||
switch_xml_t cfg, xml, x_profiles, x_profile, x_apis, param;
|
switch_xml_t cfg, xml, x_profiles, x_profile, x_apis, x_settings, param;
|
||||||
|
|
||||||
if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) {
|
if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf);
|
||||||
@ -118,6 +132,10 @@ vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile
|
|||||||
profile->menu_check_main = "std_main_menu";
|
profile->menu_check_main = "std_main_menu";
|
||||||
profile->menu_check_terminate = "std_purge";
|
profile->menu_check_terminate = "std_purge";
|
||||||
|
|
||||||
|
if ((x_settings = switch_xml_child(x_profile, "settings"))) {
|
||||||
|
switch_event_import_xml(switch_xml_child(x_settings, "param"), "name", "value", &profile->event_settings);
|
||||||
|
}
|
||||||
|
|
||||||
if ((x_apis = switch_xml_child(x_profile, "apis"))) {
|
if ((x_apis = switch_xml_child(x_profile, "apis"))) {
|
||||||
int total_options = 0;
|
int total_options = 0;
|
||||||
int total_invalid_options = 0;
|
int total_invalid_options = 0;
|
||||||
|
@ -71,6 +71,7 @@ struct vmivr_profile {
|
|||||||
const char *api_pref_recname_set;
|
const char *api_pref_recname_set;
|
||||||
const char *api_pref_password_set;
|
const char *api_pref_password_set;
|
||||||
|
|
||||||
|
switch_event_t *event_settings;
|
||||||
};
|
};
|
||||||
typedef struct vmivr_profile vmivr_profile_t;
|
typedef struct vmivr_profile vmivr_profile_t;
|
||||||
|
|
||||||
@ -80,6 +81,7 @@ struct vmivr_menu_profile {
|
|||||||
switch_event_t *event_keys_action;
|
switch_event_t *event_keys_action;
|
||||||
switch_event_t *event_keys_dtmf;
|
switch_event_t *event_keys_dtmf;
|
||||||
switch_event_t *event_keys_varname;
|
switch_event_t *event_keys_varname;
|
||||||
|
switch_event_t *event_settings;
|
||||||
switch_event_t *event_phrases;
|
switch_event_t *event_phrases;
|
||||||
};
|
};
|
||||||
typedef struct vmivr_menu_profile vmivr_menu_profile_t;
|
typedef struct vmivr_menu_profile vmivr_menu_profile_t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user