add sip_invite_params var

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7859 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-03-11 18:19:17 +00:00
parent 73d78231fc
commit 576c0c98fb
2 changed files with 32 additions and 10 deletions

View File

@ -529,7 +529,7 @@ char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup);
void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip);
void sofia_glue_sql_close(sofia_profile_t *profile);
int sofia_glue_init_sql(sofia_profile_t *profile);
char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only);
char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only, const char *params);
switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
switch_bool_t master,
switch_mutex_t *mutex,

View File

@ -670,7 +670,7 @@ int sofia_glue_transport_has_tls(const sofia_transport_t tp)
}
}
char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only)
char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only, const char *params)
{
char *stripped = switch_core_session_strdup(session, uri);
char *new_uri = NULL;
@ -681,15 +681,36 @@ char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char
if (switch_stristr("port=", stripped)) {
new_uri = switch_core_session_sprintf(session, "%s%s%s", uri_only ? "" : "<", stripped, uri_only ? "" : ">");
} else {
if (strchr(stripped, ';')) {
new_uri = switch_core_session_sprintf(session, "%s%s&transport=%s%s", uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), uri_only ? "" : ">");
if (params) {
new_uri = switch_core_session_sprintf(session, "%s%s&transport=%s&%s%s",
uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), params, uri_only ? "" : ">");
} else {
new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s%s", uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), uri_only ? "" : ">");
new_uri = switch_core_session_sprintf(session, "%s%s&transport=%s%s",
uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), uri_only ? "" : ">");
}
} else {
if (params) {
new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s&%s%s",
uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), params, uri_only ? "" : ">");
} else {
new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s%s",
uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), uri_only ? "" : ">");
}
}
}
} else {
if (params) {
if (strchr(stripped, ';')) {
new_uri = switch_core_session_sprintf(session, "%s&%s", stripped, params);
} else {
new_uri = switch_core_session_sprintf(session, "%s;%s", stripped, params);
}
} else {
new_uri = stripped;
}
}
return new_uri;
}
@ -963,10 +984,11 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
}
}
url_str = sofia_overcome_sip_uri_weakness(session, url, tech_pvt->transport, SWITCH_TRUE);
invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE);
from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_FALSE);
to_str = sofia_overcome_sip_uri_weakness(session, tech_pvt->dest_to, 0, SWITCH_FALSE);
url_str = sofia_overcome_sip_uri_weakness(session, url, tech_pvt->transport, SWITCH_TRUE,
switch_channel_get_variable(tech_pvt->channel, "sip_invite_params"));
invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, NULL);
from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_FALSE, NULL);
to_str = sofia_overcome_sip_uri_weakness(session, tech_pvt->dest_to, 0, SWITCH_FALSE, NULL);
/*
Does the "genius" who wanted SIP to be "text-based" so it was "easier to read" even use it now,