revert mod_lcr changes
This commit is contained in:
parent
ab2165c56b
commit
415b4589ac
|
@ -126,6 +126,7 @@ struct profile_obj {
|
|||
switch_bool_t reorder_by_rate;
|
||||
switch_bool_t quote_in_list;
|
||||
switch_bool_t info_in_headers;
|
||||
switch_bool_t enable_sip_redir;
|
||||
};
|
||||
typedef struct profile_obj profile_t;
|
||||
|
||||
|
@ -294,9 +295,18 @@ static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, ch
|
|||
user_rate = switch_core_sprintf(pool, ",lcr_user_rate=%s", cur_route->user_rate_str);
|
||||
}
|
||||
|
||||
data =
|
||||
switch_core_sprintf(pool, "[lcr_carrier=%s,lcr_rate=%s%s%s%s%s]%s%s%s%s%s", cur_route->carrier_name, cur_route->rate_str, user_rate, codec, cid,
|
||||
header, cur_route->gw_prefix, cur_route->prefix, destination_number, cur_route->suffix, cur_route->gw_suffix);
|
||||
if (profile->enable_sip_redir) {
|
||||
data =
|
||||
switch_core_sprintf(pool, "%s%s%s%s%s", cur_route->gw_prefix, cur_route->prefix, destination_number, cur_route->suffix, cur_route->gw_suffix);
|
||||
} else {
|
||||
data =
|
||||
switch_core_sprintf(pool, "[lcr_carrier=%s,lcr_rate=%s%s%s%s%s]%s%s%s%s%s", cur_route->carrier_name, cur_route->rate_str, user_rate, codec, cid,
|
||||
header, cur_route->gw_prefix, cur_route->prefix, destination_number, cur_route->suffix, cur_route->gw_suffix);
|
||||
}
|
||||
|
||||
if (session && (switch_string_var_check_const(data) || switch_string_has_escaped_data(data))) {
|
||||
data = switch_channel_expand_variables(switch_core_session_get_channel(session), data);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Returning Dialstring %s\n", data);
|
||||
return data;
|
||||
|
@ -405,7 +415,7 @@ static switch_bool_t db_check(char *sql)
|
|||
switch_cache_db_handle_t *dbh = NULL;
|
||||
|
||||
if (globals.odbc_dsn && (dbh = lcr_get_db_handle())) {
|
||||
if (switch_cache_db_execute_sql(dbh, sql, NULL) == SWITCH_ODBC_SUCCESS) {
|
||||
if (switch_cache_db_execute_sql(dbh, sql, NULL) == SWITCH_STATUS_SUCCESS) {
|
||||
ret = SWITCH_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -535,8 +545,7 @@ static switch_bool_t lcr_execute_sql_callback(char *sql, switch_core_db_callback
|
|||
switch_cache_db_handle_t *dbh = NULL;
|
||||
|
||||
if (globals.odbc_dsn && (dbh = lcr_get_db_handle())) {
|
||||
if (switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, NULL)
|
||||
== SWITCH_ODBC_FAIL) {
|
||||
if (switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
retval = SWITCH_FALSE;
|
||||
} else {
|
||||
retval = SWITCH_TRUE;
|
||||
|
@ -691,12 +700,12 @@ static switch_status_t is_intrastatelata(callback_t *cb_struct)
|
|||
e164 format without the +
|
||||
NANP only (so 11 digits starting with 1)
|
||||
*/
|
||||
if (!cb_struct->lookup_number || strlen(cb_struct->lookup_number) != 11 || *cb_struct->lookup_number != '1' ||
|
||||
if (!cb_struct->lookup_number || (strlen(cb_struct->lookup_number) != 11 && *cb_struct->lookup_number != '1') ||
|
||||
!switch_is_number(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)) {
|
||||
if (!cb_struct->cid || (strlen(cb_struct->cid) != 11 && *cb_struct->cid != '1') || !switch_is_number(cb_struct->cid)) {
|
||||
/* cid not NANP */
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
@ -903,6 +912,7 @@ static switch_status_t lcr_load_config()
|
|||
char *reorder_by_rate = NULL;
|
||||
char *quote_in_list = NULL;
|
||||
char *info_in_headers = NULL;
|
||||
char *enable_sip_redir = NULL;
|
||||
char *id_s = NULL;
|
||||
char *custom_sql = NULL;
|
||||
int argc, x = 0;
|
||||
|
@ -955,6 +965,8 @@ static switch_status_t lcr_load_config()
|
|||
info_in_headers = val;
|
||||
} else if (!strcasecmp(var, "quote_in_list") && !zstr(val)) {
|
||||
quote_in_list = val;
|
||||
} else if (!strcasecmp(var, "enable_sip_redir") && !zstr(val)) {
|
||||
enable_sip_redir = val;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1045,6 +1057,10 @@ static switch_status_t lcr_load_config()
|
|||
profile->info_in_headers = switch_true(info_in_headers);
|
||||
}
|
||||
|
||||
if (!zstr(enable_sip_redir)) {
|
||||
profile->enable_sip_redir = switch_true(enable_sip_redir);
|
||||
}
|
||||
|
||||
if (!zstr(quote_in_list)) {
|
||||
profile->quote_in_list = switch_true(quote_in_list);
|
||||
}
|
||||
|
@ -1252,7 +1268,11 @@ SWITCH_STANDARD_APP(lcr_app_function)
|
|||
switch_channel_set_variable(channel, vbuf, cur_route->codec);
|
||||
cnt++;
|
||||
if (cur_route->next) {
|
||||
dig_stream.write_function(&dig_stream, "%s|", cur_route->dialstring);
|
||||
if (routes.profile->enable_sip_redir) {
|
||||
dig_stream.write_function(&dig_stream, "%s,", cur_route->dialstring);
|
||||
} else {
|
||||
dig_stream.write_function(&dig_stream, "%s|", cur_route->dialstring);
|
||||
}
|
||||
} else {
|
||||
dig_stream.write_function(&dig_stream, "%s", cur_route->dialstring);
|
||||
}
|
||||
|
@ -1499,6 +1519,7 @@ SWITCH_STANDARD_API(dialplan_lcr_admin_function)
|
|||
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, " Sip Redirection Mode:\t%s\n", profile->enable_sip_redir ? "enabled" : "disabled");
|
||||
stream->write_function(stream, " Quote IN() List:\t%s\n", profile->quote_in_list ? "enabled" : "disabled");
|
||||
stream->write_function(stream, "\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue