Merge branch 'master' of ssh://git.freeswitch.org:222/freeswitch

This commit is contained in:
Michael S Collins 2011-04-19 17:52:55 -07:00
commit 33349010e1
5 changed files with 29 additions and 13 deletions

View File

@ -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,8 +672,10 @@ 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);
@ -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);

View File

@ -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);

View File

@ -460,6 +460,15 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin
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)
{

View File

@ -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;
}
}

View File

@ -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;
}