diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index 14a5bc8084..96079cd227 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -113,7 +113,7 @@ - + diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 56a8094d22..34901054e9 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -268,7 +268,9 @@ - + + + @@ -425,16 +427,17 @@ - - - - - + + + + + + diff --git a/docs/phrase/phrase_ru.xml b/docs/phrase/phrase_ru.xml index fdbccddfa4..fb873dd9da 100644 --- a/docs/phrase/phrase_ru.xml +++ b/docs/phrase/phrase_ru.xml @@ -316,6 +316,7 @@ + @@ -326,9 +327,9 @@ - + - + diff --git a/libs/esl/perl/ESL/IVR.pm b/libs/esl/perl/ESL/IVR.pm index f7919c1b94..5dc6088236 100644 --- a/libs/esl/perl/ESL/IVR.pm +++ b/libs/esl/perl/ESL/IVR.pm @@ -73,13 +73,13 @@ sub setVar($;) { sub playAndGetDigits($;) { my $self = shift; - my ($min, $max, $tries, $to, $term, $file, $invalid_file, $var, $regex) = @_; + my ($min, $max, $tries, $to, $term, $file, $invalid_file, $var, $regex, $digit_timeout) = @_; if (!$self->{_esl}->connected()) { return undef; } - $self->execute("play_and_get_digits", "$min $max $tries $to $term $file $invalid_file $var $regex"); + $self->execute("play_and_get_digits", "$min $max $tries $to $term $file $invalid_file $var $regex $digit_timeout"); return $self->getVar($var); diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index a7b84ea5d8..4abddf16e1 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -979,7 +979,6 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic { Q931ie_CallingNum *callingnum = Q931GetIEPtr(gen->CallingNum, gen->buf); Q931ie_CalledNum *callednum = Q931GetIEPtr(gen->CalledNum, gen->buf); - uint32_t cplen = mlen; int overlap_dial = 0; int fail_cause = 0; int fail = 1; @@ -2128,7 +2127,7 @@ static int ftdm_isdn_q921_log(void *pvt, Q921LogLevel_t level, char *msg, L2INT return 0; } -static L3INT ftdm_isdn_q931_log(void *pvt, Q931LogLevel_t level, char *msg, L3INT size) +static L3INT ftdm_isdn_q931_log(void *pvt, Q931LogLevel_t level, const char *msg, L3INT size) { ftdm_span_t *span = (ftdm_span_t *) pvt; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 684cc4f777..5a2b8992b2 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2205,6 +2205,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_db_handle_t *dbh, const char *sql, uint32_t retries); SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t *dbh, char *sql, uint32_t retries); +SWITCH_DECLARE(void) switch_core_set_signal_handlers(void); SWITCH_DECLARE(uint32_t) switch_core_debug_level(void); SWITCH_DECLARE(void) switch_cache_db_flush_handles(void); SWITCH_DECLARE(const char *) switch_core_banner(void); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 2ab4a18b85..988d2da641 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -136,6 +136,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE "execute_on_media" #define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer" #define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring" +#define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect" #define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout" #define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid" #define SWITCH_SOFT_HOLDING_UUID_VARIABLE "soft_holding_uuid" diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 7de7f4fdea..07a24355cf 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -156,7 +156,9 @@ typedef enum { CFLAG_VID_FLOOR = (1 << 8), CFLAG_WASTE_BANDWIDTH = (1 << 9), CFLAG_OUTCALL = (1 << 10), - CFLAG_INHASH = (1 << 11) + CFLAG_INHASH = (1 << 11), + CFLAG_EXIT_SOUND = (1 << 12), + CFLAG_ENTER_SOUND = (1 << 13) } conf_flag_t; typedef enum { @@ -717,12 +719,14 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ) && !zstr(conference->enter_sound)) { const char * enter_sound = switch_channel_get_variable(channel, "conference_enter_sound"); - if (!zstr(enter_sound)) { - conference_play_file(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, - switch_core_session_get_channel(member->session), !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); - } else { - conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), - !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + if (switch_test_flag(conference, CFLAG_ENTER_SOUND)) { + if (!zstr(enter_sound)) { + conference_play_file(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, + switch_core_session_get_channel(member->session), !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + } else { + conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), + !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + } } } } @@ -906,7 +910,7 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0)) { switch_set_flag(conference, CFLAG_DESTRUCT); } else { - if (conference->exit_sound) { + if (conference->exit_sound && switch_test_flag(conference, CFLAG_EXIT_SOUND)) { conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session), 0); } if (conference->count == 1 && conference->alone_sound && !switch_test_flag(conference, CFLAG_WAIT_MOD)) { @@ -1992,22 +1996,20 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont switch_event_fire(&event); } - if ((mydata = switch_core_session_strdup(member->session, action->expanded_data))) { - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { - if (argc > 0) { - app = argv[0]; - } - if (argc > 1) { - arg = argv[1]; - } + mydata = strdup(action->expanded_data); + switch_assert(mydata); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n", - (char *) action->expanded_data); - goto done; + if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + if (argc > 0) { + app = argv[0]; } + if (argc > 1) { + arg = argv[1]; + } + } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Unable to allocate memory to duplicate execute_app data.\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n", + (char *) action->expanded_data); goto done; } @@ -2025,8 +2027,11 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont switch_core_session_execute_application(member->session, app, arg); switch_core_session_set_read_codec(member->session, &member->read_codec); switch_channel_clear_app_flag(channel, CF_APP_TAGGED); + done: + switch_safe_free(mydata); + return; } @@ -4023,7 +4028,7 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_snprintf(i, sizeof(i), "%u", conference->rate); switch_xml_set_attr_d(x_conference, "rate", ival); switch_xml_set_attr_d(x_conference, "uuid", conference->uuid_str); - + if (switch_test_flag(conference, CFLAG_LOCKED)) { switch_xml_set_attr_d(x_conference, "locked", "true"); } @@ -4056,6 +4061,14 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_xml_set_attr_d(x_conference, "dynamic", "true"); } + if (switch_test_flag(conference, CFLAG_EXIT_SOUND)) { + switch_xml_set_attr_d(x_conference, "exit_sound", "true"); + } + + if (switch_test_flag(conference, CFLAG_ENTER_SOUND)) { + switch_xml_set_attr_d(x_conference, "enter_sound", "true"); + } + if (conference->record_count > 0) { switch_xml_set_attr_d(x_conference, "recording", "true"); } @@ -4516,6 +4529,107 @@ static switch_status_t conf_api_sub_unlock(conference_obj_t *conference, switch_ return 0; } +static switch_status_t conf_api_sub_exit_sound(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + switch_event_t *event; + + switch_assert(conference != NULL); + switch_assert(stream != NULL); + + if (argc <= 2) { + stream->write_function(stream, "Not enough args\n"); + return SWITCH_STATUS_GENERR; + } + + if ( !strcasecmp(argv[2], "on") ) { + switch_set_flag_locked(conference, CFLAG_EXIT_SOUND); + stream->write_function(stream, "OK %s exit sounds on (%s)\n", argv[0], conference->exit_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "exit-sounds-on"); + switch_event_fire(&event); + } + } else if ( !strcasecmp(argv[2], "off") || !strcasecmp(argv[2], "none") ) { + switch_clear_flag_locked(conference, CFLAG_EXIT_SOUND); + stream->write_function(stream, "OK %s exit sounds off (%s)\n", argv[0], conference->exit_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "exit-sounds-off"); + switch_event_fire(&event); + } + } else if ( !strcasecmp(argv[2], "file") ) { + if (! argv[3]) { + stream->write_function(stream, "No filename specified\n"); + } else { + /* TODO: if possible, verify file exists before setting it */ + stream->write_function(stream,"Old exit sound: [%s]\n", conference->exit_sound); + conference->exit_sound = switch_core_strdup(conference->pool, argv[3]); + stream->write_function(stream, "OK %s exit sound file set to %s\n", argv[0], conference->exit_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "exit-sound-file-changed"); + switch_event_fire(&event); + } + } + } else { + stream->write_function(stream, "Bad args\n"); + return SWITCH_STATUS_GENERR; + } + + return 0; +} + + +static switch_status_t conf_api_sub_enter_sound(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + switch_event_t *event; + + switch_assert(conference != NULL); + switch_assert(stream != NULL); + + if (argc <= 2) { + stream->write_function(stream, "Not enough args\n"); + return SWITCH_STATUS_GENERR; + } + + if ( !strcasecmp(argv[2], "on") ) { + switch_set_flag_locked(conference, CFLAG_ENTER_SOUND); + stream->write_function(stream, "OK %s enter sounds on (%s)\n", argv[0], conference->enter_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "enter-sounds-on"); + switch_event_fire(&event); + } + } else if ( !strcasecmp(argv[2], "off") || !strcasecmp(argv[2], "none") ) { + switch_clear_flag_locked(conference, CFLAG_ENTER_SOUND); + stream->write_function(stream, "OK %s enter sounds off (%s)\n", argv[0], conference->enter_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "enter-sounds-off"); + switch_event_fire(&event); + } + } else if ( !strcasecmp(argv[2], "file") ) { + if (! argv[3]) { + stream->write_function(stream, "No filename specified\n"); + } else { + /* TODO: verify file exists before setting it */ + conference->enter_sound = switch_core_strdup(conference->pool, argv[3]); + stream->write_function(stream, "OK %s enter sound file set to %s\n", argv[0], conference->enter_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "enter-sound-file-changed"); + switch_event_fire(&event); + } + } + } else { + stream->write_function(stream, "Bad args\n"); + return SWITCH_STATUS_GENERR; + } + + return 0; +} + + static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { switch_call_cause_t cause; @@ -4720,7 +4834,9 @@ typedef enum { CONF_API_COMMAND_BGDIAL, CONF_API_COMMAND_TRANSFER, CONF_API_COMMAND_RECORD, - CONF_API_COMMAND_NORECORD + CONF_API_COMMAND_NORECORD, + CONF_API_COMMAND_EXIT_SOUND, + CONF_API_COMMAND_ENTER_SOUND, } api_command_type_t; /* API Interface Function sub-commands */ @@ -4750,6 +4866,8 @@ static api_command_t conf_api_sub_commands[] = { {"transfer", (void_fn_t) & conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "transfer", " [...]"}, {"record", (void_fn_t) & conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "record", ""}, {"norecord", (void_fn_t) & conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "norecord", "<[filename|all]>"}, + {"exit_sound", (void_fn_t) & conf_api_sub_exit_sound, CONF_API_SUB_ARGS_SPLIT, "exit_sound", "on|off|none|file "}, + {"enter_sound", (void_fn_t) & conf_api_sub_enter_sound, CONF_API_SUB_ARGS_SPLIT, "enter_sound", "on|off|none|file "}, {"pin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "pin", ""}, {"nopin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "nopin", ""}, }; @@ -5330,7 +5448,7 @@ static void set_cflags(const char *flags, uint32_t *f) } else if (!strcasecmp(argv[i], "waste-bandwidth")) { *f |= CFLAG_WASTE_BANDWIDTH; } - } + } free(dup); } @@ -6620,7 +6738,10 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c switch_uuid_format(uuid_str, &uuid); conference->uuid_str = switch_core_strdup(conference->pool, uuid_str); - + /* Set enter sound and exit sound flags so that default is on */ + switch_set_flag(conference, CFLAG_ENTER_SOUND); + switch_set_flag(conference, CFLAG_EXIT_SOUND); + /* Activate the conference mutex for exclusivity */ switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool); switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f2da2c5d7d..5d51ffdb60 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1552,7 +1552,8 @@ SWITCH_STANDARD_APP(tone_detect_session_function) int argc; char *mydata = NULL; time_t to = 0; - int hits = 1; + int hits = 0; + const char *hp = NULL; if (zstr(data) || !(mydata = switch_core_session_strdup(session, data))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n"); @@ -1582,10 +1583,16 @@ SWITCH_STANDARD_APP(tone_detect_session_function) } } - if (argv[6]) { - hits = atoi(argv[6]); + if (argv[4] && argv[5]) { + hp = argv[6]; + } else if (argv[4] && !argv[6]) { + hp = argv[4]; + } + + if (hp) { + hits = atoi(hp); if (hits < 0) { - hits = 1; + hits = 0; } } @@ -3629,7 +3636,7 @@ static switch_status_t file_string_file_read(switch_file_handle_t *handle, void } context->samples -= *len; - switch_generate_sln_silence((int16_t *) data, *len, 400); + memset(data, 255, *len *2); status = SWITCH_STATUS_SUCCESS; } else { status = switch_core_file_read(&context->fh, data, len); diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index d1bb286857..043dbab16f 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -164,6 +164,7 @@ static switch_status_t load_config(void) if(buf[data_sz - 1] != 0) { buf[data_sz] = 0; } + switch_replace_char(buf, ' ', 0, SWITCH_FALSE); /* only use the first entry ex "192.168.1.1 192.168.1.2" */ globals.server = buf; } } diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 17bbb443b1..93f9c9617d 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -133,6 +133,7 @@ struct callback_obj { profile_t *profile; switch_core_session_t *session; switch_event_t *event; + float sell_rate; }; typedef struct callback_obj callback_t; @@ -666,8 +667,11 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa r = 0; goto end; } - + for (current = cbt->head; current; current = current->next) { + if (cbt->sell_rate && cbt->sell_rate > current->rate) { + continue; + } key = switch_core_sprintf(pool, "%s:%s", additional->gw_prefix, additional->gw_suffix); if (switch_core_hash_find(cbt->dedup_hash, key)) { @@ -760,10 +764,14 @@ static switch_status_t is_intrastatelata(callback_t *cb_struct) */ if (!cb_struct->lookup_number || strlen(cb_struct->lookup_number) != 11 || *cb_struct->lookup_number != '1' || !switch_is_number(cb_struct->lookup_number)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, + "%s doesn't appear to be a NANP number\n", cb_struct->lookup_number); /* dest doesn't appear to be NANP number */ return SWITCH_STATUS_GENERR; } if (!cb_struct->cid || strlen(cb_struct->cid) != 11 || *cb_struct->cid != '1' || !switch_is_number(cb_struct->cid)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, + "%s doesn't appear to be a NANP number\n", cb_struct->cid); /* cid not NANP */ return SWITCH_STATUS_GENERR; } @@ -821,6 +829,7 @@ static switch_status_t lcr_do_lookup(callback_t *cb_struct) digits_expanded = expand_digits(cb_struct->pool, digits_copy, cb_struct->profile->quote_in_list); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "Has NPA NXX: [%u == %u]\n", profile->profile_has_npanxx, SWITCH_TRUE); if (profile->profile_has_npanxx == SWITCH_TRUE) { is_intrastatelata(cb_struct); } @@ -843,6 +852,10 @@ static switch_status_t lcr_do_lookup(callback_t *cb_struct) if (cb_struct->session) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "we have a session\n"); if ((channel = switch_core_session_get_channel(cb_struct->session))) { + const char *sell_rate = switch_channel_get_variable(channel, "sell_rate"); + if (!zstr(sell_rate)) { + cb_struct->sell_rate = atof(sell_rate); + } switch_channel_set_variable_var_check(channel, "lcr_rate_field", rate_field, SWITCH_FALSE); switch_channel_set_variable_var_check(channel, "lcr_user_rate_field", user_rate_field, SWITCH_FALSE); switch_channel_set_variable_var_check(channel, "lcr_query_digits", digits_copy, SWITCH_FALSE); @@ -1062,13 +1075,17 @@ static switch_status_t lcr_load_config() if (zstr(custom_sql)) { /* use default sql */ sql_stream.write_function(&sql_stream, - "SELECT l.digits AS lcr_digits, c.carrier_name AS lcr_carrier_name, l.${lcr_rate_field} AS lcr_rate_field, cg.prefix AS lcr_gw_prefix, cg.suffix AS lcr_gw_suffix, l.lead_strip AS lcr_lead_strip, l.trail_strip AS lcr_trail_strip, l.prefix AS lcr_prefix, l.suffix AS lcr_suffix " + "SELECT l.digits AS lcr_digits, c.carrier_name AS lcr_carrier_name, l.${lcr_rate_field} AS lcr_rate_field, \ + cg.prefix AS lcr_gw_prefix, cg.suffix AS lcr_gw_suffix, l.lead_strip AS lcr_lead_strip, \ + l.trail_strip AS lcr_trail_strip, l.prefix AS lcr_prefix, l.suffix AS lcr_suffix " ); if (db_check("SELECT codec from carrier_gateway limit 1") == SWITCH_TRUE) { sql_stream.write_function(&sql_stream, ", cg.codec AS lcr_codec "); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "codec field defined.\n"); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "codec field not defined, please update your lcr carrier_gateway database schema.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "codec field not defined, please update your lcr carrier_gateway database schema.\n" + ); } if (db_check("SELECT cid from lcr limit 1") == SWITCH_TRUE) { sql_stream.write_function(&sql_stream, ", l.cid AS lcr_cid "); @@ -1076,12 +1093,15 @@ static switch_status_t lcr_load_config() } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cid field not defined, please update your lcr database schema.\n"); } - sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN ("); + sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id \ + JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE \ + c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN ("); sql_stream.write_function(&sql_stream, "${lcr_query_expanded_digits}"); sql_stream.write_function(&sql_stream, ") AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end "); if (profile->id > 0) { sql_stream.write_function(&sql_stream, "AND lcr_profile=%d ", profile->id); } + sql_stream.write_function(&sql_stream, "ORDER BY digits DESC%s", profile->order_by); if (db_random) { @@ -1880,16 +1900,11 @@ SWITCH_STANDARD_API(dialplan_lcr_admin_function) stream->write_function(stream, " has intrastate:\t%s\n", profile->profile_has_intrastate ? "true" : "false"); stream->write_function(stream, " has intralata:\t%s\n", profile->profile_has_intralata ? "true" : "false"); stream->write_function(stream, " has npanxx:\t%s\n", profile->profile_has_npanxx ? "true" : "false"); - stream->write_function(stream, " Reorder rate:\t%s\n", - profile->reorder_by_rate ? "enabled" : "disabled"); - stream->write_function(stream, " Info in headers:\t%s\n", - profile->info_in_headers ? "enabled" : "disabled"); - stream->write_function(stream, " Quote IN() List:\t%s\n", - profile->quote_in_list ? "enabled" : "disabled"); - stream->write_function(stream, " Sip Redirection Mode:\t%s\n", - profile->enable_sip_redir ? "enabled" : "disabled"); - stream->write_function(stream, " Import fields:\t%s\n", - profile->export_fields_str ? profile->export_fields_str : "(null)"); + stream->write_function(stream, " Reorder rate:\t%s\n", profile->reorder_by_rate ? "enabled" : "disabled"); + stream->write_function(stream, " Info in headers:\t%s\n", profile->info_in_headers ? "enabled" : "disabled"); + stream->write_function(stream, " Quote IN() List:\t%s\n", profile->quote_in_list ? "enabled" : "disabled"); + stream->write_function(stream, " Sip Redirection Mode:\t%s\n", profile->enable_sip_redir ? "enabled" : "disabled"); + stream->write_function(stream, " Import fields:\t%s\n", profile->export_fields_str ? profile->export_fields_str : "(null)"); stream->write_function(stream, " Limit type:\t%s\n", profile->limit_type); stream->write_function(stream, "\n"); } diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index c710fc352a..8564a771e5 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -2415,7 +2415,7 @@ SWITCH_STANDARD_API(pa_cmd) } else if (!strcmp(action, "call")) { switch_snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd); cmd = cmd_buf; - } else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "answer")) { + } else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "devlist") || !strcmp(action, "answer")) { cmd = action; } } @@ -2543,6 +2543,7 @@ SWITCH_STANDARD_API(pa_cmd) " " " " " " + "
" " " " " " " diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index dac75facd7..2c338d6ce5 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -2041,8 +2041,8 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re listener->device_name, listener->device_instance); } if(zstr(listener->device_name) && request->type != REGISTER_MESSAGE && request->type != ALARM_MESSAGE && request->type != XML_ALARM_MESSAGE) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Device should send a register message first.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Device should send a register message first. Received %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); return SWITCH_STATUS_FALSE; } switch(request->type) { @@ -2110,7 +2110,7 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re return skinny_handle_xml_alarm(listener, request); default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Unhandled request %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); + "Unhandled %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); return SWITCH_STATUS_SUCCESS; } } diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index e8e56568b3..04237ad3ea 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -35,219 +35,220 @@ /* Translation tables */ struct skinny_table SKINNY_MESSAGE_TYPES[] = { - {"KeepAliveMessage", KEEP_ALIVE_MESSAGE}, - {"RegisterMessage", REGISTER_MESSAGE}, - {"PortMessage", PORT_MESSAGE}, - {"KeypadButtonMessage", KEYPAD_BUTTON_MESSAGE}, - {"EnblocCallMessage", ENBLOC_CALL_MESSAGE}, - {"StimulusMessage", STIMULUS_MESSAGE}, - {"OffHookMessage", OFF_HOOK_MESSAGE}, - {"OnHookMessage", ON_HOOK_MESSAGE}, - {"ForwardStatReqMessage", FORWARD_STAT_REQ_MESSAGE}, - {"SpeedDialStatReqMessage", SPEED_DIAL_STAT_REQ_MESSAGE}, - {"LineStatReqMessage", LINE_STAT_REQ_MESSAGE}, - {"ConfigStatReqMessage", CONFIG_STAT_REQ_MESSAGE}, - {"TimeDateReqMessage", TIME_DATE_REQ_MESSAGE}, - {"ButtonTemplateReqMessage", BUTTON_TEMPLATE_REQ_MESSAGE}, - {"VersionReqMessage", VERSION_REQ_MESSAGE}, - {"CapabilitiesReqMessage", CAPABILITIES_RES_MESSAGE}, - {"AlarmMessage", ALARM_MESSAGE}, - {"OpenReceiveChannelAckMessage", OPEN_RECEIVE_CHANNEL_ACK_MESSAGE}, - {"SoftKeySetReqMessage", SOFT_KEY_SET_REQ_MESSAGE}, - {"SoftKeyEventMessage", SOFT_KEY_EVENT_MESSAGE}, - {"UnregisterMessage", UNREGISTER_MESSAGE}, - {"SoftKeyTemplateReqMessage", SOFT_KEY_TEMPLATE_REQ_MESSAGE}, - {"HeadsetStatusMessage", HEADSET_STATUS_MESSAGE}, - {"RegisterAvailableLinesMessage", REGISTER_AVAILABLE_LINES_MESSAGE}, - {"DeviceToUserDataMessage", DEVICE_TO_USER_DATA_MESSAGE}, - {"DeviceToUserDataResponseMessage", DEVICE_TO_USER_DATA_RESPONSE_MESSAGE}, - {"ServiceUrlStatReqMessage", SERVICE_URL_STAT_REQ_MESSAGE}, - {"FeatureStatReqMessage", FEATURE_STAT_REQ_MESSAGE}, - {"DeviceToUserDataVersion1Message", DEVICE_TO_USER_DATA_VERSION1_MESSAGE}, - {"DeviceToUserDataResponseVersion1Message", DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE}, - {"RegisterAckMessage", REGISTER_ACK_MESSAGE}, - {"StartToneMessage", START_TONE_MESSAGE}, - {"StopToneMessage", STOP_TONE_MESSAGE}, - {"SetRingerMessage", SET_RINGER_MESSAGE}, - {"SetLampMessage", SET_LAMP_MESSAGE}, - {"SetSpeakerModeMessage", SET_SPEAKER_MODE_MESSAGE}, - {"StartMediaTransmissionMessage", START_MEDIA_TRANSMISSION_MESSAGE}, - {"StopMediaTransmissionMessage", STOP_MEDIA_TRANSMISSION_MESSAGE}, - {"CallInfoMessage", CALL_INFO_MESSAGE}, - {"ForwardStatMessage", FORWARD_STAT_MESSAGE}, - {"SpeedDialStatResMessage", SPEED_DIAL_STAT_RES_MESSAGE}, - {"LineStatResMessage", LINE_STAT_RES_MESSAGE}, - {"ConfigStatResMessage", CONFIG_STAT_RES_MESSAGE}, - {"DefineTimeDateMessage", DEFINE_TIME_DATE_MESSAGE}, - {"ButtonTemplateResMessage", BUTTON_TEMPLATE_RES_MESSAGE}, - {"VersionMessage", VERSION_MESSAGE}, - {"CapabilitiesReqMessage", CAPABILITIES_REQ_MESSAGE}, - {"RegisterRejectMessage", REGISTER_REJECT_MESSAGE}, - {"ResetMessage", RESET_MESSAGE}, - {"KeepAliveAckMessage", KEEP_ALIVE_ACK_MESSAGE}, - {"OpenReceiveChannelMessage", OPEN_RECEIVE_CHANNEL_MESSAGE}, - {"CloseReceiveChannelMessage", CLOSE_RECEIVE_CHANNEL_MESSAGE}, - {"SoftKeyTemplateResMessage", SOFT_KEY_TEMPLATE_RES_MESSAGE}, - {"SoftKeySetResMessage", SOFT_KEY_SET_RES_MESSAGE}, - {"SelectSoftKeysMessage", SELECT_SOFT_KEYS_MESSAGE}, - {"CallStateMessage", CALL_STATE_MESSAGE}, - {"DisplayPromptStatusMessage", DISPLAY_PROMPT_STATUS_MESSAGE}, - {"ClearPromptStatusMessage", CLEAR_PROMPT_STATUS_MESSAGE}, - {"ActivateCallPlaneMessage", ACTIVATE_CALL_PLANE_MESSAGE}, - {"UnregisterAckMessage", UNREGISTER_ACK_MESSAGE}, - {"BackSpaceReqMessage", BACK_SPACE_REQ_MESSAGE}, - {"DialedNumberMessage", DIALED_NUMBER_MESSAGE}, - {"UserToDeviceDataMessage", USER_TO_DEVICE_DATA_MESSAGE}, - {"FeatureResMessage", FEATURE_STAT_RES_MESSAGE}, - {"DisplayPriNotifyMessage", DISPLAY_PRI_NOTIFY_MESSAGE}, - {"ServiceUrlStatMessage", SERVICE_URL_STAT_RES_MESSAGE}, - {"UserToDeviceDataVersion1Message", USER_TO_DEVICE_DATA_VERSION1_MESSAGE}, - {"XMLAlarmMessage", XML_ALARM_MESSAGE}, - {NULL, 0} + {KEEP_ALIVE_MESSAGE, "KeepAliveMessage"}, + {REGISTER_MESSAGE, "RegisterMessage"}, + {PORT_MESSAGE, "PortMessage"}, + {KEYPAD_BUTTON_MESSAGE, "KeypadButtonMessage"}, + {ENBLOC_CALL_MESSAGE, "EnblocCallMessage"}, + {STIMULUS_MESSAGE, "StimulusMessage"}, + {OFF_HOOK_MESSAGE, "OffHookMessage"}, + {ON_HOOK_MESSAGE, "OnHookMessage"}, + { FORWARD_STAT_REQ_MESSAGE, "ForwardStatReqMessage"}, + {SPEED_DIAL_STAT_REQ_MESSAGE, "SpeedDialStatReqMessage"}, + {LINE_STAT_REQ_MESSAGE, "LineStatReqMessage"}, + {CONFIG_STAT_REQ_MESSAGE, "ConfigStatReqMessage"}, + {TIME_DATE_REQ_MESSAGE, "TimeDateReqMessage"}, + {BUTTON_TEMPLATE_REQ_MESSAGE, "ButtonTemplateReqMessage"}, + {VERSION_REQ_MESSAGE, "VersionReqMessage"}, + {CAPABILITIES_RES_MESSAGE, "CapabilitiesReqMessage"}, + {ALARM_MESSAGE, "AlarmMessage"}, + {OPEN_RECEIVE_CHANNEL_ACK_MESSAGE, "OpenReceiveChannelAckMessage"}, + {SOFT_KEY_SET_REQ_MESSAGE, "SoftKeySetReqMessage"}, + {SOFT_KEY_EVENT_MESSAGE, "SoftKeyEventMessage"}, + {UNREGISTER_MESSAGE, "UnregisterMessage"}, + {SOFT_KEY_TEMPLATE_REQ_MESSAGE, "SoftKeyTemplateReqMessage"}, + {HEADSET_STATUS_MESSAGE, "HeadsetStatusMessage"}, + {REGISTER_AVAILABLE_LINES_MESSAGE, "RegisterAvailableLinesMessage"}, + {DEVICE_TO_USER_DATA_MESSAGE, "DeviceToUserDataMessage"}, + {DEVICE_TO_USER_DATA_RESPONSE_MESSAGE, "DeviceToUserDataResponseMessage"}, + {SERVICE_URL_STAT_REQ_MESSAGE, "ServiceUrlStatReqMessage"}, + {FEATURE_STAT_REQ_MESSAGE, "FeatureStatReqMessage"}, + {DEVICE_TO_USER_DATA_VERSION1_MESSAGE, "DeviceToUserDataVersion1Message"}, + {DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE, "DeviceToUserDataResponseVersion1Message"}, + {REGISTER_ACK_MESSAGE, "RegisterAckMessage"}, + {START_TONE_MESSAGE, "StartToneMessage"}, + {STOP_TONE_MESSAGE, "StopToneMessage"}, + {SET_RINGER_MESSAGE, "SetRingerMessage"}, + {SET_LAMP_MESSAGE, "SetLampMessage"}, + {SET_SPEAKER_MODE_MESSAGE, "SetSpeakerModeMessage"}, + {START_MEDIA_TRANSMISSION_MESSAGE, "StartMediaTransmissionMessage"}, + {STOP_MEDIA_TRANSMISSION_MESSAGE, "StopMediaTransmissionMessage"}, + {CALL_INFO_MESSAGE, "CallInfoMessage"}, + {FORWARD_STAT_MESSAGE, "ForwardStatMessage"}, + {SPEED_DIAL_STAT_RES_MESSAGE, "SpeedDialStatResMessage"}, + {LINE_STAT_RES_MESSAGE, "LineStatResMessage"}, + {CONFIG_STAT_RES_MESSAGE, "ConfigStatResMessage"}, + {DEFINE_TIME_DATE_MESSAGE, "DefineTimeDateMessage"}, + {BUTTON_TEMPLATE_RES_MESSAGE, "ButtonTemplateResMessage"}, + {VERSION_MESSAGE, "VersionMessage"}, + {CAPABILITIES_REQ_MESSAGE, "CapabilitiesReqMessage"}, + {REGISTER_REJECT_MESSAGE, "RegisterRejectMessage"}, + {RESET_MESSAGE, "ResetMessage"}, + {KEEP_ALIVE_ACK_MESSAGE, "KeepAliveAckMessage"}, + {OPEN_RECEIVE_CHANNEL_MESSAGE, "OpenReceiveChannelMessage"}, + {CLOSE_RECEIVE_CHANNEL_MESSAGE, "CloseReceiveChannelMessage"}, + {SOFT_KEY_TEMPLATE_RES_MESSAGE, "SoftKeyTemplateResMessage"}, + {SOFT_KEY_SET_RES_MESSAGE, "SoftKeySetResMessage"}, + {SELECT_SOFT_KEYS_MESSAGE, "SelectSoftKeysMessage"}, + {CALL_STATE_MESSAGE, "CallStateMessage"}, + {DISPLAY_PROMPT_STATUS_MESSAGE, "DisplayPromptStatusMessage"}, + {CLEAR_PROMPT_STATUS_MESSAGE, "ClearPromptStatusMessage"}, + {ACTIVATE_CALL_PLANE_MESSAGE, "ActivateCallPlaneMessage"}, + {UNREGISTER_ACK_MESSAGE, "UnregisterAckMessage"}, + {BACK_SPACE_REQ_MESSAGE, "BackSpaceReqMessage"}, + {DIALED_NUMBER_MESSAGE, "DialedNumberMessage"}, + {USER_TO_DEVICE_DATA_MESSAGE, "UserToDeviceDataMessage"}, + {FEATURE_STAT_RES_MESSAGE, "FeatureResMessage"}, + {DISPLAY_PRI_NOTIFY_MESSAGE, "DisplayPriNotifyMessage"}, + {SERVICE_URL_STAT_RES_MESSAGE, "ServiceUrlStatMessage"}, + {USER_TO_DEVICE_DATA_VERSION1_MESSAGE, "UserToDeviceDataVersion1Message"}, + {XML_ALARM_MESSAGE, "XMLAlarmMessage"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage") SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1) struct skinny_table SKINNY_DEVICE_TYPES[] = { - {"Cisco 30 SP+", 1}, - {"Cisco 12 SP+", 2}, - {"Cisco 12 SP", 3}, - {"Cisco 12", 4}, - {"Cisco 30 VIP", 5}, - {"Cisco IP Phone 7910", 6}, - {"Cisco IP Phone 7960", 7}, - {"Cisco IP Phone 7940", 8}, - {"Cisco IP Phone 7935", 9}, - {"Cisco ATA 186", 12}, - {"Cisco IP Phone CP-7962G", 404}, - {"Cisco IP Phone CP-7965G", 436}, - {"Cisco IP Phone CP-7961G", 30018}, - {"Cisco IP Phone 7936", 30019}, - {NULL, 0} + {1, "Cisco 30 SP+"}, + {2, "Cisco 12 SP+"}, + {3, "Cisco 12 SP"}, + {4, "Cisco 12"}, + {5, "Cisco 30 VIP"}, + {6, "Cisco IP Phone 7910"}, + {7, "Cisco IP Phone 7960"}, + {8, "Cisco IP Phone 7940"}, + {9, "Cisco IP Phone 7935"}, + {12, "Cisco ATA 186"}, + {365, "Cisco IP Phone CP-7921G"}, + {404, "Cisco IP Phone CP-7962G"}, + {436, "Cisco IP Phone CP-7965G"}, + {30018, "Cisco IP Phone CP-7961G"}, + {30019, "Cisco IP Phone 7936"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType") SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1) struct skinny_table SKINNY_RING_TYPES[] = { - {"RingOff", SKINNY_RING_OFF}, - {"RingInside", SKINNY_RING_INSIDE}, - {"RingOutside", SKINNY_RING_OUTSIDE}, - {"RingFeature", SKINNY_RING_FEATURE}, - {NULL, 0} + {SKINNY_RING_OFF, "RingOff"}, + {SKINNY_RING_INSIDE, "RingInside"}, + {SKINNY_RING_OUTSIDE, "RingOutside"}, + {SKINNY_RING_FEATURE, "RingFeature"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1) struct skinny_table SKINNY_RING_MODES[] = { - {"RingForever", SKINNY_RING_FOREVER}, - {"RingOnce", SKINNY_RING_ONCE}, - {NULL, 0} + {SKINNY_RING_FOREVER, "RingForever"}, + {SKINNY_RING_ONCE, "RingOnce"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1) struct skinny_table SKINNY_BUTTONS[] = { - {"Unknown", SKINNY_BUTTON_UNKNOWN}, - {"LastNumberRedial", SKINNY_BUTTON_LAST_NUMBER_REDIAL}, - {"SpeedDial", SKINNY_BUTTON_SPEED_DIAL}, - {"Hold", SKINNY_BUTTON_HOLD}, - {"Transfer", SKINNY_BUTTON_TRANSFER}, - {"Line", SKINNY_BUTTON_LINE}, - {"Voicemail", SKINNY_BUTTON_VOICEMAIL}, - {"Privacy", SKINNY_BUTTON_PRIVACY}, - {"ServiceUrl", SKINNY_BUTTON_SERVICE_URL}, - {"Undefined", SKINNY_BUTTON_UNDEFINED}, - {NULL, 0} + {SKINNY_BUTTON_UNKNOWN, "Unknown"}, + {SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"}, + {SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"}, + {SKINNY_BUTTON_HOLD, "Hold"}, + {SKINNY_BUTTON_TRANSFER, "Transfer"}, + {SKINNY_BUTTON_LINE, "Line"}, + {SKINNY_BUTTON_VOICEMAIL, "Voicemail"}, + {SKINNY_BUTTON_PRIVACY, "Privacy"}, + {SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"}, + {SKINNY_BUTTON_UNDEFINED, "Undefined"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1) struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = { - {"SoftkeyRedial", SOFTKEY_REDIAL}, - {"SoftkeyNewcall", SOFTKEY_NEWCALL}, - {"SoftkeyHold", SOFTKEY_HOLD}, - {"SoftkeyTransfer", SOFTKEY_TRANSFER}, - {"SoftkeyCfwdall", SOFTKEY_CFWDALL}, - {"SoftkeyCfwdbusy", SOFTKEY_CFWDBUSY}, - {"SoftkeyCfwdnoanswer", SOFTKEY_CFWDNOANSWER}, - {"SoftkeyBackspace", SOFTKEY_BACKSPACE}, - {"SoftkeyEndcall", SOFTKEY_ENDCALL}, - {"SoftkeyResume", SOFTKEY_RESUME}, - {"SoftkeyAnswer", SOFTKEY_ANSWER }, - {"SoftkeyInfo", SOFTKEY_INFO}, - {"SoftkeyConfrm", SOFTKEY_CONFRM}, - {"SoftkeyPark", SOFTKEY_PARK}, - {"SoftkeyJoin", SOFTKEY_JOIN}, - {"SoftkeyMeetmeconfrm", SOFTKEY_MEETMECONFRM}, - {"SoftkeyCallpickup", SOFTKEY_CALLPICKUP}, - {"SoftkeyGrpcallpickup", SOFTKEY_GRPCALLPICKUP}, - {"SoftkeyDnd", SOFTKEY_DND}, - {"SoftkeyIdivert", SOFTKEY_IDIVERT}, - {NULL, 0} + {SOFTKEY_REDIAL, "SoftkeyRedial"}, + {SOFTKEY_NEWCALL, "SoftkeyNewcall"}, + {SOFTKEY_HOLD, "SoftkeyHold"}, + {SOFTKEY_TRANSFER, "SoftkeyTransfer"}, + {SOFTKEY_CFWDALL, "SoftkeyCfwdall"}, + {SOFTKEY_CFWDBUSY, "SoftkeyCfwdbusy"}, + {SOFTKEY_CFWDNOANSWER, "SoftkeyCfwdnoanswer"}, + {SOFTKEY_BACKSPACE, "SoftkeyBackspace"}, + {SOFTKEY_ENDCALL, "SoftkeyEndcall"}, + {SOFTKEY_RESUME, "SoftkeyResume"}, + {SOFTKEY_ANSWER , "SoftkeyAnswer"}, + {SOFTKEY_INFO, "SoftkeyInfo"}, + {SOFTKEY_CONFRM, "SoftkeyConfrm"}, + {SOFTKEY_PARK, "SoftkeyPark"}, + {SOFTKEY_JOIN, "SoftkeyJoin"}, + {SOFTKEY_MEETMECONFRM, "SoftkeyMeetmeconfrm"}, + {SOFTKEY_CALLPICKUP, "SoftkeyCallpickup"}, + {SOFTKEY_GRPCALLPICKUP, "SoftkeyGrpcallpickup"}, + {SOFTKEY_DND, "SoftkeyDnd"}, + {SOFTKEY_IDIVERT, "SoftkeyIdivert"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown") SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0) struct skinny_table SKINNY_LAMP_MODES[] = { - {"Off", SKINNY_LAMP_OFF}, - {"On", SKINNY_LAMP_ON}, - {"Wink", SKINNY_LAMP_WINK}, - {"Flash", SKINNY_LAMP_FLASH}, - {"Blink", SKINNY_LAMP_BLINK}, - {NULL, 0} + {SKINNY_LAMP_OFF, "Off"}, + {SKINNY_LAMP_ON, "On"}, + {SKINNY_LAMP_WINK, "Wink"}, + {SKINNY_LAMP_FLASH, "Flash"}, + {SKINNY_LAMP_BLINK, "Blink"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1) struct skinny_table SKINNY_SPEAKER_MODES[] = { - {"SpeakerOn", SKINNY_SPEAKER_ON}, - {"SpeakerOff", SKINNY_SPEAKER_OFF}, - {NULL, 0} + {SKINNY_SPEAKER_ON, "SpeakerOn"}, + {SKINNY_SPEAKER_OFF, "SpeakerOff"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1) struct skinny_table SKINNY_KEY_SETS[] = { - {"KeySetOnHook", SKINNY_KEY_SET_ON_HOOK}, - {"KeySetConnected", SKINNY_KEY_SET_CONNECTED}, - {"KeySetOnHold", SKINNY_KEY_SET_ON_HOLD}, - {"KeySetRingIn", SKINNY_KEY_SET_RING_IN}, - {"KeySetOffHook", SKINNY_KEY_SET_OFF_HOOK}, - {"KeySetConnectedWithTransfer", SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER}, - {"KeySetDigitsAfterDialingFirstDigit", SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT}, - {"KeySetConnectedWithConference", SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE}, - {"KeySetRingOut", SKINNY_KEY_SET_RING_OUT}, - {"KeySetOffHookWithFeatures", SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES}, - {"KeySetInUseHint", SKINNY_KEY_SET_IN_USE_HINT}, - {NULL, 0} + {SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"}, + {SKINNY_KEY_SET_CONNECTED, "KeySetConnected"}, + {SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"}, + {SKINNY_KEY_SET_RING_IN, "KeySetRingIn"}, + {SKINNY_KEY_SET_OFF_HOOK, "KeySetOffHook"}, + {SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER, "KeySetConnectedWithTransfer"}, + {SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, "KeySetDigitsAfterDialingFirstDigit"}, + {SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE, "KeySetConnectedWithConference"}, + {SKINNY_KEY_SET_RING_OUT, "KeySetRingOut"}, + {SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"}, + {SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET") SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1) struct skinny_table SKINNY_CALL_STATES[] = { - {"OffHook", SKINNY_OFF_HOOK}, - {"OnHook", SKINNY_ON_HOOK}, - {"RingOut", SKINNY_RING_OUT}, - {"RingIn", SKINNY_RING_IN}, - {"Connected", SKINNY_CONNECTED}, - {"Busy", SKINNY_BUSY}, - {"LineInUse", SKINNY_LINE_IN_USE}, - {"Hold", SKINNY_HOLD}, - {"CallWaiting", SKINNY_CALL_WAITING}, - {"CallTransfer", SKINNY_CALL_TRANSFER}, - {"CallPark", SKINNY_CALL_PARK}, - {"Proceed", SKINNY_PROCEED}, - {"InUseRemotely", SKINNY_IN_USE_REMOTELY}, - {"InvalidNumber", SKINNY_INVALID_NUMBER}, - {NULL, 0} + {SKINNY_OFF_HOOK, "OffHook"}, + {SKINNY_ON_HOOK, "OnHook"}, + {SKINNY_RING_OUT, "RingOut"}, + {SKINNY_RING_IN, "RingIn"}, + {SKINNY_CONNECTED, "Connected"}, + {SKINNY_BUSY, "Busy"}, + {SKINNY_LINE_IN_USE, "LineInUse"}, + {SKINNY_HOLD, "Hold"}, + {SKINNY_CALL_WAITING, "CallWaiting"}, + {SKINNY_CALL_TRANSFER, "CallTransfer"}, + {SKINNY_CALL_PARK, "CallPark"}, + {SKINNY_PROCEED, "Proceed"}, + {SKINNY_IN_USE_REMOTELY, "InUseRemotely"}, + {SKINNY_INVALID_NUMBER, "InvalidNumber"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown") SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1) struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = { - {"DeviceReset", SKINNY_DEVICE_RESET}, - {"DeviceRestart", SKINNY_DEVICE_RESTART}, - {NULL, 0} + {SKINNY_DEVICE_RESET, "DeviceReset"}, + {SKINNY_DEVICE_RESTART, "DeviceRestart"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1) diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 00ddf0c74d..abfdfc2aa0 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -36,8 +36,8 @@ /* SKINNY TABLES */ /*****************************************************************************/ struct skinny_table { - const char *name; uint32_t id; + const char *name; }; #define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \ @@ -92,7 +92,7 @@ const char *skinny_message_type2str(uint32_t id); uint32_t skinny_str2message_type(const char *str); #define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES) -extern struct skinny_table SKINNY_DEVICE_TYPES[15]; +extern struct skinny_table SKINNY_DEVICE_TYPES[16]; const char *skinny_device_type2str(uint32_t id); uint32_t skinny_str2device_type(const char *str); #define SKINNY_PUSH_DEVICE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_DEVICE_TYPES) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 9af3963dee..bcc8f75692 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1655,6 +1655,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi const char *ip = NULL, *port = NULL; switch_channel_set_flag(channel, CF_PROXY_MODE); + if (tech_pvt->rm_encoding) { + tech_pvt->rm_encoding = NULL; + } sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE); if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b9aec74563..2bf27d5ba8 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -76,14 +76,15 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]) { -#if 0 + if (status >= 300 && sip && sip->sip_call_id) { char *sql; sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", sip->sip_call_id->i_id); switch_assert(sql != NULL); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); + nua_handle_destroy(nh); } -#endif + } #define url_set_chanvars(session, url, varprefix) _url_set_chanvars(session, url, #varprefix "_user", #varprefix "_host", #varprefix "_port", #varprefix "_uri", #varprefix "_params") @@ -5710,6 +5711,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_core_event_hook_add_state_change(a_session, xfer_hanguphook); switch_channel_set_variable(a_channel, "att_xfer_kill_uuid", switch_core_session_get_uuid(b_session)); + if (profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) { + switch_channel_set_flag(a_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE); + } + + if ((tmp = switch_channel_get_hold_music(a_channel))) { moh = tmp; } @@ -5769,6 +5775,12 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_core_session_rwunlock(tmp); } + if ((profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) && (tmp = switch_core_session_locate(br_a))) { + switch_channel_t *tchannel = switch_core_session_get_channel(tmp); + switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE); + switch_core_session_rwunlock(tmp); + } + switch_ivr_uuid_bridge(br_b, br_a); switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER"); nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 701b730fcc..66bf8ea644 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -729,6 +729,8 @@ void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt) return; } + tech_pvt->payload_space = 0; + switch_assert(tech_pvt->session != NULL); if ((abs = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) { diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index a9a762e00e..cbc45024e1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1506,9 +1506,9 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * stream.write_function(&stream, "\n" "\n", - version, - zstr(uuid) ? "partial" : "full", clean_id); + "version=\"%s\" state=\"partial\" entity=\"%s\">\n", version, clean_id); + + } //if (strcasecmp(event_status, "Registered")) { diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 51194f4b14..0b96db82a1 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -20,6 +20,8 @@ * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. * * Contributor(s): * Michal Bielicki diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index 9a286d454f..abdb8101f6 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -20,6 +20,8 @@ * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. * * Contributor(s): * Daniel Swarbrick diff --git a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB index 84485269f9..68d83fe433 100644 --- a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB +++ b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB @@ -1,3 +1,34 @@ + +-- 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. +-- Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) +-- Seventh Signal Ltd. & Co. KG, All Rights Reserverd. +-- +-- Contributor(s): +-- Daniel Swarbrick +-- Stefan Knoblich +-- +-- MIB Definition for mod_snmp + FREESWITCH-MIB DEFINITIONS ::= BEGIN IMPORTS diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c index d415d4fe1c..059646bc19 100644 --- a/src/mod/event_handlers/mod_snmp/mod_snmp.c +++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c @@ -20,6 +20,8 @@ * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. * * Contributor(s): * Daniel Swarbrick diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index 871fb5ad75..8d58667687 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -20,6 +20,8 @@ * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. * * Contributor(s): * Daniel Swarbrick diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h index 5da87a6c4e..ba3c523d49 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.h +++ b/src/mod/event_handlers/mod_snmp/subagent.h @@ -1,3 +1,36 @@ +/* + * 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. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. + * + * Contributor(s): + * Daniel Swarbrick + * Stefan Knoblich + * + * subagent.h -- SNMP Agent Definitions + * + */ + #ifndef subagent_H #define subagent_H diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index b1bff61205..15d95438be 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -58,6 +58,10 @@ struct say_t matrix[7][8] = { {m_00, m_01, m_02, m_03, m_04, m_05, m_06, m_07}, {m_60, m_61, m_62, m_63, m_64, m_65, m_66, m_67} }; + +struct say_cur_t matrix_currency[3] = {c_0, c_1, c_2}; + + SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load); SWITCH_MODULE_DEFINITION(mod_say_ru, mod_say_ru_load, NULL, NULL); @@ -253,8 +257,7 @@ static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, s int iruble = 0; int ikopecks = 0; int ikopeck = 0; - - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n", tosay); +// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s say_opt->currency=%d\n", tosay,say_opt->currency); if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); @@ -278,40 +281,48 @@ static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, s rubles++; } - ru_say_count(sh, rubles, male, nominativus); + + ru_say_count(sh, rubles, matrix_currency[say_opt->currency].first_gender,matrix_currency[say_opt->currency].first_cases); if (rubles) { irubles = atoi(rubles) % 100; iruble = atoi(rubles) % 10; } - - if (irubles == 1 || (irubles > 20 && iruble == 1)) { /* рубль */ - switch_say_file(sh, "currency/ruble"); - } else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5)) { /*рубля */ - switch_say_file(sh, "currency/ruble-a"); - } else { /*рублей */ - switch_say_file(sh, "currency/rubles"); + if (iruble<5) { + if ((irubles>10)&&(irubles<15)) { + switch_say_file(sh, "currency/%s",matrix_currency->first[5]); + } + else { + switch_say_file(sh, "currency/%s",matrix_currency->first[iruble]); + } } - + else { + switch_say_file(sh, "currency/%s",matrix_currency->first[5]); + } + + /* Say kopecks */ - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n", kopecks); - ru_say_count(sh, kopecks, female, nominativus); + ru_say_count(sh, kopecks, matrix_currency[say_opt->currency].second_gender,matrix_currency[say_opt->currency].second_cases); if (kopecks) { ikopecks = atoi(kopecks) % 100; ikopeck = atoi(kopecks) % 10; } - if (ikopecks == 1 || (ikopecks > 20 && ikopeck == 1)) { - /* копейка */ - switch_say_file(sh, "currency/kopeck"); - } else if ((ikopecks > 1 && ikopecks < 5) || (ikopecks > 20 && ikopeck > 1 && ikopeck < 5)) { - /* копейки */ - switch_say_file(sh, "currency/kopeck-i"); - } else { - /* копеек */ - switch_say_file(sh, "currency/kopecks"); + if (ikopeck<5) { + if ((ikopecks>10)&&(ikopecks<15)) { + switch_say_file(sh, "currency/%s",matrix_currency->second[5]); + } + else { + switch_say_file(sh, "currency/%s",matrix_currency->second[ikopeck]); + } } + else { + switch_say_file(sh, "currency/%s",matrix_currency->second[5]); + } + + + return SWITCH_STATUS_SUCCESS; } @@ -440,6 +451,7 @@ static switch_status_t ru_say_time(switch_say_file_handle_t *sh, char *tosay, sw break; case SST_SHORT_DATE_TIME: say_time = 1; + tm.tm_sec = 0; // В коротком варианте секунды не проговариваем if (tm.tm_year != tm_now.tm_year) { say_date = 1; break; @@ -593,7 +605,7 @@ static switch_new_say_callback_ru_t choose_callback(switch_say_args_t *say_args) case SST_CURRENT_TIME: say_cb = ru_say_time; break; - + case SST_SHORT_DATE_TIME: case SST_CURRENT_DATE_TIME: say_cb = ru_say_time; break; @@ -608,7 +620,7 @@ static switch_new_say_callback_ru_t choose_callback(switch_say_args_t *say_args) say_cb = ru_say_money; break; default: - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); break; } @@ -628,7 +640,9 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t const char *gender=NULL; const char *currency=NULL; say_opt_t say_opt; - + say_opt.cases=0; + say_opt.gender=0; + say_opt.currency=0; if (session) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_get_variables(channel, &var_event); @@ -692,12 +706,15 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t } if (currency) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", currency); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", currency); - if (strcmp(currency,"rubl") || strcmp(currency,"рубль")) { + if ((strcmp(currency,"ruble")==0) || (strcmp(currency,"рубль")==0)) { say_opt.currency=(currency_t)0; +// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "rul!!! \n"); + } - if (strcmp(gender,"dollar") || strcmp(gender,"доллар")) { + if ((strcmp(currency,"dollar")==0) || (strcmp(currency,"доллар")==0)) { +// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "dollar!!! !\n"); say_opt.currency=(currency_t)1; } } diff --git a/src/mod/say/mod_say_ru/mod_say_ru.h b/src/mod/say/mod_say_ru/mod_say_ru.h index d7769ad246..92ed89a1fb 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.h +++ b/src/mod/say/mod_say_ru/mod_say_ru.h @@ -49,10 +49,12 @@ typedef enum { typedef enum { ruble, - dollar + dollar, + euro } currency_t; + typedef struct { say_gender_t gender; cases_t cases; @@ -66,6 +68,29 @@ struct say_t { char *million[14]; int all; }; +struct say_cur_t { + char *first[6]; + say_gender_t first_gender; + cases_t first_cases; + char *second[6]; + say_gender_t second_gender; + cases_t second_cases; + +}; + +// описываем как произносить валяюты от 0 до 5 дальше идёт номер рода и падежа (с нуля) +//рубли +#define c_0 {{"rubles","ruble","ruble-a","ruble-a","ruble-a","rubles"},male,nominativus,\ + {"kopecks","kopeck","kopeck-i","kopeck-i","kopeck-i","kopecks"},female,nominativus} + +#define c_1 {{"dollars","dollar","dollara","dollara","dollara","dollars"},male,nominativus,\ + {"centov","cent","centa","centa","centa","centov"},male,nominativus} + +#define c_2 {{"rubles","ruble","ruble-a","ruble-a","ruble-a","rubles"},male,nominativus,\ + {"kopecks","kopeck","kopeck-i","kopeck-i","kopeck-i","kopecks"},female,nominativus} + + + typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt); diff --git a/src/switch_channel.c b/src/switch_channel.c index 2dd7d987da..bc8daabbc6 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2661,11 +2661,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_mutex_unlock(channel->profile_mutex); } - if (switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE) != SWITCH_STATUS_SUCCESS) { - if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { - switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); - } - } + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE); + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); + + if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { switch_channel_set_flag(channel, CF_PASSTHRU_PTIME_MISMATCH); @@ -2772,17 +2771,27 @@ SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *chan if (!strncasecmp(var, variable_prefix, strlen(variable_prefix))) { char *arg = NULL; + char *p; + int bg = 0; x++; app = switch_core_session_strdup(channel->session, val); - - if (strstr(app, "::")) { + + for(p = app; p && *p; p++) { + if (*p == ' ') { + *p++ = '\0'; + arg = p; + break; + } else if (*p == ':' && (*(p+1) == ':')) { + bg++; + break; + } + } + + + if (bg) { switch_core_session_execute_application_async(channel->session, app, arg); } else { - if ((arg = strchr(app, ' '))) { - *arg++ = '\0'; - } - switch_core_session_execute_application(channel->session, app, arg); } } @@ -2861,10 +2870,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan channel->name); - if (switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE) != SWITCH_STATUS_SUCCESS) { - if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { - switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); - } + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE); + + if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); } if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE)) && !zstr(var)) { diff --git a/src/switch_core.c b/src/switch_core.c index 85e795c408..d3a696bef5 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -480,9 +480,13 @@ SWITCH_DECLARE(void) switch_core_set_globals(void) DWORD dwBufSize = BUFSIZE; char base_dir[1024]; char *lastbacklash; + GetModuleFileName(NULL, base_dir, BUFSIZE); lastbacklash = strrchr(base_dir, '\\'); base_dir[(lastbacklash - base_dir)] = '\0'; + /* set base_dir as cwd, to be able to use relative paths in scripting languages (e.g. mod_lua) when FS is running as a service or while debugging FS using visual studio */ + SetCurrentDirectory(base_dir); + #else char base_dir[1024] = SWITCH_PREFIX_DIR; #endif @@ -1440,7 +1444,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc static void handle_SIGQUIT(int sig) { if (sig); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig Quit!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig Quit!\n"); return; } #endif @@ -1449,7 +1453,7 @@ static void handle_SIGQUIT(int sig) static void handle_SIGPIPE(int sig) { if (sig); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig Pipe!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig Pipe!\n"); return; } #endif @@ -1458,7 +1462,7 @@ static void handle_SIGPIPE(int sig) static void handle_SIGPOLL(int sig) { if (sig); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig Poll!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig Poll!\n"); return; } #endif @@ -1467,7 +1471,7 @@ static void handle_SIGPOLL(int sig) static void handle_SIGIO(int sig) { if (sig); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig I/O!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig I/O!\n"); return; } #endif @@ -1475,7 +1479,7 @@ static void handle_SIGIO(int sig) #ifdef TRAP_BUS static void handle_SIGBUS(int sig) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig BUS!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig BUS!\n"); return; } #endif @@ -1768,27 +1772,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t runtime.runlevel++; - /* set signal handlers */ - signal(SIGINT, SIG_IGN); -#ifdef SIGPIPE - signal(SIGPIPE, handle_SIGPIPE); -#endif -#ifdef SIGQUIT - signal(SIGQUIT, handle_SIGQUIT); -#endif -#ifdef SIGPOLL - signal(SIGPOLL, handle_SIGPOLL); -#endif -#ifdef SIGIO - signal(SIGIO, handle_SIGIO); -#endif -#ifdef TRAP_BUS - signal(SIGBUS, handle_SIGBUS); -#endif -#ifdef SIGUSR1 - signal(SIGUSR1, handle_SIGHUP); -#endif - signal(SIGHUP, handle_SIGHUP); + switch_core_set_signal_handlers(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Bringing up environment.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Loading Modules.\n"); @@ -1802,6 +1786,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t switch_load_core_config("post_load_switch.conf"); + switch_core_set_signal_handlers(); + if (switch_event_create(&event, SWITCH_EVENT_STARTUP) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Ready"); switch_event_fire(&event); @@ -1865,6 +1851,31 @@ static void win_shutdown(void) } #endif +SWITCH_DECLARE(void) switch_core_set_signal_handlers(void) +{ + /* set signal handlers */ + signal(SIGINT, SIG_IGN); +#ifdef SIGPIPE + signal(SIGPIPE, handle_SIGPIPE); +#endif +#ifdef SIGQUIT + signal(SIGQUIT, handle_SIGQUIT); +#endif +#ifdef SIGPOLL + signal(SIGPOLL, handle_SIGPOLL); +#endif +#ifdef SIGIO + signal(SIGIO, handle_SIGIO); +#endif +#ifdef TRAP_BUS + signal(SIGBUS, handle_SIGBUS); +#endif +#ifdef SIGUSR1 + signal(SIGUSR1, handle_SIGHUP); +#endif + signal(SIGHUP, handle_SIGHUP); +} + SWITCH_DECLARE(uint32_t) switch_core_debug_level(void) { return runtime.debug_level; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 3afbfb6397..9fb2eea95c 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2392,7 +2392,6 @@ static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch { switch_channel_t *channel = switch_core_session_get_channel(session); switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_"); - switch_event_t *event; int i; if (!cont || !cont->detect_fax || dtmf->digit != 'f') { @@ -2403,13 +2402,10 @@ static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch if (cont->list[i].callback) { cont->list[i].callback(cont->session, cont->list[i].app, cont->list[i].data); - } else if (cont->list[i].app) { - if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", cont->list[i].app); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cont->list[i].data); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_core_session_queue_private_event(cont->session, &event, SWITCH_FALSE); + } else { + switch_channel_execute_on(switch_core_session_get_channel(cont->session), SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE); + if (cont->list[i].app) { + switch_core_session_execute_application_async(cont->session, cont->list[i].app, cont->list[i].data); } } @@ -2491,13 +2487,10 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da cont->list[i].sleep = 0; cont->list[i].expires = 0; } - } else if (cont->list[i].app) { - if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", cont->list[i].app); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cont->list[i].data); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_core_session_queue_private_event(cont->session, &event, SWITCH_FALSE); + } else { + switch_channel_execute_on(switch_core_session_get_channel(cont->session), SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE); + if (cont->list[i].app) { + switch_core_session_execute_application_async(cont->session, cont->list[i].app, cont->list[i].data); } } @@ -2605,6 +2598,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi return SWITCH_STATUS_MEMERR; } + if ((var = switch_channel_get_variable(channel, "tone_detect_hits"))) { + int tmp = atoi(var); + if (tmp > 0) { + hits = tmp; + } + } + + if (!hits) hits = 1; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Adding tone spec %s index %d hits %d\n", tone_spec, cont->index, hits); i = 0; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index dbe3b811fe..f1a6bdba22 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -357,11 +357,11 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } - if ((bypass_media_after_bridge || switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED) + if ((bypass_media_after_bridge || switch_channel_test_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED) && switch_channel_test_flag(chan_b, CF_ANSWERED)) { switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE); bypass_media_after_bridge = 0; - switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE); + switch_channel_clear_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE); goto end_of_bridge_loop; } } @@ -1367,6 +1367,8 @@ static void cleanup_proxy_mode_a(switch_core_session_t *session) const char *sbv = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); if (!zstr(sbv) && (sbsession = switch_core_session_locate(sbv))) { switch_channel_t *sbchannel = switch_core_session_get_channel(sbsession); + /* Clear this now, otherwise will cause the one we're interested in to hang up too...*/ + switch_channel_set_variable(sbchannel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL); switch_channel_hangup(sbchannel, SWITCH_CAUSE_ATTENDED_TRANSFER); switch_core_session_rwunlock(sbsession); } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 5980ea41c7..6c769ecfd8 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -193,7 +193,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio if (pattern) { switch_regex_t *re = NULL; - int proceed = 0, ovector[30]; + int proceed = 0, ovector[100]; char *substituted = NULL; uint32_t len = 0; char *odata = NULL; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 9804e53238..627aa46707 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -945,6 +945,8 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena *new_module = module; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", module_interface->module_name); + switch_core_set_signal_handlers(); + return SWITCH_STATUS_SUCCESS; }