提交 dc9bf683 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-3714 --resolve You are using the sip_from_host and sip_to_host which are…

FS-3714 --resolve You are using the sip_from_host and sip_to_host which are calculated based on the response from the other end, this patch will pre-populate the variables with what it is suspeceted to be in these values but they are not guranteed to be right if there was forwarding etc and also it will not always be an ip if you send to foo@domain.com the sip_to_host will be domain.com until it replies.  This is the best you will get....
上级 092c2328
...@@ -1139,4 +1139,4 @@ void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str ...@@ -1139,4 +1139,4 @@ void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str
char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_dispatch_event_t *de, sofia_nat_parse_t *np); char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_dispatch_event_t *de, sofia_nat_parse_t *np);
void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on); void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on);
void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); void sofia_process_dispatch_event(sofia_dispatch_event_t **dep);
char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool);
...@@ -2240,6 +2240,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) ...@@ -2240,6 +2240,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
} }
switch_channel_set_variable(channel, "sip_req_uri", s); switch_channel_set_variable(channel, "sip_req_uri", s);
} }
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 (!(tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, if (!(tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
NUTAG_URL(url_str), NUTAG_URL(url_str),
...@@ -6785,6 +6788,31 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sof ...@@ -6785,6 +6788,31 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sof
return contact_str; return contact_str;
} }
char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool)
{
char *s, *p;
if ((p = strchr(str, '@'))) {
p++;
} else {
return NULL;
}
if (pool) {
s = switch_core_strdup(pool, p);
} else {
s = strdup(p);
}
for (p = s; p && *p; p++) {
if ((*p == ';') || (*p == '>')) {
*p = '\0';
break;
}
}
return s;
}
/* For Emacs: /* For Emacs:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论