try to auto guess presence_id where possible

This commit is contained in:
Anthony Minessale committed 2012-02-15 15:22:28 -06:00
1 parent 02ea0221ab
commit 5e224c9f93
2 files changed
+22

No files matched your search

+19
View File
@@ -2291,6 +2291,25 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
switch_channel_set_variable(channel, "sip_to_host", sofia_glue_get_host(to_str, switch_core_session_get_pool(session)));
switch_channel_set_variable(channel, "sip_from_host", sofia_glue_get_host(from_str, switch_core_session_get_pool(session)));
if (!switch_channel_get_variable(channel, "presence_id")) {
char *from = switch_core_session_strdup(session, from_str);
if (!strncasecmp(from, "sip:", 4)) {
from += 4;
}
if (!strncasecmp(from, "sips:", 4)) {
from += 5;
}
if ((p = strchr(from, ':')) || (p = strchr(from, ';'))) {
*p++ = '\0';
}
switch_channel_set_variable(channel, "presence_id", from);
}
if (!(tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
NUTAG_URL(url_str),
TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)),