char *user_via = NULL;
char *contact_str = NULL;
char *dup_dest = NULL;
+ char *p = NULL;
char *remote_host = NULL;
if (!to) {
/* sofia_glue is running sofia_overcome_sip_uri_weakness we do not, not sure if it matters */
- dup_dest = strdup(dst->contact);
+ if (dst->route_uri) {
+ dup_dest = strdup(dst->route_uri);
+ } else {
+ dup_dest = strdup(dst->to);
+ }
+
if (dst->route_uri) {
remote_host = strdup(dst->route_uri);
contact_str = profile->url;
}
- switch_safe_free(dup_dest);
- switch_safe_free(remote_host);
-
status = SWITCH_STATUS_SUCCESS;
- /*
- if ((p = strstr(contact, ";fs_"))) {
+ if (dup_dest && (p = strstr(dup_dest, ";fs_"))) {
*p = '\0';
}
- */
-
+
/* if this cries, add contact here too, change the 1 to 0 and omit the safe_free */
msg_nh = nua_handle(profile->nua, NULL,
TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
SIPTAG_FROM_STR(from),
TAG_IF(contact, NUTAG_URL(contact)),
- SIPTAG_TO_STR(dst->to),
+ SIPTAG_TO_STR(dup_dest),
SIPTAG_CONTACT_STR(contact_str),
TAG_END());
TAG_END());
sofia_glue_free_destination(dst);
+ switch_safe_free(dup_dest);
+ switch_safe_free(remote_host);
}
switch_console_free_matches(&list);