update and test for odbc support

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5850 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-12 16:49:14 +00:00
parent 4bd0e998d0
commit 96628675b5
4 changed files with 21 additions and 42 deletions

View File

@ -12,9 +12,6 @@
<param name="terminator-key" value="#"/> <param name="terminator-key" value="#"/>
<param name="play-new-messages-key" value="1"/> <param name="play-new-messages-key" value="1"/>
<param name="play-saved-messages-key" value="2"/> <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="main-menu-key" value="0"/>
<param name="config-menu-key" value="5"/> <param name="config-menu-key" value="5"/>
<param name="record-greeting-key" value="1"/> <param name="record-greeting-key" value="1"/>

View File

@ -65,9 +65,10 @@
<macro name="voicemail_menu"> <macro name="voicemail_menu">
<input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$"> <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
<match> <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> </match>
</input> </input>
</macro> </macro>
@ -105,7 +106,7 @@
<input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$"> <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
<match> <match>
<action function="speak-text" <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> </match>
</input> </input>
</macro> </macro>

View File

@ -1,2 +1,3 @@
BASE=../../../.. BASE=../../../..
include /usr/src/freeswitch.trunk/build/modmake.rules 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 ;`

View File

@ -56,9 +56,6 @@ struct vm_profile {
char terminator_key[2]; char terminator_key[2];
char play_new_messages_key[2]; char play_new_messages_key[2];
char play_saved_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 main_menu_key[2];
char config_menu_key[2]; char config_menu_key[2];
@ -377,13 +374,10 @@ static switch_status_t load_config(void)
for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) { 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 *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 *terminator_key = "#";
char *play_new_messages_key = "1"; char *play_new_messages_key = "1";
char *play_saved_messages_key = "2"; 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 *main_menu_key = "0";
char *config_menu_key = "5"; char *config_menu_key = "5";
@ -416,12 +410,6 @@ static switch_status_t load_config(void)
play_new_messages_key = val; play_new_messages_key = val;
} else if (!strcasecmp(var, "play-saved-messages-key") && !switch_strlen_zero(val)) { } else if (!strcasecmp(var, "play-saved-messages-key") && !switch_strlen_zero(val)) {
play_saved_messages_key = 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)) { } else if (!strcasecmp(var, "main-menu-key") && !switch_strlen_zero(val)) {
main_menu_key = val; main_menu_key = val;
} else if (!strcasecmp(var, "config-menu-key") && !switch_strlen_zero(val)) { } else if (!strcasecmp(var, "config-menu-key") && !switch_strlen_zero(val)) {
@ -478,13 +466,10 @@ static switch_status_t load_config(void)
} }
} else if (!strcasecmp(var, "odbc-dsn")) { } else if (!strcasecmp(var, "odbc-dsn")) {
#ifdef SWITCH_HAVE_ODBC #ifdef SWITCH_HAVE_ODBC
odbc_dsn_tmp = val; odbc_dsn = switch_core_strdup(globals.pool, val);
odbc_dsn = strdup(val);
if ((odbc_user = strchr(odbc_dsn, ':'))) { if ((odbc_user = strchr(odbc_dsn, ':'))) {
*odbc_user++ = '\0'; *odbc_user++ = '\0';
} }
if ((odbc_pass = strchr(odbc_user, ':'))) { if ((odbc_pass = strchr(odbc_user, ':'))) {
*odbc_pass++ = '\0'; *odbc_pass++ = '\0';
} }
@ -501,9 +486,9 @@ static switch_status_t load_config(void)
profile->name = switch_core_strdup(globals.pool, name); profile->name = switch_core_strdup(globals.pool, name);
if (!switch_strlen_zero(odbc_dsn) && !switch_strlen_zero(odbc_user) && !switch_strlen_zero(odbc_pass)) { 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_dsn = odbc_dsn;
profile->odbc_user = switch_core_strdup(globals.pool, odbc_user); profile->odbc_user = odbc_user;
profile->odbc_pass = switch_core_strdup(globals.pool, odbc_pass); profile->odbc_pass = odbc_pass;
} else { } else {
profile->dbname = switch_core_sprintf(globals.pool, "voicemail_%s", name); profile->dbname = switch_core_sprintf(globals.pool, "voicemail_%s", name);
} }
@ -541,9 +526,6 @@ static switch_status_t load_config(void)
*profile->terminator_key = *terminator_key; *profile->terminator_key = *terminator_key;
*profile->play_new_messages_key = *play_new_messages_key; *profile->play_new_messages_key = *play_new_messages_key;
*profile->play_saved_messages_key = *play_saved_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->main_menu_key = *main_menu_key;
*profile->config_menu_key = *config_menu_key; *profile->config_menu_key = *config_menu_key;
*profile->record_greeting_key = *record_greeting_key; *profile->record_greeting_key = *record_greeting_key;
@ -564,11 +546,6 @@ static switch_status_t load_config(void)
} }
switch_safe_free(odbc_dsn);
switch_safe_free(dbname);
} }
end: end:
@ -946,7 +923,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
args.input_callback = control_playback; args.input_callback = control_playback;
args.buf = &fh; args.buf = &fh;
TRY_CODE(switch_ivr_play_file(session, NULL, cbt->file_path, &args)); TRY_CODE(switch_ivr_play_file(session, NULL, cbt->file_path, &args));
printf("XXXX wtf[%s]\n", cbt->email);
if (switch_channel_ready(channel)) { if (switch_channel_ready(channel)) {
status = vm_macro_get(session, VM_LISTEN_FILE_CHECK_MACRO, status = vm_macro_get(session, VM_LISTEN_FILE_CHECK_MACRO,
key_buf, input, sizeof(input), 1, profile->terminator_key, &term, profile->digit_timeout); key_buf, input, sizeof(input), 1, profile->terminator_key, &term, profile->digit_timeout);
@ -1001,7 +978,7 @@ static void message_count(vm_profile_t *profile, char *myid, char *domain_name,
{ {
char msg_count[80] = ""; char msg_count[80] = "";
callback_t cbt = { 0 }; callback_t cbt = { 0 };
char sql[128]; char sql[256];
cbt.buf = msg_count; cbt.buf = msg_count;
cbt.len = sizeof(msg_count); cbt.len = sizeof(msg_count);
@ -1117,7 +1094,7 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n
case VM_CHECK_PLAY_MESSAGES: case VM_CHECK_PLAY_MESSAGES:
{ {
listen_callback_t cbt; listen_callback_t cbt;
char sql[128]; char sql[256];
int cur_message, total_messages; int cur_message, total_messages;
message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages); message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages);
memset(&cbt, 0, sizeof(cbt)); memset(&cbt, 0, sizeof(cbt));
@ -1257,10 +1234,11 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n
char key_buf[80] = ""; char key_buf[80] = "";
play_msg_type = MSG_NONE; 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_new_messages_key,
profile->play_saved_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, status = vm_macro_get(session, VM_MENU_MACRO, key_buf, input, sizeof(input), 1,
profile->terminator_key, &term, timeout); profile->terminator_key, &term, timeout);
@ -1272,6 +1250,8 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n
play_msg_type = MSG_NEW; play_msg_type = MSG_NEW;
} else if (!strcmp(input, profile->play_saved_messages_key)) { } else if (!strcmp(input, profile->play_saved_messages_key)) {
play_msg_type = MSG_SAVED; play_msg_type = MSG_SAVED;
} else if (!strcmp(input, profile->terminator_key)) {
goto end;
} else if (!strcmp(input, profile->config_menu_key)) { } else if (!strcmp(input, profile->config_menu_key)) {
vm_check_state = VM_CHECK_CONFIG; vm_check_state = VM_CHECK_CONFIG;
} }
@ -1423,7 +1403,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, char
{ {
switch_channel_t *channel; switch_channel_t *channel;
char *myfolder = "inbox"; char *myfolder = "inbox";
char sql[128]; char sql[256];
prefs_callback_t cbt; prefs_callback_t cbt;
vm_profile_t *profile; vm_profile_t *profile;
char *uuid = switch_core_session_get_uuid(session); char *uuid = switch_core_session_get_uuid(session);