diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 93f9c9617d..ac5d90871e 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -133,7 +133,7 @@ struct callback_obj { profile_t *profile; switch_core_session_t *session; switch_event_t *event; - float sell_rate; + float max_rate; }; typedef struct callback_obj callback_t; @@ -622,6 +622,9 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa } else if (CF("lcr_carrier_name")) { additional->carrier_name = switch_core_strdup(pool, switch_str_nil(argv[i])); } else if (CF("lcr_rate_field")) { + if (!argv[i] || zstr(argv[i])) { + goto end; + } additional->rate = (float)atof(switch_str_nil(argv[i])); additional->rate_str = switch_core_sprintf(pool, "%0.5f", additional->rate); } else if (CF("lcr_gw_prefix")) { @@ -669,10 +672,12 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa for (current = cbt->head; current; current = current->next) { - if (cbt->sell_rate && cbt->sell_rate > current->rate) { - continue; + if (cbt->max_rate && (cbt->max_rate < additional->rate)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Skipping [%s] because [%f] is higher than the max_rate of [%f]\n", + additional->carrier_name, additional->rate, cbt->max_rate); + break; } - + key = switch_core_sprintf(pool, "%s:%s", additional->gw_prefix, additional->gw_suffix); if (switch_core_hash_find(cbt->dedup_hash, key)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, @@ -852,9 +857,9 @@ 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); + const char *max_rate = switch_channel_get_variable(channel, "max_rate"); + if (!zstr(max_rate)) { + cb_struct->max_rate = atof(max_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); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 7b94b55062..21de3fa22b 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -69,8 +69,8 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session); switch_status_t callprogress_detector_start(switch_core_session_t *session, const char *name); switch_status_t callprogress_detector_stop(switch_core_session_t *session); -SWITCH_DECLARE(switch_status_t) spandsp_fax_detect_session(switch_core_session_t *session, +switch_status_t spandsp_fax_detect_session(switch_core_session_t *session, const char *flags, time_t timeout, int hits, const char *app, const char *data, switch_tone_detect_callback_t callback); -SWITCH_DECLARE(switch_status_t) spandsp_fax_stop_detect_session(switch_core_session_t *session); +switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 620971b307..1d260f3098 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -459,6 +459,15 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID PACKETLEN: %d PASSED: %d:%d\n", r, len, count); } + + if (r < 0) { + t30_state_t *t30; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TERMINATING T30 STATE\n"); + if (pvt->t38_state && (t30 = t38_terminal_get_t30_state(pvt->t38_state))) { + t30_terminate(t30); + } + } + return r; } @@ -1953,7 +1962,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da return rval; } -SWITCH_DECLARE(switch_status_t) spandsp_fax_stop_detect_session(switch_core_session_t *session) +switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); spandsp_fax_tone_container_t *cont = switch_channel_get_private(channel, "_fax_tone_detect_"); @@ -1967,7 +1976,7 @@ SWITCH_DECLARE(switch_status_t) spandsp_fax_stop_detect_session(switch_core_sess return SWITCH_STATUS_FALSE; } -SWITCH_DECLARE(switch_status_t) spandsp_fax_detect_session(switch_core_session_t *session, +switch_status_t spandsp_fax_detect_session(switch_core_session_t *session, const char *flags, time_t timeout, int hits, const char *app, const char *data, switch_tone_detect_callback_t callback) { diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 96f8d57726..feaca4b7ed 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -658,7 +658,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec, if (frames && codec->implementation->decoded_bytes_per_packet * frames > *decoded_data_len) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Buffer size sanity check failed!\n"); - return SWITCH_STATUS_GENERR; + *decoded_data_len = codec->implementation->decoded_bytes_per_packet; + memset(decoded_data, 255, *decoded_data_len); + return SWITCH_STATUS_SUCCESS; } } diff --git a/src/switch_nat.c b/src/switch_nat.c index e9d4b2b9ca..ebea68e7cb 100644 --- a/src/switch_nat.c +++ b/src/switch_nat.c @@ -586,7 +586,7 @@ SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t po switch_event_t *event = NULL; if (!nat_globals.mapping) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "NAT port mapping disabled\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT port mapping disabled\n"); return status; }