FS-3663 --resolve

This commit is contained in:
Anthony Minessale 2011-11-04 13:16:47 -05:00
parent a48da3b46c
commit 0ed54079e4
3 changed files with 51 additions and 7 deletions

View File

@ -240,6 +240,7 @@ SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switc
SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone);
SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, switch_memory_pool_t *pool);
/*!
\brief Evaluate the truthfullness of a string expression

View File

@ -7404,16 +7404,12 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
}
if (sip->sip_from && sip->sip_from->a_url) {
char *tmp;
from_user = sip->sip_from->a_url->url_user;
from_host = sip->sip_from->a_url->url_host;
channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from);
if (sip->sip_from->a_url->url_params && (tmp = sofia_glue_find_parameter(sip->sip_from->a_url->url_params, "isup-oli="))) {
aniii = switch_core_session_strdup(session, tmp + 9);
if ((tmp = strchr(aniii, ';'))) {
tmp = '\0';
}
if (sip->sip_from->a_url->url_params) {
aniii = switch_find_parameter(sip->sip_from->a_url->url_params, "isup-oli", switch_core_session_get_pool(session));
}
if (!zstr(from_user)) {
@ -7755,7 +7751,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
if (sip->sip_request->rq_url->url_params) {
gw_param_name = sofia_glue_find_parameter_value(session, sip->sip_request->rq_url->url_params, "gw=");
gw_param_name = switch_find_parameter(sip->sip_request->rq_url->url_params, "gw", switch_core_session_get_pool(session));
}
if (strstr(destination_number, "gw+")) {

View File

@ -122,6 +122,53 @@ SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, switch_memory_pool_t *pool)
{
char *e, *r = NULL, *ptr = NULL, *next = NULL;
size_t len;
ptr = (char *) str;
while (ptr) {
len = strlen(param);
e = ptr+len;
next = strchr(ptr, ';');
if (!strncasecmp(ptr, param, len) && *e == '=') {
int mlen;
ptr = ++e;
if (next) {
e = next;
} else {
e = ptr + strlen(ptr);
}
mlen = (e - ptr) + 1;
if (pool) {
r = switch_core_alloc(pool, mlen);
} else {
r = malloc(mlen);
}
*(r + mlen) = '\0';
switch_snprintf(r, mlen, "%s", ptr);
break;
}
if (next) {
ptr = next + 1;
}
}
return r;
}
SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type,
switch_memory_pool_t *pool)
{