[Freeswitch-svn] [commit] r5850 - in freeswitch/trunk: conf src/mod/applications/mod_voicemail
Freeswitch SVN
anthm at freeswitch.org
Fri Oct 12 12:49:15 EDT 2007
Author: anthm
Date: Fri Oct 12 12:49:14 2007
New Revision: 5850
Modified:
freeswitch/trunk/conf/voicemail.conf.xml
freeswitch/trunk/conf/voicemail_en_tts.xml
freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile
freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
Log:
update and test for odbc support
Modified: freeswitch/trunk/conf/voicemail.conf.xml
==============================================================================
--- freeswitch/trunk/conf/voicemail.conf.xml (original)
+++ freeswitch/trunk/conf/voicemail.conf.xml Fri Oct 12 12:49:14 2007
@@ -12,9 +12,6 @@
<param name="terminator-key" value="#"/>
<param name="play-new-messages-key" value="1"/>
<param name="play-saved-messages-key" value="2"/>
- <param name="save-message-key" value="8"/>
- <param name="delete-message-key" value="7"/>
- <param name="replay-message-key" value="1"/>
<param name="main-menu-key" value="0"/>
<param name="config-menu-key" value="5"/>
<param name="record-greeting-key" value="1"/>
Modified: freeswitch/trunk/conf/voicemail_en_tts.xml
==============================================================================
--- freeswitch/trunk/conf/voicemail_en_tts.xml (original)
+++ freeswitch/trunk/conf/voicemail_en_tts.xml Fri Oct 12 12:49:14 2007
@@ -65,9 +65,10 @@
<macro name="voicemail_menu">
- <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
+ <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
<match>
- <action function="speak-text" data="press $1 to listen to new messages. press $2 to listen to saved messages. press $3 for advanced options"/>
+ <action function="speak-text"
+ data="press $1 to listen to new messages. press $2 to listen to saved messages. press $3 for advanced options, press $4 to exit"/>
</match>
</input>
</macro>
@@ -105,7 +106,7 @@
<input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
<match>
<action function="speak-text"
- data="press $1 to listen to the recording again, press $2 to save the recording, press $3 to delete the recording"/>
+ data="press $1 to listen to the recording again, press $2 to save the recording, press $3 to delete the recording, press $4 to forward the recording to your email"/>
</match>
</input>
</macro>
Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile (original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile Fri Oct 12 12:49:14 2007
@@ -1,2 +1,3 @@
BASE=../../../..
include /usr/src/freeswitch.trunk/build/modmake.rules
+LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;`
Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Fri Oct 12 12:49:14 2007
@@ -56,9 +56,6 @@
char terminator_key[2];
char play_new_messages_key[2];
char play_saved_messages_key[2];
- char save_message_key[2];
- char delete_message_key[2];
- char replay_message_key[2];
char main_menu_key[2];
char config_menu_key[2];
@@ -377,13 +374,10 @@
for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) {
char *name = (char *) switch_xml_attr_soft(x_profile, "name");
- char *odbc_dsn = NULL, *odbc_dsn_tmp = NULL, *odbc_user = NULL, *odbc_pass = NULL, *dbname = NULL;
+ char *odbc_dsn = NULL, *odbc_user = NULL, *odbc_pass = NULL;
char *terminator_key = "#";
char *play_new_messages_key = "1";
char *play_saved_messages_key = "2";
- char *save_message_key = "8";
- char *delete_message_key = "7";
- char *replay_message_key = "1";
char *main_menu_key = "0";
char *config_menu_key = "5";
@@ -416,12 +410,6 @@
play_new_messages_key = val;
} else if (!strcasecmp(var, "play-saved-messages-key") && !switch_strlen_zero(val)) {
play_saved_messages_key = val;
- } else if (!strcasecmp(var, "save-message-key") && !switch_strlen_zero(val)) {
- save_message_key = val;
- } else if (!strcasecmp(var, "delete-message-key") && !switch_strlen_zero(val)) {
- delete_message_key = val;
- } else if (!strcasecmp(var, "replay-message-key") && !switch_strlen_zero(val)) {
- replay_message_key = val;
} else if (!strcasecmp(var, "main-menu-key") && !switch_strlen_zero(val)) {
main_menu_key = val;
} else if (!strcasecmp(var, "config-menu-key") && !switch_strlen_zero(val)) {
@@ -478,13 +466,10 @@
}
} else if (!strcasecmp(var, "odbc-dsn")) {
#ifdef SWITCH_HAVE_ODBC
- odbc_dsn_tmp = val;
- odbc_dsn = strdup(val);
-
+ odbc_dsn = switch_core_strdup(globals.pool, val);
if ((odbc_user = strchr(odbc_dsn, ':'))) {
*odbc_user++ = '\0';
}
-
if ((odbc_pass = strchr(odbc_user, ':'))) {
*odbc_pass++ = '\0';
}
@@ -501,9 +486,9 @@
profile->name = switch_core_strdup(globals.pool, name);
if (!switch_strlen_zero(odbc_dsn) && !switch_strlen_zero(odbc_user) && !switch_strlen_zero(odbc_pass)) {
- profile->odbc_dsn = switch_core_strdup(globals.pool, odbc_dsn_tmp);
- profile->odbc_user = switch_core_strdup(globals.pool, odbc_user);
- profile->odbc_pass = switch_core_strdup(globals.pool, odbc_pass);
+ profile->odbc_dsn = odbc_dsn;
+ profile->odbc_user = odbc_user;
+ profile->odbc_pass = odbc_pass;
} else {
profile->dbname = switch_core_sprintf(globals.pool, "voicemail_%s", name);
}
@@ -533,7 +518,7 @@
}
switch_core_db_close(db);
#ifdef SWITCH_HAVE_ODBC
- }
+ }
#endif
profile->digit_timeout = timeout;
profile->max_login_attempts = max_login_attempts;
@@ -541,9 +526,6 @@
*profile->terminator_key = *terminator_key;
*profile->play_new_messages_key = *play_new_messages_key;
*profile->play_saved_messages_key = *play_saved_messages_key;
- *profile->save_message_key = *save_message_key;
- *profile->delete_message_key = *delete_message_key;
- *profile->replay_message_key = *replay_message_key;
*profile->main_menu_key = *main_menu_key;
*profile->config_menu_key = *config_menu_key;
*profile->record_greeting_key = *record_greeting_key;
@@ -564,11 +546,6 @@
}
-
-
- switch_safe_free(odbc_dsn);
- switch_safe_free(dbname);
-
}
end:
@@ -946,7 +923,7 @@
args.input_callback = control_playback;
args.buf = &fh;
TRY_CODE(switch_ivr_play_file(session, NULL, cbt->file_path, &args));
- printf("XXXX wtf[%s]\n", cbt->email);
+
if (switch_channel_ready(channel)) {
status = vm_macro_get(session, VM_LISTEN_FILE_CHECK_MACRO,
key_buf, input, sizeof(input), 1, profile->terminator_key, &term, profile->digit_timeout);
@@ -1001,7 +978,7 @@
{
char msg_count[80] = "";
callback_t cbt = { 0 };
- char sql[128];
+ char sql[256];
cbt.buf = msg_count;
cbt.len = sizeof(msg_count);
@@ -1014,7 +991,7 @@
myfolder);
vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
*total_new_messages = atoi(msg_count);
-
+
snprintf(sql, sizeof(sql),
"select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch!=0",
myid,
@@ -1117,7 +1094,7 @@
case VM_CHECK_PLAY_MESSAGES:
{
listen_callback_t cbt;
- char sql[128];
+ char sql[256];
int cur_message, total_messages;
message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages);
memset(&cbt, 0, sizeof(cbt));
@@ -1257,10 +1234,11 @@
char key_buf[80] = "";
play_msg_type = MSG_NONE;
- snprintf(key_buf, sizeof(key_buf), "%s:%s:%s",
+ snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
profile->play_new_messages_key,
profile->play_saved_messages_key,
- profile->config_menu_key);
+ profile->config_menu_key,
+ profile->terminator_key);
status = vm_macro_get(session, VM_MENU_MACRO, key_buf, input, sizeof(input), 1,
profile->terminator_key, &term, timeout);
@@ -1272,6 +1250,8 @@
play_msg_type = MSG_NEW;
} else if (!strcmp(input, profile->play_saved_messages_key)) {
play_msg_type = MSG_SAVED;
+ } else if (!strcmp(input, profile->terminator_key)) {
+ goto end;
} else if (!strcmp(input, profile->config_menu_key)) {
vm_check_state = VM_CHECK_CONFIG;
}
@@ -1423,7 +1403,7 @@
{
switch_channel_t *channel;
char *myfolder = "inbox";
- char sql[128];
+ char sql[256];
prefs_callback_t cbt;
vm_profile_t *profile;
char *uuid = switch_core_session_get_uuid(session);
More information about the Freeswitch-svn
mailing list