From 4c474737825bcf2639dc790d390e5027a514c112 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 26 Dec 2007 17:26:46 +0000 Subject: [PATCH] add configurable file metadata (MODAPP-60) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6983 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- conf/autoload_configs/voicemail.conf.xml | 3 +++ .../mod_voicemail/mod_voicemail.c | 26 ++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/conf/autoload_configs/voicemail.conf.xml b/conf/autoload_configs/voicemail.conf.xml index ae45738c70..95e382fad3 100644 --- a/conf/autoload_configs/voicemail.conf.xml +++ b/conf/autoload_configs/voicemail.conf.xml @@ -47,6 +47,9 @@ + + + diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 3eb0ea8e1a..5a1b0adc26 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -80,6 +80,9 @@ struct vm_profile { char urgent_key[2]; char operator_key[2]; char file_ext[10]; + char *record_title; + char *record_comment; + char *record_copyright; char *operator_ext; char *tone_spec; char *storage_dir; @@ -281,6 +284,10 @@ static switch_status_t load_config(void) uint32_t record_silence_hits = 2; uint32_t record_sample_rate = 0; + char *record_title = "FreeSWITCH Voicemail"; + char *record_comment = "FreeSWITCH Voicemail"; + char *record_copyright = "http://www.freeswitch.org"; + switch_core_db_t *db; uint32_t timeout = 10000, max_login_attempts = 3, max_record_len = 300; @@ -431,7 +438,13 @@ static switch_status_t load_config(void) callback_context = val; } else if (!strcasecmp(var, "file-extension")) { file_ext = val; - } else if (!strcasecmp(var, "record-silence-threshold")) { + } else if (!strcasecmp(var, "record-title") && !switch_strlen_zero(val)) { + record_title = val; + } else if (!strcasecmp(var, "record-comment") && !switch_strlen_zero(val)) { + record_comment = val; + } else if (!strcasecmp(var, "record-copyright") && !switch_strlen_zero(val)) { + record_copyright = val; + } else if (!strcasecmp(var, "record-silence-threshold")) { int tmp = 0; if (!switch_strlen_zero(val)) { tmp = atoi(val); @@ -596,6 +609,11 @@ static switch_status_t load_config(void) profile->tone_spec = switch_core_strdup(globals.pool, tone_spec); profile->callback_dialplan = switch_core_strdup(globals.pool, callback_dialplan); profile->callback_context = switch_core_strdup(globals.pool, callback_context); + + profile->record_title = switch_core_strdup(globals.pool, record_title); + profile->record_comment = switch_core_strdup(globals.pool, record_comment); + profile->record_copyright = switch_core_strdup(globals.pool, record_copyright); + switch_copy_string(profile->file_ext, file_ext, sizeof(profile->file_ext)); switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, globals.pool); @@ -1821,9 +1839,9 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); switch_channel_set_variable(channel, "RECORD_DATE", date); switch_channel_set_variable(channel, "RECORD_SOFTWARE", "FreeSWITCH"); - switch_channel_set_variable(channel, "RECORD_TITLE", "FreeSWITCH Voicemail"); - switch_channel_set_variable(channel, "RECORD_COMMENT", "FreeSWITCH Voicemail"); - switch_channel_set_variable(channel, "RECORD_COPYRIGHT", "http://www.freeswitch.org"); + switch_channel_set_variable(channel, "RECORD_TITLE", profile->record_title); + switch_channel_set_variable(channel, "RECORD_COMMENT", profile->record_comment); + switch_channel_set_variable(channel, "RECORD_COPYRIGHT", profile->record_copyright); status = create_file(session, profile, VM_RECORD_MESSAGE_MACRO, file_path, &message_len);