From 135bac5b6d9af42c708b5ec92cb23d8e6ff3076a Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 29 Mar 2011 17:08:02 -0400 Subject: [PATCH 01/10] freetdm: change a-law and u-law for alaw and ulaw as valid strings for bearer layer 1 --- libs/freetdm/src/include/freetdm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index d2c0a7e267..6ab518a6e3 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -291,7 +291,7 @@ typedef enum { FTDM_USER_LAYER1_PROT_ALAW = 0x03, FTDM_USER_LAYER1_PROT_INVALID } ftdm_user_layer1_prot_t; -#define USER_LAYER1_PROT_STRINGS "V.110", "u-law", "a-law", "Invalid" +#define USER_LAYER1_PROT_STRINGS "V.110", "ulaw", "alaw", "Invalid" FTDM_STR2ENUM_P(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t) /*! Calling Party Category */ From dae2cb4aac64e605e3c2680b5beb0e8bf7f3b8bf Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 29 Mar 2011 18:05:05 -0500 Subject: [PATCH 02/10] Fix X-PREPROCESS exec to wait pid --- src/switch_xml.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_xml.c b/src/switch_xml.c index d6cac65c65..124dab9ab0 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -56,6 +56,7 @@ #include #ifndef WIN32 +#include #include #include #else /* we're on windoze :( */ @@ -1245,6 +1246,7 @@ static int preprocess_exec(const char *cwd, const char *command, int write_fd, i } } close(fds[0]); + waitpid(pid, NULL, 0); } else { /* child */ close(fds[0]); dup2(fds[1], STDOUT_FILENO); From 1552ecf54afdfb14d15c5cfa517449e22d049cd6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 19:53:26 -0500 Subject: [PATCH 03/10] prevent race condition on conference join/exit --- .../mod_conference/mod_conference.c | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 8103a39abc..ef3000d287 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -155,7 +155,8 @@ typedef enum { CFLAG_WAIT_MOD = (1 << 7), CFLAG_VID_FLOOR = (1 << 8), CFLAG_WASTE_BANDWIDTH = (1 << 9), - CFLAG_OUTCALL = (1 << 10) + CFLAG_OUTCALL = (1 << 10), + CFLAG_INHASH = (1 << 11) } conf_flag_t; typedef enum { @@ -667,7 +668,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe lock_member(member); switch_mutex_lock(conference->member_mutex); - switch_clear_flag(conference, CFLAG_DESTRUCT); + member->join_time = switch_epoch_time_now(NULL); member->conference = conference; member->next = conference->members; @@ -1491,29 +1492,30 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v } } - if (switch_test_flag(conference, CFLAG_DESTRUCT)) { - switch_core_timer_destroy(&timer); - switch_mutex_lock(globals.hash_mutex); + + switch_core_timer_destroy(&timer); + switch_mutex_lock(globals.hash_mutex); + if (switch_test_flag(conference, CFLAG_INHASH)) { switch_core_hash_delete(globals.conference_hash, conference->name); - switch_mutex_unlock(globals.hash_mutex); + } + switch_mutex_unlock(globals.hash_mutex); - /* Wait till everybody is out */ - switch_clear_flag_locked(conference, CFLAG_RUNNING); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock ON\n"); - switch_thread_rwlock_wrlock(conference->rwlock); - switch_thread_rwlock_unlock(conference->rwlock); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock OFF\n"); + /* Wait till everybody is out */ + switch_clear_flag_locked(conference, CFLAG_RUNNING); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock ON\n"); + switch_thread_rwlock_wrlock(conference->rwlock); + switch_thread_rwlock_unlock(conference->rwlock); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock OFF\n"); - if (conference->sh) { - switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; - switch_core_speech_close(&conference->lsh, &flags); - conference->sh = NULL; - } + if (conference->sh) { + switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; + switch_core_speech_close(&conference->lsh, &flags); + conference->sh = NULL; + } - if (conference->pool) { - switch_memory_pool_t *pool = conference->pool; - switch_core_destroy_memory_pool(&pool); - } + if (conference->pool) { + switch_memory_pool_t *pool = conference->pool; + switch_core_destroy_memory_pool(&pool); } switch_mutex_lock(globals.hash_mutex); @@ -6118,7 +6120,13 @@ static conference_obj_t *conference_find(char *name) conference_obj_t *conference; switch_mutex_lock(globals.hash_mutex); - conference = switch_core_hash_find(globals.conference_hash, name); + if ((conference = switch_core_hash_find(globals.conference_hash, name))) { + if (switch_test_flag(conference, CFLAG_DESTRUCT)) { + switch_core_hash_delete(globals.conference_hash, conference->name); + switch_clear_flag(conference, CFLAG_INHASH); + conference = NULL; + } + } switch_mutex_unlock(globals.hash_mutex); return conference; @@ -6568,7 +6576,9 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool); switch_thread_rwlock_create(&conference->rwlock, conference->pool); switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool); + switch_mutex_lock(globals.hash_mutex); + switch_set_flag(conference, CFLAG_INHASH); switch_core_hash_insert(globals.conference_hash, conference->name, conference); switch_mutex_unlock(globals.hash_mutex); From d5ef86d7788ef0080ca3be7e2ff39bda989d4b4d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 19:55:28 -0500 Subject: [PATCH 04/10] introduce new say_string method of doing say and use it in mod_say_en as an example. try: eval ${say_string en.gsm en current_date_time pronounced ${strepoch()}} from the cli with this patch. We can do more to centralize the say things and go back and apply it to other langs, using this method you can set the desired file ext as well which I think is a bounty.... --- src/include/switch_apr.h | 2 + src/include/switch_core.h | 9 + src/include/switch_ivr.h | 10 + src/include/switch_module_interfaces.h | 25 +- src/include/switch_types.h | 17 ++ .../applications/mod_commands/mod_commands.c | 54 ++++ src/mod/say/mod_say_en/mod_say_en.c | 288 +++++++++++++----- src/switch_channel.c | 17 +- src/switch_event.c | 18 +- src/switch_ivr.c | 128 ++++++++ src/switch_loadable_module.c | 91 ++++++ 11 files changed, 548 insertions(+), 111 deletions(-) diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 62559faf63..2306075e1f 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -145,6 +145,8 @@ SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len) SWITCH_DECLARE(int) switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap); +SWITCH_DECLARE(int) switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap); + SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size); diff --git a/src/include/switch_core.h b/src/include/switch_core.h index e54de72027..2946478c89 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2240,6 +2240,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c */ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force); + +SWITCH_DECLARE(char *) switch_say_file_handle_get_variable(switch_say_file_handle_t *sh, const char *var); +SWITCH_DECLARE(char *) switch_say_file_handle_get_path(switch_say_file_handle_t *sh); +SWITCH_DECLARE(char *) switch_say_file_handle_detach_path(switch_say_file_handle_t *sh); +SWITCH_DECLARE(void) switch_say_file_handle_destroy(switch_say_file_handle_t **sh); +SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_handle_t **sh, const char *ext, switch_event_t **var_event); +SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *fmt, ...); + + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 9b353f3ded..36eaaec9ca 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -859,6 +859,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *say_gender, switch_input_args_t *args); +SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *session, + const char *lang, + const char *ext, + const char *tosay, + const char *module_name, + const char *say_type, + const char *say_method, + const char *say_gender, + char **rstr); + SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name); SWITCH_DECLARE(switch_say_gender_t) switch_ivr_get_say_gender_by_name(const char *name); SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name); diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index 90d7342ef4..33c4c22bac 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -103,29 +103,9 @@ struct switch_stream_handle { }; struct switch_io_event_hooks; +struct switch_say_file_handle; - - -typedef switch_call_cause_t (*switch_io_outgoing_channel_t) - - - - - - - - - - - - - - - - - - - +typedef switch_call_cause_t (*switch_io_outgoing_channel_t) (switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t, switch_call_cause_t *); typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int); @@ -490,6 +470,7 @@ struct switch_say_interface { const char *interface_name; /*! function to pass down to the module */ switch_say_callback_t say_function; + switch_say_string_callback_t say_string_function; switch_thread_rwlock_t *rwlock; int refs; switch_mutex_t *reflock; diff --git a/src/include/switch_types.h b/src/include/switch_types.h index e732bca597..81cc3fb719 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -36,6 +36,7 @@ #define SWITCH_TYPES_H #include + SWITCH_BEGIN_EXTERN_C #define SWITCH_ENT_ORIGINATE_DELIM ":_:" #define SWITCH_BLANK_STRING "" @@ -1735,6 +1736,7 @@ typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_str typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream); + #define SWITCH_STANDARD_API(name) static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream) typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session_t *session, void *input, @@ -1772,17 +1774,32 @@ typedef struct { switch_ivr_dmachine_t *dmachine; } switch_input_args_t; + typedef struct { switch_say_type_t type; switch_say_method_t method; switch_say_gender_t gender; + const char *ext; } switch_say_args_t; + typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args); +typedef switch_status_t (*switch_say_string_callback_t) (switch_core_session_t *session, + char *tosay, + switch_say_args_t *say_args, char **rstr); + +struct switch_say_file_handle; +typedef struct switch_say_file_handle switch_say_file_handle_t; + +typedef switch_status_t (*switch_new_say_callback_t) (switch_say_file_handle_t *sh, + char *tosay, + switch_say_args_t *say_args); + + typedef struct switch_xml *switch_xml_t; typedef struct switch_core_time_duration switch_core_time_duration_t; typedef switch_xml_t(*switch_xml_search_function_t) (const char *section, diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index fd2081e31d..6fb35598c2 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -116,6 +116,59 @@ static switch_status_t select_url(const char *user, return SWITCH_STATUS_SUCCESS; } + +#define SAY_STRING_SYNTAX "[.] [.] [] " +SWITCH_STANDARD_API(say_string_function) +{ + char *argv[6] = { 0 }; + int argc; + char *lbuf = NULL, *string = NULL; + int err = 1, par = 0; + char *p, *ext = "wav"; + + if (cmd) { + lbuf = strdup(cmd); + } + + if (lbuf && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) && (argc == 5 || argc == 6)) { + + if ((p = strchr(argv[0], '.'))) { + *p++ = '\0'; + ext = p; + par++; + } + + if (!par && (p = strchr(argv[1], '.'))) { + *p++ = '\0'; + ext = p; + } + switch_ivr_say_string(session, + argv[1], + ext, + (argc == 5) ? argv[4] : argv[5], + argv[0], + argv[2], + argv[3], + (argc == 6) ? argv[4] : NULL , + &string); + if (string) { + stream->write_function(stream, "%s", string); + free(string); + err = 0; + } + } + + if (err) { + stream->write_function(stream, "-ERR Usage: %s\n", SAY_STRING_SYNTAX); + } + + free(lbuf); + + return SWITCH_STATUS_SUCCESS; + +} + + SWITCH_STANDARD_API(reg_url_function) { char *data; @@ -5105,6 +5158,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "reload", "Reload Module", reload_function, UNLOAD_SYNTAX); SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_xml_function, ""); SWITCH_ADD_API(commands_api_interface, "replace", "replace a string", replace_function, "||"); + SWITCH_ADD_API(commands_api_interface, "say_string", "", say_string_function, SAY_STRING_SYNTAX); SWITCH_ADD_API(commands_api_interface, "sched_api", "Schedule an api command", sched_api_function, SCHED_SYNTAX); SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function, SCHED_BROADCAST_SYNTAX); diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 6c604f208e..ec577374dc 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -51,7 +51,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load); SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL); -#define say_num(num, meth) { \ + +#define say_num(_sh, num, meth) { \ char tmp[80]; \ switch_status_t tstatus; \ switch_say_method_t smeth = say_args->method; \ @@ -59,7 +60,7 @@ SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL); say_args->type = SST_ITEMS; say_args->method = meth; \ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \ if ((tstatus = \ - en_say_general_count(session, tmp, say_args, args)) \ + en_say_general_count(_sh, tmp, say_args)) \ != SWITCH_STATUS_SUCCESS) { \ return tstatus; \ } \ @@ -67,57 +68,44 @@ SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL); } \ -#define say_file(...) { \ - char tmp[80]; \ - switch_status_t tstatus; \ - switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \ - if ((tstatus = \ - switch_ivr_play_file(session, NULL, tmp, args)) \ - != SWITCH_STATUS_SUCCESS){ \ - return tstatus; \ - } \ - if (!switch_channel_ready(switch_core_session_get_channel(session))) { \ - return SWITCH_STATUS_FALSE; \ - }} \ - -static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args) +static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_say_file_handle_t *sh) { if (a) { - say_file("digits/%d.wav", a); - say_file("digits/hundred.wav"); + switch_say_file(sh, "digits/%d", a); + switch_say_file(sh, "digits/hundred"); } if (b) { if (b > 1) { if ((c == 0) && (method == SSM_COUNTED)) { - say_file("digits/h-%d0.wav", b); + switch_say_file(sh, "digits/h-%d0", b); } else { - say_file("digits/%d0.wav", b); + switch_say_file(sh, "digits/%d0", b); } } else { - say_file("digits/%d%d.wav", b, c); + switch_say_file(sh, "digits/%d%d", b, c); c = 0; } } if (c) { if (method == SSM_COUNTED) { - say_file("digits/h-%d.wav", c); + switch_say_file(sh, "digits/h-%d", c); } else { - say_file("digits/%d.wav", c); + switch_say_file(sh, "digits/%d", c); } } if (what && (a || b || c)) { - say_file(what); + switch_say_file(sh, what); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t en_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t en_say_general_count(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) { int in; int x = 0; @@ -129,7 +117,7 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { char *p; for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); + switch_say_file(sh, "digits/%c", *p); } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); @@ -156,13 +144,13 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char switch (say_args->method) { case SSM_COUNTED: case SSM_PRONOUNCED: - if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million", sh)) != SWITCH_STATUS_SUCCESS) { return status; } - if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand", sh)) != SWITCH_STATUS_SUCCESS) { return status; } - if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, sh)) != SWITCH_STATUS_SUCCESS) { return status; } break; @@ -170,20 +158,21 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char break; } } else { - say_file("digits/0.wav"); + switch_say_file(sh, "digits/0"); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) { int32_t t; switch_time_t target = 0, target_now = 0; switch_time_exp_t tm, tm_now; uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0; - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *tz = switch_channel_get_variable(channel, "timezone"); + const char *tz = NULL; + + tz = switch_say_file_handle_get_variable(sh, "timezone"); if (say_args->type == SST_TIME_MEASUREMENT) { int64_t hours = 0; @@ -192,7 +181,7 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, int64_t r = 0; if (strchr(tosay, ':')) { - char *tme = switch_core_session_strdup(session, tosay); + char *tme = strdup(tosay); char *p; if ((p = strrchr(tme, ':'))) { @@ -208,6 +197,7 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, minutes = atoi(tme); } } + free(tme); } else { if ((seconds = atol(tosay)) <= 0) { seconds = (int64_t) switch_epoch_time_now(NULL); @@ -227,39 +217,39 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, } if (hours) { - say_num(hours, SSM_PRONOUNCED); + say_num(sh, hours, SSM_PRONOUNCED); if (hours == 1) { - say_file("time/hour.wav"); + switch_say_file(sh, "time/hour"); } else { - say_file("time/hours.wav"); + switch_say_file(sh, "time/hours"); } } else { - say_file("digits/0.wav"); - say_file("time/hours.wav"); + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/hours"); } if (minutes) { - say_num(minutes, SSM_PRONOUNCED); + say_num(sh, minutes, SSM_PRONOUNCED); if (minutes == 1) { - say_file("time/minute.wav"); + switch_say_file(sh, "time/minute"); } else { - say_file("time/minutes.wav"); + switch_say_file(sh, "time/minutes"); } } else { - say_file("digits/0.wav"); - say_file("time/minutes.wav"); + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/minutes"); } if (seconds) { - say_num(seconds, SSM_PRONOUNCED); + say_num(sh, seconds, SSM_PRONOUNCED); if (seconds == 1) { - say_file("time/second.wav"); + switch_say_file(sh, "time/second"); } else { - say_file("time/seconds.wav"); + switch_say_file(sh, "time/seconds"); } } else { - say_file("digits/0.wav"); - say_file("time/seconds.wav"); + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/seconds"); } return SWITCH_STATUS_SUCCESS; @@ -275,7 +265,7 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, if (tz) { int check = atoi(tz); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); if (check) { switch_time_exp_tz(&tm, target, check); switch_time_exp_tz(&tm_now, target_now, check); @@ -329,13 +319,13 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, } if (say_today) { - say_file("time/today.wav"); + switch_say_file(sh, "time/today"); } if (say_yesterday) { - say_file("time/yesterday.wav"); + switch_say_file(sh, "time/yesterday"); } if (say_dow) { - say_file("time/day-%d.wav", tm.tm_wday); + switch_say_file(sh, "time/day-%d", tm.tm_wday); } if (say_date) { @@ -344,20 +334,20 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, } if (say_month) { - say_file("time/mon-%d.wav", tm.tm_mon); + switch_say_file(sh, "time/mon-%d", tm.tm_mon); } if (say_day) { - say_num(tm.tm_mday, SSM_COUNTED); + say_num(sh, tm.tm_mday, SSM_COUNTED); } if (say_year) { - say_num(tm.tm_year + 1900, SSM_PRONOUNCED); + say_num(sh, tm.tm_year + 1900, SSM_PRONOUNCED); } if (say_time) { int32_t hour = tm.tm_hour, pm = 0; if (say_date || say_today || say_yesterday || say_dow) { - say_file("time/at.wav"); + switch_say_file(sh, "time/at"); } if (hour > 12) { @@ -370,25 +360,25 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, pm = 0; } - say_num(hour, SSM_PRONOUNCED); + say_num(sh, hour, SSM_PRONOUNCED); if (tm.tm_min > 9) { - say_num(tm.tm_min, SSM_PRONOUNCED); + say_num(sh, tm.tm_min, SSM_PRONOUNCED); } else if (tm.tm_min) { - say_file("time/oh.wav"); - say_num(tm.tm_min, SSM_PRONOUNCED); + switch_say_file(sh, "time/oh"); + say_num(sh, tm.tm_min, SSM_PRONOUNCED); } else { - say_file("time/oclock.wav"); + switch_say_file(sh, "time/oclock"); } - say_file("time/%s.wav", pm ? "p-m" : "a-m"); + switch_say_file(sh, "time/%s", pm ? "p-m" : "a-m"); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t en_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t en_say_money(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) { char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */ char *dollars = NULL; @@ -415,43 +405,108 @@ static switch_status_t en_say_money(switch_core_session_t *session, char *tosay, /* If negative say "negative" */ if (sbuf[0] == '-') { - say_file("currency/negative.wav"); + switch_say_file(sh, "currency/negative"); dollars++; } /* Say dollar amount */ - en_say_general_count(session, dollars, say_args, args); + en_say_general_count(sh, dollars, say_args); if (atoi(dollars) == 1) { - say_file("currency/dollar.wav"); + switch_say_file(sh, "currency/dollar"); } else { - say_file("currency/dollars.wav"); + switch_say_file(sh, "currency/dollars"); } /* Say "and" */ - say_file("currency/and.wav"); + switch_say_file(sh, "currency/and"); /* Say cents */ if (cents) { - en_say_general_count(session, cents, say_args, args); + en_say_general_count(sh, cents, say_args); if (atoi(cents) == 1) { - say_file("currency/cent.wav"); + switch_say_file(sh, "currency/cent"); } else { - say_file("currency/cents.wav"); + switch_say_file(sh, "currency/cents"); } } else { - say_file("digits/0.wav"); - say_file("currency/cents.wav"); + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "currency/cents"); } return SWITCH_STATUS_SUCCESS; } - -static switch_status_t en_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t say_ip(switch_say_file_handle_t *sh, + char *tosay, + switch_say_args_t *say_args) + { + char *a, *b, *c, *d; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (!(a = strdup(tosay))) { + abort(); + } - switch_say_callback_t say_cb = NULL; + if (!(b = strchr(a, '.'))) { + goto end; + } + + *b++ = '\0'; + + if (!(c = strchr(b, '.'))) { + goto end; + } + + *c++ = '\0'; + + if (!(d = strchr(c, '.'))) { + goto end; + } + + *d++ = '\0'; + + say_num(sh, atoi(a), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(b), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(c), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(d), say_args->method); + + end: + + free(a); + + return status; +} + + +static switch_status_t say_spell(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) +{ + char *p; + + for (p = tosay; p && *p; p++) { + int a = tolower((int) *p); + if (a >= '0' && a <= '9') { + switch_say_file(sh, "digits/%d", a - '0'); + } else { + if (say_args->type == SST_NAME_SPELLED) { + switch_say_file(sh, "ascii/%d", a); + } else if (say_args->type == SST_NAME_PHONETIC) { + switch_say_file(sh, "phonetic-ascii/%d", a); + } + } + } + + return SWITCH_STATUS_SUCCESS; +} + + +static switch_new_say_callback_t choose_callback(switch_say_args_t *say_args) +{ + switch_new_say_callback_t say_cb = NULL; switch (say_args->type) { case SST_NUMBER: @@ -468,11 +523,11 @@ static switch_status_t en_say(switch_core_session_t *session, char *tosay, switc say_cb = en_say_time; break; case SST_IP_ADDRESS: - return switch_ivr_say_ip(session, tosay, en_say_general_count, say_args, args); + say_cb = say_ip; break; case SST_NAME_SPELLED: case SST_NAME_PHONETIC: - return switch_ivr_say_spell(session, tosay, say_args, args); + say_cb = say_spell; break; case SST_CURRENCY: say_cb = en_say_money; @@ -482,11 +537,77 @@ static switch_status_t en_say(switch_core_session_t *session, char *tosay, switc break; } - if (say_cb) { - return say_cb(session, tosay, say_args, args); + return say_cb; +} + + +static switch_status_t run_callback(switch_new_say_callback_t say_cb, char *tosay, switch_say_args_t *say_args, switch_core_session_t *session, char **rstr) +{ + switch_say_file_handle_t *sh; + switch_status_t status = SWITCH_STATUS_FALSE; + switch_event_t *var_event = NULL; + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_get_variables(channel, &var_event); } - return SWITCH_STATUS_FALSE; + switch_say_file_handle_create(&sh, say_args->ext, &var_event); + + status = say_cb(sh, tosay, say_args); + + if ((*rstr = switch_say_file_handle_detach_path(sh))) { + status = SWITCH_STATUS_SUCCESS; + } + + switch_say_file_handle_destroy(&sh); + + return status; +} + + +static switch_status_t en_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + + switch_new_say_callback_t say_cb = NULL; + char *string = NULL; + + switch_status_t status = SWITCH_STATUS_FALSE; + + say_cb = choose_callback(say_args); + + if (say_cb) { + status = run_callback(say_cb, tosay, say_args, session, &string); + if (session && string) { + status = switch_ivr_play_file(session, NULL, string, args); + } + + switch_safe_free(string); + } + + return status; +} + + +static switch_status_t en_say_string(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, char **rstr) +{ + + switch_new_say_callback_t say_cb = NULL; + char *string = NULL; + + switch_status_t status = SWITCH_STATUS_FALSE; + + say_cb = choose_callback(say_args); + + if (say_cb) { + status = run_callback(say_cb, tosay, say_args, session, &string); + if (string) { + status = SWITCH_STATUS_SUCCESS; + *rstr = string; + } + } + + return status; } SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load) @@ -497,7 +618,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load) say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE); say_interface->interface_name = "en"; say_interface->say_function = en_say; - + say_interface->say_string_function = en_say_string; + /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_channel.c b/src/switch_channel.c index 7d246893f7..52542e12d6 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2943,7 +2943,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel char *data, *indup, *endof_indup; size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128; char *cloned_sub_val = NULL, *sub_val = NULL; - char *func_val = NULL; + char *func_val = NULL, *sb = NULL; int nv = 0; if (zstr(in)) { @@ -3033,8 +3033,19 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel } p = e > endof_indup ? endof_indup : e; - if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) { - if (*vval == '(') br = 1; + vval = NULL; + for(sb = vname; sb && *sb; sb++) { + if (*sb == ' ') { + vval = sb; + break; + } else if (*sb == '(') { + vval = sb; + br = 1; + break; + } + } + + if (vval) { e = vval - 1; *vval++ = '\0'; while (*e == ' ') { diff --git a/src/switch_event.c b/src/switch_event.c index b7687c2041..e290987248 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1563,7 +1563,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const char *cloned_sub_val = NULL; char *func_val = NULL; int nv = 0; - char *gvar = NULL; + char *gvar = NULL, *sb = NULL; if (zstr(in)) { return (char *) in; @@ -1651,10 +1651,22 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const } p = e > endof_indup ? endof_indup : e; - if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) { - if (*vval == '(') br = 1; + vval = NULL; + for(sb = vname; sb && *sb; sb++) { + if (*sb == ' ') { + vval = sb; + break; + } else if (*sb == '(') { + vval = sb; + br = 1; + break; + } + } + + if (vval) { e = vval - 1; *vval++ = '\0'; + while (*e == ' ') { *e-- = '\0'; } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 5a082763b2..b6dac4d71d 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2432,6 +2432,134 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, return status; } +SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *session, + const char *lang, + const char *ext, + const char *tosay, + const char *module_name, + const char *say_type, + const char *say_method, + const char *say_gender, + char **rstr) +{ + switch_say_interface_t *si; + switch_channel_t *channel = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + const char *save_path = NULL, *chan_lang = NULL, *lname = NULL, *sound_path = NULL; + switch_event_t *hint_data; + switch_xml_t cfg, xml = NULL, language, macros; + + if (session) { + channel = switch_core_session_get_channel(session); + + if (!lang) { + lang = switch_channel_get_variable(channel, "language"); + + if (!lang) { + chan_lang = switch_channel_get_variable(channel, "default_language"); + if (!chan_lang) { + chan_lang = "en"; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No language specified - Using [%s]\n", chan_lang); + } else { + chan_lang = lang; + } + } + } + + if (!lang) lang = "en"; + if (!chan_lang) chan_lang = lang; + + switch_event_create(&hint_data, SWITCH_EVENT_REQUEST_PARAMS); + switch_assert(hint_data); + + switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "macro_name", "say_app"); + switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "lang", chan_lang); + + if (channel) { + switch_channel_event_set_data(channel, hint_data); + } + + if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of phrases failed.\n"); + goto done; + } + + if (!(macros = switch_xml_child(cfg, "macros"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find macros tag.\n"); + goto done; + } + + if (!(language = switch_xml_child(macros, "language"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language tag.\n"); + goto done; + } + + while (language) { + if ((lname = (char *) switch_xml_attr(language, "name")) && !strcasecmp(lname, chan_lang)) { + const char *tmp; + + if ((tmp = switch_xml_attr(language, "module"))) { + module_name = tmp; + } + break; + } + language = language->next; + } + + if (!language) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language %s.\n", chan_lang); + goto done; + } + + if (!module_name) { + module_name = chan_lang; + } + + if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { + sound_path = (char *) switch_xml_attr(language, "sound_path"); + } + + if (channel) { + save_path = switch_channel_get_variable(channel, "sound_prefix"); + } + + if (sound_path && channel) { + switch_channel_set_variable(channel, "sound_prefix", sound_path); + } + + if ((si = switch_loadable_module_get_say_interface(module_name))) { + /* should go back and proto all the say mods to const.... */ + switch_say_args_t say_args = {0}; + + say_args.type = switch_ivr_get_say_type_by_name(say_type); + say_args.method = switch_ivr_get_say_method_by_name(say_method); + say_args.gender = switch_ivr_get_say_gender_by_name(say_gender); + say_args.ext = ext; + status = si->say_string_function(session, (char *) tosay, &say_args, rstr); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name); + status = SWITCH_STATUS_FALSE; + } + + done: + + if (hint_data) { + switch_event_destroy(&hint_data); + } + + if (save_path && channel) { + switch_channel_set_variable(channel, "sound_prefix", save_path); + } + + if (xml) { + switch_xml_free(xml); + } + + return status; +} + + static const char *get_prefixed_str(char *buffer, size_t buffer_size, const char *prefix, size_t prefix_size, const char *str) { size_t str_len; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index d6796c8119..ea7bc73684 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1918,6 +1918,97 @@ SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_m } } +struct switch_say_file_handle { + char *ext; + int cnt; + struct switch_stream_handle stream; + switch_event_t *param_event; +}; + +SWITCH_DECLARE(char *) switch_say_file_handle_get_variable(switch_say_file_handle_t *sh, const char *var) +{ + char *ret = NULL; + + if (sh->param_event) { + ret = switch_event_get_header(sh->param_event, var); + } + + return ret; + +} + +SWITCH_DECLARE(char *) switch_say_file_handle_get_path(switch_say_file_handle_t *sh) +{ + return (char *) sh->stream.data; +} + +SWITCH_DECLARE(char *) switch_say_file_handle_detach_path(switch_say_file_handle_t *sh) +{ + char *path; + + switch_assert(sh); + path = (char *) sh->stream.data; + sh->stream.data = NULL; + return path; +} + + +SWITCH_DECLARE(void) switch_say_file_handle_destroy(switch_say_file_handle_t **sh) +{ + switch_assert(sh); + + switch_safe_free((*sh)->stream.data); + switch_safe_free((*sh)->ext); + + if ((*sh)->param_event) { + switch_event_destroy(&(*sh)->param_event); + } + free(*sh); + *sh = NULL; +} + +SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_handle_t **sh, const char *ext, switch_event_t **var_event) +{ + switch_assert(sh); + + *sh = malloc(sizeof(**sh)); + memset(*sh, 0, sizeof(**sh)); + + SWITCH_STANDARD_STREAM((*sh)->stream); + + if (var_event) { + (*sh)->param_event = *var_event; + *var_event = NULL; + } + + (*sh)->ext = strdup(ext); + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *fmt, ...) +{ + char buf[256] = ""; + int ret; + va_list ap; + + va_start(ap, fmt); + + if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) { + if (!sh->cnt++) { + sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); + } else { + sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); + } + + } + + va_end(ap); +} + + + + /* For Emacs: * Local Variables: * mode:c From eefdb764cfe7ebaca6308be022e6f252cb970de0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 20:35:34 -0500 Subject: [PATCH 05/10] merge file_string into dptools --- build/modules.conf.in | 1 - conf/autoload_configs/modules.conf.xml | 1 - .../applications/mod_dptools/mod_dptools.c | 171 +++++++++++ src/mod/formats/mod_file_string/Makefile | 2 - .../mod_file_string.2008.vcproj | 283 ------------------ .../mod_file_string.2010.vcxproj | 131 -------- .../formats/mod_file_string/mod_file_string.c | 221 -------------- .../mod_file_string/mod_file_string.vcproj | 51 ---- 8 files changed, 171 insertions(+), 690 deletions(-) delete mode 100644 src/mod/formats/mod_file_string/Makefile delete mode 100644 src/mod/formats/mod_file_string/mod_file_string.2008.vcproj delete mode 100644 src/mod/formats/mod_file_string/mod_file_string.2010.vcxproj delete mode 100644 src/mod/formats/mod_file_string/mod_file_string.c delete mode 100644 src/mod/formats/mod_file_string/mod_file_string.vcproj diff --git a/build/modules.conf.in b/build/modules.conf.in index 1147ad4863..ee9aea41d2 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -88,7 +88,6 @@ formats/mod_sndfile #formats/mod_shout formats/mod_local_stream formats/mod_tone_stream -formats/mod_file_string #formats/mod_portaudio_stream #formats/mod_shell_stream #languages/mod_python diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index 8553a6dba1..14a5bc8084 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -93,7 +93,6 @@ - diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 1500ff1b5e..70bc193a7f 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -29,6 +29,7 @@ * Neal Horman * Bret McDanel * Luke Dashjr (OpenMethods, LLC) + * Cesar Cepeda * * mod_dptools.c -- Raw Audio File Streaming Application Module * @@ -3525,6 +3526,164 @@ SWITCH_STANDARD_APP(limit_hash_execute_function) } } + + +/* FILE STRING INTERFACE */ + +/* for apr_pstrcat */ +#define DEFAULT_PREBUFFER_SIZE 1024 * 64 + +struct file_string_source; + +struct file_string_context { + char *argv[128]; + int argc; + int index; + int samples; + switch_file_handle_t fh; +}; + +typedef struct file_string_context file_string_context_t; + + +static int next_file(switch_file_handle_t *handle) +{ + file_string_context_t *context = handle->private_info; + char *file; + const char *prefix = handle->prefix; + + top: + + context->index++; + + if (switch_test_flag((&context->fh), SWITCH_FILE_OPEN)) { + switch_core_file_close(&context->fh); + } + + if (context->index >= context->argc) { + return 0; + } + + + if (!prefix) { + if (!(prefix = switch_core_get_variable_pdup("sound_prefix", handle->memory_pool))) { + prefix = SWITCH_GLOBAL_dirs.sounds_dir; + } + } + + if (!prefix || switch_is_file_path(context->argv[context->index])) { + file = context->argv[context->index]; + } else { + file = switch_core_sprintf(handle->memory_pool, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, context->argv[context->index]); + } + + if (switch_core_file_open(&context->fh, + file, handle->channels, handle->samplerate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + goto top; + } + + handle->samples = context->fh.samples; + handle->samplerate = context->fh.samplerate; + handle->channels = context->fh.channels; + handle->format = context->fh.format; + handle->sections = context->fh.sections; + handle->seekable = context->fh.seekable; + handle->speed = context->fh.speed; + handle->interval = context->fh.interval; + + if (context->index == 0) { + context->samples = (handle->samplerate / 1000) * 250; + } + + return 1; +} + + +static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) +{ + file_string_context_t *context = handle->private_info; + + if (samples == 0 && whence == SEEK_SET) { + context->index = -1; + return SWITCH_STATUS_SUCCESS; + } + + if (!handle->seekable) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); + return SWITCH_STATUS_NOTIMPL; + } + + return switch_core_file_seek(&context->fh, cur_sample, samples, whence); +} + +static switch_status_t file_string_file_open(switch_file_handle_t *handle, const char *path) +{ + file_string_context_t *context; + char *file_dup; + + if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n"); + return SWITCH_STATUS_FALSE; + } + + context = switch_core_alloc(handle->memory_pool, sizeof(*context)); + + file_dup = switch_core_strdup(handle->memory_pool, path); + context->argc = switch_separate_string(file_dup, '!', context->argv, (sizeof(context->argv) / sizeof(context->argv[0]))); + context->index = -1; + + handle->private_info = context; + + return next_file(handle) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +} + +static switch_status_t file_string_file_close(switch_file_handle_t *handle) +{ + file_string_context_t *context = handle->private_info; + + switch_core_file_close(&context->fh); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t file_string_file_read(switch_file_handle_t *handle, void *data, size_t *len) +{ + file_string_context_t *context = handle->private_info; + switch_status_t status; + size_t llen = *len; + + if (context->samples > 0) { + if (*len > (size_t) context->samples) { + *len = context->samples; + } + + context->samples -= *len; + switch_generate_sln_silence((int16_t *) data, *len, 400); + status = SWITCH_STATUS_SUCCESS; + } else { + status = switch_core_file_read(&context->fh, data, len); + } + + if (status != SWITCH_STATUS_SUCCESS) { + if (!next_file(handle)) { + return SWITCH_STATUS_FALSE; + } + *len = llen; + status = switch_core_file_read(&context->fh, data, len); + } + + return SWITCH_STATUS_SUCCESS; +} + +/* Registration */ + +static char *file_string_supported_formats[SWITCH_MAX_CODECS] = { 0 }; + + +/* /FILE STRING INTERFACE */ + + + #define SPEAK_DESC "Speak text to a channel via the tts interface" #define DISPLACE_DESC "Displace audio from a file to the channels input" #define SESS_REC_DESC "Starts a background recording of the entire session" @@ -3546,10 +3705,22 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) switch_application_interface_t *app_interface; switch_dialplan_interface_t *dp_interface; switch_chat_interface_t *chat_interface; + switch_file_interface_t *file_interface; /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); + file_string_supported_formats[0] = "file_string"; + + file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); + file_interface->interface_name = modname; + file_interface->extens = file_string_supported_formats; + file_interface->file_open = file_string_file_open; + file_interface->file_close = file_string_file_close; + file_interface->file_read = file_string_file_read; + file_interface->file_seek = file_string_file_seek; + + error_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); error_endpoint_interface->interface_name = "error"; error_endpoint_interface->io_routines = &error_io_routines; diff --git a/src/mod/formats/mod_file_string/Makefile b/src/mod/formats/mod_file_string/Makefile deleted file mode 100644 index 2c35e6e98f..0000000000 --- a/src/mod/formats/mod_file_string/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -BASE=../../../.. -include $(BASE)/build/modmake.rules diff --git a/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj b/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj deleted file mode 100644 index 5168a7029a..0000000000 --- a/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mod/formats/mod_file_string/mod_file_string.2010.vcxproj b/src/mod/formats/mod_file_string/mod_file_string.2010.vcxproj deleted file mode 100644 index 9a543f0a12..0000000000 --- a/src/mod/formats/mod_file_string/mod_file_string.2010.vcxproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mod_file_string - {70564D74-199A-4452-9C60-19ED5F242F0D} - mod_file_string - Win32Proj - - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - - - - - false - - - - - - - X64 - - - - - - - false - - - MachineX64 - - - - - - - - - false - - - - - - - X64 - - - - - - - false - - - MachineX64 - - - - - - - - {202d7a4e-760d-4d0e-afa1-d7459ced30ff} - false - - - - - - \ No newline at end of file diff --git a/src/mod/formats/mod_file_string/mod_file_string.c b/src/mod/formats/mod_file_string/mod_file_string.c deleted file mode 100644 index 92d3800f24..0000000000 --- a/src/mod/formats/mod_file_string/mod_file_string.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * Cesar Cepeda - * - * - * mod_file_string.c -- Local Streaming Audio - * - */ -#include -/* for apr_pstrcat */ -#define DEFAULT_PREBUFFER_SIZE 1024 * 64 - -SWITCH_MODULE_LOAD_FUNCTION(mod_file_string_load); - -SWITCH_MODULE_DEFINITION(mod_file_string, mod_file_string_load, NULL, NULL); - - -struct file_string_source; - -static struct { - switch_mutex_t *mutex; - switch_hash_t *source_hash; -} globals; - -struct file_string_context { - char *argv[128]; - int argc; - int index; - int samples; - switch_file_handle_t fh; -}; - -typedef struct file_string_context file_string_context_t; - - -static int next_file(switch_file_handle_t *handle) -{ - file_string_context_t *context = handle->private_info; - char *file; - const char *prefix = handle->prefix; - - top: - - context->index++; - - if (switch_test_flag((&context->fh), SWITCH_FILE_OPEN)) { - switch_core_file_close(&context->fh); - } - - if (context->index >= context->argc) { - return 0; - } - - - if (!prefix) { - if (!(prefix = switch_core_get_variable_pdup("sound_prefix", handle->memory_pool))) { - prefix = SWITCH_GLOBAL_dirs.sounds_dir; - } - } - - if (!prefix || switch_is_file_path(context->argv[context->index])) { - file = context->argv[context->index]; - } else { - file = switch_core_sprintf(handle->memory_pool, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, context->argv[context->index]); - } - - if (switch_core_file_open(&context->fh, - file, handle->channels, handle->samplerate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { - goto top; - } - - handle->samples = context->fh.samples; - handle->samplerate = context->fh.samplerate; - handle->channels = context->fh.channels; - handle->format = context->fh.format; - handle->sections = context->fh.sections; - handle->seekable = context->fh.seekable; - handle->speed = context->fh.speed; - handle->interval = context->fh.interval; - - if (context->index == 0) { - context->samples = (handle->samplerate / 1000) * 250; - } - - return 1; -} - - -static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) -{ - file_string_context_t *context = handle->private_info; - - if (samples == 0 && whence == SEEK_SET) { - context->index = -1; - return SWITCH_STATUS_SUCCESS; - } - - if (!handle->seekable) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); - return SWITCH_STATUS_NOTIMPL; - } - - return switch_core_file_seek(&context->fh, cur_sample, samples, whence); -} - -static switch_status_t file_string_file_open(switch_file_handle_t *handle, const char *path) -{ - file_string_context_t *context; - char *file_dup; - - if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n"); - return SWITCH_STATUS_FALSE; - } - - context = switch_core_alloc(handle->memory_pool, sizeof(*context)); - - file_dup = switch_core_strdup(handle->memory_pool, path); - context->argc = switch_separate_string(file_dup, '!', context->argv, (sizeof(context->argv) / sizeof(context->argv[0]))); - context->index = -1; - - handle->private_info = context; - - return next_file(handle) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; -} - -static switch_status_t file_string_file_close(switch_file_handle_t *handle) -{ - file_string_context_t *context = handle->private_info; - - switch_core_file_close(&context->fh); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t file_string_file_read(switch_file_handle_t *handle, void *data, size_t *len) -{ - file_string_context_t *context = handle->private_info; - switch_status_t status; - size_t llen = *len; - - if (context->samples > 0) { - if (*len > (size_t) context->samples) { - *len = context->samples; - } - - context->samples -= *len; - switch_generate_sln_silence((int16_t *) data, *len, 400); - status = SWITCH_STATUS_SUCCESS; - } else { - status = switch_core_file_read(&context->fh, data, len); - } - - if (status != SWITCH_STATUS_SUCCESS) { - if (!next_file(handle)) { - return SWITCH_STATUS_FALSE; - } - *len = llen; - status = switch_core_file_read(&context->fh, data, len); - } - - return SWITCH_STATUS_SUCCESS; -} - -/* Registration */ - -static char *supported_formats[SWITCH_MAX_CODECS] = { 0 }; - -SWITCH_MODULE_LOAD_FUNCTION(mod_file_string_load) -{ - switch_file_interface_t *file_interface; - supported_formats[0] = "file_string"; - - *module_interface = switch_loadable_module_create_module_interface(pool, modname); - file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); - file_interface->interface_name = modname; - file_interface->extens = supported_formats; - file_interface->file_open = file_string_file_open; - file_interface->file_close = file_string_file_close; - file_interface->file_read = file_string_file_read; - file_interface->file_seek = file_string_file_seek; - - memset(&globals, 0, sizeof(globals)); - /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: - */ diff --git a/src/mod/formats/mod_file_string/mod_file_string.vcproj b/src/mod/formats/mod_file_string/mod_file_string.vcproj deleted file mode 100644 index 639300296c..0000000000 --- a/src/mod/formats/mod_file_string/mod_file_string.vcproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - From 8806ba8c2fa2e54b54eafb2a9e7c899dfe8b5926 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 20:39:21 -0500 Subject: [PATCH 06/10] missed a spot --- src/switch_loadable_module.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index ea7bc73684..9804e53238 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1971,6 +1971,10 @@ SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_ha { switch_assert(sh); + if (zstr(ext)) { + ext = "wav"; + } + *sh = malloc(sizeof(**sh)); memset(*sh, 0, sizeof(**sh)); From 7dcbe7bda688e0523ab889fd09f2736beb6e3858 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 21:05:04 -0500 Subject: [PATCH 07/10] FS-3189 ok, patch added, but have you discovered why you trigger this because its not typical and is the sign of a problem I would assume? --- conf/sip_profiles/internal.xml | 6 ++++-- src/mod/endpoints/mod_sofia/sofia.c | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index b78ea20070..b803bcea6d 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -47,8 +47,8 @@ Sometimes, in extremely rare edge cases, the Sofia SIP stack may stop responding. These options allow you to enable and control a watchdog on the Sofia SIP stack so that if it stops responding for the - specified number of milliseconds, it will cause FreeSWITCH to shut - down immediately. This is useful if you run in an HA environment and + specified number of milliseconds, it will cause FreeSWITCH to crash + immediately. This is useful if you run in an HA environment and need to ensure automated recovery from such a condition. Note that if your server is idle a lot, the watchdog may fire due to not receiving any SIP messages. Thus, if you expect your system to be idle, you @@ -57,6 +57,8 @@ globally for all profiles. So, if you run in an HA environment with a master and slave, you should use the CLI to make sure the watchdog is only enabled on the master. + If such crash occurs, FreeSWITCH will dump core if allowed. The + stacktrace will include function watchdog_triggered_abort(). --> diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index ca9b0cd974..5a3ad76680 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1275,6 +1275,11 @@ static void sofia_perform_profile_start_failure(sofia_profile_t *profile, char * } } +/* not a static function so that it's still visible on stacktraces */ +void watchdog_triggered_abort(void) { + abort(); +} + #define sofia_profile_start_failure(p, xp) sofia_perform_profile_start_failure(p, xp, __FILE__, __LINE__) @@ -1390,10 +1395,10 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } if (event_fail || step_fail) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED BY WATCHDOG!\n" "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); switch_yield(2000000); - abort(); + watchdog_triggered_abort(); } } From 3d47df436c7ef08f4a203eed5c5db6dfde2a62e1 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 29 Mar 2011 19:35:20 -0700 Subject: [PATCH 08/10] Update ChangeLog through Mar 9 (more coming) --- docs/ChangeLog | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index 63cdce2379..55bec755fc 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -205,16 +205,27 @@ freeswitch (1.0.7) core: use strdup instead of core_session_strdup in hangup hook (r:3a10d6a1) core: fix jb + no timer situations (r:61d3c56f) core: Add events PLAYBACK_START and PLAYBACK_STOP, plus some minor improvments for RECORD_STOP (r:bc397ab6/FS-2971) + core: Fix event queue from needlessly filling up (r:2044a749/FS-3105) + core: Fix issue that was preventing the sqlite handles from being recycled properly (r:11451c10/FS-3106) + core: clear timestamp when generating a fake empty frame to fix edge-case sending the same timestamp over and over (r:08496cd7) + core: wait for state change to avoid race (r:f33e9c6e/FS-2966) + core: Fix freeswitch.session in Lua, etc. (r:0ba25358/FS-3119) + core: try to reduce contention by not creating handles with the global mutex locked (r:b3a2fa1c) + core: add limits to simo open sql handles (r:61cdf0da) + core: Fix db locks affecting mod_callcenter (r:8da371c7/FS-3127) + core: improve flow of dtmf through a bridge when timer is disabled (r:59da356d) embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612) embedded languages: add insertFile front end to switch_ivr_insert_file and reswig (r:c4e350ab) fs_cli: block control-z from fs cli and print a warning how to exit properly (r:dc436b82) fs_cli: skip blocking writes on fs_cli to avoid backing up event socket (r:2ec2a9b0) fs_cli: let ctl-c work until you are connected (r:986f258d) + fs_cli: add -i --interrupt to fs_cli to allow control-c to exit the program (r:e7b3c3b1) lang: Improve French phrase files (FSCONFIG-23) lang: Update langs - Add pt_PT, update es to have es_ES and es_MX, update mod_say_es and add mod_say_pt (FS-2937) (r:c81a9448/FS-2937) libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171) + libdingaling: fix crash when GV call ends (r:687140b5/FS-3139) libesl: Fix potential race condition (ESL-36) libesl: Add /uuid command to fs_cli to filter logs by uuid libesl: Increase buffer in fs_cli for Win (r:d1d6be88/FSCORE-611) @@ -238,6 +249,7 @@ freeswitch (1.0.7) libesl: null terminate buffer after reading from the socket to prevent cross-over to old data that confuses the parser and throws off framing (r:e8a10558/ESL-56) libesl: add optional job-uuid param to bgapi in oop mod (r:e96acac3) libesl: fix linger support in esl client lib (r:0444626b) + libesl: fix segfault (r:30813ca5/FS-3130) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) @@ -252,6 +264,7 @@ freeswitch (1.0.7) libsofiasip: Fix T.38 bug in sofia_glue (r:2843f1ad/MODSOFIA-94) libsofiasip: VS2010 sofia posix problem (r:46dd24c2/SFSIP-220) libsofiasip: set minimum initital sip t1 timer to 1000ms to work around race condition on retry timer firing before all the things that are supposed to be handled by the timer are set. The base resolution on this timer is 500ms, so doubling up makes sure we always hit the initial retry timer on the next run, where everything should be set. The side effect was, 1/2 the time on a request that did not get immediate response, the timer would be fired and cleared, but the action (sending retry) was never done, and a new timer was not set, causing the request to just sit zombied and never retry. A better solution would be to find and correct the race condition so the timer is never set to early and we never hit this condition. (r:20c2740c) + libsofiasip: fix bad assert (r:56404641/FS-3133) libspandsp: Fixed a typo in spandsp's msvc/inttypes.h Updated sig_tone processing in spandsp to the latest, to allow moy to proceed with his signaling work. libspandsp: removed a saturate16 from spandsp that was causing problems fixed a typo in the MSVC inttypes.h file for spandsp libspandsp: Changes to the signaling tone detector to detect concurrent 2400Hz + 2600Hz tones. This passes voice immunity and other key tests, but it bounces a bit when transitions like 2400 -> 2400+2600 -> 2600 occur. Transitions between tone off and tone on are clean. (r:bc13e944) @@ -335,6 +348,9 @@ freeswitch (1.0.7) mod_conference: don't switch to CS_SOFT_EXECUTE before setting the current extension (r:4b5bcba0) mod_conference: play files saying vol level in conf in lieu of making a function of say modules to return file_string urls (we need that) (r:94b680fb) mod_conference: fire auto gain level events (r:d8ef36ed) + mod_conference: clear talk flag when you mute (r:b7419add) + mod_conference: fix pthread mutex lock error and add some tab completion and help messages from cli (r:547d5393/FS-3095) + mod_conference: Use the channel's sound_prefix if it's not set in the conference's config (r:0911ed74/FS-3124) mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) mod_db: fix stack corruption (MODAPP-407) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) @@ -531,6 +547,8 @@ freeswitch (1.0.7) mod_sndfile: Add support for .alaw and .ulaw to mod_sndfile (r:facf09b8/MODFORM-41) mod_sndfile: return break in mod_sndfile when seek returns failure (r:564dc7e4) mod_snmp: initial checkin of mod_snmp (r:6e2b1bd3) + mod_snmp: fix segfault when getting channel list (r:b6b4e6b5/FS-3114) + mod_snmp: fix segv when snmpwalking ringing channels, fix segv in snmp getBulkRequest (r:9c4c1e81/FS-3120) mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain mod_sofia: fix callee being updated with callee information mod_sofia: set appearance-index in update statement for SLA @@ -665,6 +683,12 @@ freeswitch (1.0.7) mod_sofia: segfault with sofia_contact when invalid parameters are given (r:4e60f14a/FS-3072) mod_sofia: Fix minupnpd nat_map updated IP not getting set in SIP profiles (r:e7acd4d1/FS-3054) mod_sofia: add sip_execute_on_image variable similar to execute_on_answer etc so you can run t38_gateway or rxfax etc when you get a T.38 re-invite but no CNG tone or you want to ignore the tone and only react when getting a T.38 re-invite (r:53fc3f7f) + mod_sofia: add sip_jitter_buffer_during_bridge which you can set to true to keep a jitter buffer on both ends of the call when you are NormT (r:01073a79) + mod_sofia: fix race condition in sofia recover for atom processors (r:3eeb4995/FS-3117) + mod_sofia: improve codec ordering in ep_codec_string (r:8fe24a29/FS-3121) + mod_sofia: Send BYE to endpoints that lose race even if they answered (r:8c3651fa/FS-640) + mod_sofia: do not renegotiate codecs on hold re-invites (r:bfd0ba97) + mod_sofia: add rtp-notimer-during-bridge (alternative to rtp-autoflush-during-bridge (r:2a35dfb5) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -689,6 +713,7 @@ freeswitch (1.0.7) mod_valet_parking: add event data to valet parking hold event mod_valet_parking: add event for Valet Parking action exit mod_valet_parking: pass hold class on transfer (r:76a065ec) + mod_valet_parking: add valet_announce_slot variable (r:293d7254) mod_voicemail: Fix vm_prefs profile lock (MODAPP-417) mod_voicemail: add 'vm-enabled' param (default true) mod_voicemail: fix vm msg being deleted when pressing key to forward to email (MODAPP-403) From d41902d1dc2b8ff886818bfbbc4c6a287343f822 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 29 Mar 2011 22:22:56 -0600 Subject: [PATCH 09/10] VS2010 Express build fixes and remove mod_file_string --- Freeswitch.2010.express.sln | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln index a4044348bd..b0df7d9c35 100644 --- a/Freeswitch.2010.express.sln +++ b/Freeswitch.2010.express.sln @@ -54,6 +54,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsqlite", "libs\win32\sqlite\sqlite.2010.vcxproj", "{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre", "libs\win32\pcre\libpcre.2010.vcxproj", "{8D04B550-D240-4A44-8A18-35DA3F7038D9}" + ProjectSection(ProjectDependencies) = postProject + {1CED5987-A529-46DC-B30F-870D85FF9C94} = {1CED5987-A529-46DC-B30F-870D85FF9C94} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libapr", "libs\win32\apr\libapr.2010.vcxproj", "{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}" EndProject @@ -249,8 +252,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16khz music", "libs\win32\S EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz music", "libs\win32\Sound_Files\32khzmusic.2010.vcxproj", "{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_file_string", "src\mod\formats\mod_file_string\mod_file_string.2010.vcxproj", "{70564D74-199A-4452-9C60-19ED5F242F0D}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_nibblebill", "src\mod\applications\mod_nibblebill\mod_nibblebill.2010.vcxproj", "{3C977801-FE88-48F2-83D3-FA2EBFF6688E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_ru", "src\mod\say\mod_say_ru\mod_say_ru.2010.vcxproj", "{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}" @@ -317,6 +318,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\ap EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldns", "libs\win32\ldns\ldns-lib\ldns-lib.2010.vcxproj", "{23B4D303-79FC-49E0-89E2-2280E7E28940}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre Generate pcre_chartables.c", "libs\win32\pcre\pcre_chartables.c.2010.vcxproj", "{1CED5987-A529-46DC-B30F-870D85FF9C94}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1634,17 +1637,6 @@ Global {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64 @@ -1988,6 +1980,15 @@ Global {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.ActiveCfg = Release|Win32 {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.Build.0 = Release|Win32 {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.ActiveCfg = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.ActiveCfg = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.Build.0 = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.ActiveCfg = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.ActiveCfg = Debug|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From de96c09d96b2008f9dd6cacc042f2f61c733fef6 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 29 Mar 2011 23:37:55 -0500 Subject: [PATCH 10/10] VS2008 VS2010 remove mod_file_string from solutions --- Freeswitch.2008.sln | 17 ----------------- Freeswitch.2010.sln | 21 --------------------- w32/Setup/Setup.wixproj | 9 --------- 3 files changed, 47 deletions(-) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 4cfd581dad..f915005e7c 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -981,11 +981,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz music", "libs\win32\S {1F0A8A77-E661-418F-BB92-82172AE43803} = {1F0A8A77-E661-418F-BB92-82172AE43803} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_file_string", "src\mod\formats\mod_file_string\mod_file_string.2008.vcproj", "{70564D74-199A-4452-9C60-19ED5F242F0D}" - ProjectSection(ProjectDependencies) = postProject - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_nibblebill", "src\mod\applications\mod_nibblebill\mod_nibblebill.2008.vcproj", "{3C977801-FE88-48F2-83D3-FA2EBFF6688E}" ProjectSection(ProjectDependencies) = postProject {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} @@ -2490,17 +2485,6 @@ Global {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64 @@ -2913,7 +2897,6 @@ Global {2CA40887-1622-46A1-A7F9-17FD7E7E545B} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D} - {70564D74-199A-4452-9C60-19ED5F242F0D} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {1A1FF289-4FD6-4285-A422-D31DD67A4723} = {CBD81696-EFB4-4D2F-8451-1B8DAA86155A} {EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000} diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 5f36859568..63b3ad12f2 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -631,8 +631,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16khz music", "libs\win32\S EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz music", "libs\win32\Sound_Files\32khzmusic.2010.vcxproj", "{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_file_string", "src\mod\formats\mod_file_string\mod_file_string.2010.vcxproj", "{70564D74-199A-4452-9C60-19ED5F242F0D}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_nibblebill", "src\mod\applications\mod_nibblebill\mod_nibblebill.2010.vcxproj", "{3C977801-FE88-48F2-83D3-FA2EBFF6688E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_ru", "src\mod\say\mod_say_ru\mod_say_ru.2010.vcxproj", "{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}" @@ -2971,24 +2969,6 @@ Global {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64 Setup.ActiveCfg = Release|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x86 Setup.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64 Setup.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64 Setup.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x86 Setup.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64 Setup.ActiveCfg = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x86 Setup.ActiveCfg = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64 Setup.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x86 Setup.ActiveCfg = Release|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64 @@ -3711,7 +3691,6 @@ Global {2CA40887-1622-46A1-A7F9-17FD7E7E545B} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D} - {70564D74-199A-4452-9C60-19ED5F242F0D} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {CBD81696-EFB4-4D2F-8451-1B8DAA86155A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {62F27B1A-C919-4A70-8478-51F178F3B18F} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {89385C74-5860-4174-9CAF-A39E7C48909C} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index f97000b585..d9d34b1952 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -525,15 +525,6 @@ Binaries;Content;Satellites MODLOCATION - - mod_file_string - {70564d74-199a-4452-9c60-19ed5f242f0d} - True - - - Binaries;Content;Satellites - MODLOCATION - mod_local_stream {2ca40887-1622-46a1-a7f9-17fd7e7e545b}