switch_status_t sofia_on_hangup(switch_core_session_t *session);
char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup);
char *sofia_glue_get_path_from_contact(char *buf);
+char *sofia_glue_get_profile_url(sofia_profile_t *profile, char *remote_ip, const sofia_transport_t transport);
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, time_t prune);
int sofia_glue_init_sql(sofia_profile_t *profile);
user, ipv6 ? "[" : "", host, ipv6 ? "]" : "", port, sofia_glue_transport2str(transport));
if (sofia_glue_check_nat(profile, tech_pvt->mparams.remote_ip)) {
- url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
check_nat = 1;
- } else {
- url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
}
+ url = sofia_glue_get_profile_url(profile, tech_pvt->mparams.remote_ip, transport);
if (!url) {
if (check_nat) {
} else {
const char *url = NULL;
- if (sofia_glue_check_nat(profile, tech_pvt->mparams.remote_ip)) {
- url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
- } else {
- url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
- }
+ url = sofia_glue_get_profile_url(profile, tech_pvt->mparams.remote_ip, transport);
if (url) {
const char *brackets = NULL;
ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", tech_pvt->profile->extsipport);
}
} else {
- if (sofia_glue_transport_has_tls(tech_pvt->transport)) {
- tech_pvt->invite_contact = tech_pvt->profile->tls_url;
- } else {
- if (!zstr(tech_pvt->mparams.remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->mparams.remote_ip)) {
- tech_pvt->invite_contact = tech_pvt->profile->public_url;
- } else {
- tech_pvt->invite_contact = tech_pvt->profile->url;
- }
- }
+ sofia_glue_get_profile_url(tech_pvt->profile, tech_pvt->mparams.remote_ip, tech_pvt->transport);
}
}
}
+char *sofia_glue_get_profile_url(sofia_profile_t *profile, char *remote_ip, const sofia_transport_t transport)
+{
+ char *url = NULL;
+ int check_nat = 0;
+
+ if (!zstr(remote_ip) && sofia_glue_check_nat(profile, remote_ip)) {
+ check_nat = 1;
+ }
+
+ if (sofia_glue_transport_has_tls(transport)) {
+ if (check_nat && profile->tls_public_url) {
+ url = profile->tls_public_url;
+ } else {
+ url = profile->tls_url;
+ }
+ } else {
+ if (check_nat && profile->public_url) {
+ url = profile->public_url;
+ } else {
+ url = profile->url;
+ }
+ }
+
+ if (!url) url = profile->url;
+
+ return url;
+}
/* For Emacs:
* Local Variables: