Index: src/mod/endpoints/mod_sofia/sofia_reg.c
===================================================================
--- src/mod/endpoints/mod_sofia/sofia_reg.c	(revision 10566)
+++ src/mod/endpoints/mod_sofia/sofia_reg.c	(working copy)
@@ -351,7 +351,7 @@
 	char to[128] = "";
 
 	switch_snprintf(to, sizeof(to), "sip:%s@%s", argv[1], argv[2]);
-	contact = sofia_glue_get_url_from_contact(argv[3], 1);
+	contact = sofia_glue_get_url_from_contact(argv[3], 1, 0);
 
 	nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
 	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
@@ -389,7 +389,7 @@
 		event = "reboot_now";
 	}
 
-	if ((contact_url = sofia_glue_get_url_from_contact((char *)contact, 1))) {
+	if ((contact_url = sofia_glue_get_url_from_contact((char *)contact, 1, 0))) {
 		char *p;
 		id = switch_mprintf("sip:%s@%s", user, host);
 
@@ -830,10 +830,10 @@
 				if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
 					!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
 					if (contact->m_url->url_params) {
-						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s%s;fs_nat=yes>",
+						switch_snprintf(contact_str, sizeof(contact_str), "%s <%s:%s@%s:%d;%s%s;fs_nat=yes>", contact->m_url->url_scheme,
 										display, contact->m_url->url_user, url_ip, network_port, contact->m_url->url_params, received_data);
 					} else {
-						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d%s;fs_nat=yes>", display, contact->m_url->url_user, url_ip,
+						switch_snprintf(contact_str, sizeof(contact_str), "%s <%s:%s@%s:%d%s;fs_nat=yes>", contact->m_url->url_scheme, display, contact->m_url->url_user, url_ip,
 										network_port, received_data);
 					}
 					if (strstr(v_contact_str, "tls")) {
@@ -983,7 +983,7 @@
 	} else {
 		if (multi_reg) {
 			char *icontact, *p;
-			icontact = sofia_glue_get_url_from_contact(contact_str, 1);
+			icontact = sofia_glue_get_url_from_contact(contact_str, 1, 0);
 			if ((p = strchr(icontact, ';'))) {
 				*p = '\0';
 			}
Index: src/mod/endpoints/mod_sofia/mod_sofia.c
===================================================================
--- src/mod/endpoints/mod_sofia/mod_sofia.c	(revision 10566)
+++ src/mod/endpoints/mod_sofia/mod_sofia.c	(working copy)
@@ -1818,8 +1818,8 @@
 	struct cb_helper *cb = (struct cb_helper *) pArg;
 	char *contact;
 
-	if (!switch_strlen_zero(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1)) ) {
-		cb->stream->write_function(cb->stream, "%ssofia/%s/sip:%s,", argv[2], argv[1], sofia_glue_strip_proto(contact));
+	if (!switch_strlen_zero(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1, 1)) ) {
+		cb->stream->write_function(cb->stream, "%ssofia/%s/sip:%s,", argv[2], argv[1], contact);
 		free(contact);
 	}
 
@@ -2335,7 +2335,7 @@
 
 	id = switch_mprintf("sip:%s@%s", user, host);
 	switch_assert(id);
-	contact = sofia_glue_get_url_from_contact(contact_in, 1);
+	contact = sofia_glue_get_url_from_contact(contact_in, 1, 0);
 				
 	if ((p = strstr(contact, ";fs_"))) {
 		*p = '\0';
@@ -2435,7 +2435,7 @@
 				id = switch_mprintf("sip:%s@%s", user, host);
 
 				switch_assert(id);
-				contact = sofia_glue_get_url_from_contact(buf, 0);
+				contact = sofia_glue_get_url_from_contact(buf, 0, 0);
 
 				if ((p = strstr(contact, ";fs_"))) {
 					*p = '\0';
Index: src/mod/endpoints/mod_sofia/sofia.c
===================================================================
--- src/mod/endpoints/mod_sofia/sofia.c	(revision 10566)
+++ src/mod/endpoints/mod_sofia/sofia.c	(working copy)
@@ -1136,12 +1136,14 @@
 				params = switch_core_sprintf(gateway->pool, ";transport=%s", register_transport);
 			}
 
-			gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", proxy, register_transport);
-			gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", from_user, from_domain, register_transport);
+			gateway->register_url = switch_core_sprintf(gateway->pool, "%s:%s;transport=%s", sofia_glue_transport2scheme(gateway->register_transport), proxy, register_transport);
+			gateway->register_from = switch_core_sprintf(gateway->pool, "<%s:%s@%s;transport=%s>", sofia_glue_transport2scheme(gateway->register_transport), from_user, from_domain, register_transport);
 
 			sipip = profile->extsipip ?  profile->extsipip : profile->sipip;
-			format = strchr(sipip, ':') ? "<sip:%s@[%s]:%d%s>" : "<sip:%s@%s:%d%s>";
-			gateway->register_contact = switch_core_sprintf(gateway->pool, format, extension,
+			format = strchr(sipip, ':') ? "<%s:%s@[%s]:%d%s>" : "<%s:%s@%s:%d%s>";
+			gateway->register_contact = switch_core_sprintf(gateway->pool, format,
+															sofia_glue_transport2scheme(gateway->register_transport),
+															extension,
 															sipip,
 															sofia_glue_transport_has_tls(gateway->register_transport) ? profile->tls_sip_port : profile->
 															sip_port, params);
@@ -1149,6 +1151,9 @@
 			if (!strncasecmp(proxy, "sip:", 4)) {
 				gateway->register_proxy = switch_core_strdup(gateway->pool, proxy);
 				gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4);
+			} else if (!strncasecmp(proxy, "sips:", 5)) {
+				gateway->register_proxy = switch_core_strdup(gateway->pool, proxy);
+				gateway->register_to = switch_core_sprintf(gateway->pool, "sips:%s@%s", username, proxy + 4);
 			} else {
 				gateway->register_proxy = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
 				gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy);
@@ -3364,8 +3369,8 @@
 								headers = switch_core_session_sprintf(session, "?%s", refer_to->r_url->url_headers);
 							}
 
-							exten = switch_core_session_sprintf(session, "sofia/%s/sip:%s@%s:%s%s%s", 
-																profile->name, refer_to->r_url->url_user, 
+							exten = switch_core_session_sprintf(session, "sofia/%s/%s:%s@%s:%s%s%s", 
+																profile->name, refer_to->r_url->url_scheme, refer_to->r_url->url_user, 
 																refer_to->r_url->url_host, port, param_string, headers);
 
 							switch_core_new_memory_pool(&npool);
@@ -3811,7 +3816,8 @@
 		const char *ipv6 = strchr(tech_pvt->remote_ip, ':');
 		tech_pvt->record_route =
 			switch_core_session_sprintf(session,
-			"sip:%s@%s%s%s:%d;transport=%s",
+			"%s:%s@%s%s%s:%d;transport=%s",
+			sip->sip_contact->m_url->url_scheme,
 			sip->sip_contact->m_url->url_user,
 			ipv6 ? "[" : "",
 			tech_pvt->remote_ip,
@@ -3957,7 +3963,8 @@
 			ipv6 = strchr(host, ':');
 			tech_pvt->to_uri =
 				switch_core_session_sprintf(session,
-					"sip:%s@%s%s%s:%d;transport=%s",
+					"%s:%s@%s%s%s:%d;transport=%s",
+					sofia_glue_transport2scheme(transport),
 					user, ipv6 ? "[" : "",
 					host, ipv6 ? "]" : "",
 					port,
@@ -4075,7 +4082,7 @@
 		char *from_key;
 		char *user = (char *) sip->sip_request->rq_url->url_user;
 		check_decode(user, session);
-		from_key = switch_core_session_sprintf(session, "sip:%s@%s", user, sip->sip_request->rq_url->url_host);
+		from_key = switch_core_session_sprintf(session, "%s:%s@%s", sip->sip_request->rq_url->url_scheme, user, sip->sip_request->rq_url->url_host);
 
 		if ((gateway = sofia_reg_find_gateway(from_key))) {
 			context = gateway->register_context;
Index: src/mod/endpoints/mod_sofia/mod_sofia.h
===================================================================
--- src/mod/endpoints/mod_sofia/mod_sofia.h	(revision 10566)
+++ src/mod/endpoints/mod_sofia/mod_sofia.h	(working copy)
@@ -264,11 +264,16 @@
 } reg_state_t;
 
 typedef enum {
-	SOFIA_TRANSPORT_UNKNOWN = 0,
-	SOFIA_TRANSPORT_UDP,
-	SOFIA_TRANSPORT_TCP,
-	SOFIA_TRANSPORT_TCP_TLS,
-	SOFIA_TRANSPORT_SCTP
+	SOFIA_TRANSPORT_UNKNOWN = 0,			/*!< transport could not be identified */
+	SOFIA_TRANSPORT_UDP	= (1 << 0),		/*!< UDP: no TLS support */
+	SOFIA_TRANSPORT_TCP	= (1 << 1),		/*!< TCP: both */
+	SOFIA_TRANSPORT_SCTP	= (1 << 2),		/*!< SCTP: both, not sure if sofia-sip supports SCTP TLS */
+
+	SOFIA_TRANSPORT_SECURE	= (1 << 16),		/*!< secure transport (using TLS) */
+	SOFIA_TRANSPORT_SIPS	= (1 << 17),		/*!< sips: scheme flag */
+
+	SOFIA_TRANSPORT_TCP_TLS = (SOFIA_TRANSPORT_TCP | SOFIA_TRANSPORT_SECURE),				/*!< TCP TLS, either tcp + "sips:" or tls transport with "sip:" */
+	SOFIA_TRANSPORT_SCTP_TLS= (SOFIA_TRANSPORT_SCTP | SOFIA_TRANSPORT_SECURE | SOFIA_TRANSPORT_SIPS),	/*!< SCTP TLS is "sips:" only */
 } sofia_transport_t;
 
 typedef enum {
@@ -669,7 +674,7 @@
 extern switch_endpoint_interface_t *sofia_endpoint_interface;
 void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip);
 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_url_from_contact(char *buf, const uint8_t to_dup, const uint8_t strip_proto);
 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);
@@ -737,6 +742,7 @@
 sofia_transport_t sofia_glue_str2transport(const char *str);
 
 const char *sofia_glue_transport2str(const sofia_transport_t tp);
+const char *sofia_glue_transport2scheme(const sofia_transport_t tp);
 char * sofia_glue_find_parameter(const char *str, const char *param);
 
 int sofia_glue_transport_has_tls(const sofia_transport_t tp);
Index: src/mod/endpoints/mod_sofia/sofia_presence.c
===================================================================
--- src/mod/endpoints/mod_sofia/sofia_presence.c	(revision 10566)
+++ src/mod/endpoints/mod_sofia/sofia_presence.c	(working copy)
@@ -120,7 +120,7 @@
 	}
 
 	status = SWITCH_STATUS_SUCCESS;
-	contact = sofia_glue_get_url_from_contact(buf, 1);
+	contact = sofia_glue_get_url_from_contact(buf, 1, 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, SIPTAG_FROM_STR(from), NUTAG_URL(contact), SIPTAG_TO_STR(buf),	
 						SIPTAG_CONTACT_STR(profile->url), TAG_END());
@@ -1242,7 +1242,7 @@
 
 	id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
 
-	contact = sofia_glue_get_url_from_contact(o_contact, 1);
+	contact = sofia_glue_get_url_from_contact(o_contact, 1, 0);
 	if ((route = strstr(contact, ";fs_path=")) && (route = strdup(route + 9))) {
 		
 		for (p = route; p && *p ; p++) {
@@ -1409,7 +1409,8 @@
 
 		ipv6 = strchr(contact_host, ':');
 		if (contact->m_url->url_params) {
-			contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s;%s>%s",
+			contact_str = switch_mprintf("%s <%s:%s@%s%s%s%s;%s>%s",
+										contact->m_url->url_scheme,
 										display, contact->m_url->url_user,
 										ipv6 ? "[" : "",
 										contact_host,
@@ -1418,7 +1419,8 @@
 										contact->m_url->url_params,
 										is_nat ? ";nat" : "");
 		} else {
-			contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s>%s",
+			contact_str = switch_mprintf("%s <%s:%s@%s%s%s%s>%s",
+										contact->m_url->url_scheme,
 										display,
 										contact->m_url->url_user,
 										ipv6 ? "[" : "",
@@ -1548,7 +1550,8 @@
 					switch_snprintf(params, sizeof(params), ";%s", contact->m_url->url_params);
 				}
 				ipv6 = strchr(network_ip, ':');
-				sticky = switch_mprintf("sip:%s@%s%s%s:%d%s",
+				sticky = switch_mprintf("%s:%s@%s%s%s:%d%s",
+										contact->m_url->url_scheme,
 										contact_user,
 										ipv6 ? "[" : "",
 										network_ip,
Index: src/mod/endpoints/mod_sofia/sofia_glue.c
===================================================================
--- src/mod/endpoints/mod_sofia/sofia_glue.c	(revision 10566)
+++ src/mod/endpoints/mod_sofia/sofia_glue.c	(working copy)
@@ -629,21 +629,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-sofia_transport_t sofia_glue_str2transport(const char *str)
-{
-	if (!strncasecmp(str, "udp", 3)) {
-		return SOFIA_TRANSPORT_UDP;
-	} else if (!strncasecmp(str, "tcp", 3)) {
-		return SOFIA_TRANSPORT_TCP;
-	} else if (!strncasecmp(str, "sctp", 4)) {
-		return SOFIA_TRANSPORT_SCTP;
-	} else if (!strncasecmp(str, "tls", 3)) {
-		return SOFIA_TRANSPORT_TCP_TLS;
-	}
-
-	return SOFIA_TRANSPORT_UNKNOWN;
-}
-
 char *sofia_glue_find_parameter(const char *str, const char *param)
 {
 	char *ptr = NULL;
@@ -660,47 +645,90 @@
 	return NULL;
 }
 
+
+sofia_transport_t sofia_glue_str2transport(const char *str)
+{
+	if (!strncasecmp(str, "udp", 3)) {
+		return SOFIA_TRANSPORT_UDP;
+	} else if (!strncasecmp(str, "tcp", 3)) {
+		return SOFIA_TRANSPORT_TCP;
+	} else if (!strncasecmp(str, "sctp", 4)) {
+		return SOFIA_TRANSPORT_SCTP;
+	} else if (!strncasecmp(str, "tls", 3)) {
+		return SOFIA_TRANSPORT_TCP_TLS;
+	}
+
+	return SOFIA_TRANSPORT_UNKNOWN;
+}
+
 sofia_transport_t sofia_glue_url2transport(const url_t *url)
 {
-	char *ptr = NULL;
-	int tls = 0;
+	sofia_transport_t tp = SOFIA_TRANSPORT_UNKNOWN;
+	char buf[10];
 
 	if (!url)
 		return SOFIA_TRANSPORT_UNKNOWN;
 
-	if (url->url_scheme && !strcasecmp(url->url_scheme, "sips")) {
-		tls++;
+	if (url_param(url->url_params, "transport=", buf, sizeof(buf))) {
+		tp = sofia_glue_str2transport(buf);
 	}
 
-	if ((ptr = sofia_glue_find_parameter(url->url_params, "transport="))) {
-		return sofia_glue_str2transport(ptr + 10);
+	/*
+	 * stop here if the transport is unknown or if it doesn't support tls (UDP...)
+	 */
+	if (tp == SOFIA_TRANSPORT_UNKNOWN || tp == SOFIA_TRANSPORT_UDP)
+		return tp;
+
+	/*
+	 * check if transport=tls has been set, if not parse scheme and security param
+	 * (backward compat)
+	 */
+	if (!sofia_glue_transport_has_tls(tp)) {
+		if (url_param(url->url_params, "security=on", NULL, 0)) {
+			tp |= SOFIA_TRANSPORT_SECURE;
+		}
+
+		if (url->url_type == url_sips) {					/* shortcut */
+			tp |= SOFIA_TRANSPORT_SIPS | SOFIA_TRANSPORT_SECURE;
+		}
+		else if (url->url_scheme && !strcasecmp(url->url_scheme, "sips")) {	/* shortcut didn't work, parse scheme */
+			tp |= SOFIA_TRANSPORT_SIPS | SOFIA_TRANSPORT_SECURE;
+		}
 	}
-
-	return (tls) ? SOFIA_TRANSPORT_TCP_TLS : SOFIA_TRANSPORT_UDP;
+	return tp;
 }
 
 sofia_transport_t sofia_glue_via2transport(const sip_via_t *via)
 {
+	sofia_transport_t tp = SOFIA_TRANSPORT_UNKNOWN;
 	char *ptr = NULL;
 
 	if (!via || !via->v_protocol)
 		return SOFIA_TRANSPORT_UNKNOWN;
 
+	/*
+	 *
+	 */
 	if ((ptr = strrchr(via->v_protocol, '/'))) {
-		ptr++;
+		tp = sofia_glue_str2transport(++ptr);
+	}
 
-		if (!strncasecmp(ptr, "udp", 3)) {
-			return SOFIA_TRANSPORT_UDP;
-		} else if (!strncasecmp(ptr, "tcp", 3)) {
-			return SOFIA_TRANSPORT_TCP;
-		} else if (!strncasecmp(ptr, "tls", 3)) {
-			return SOFIA_TRANSPORT_TCP_TLS;
-		} else if (!strncasecmp(ptr, "sctp", 4)) {
-			return SOFIA_TRANSPORT_SCTP;
+	/*
+	 * stop here if the transport is unknown or if it doesn't support tls (UDP...)
+	 */
+	if (tp == SOFIA_TRANSPORT_UNKNOWN || tp == SOFIA_TRANSPORT_UDP)
+		return tp;
+
+	/*
+	 * check scheme only if not transport=tls (backward compat)
+	 */
+	if (!sofia_glue_transport_has_tls(tp)) {
+		/* SIPS scheme? */
+		if (!strcasecmp(via->v_protocol, "sips")) {
+			tp |= SOFIA_TRANSPORT_SIPS | SOFIA_TRANSPORT_SECURE;
 		}
 	}
-
-	return SOFIA_TRANSPORT_UNKNOWN;
+	return tp;
 }
 
 const char *sofia_glue_transport2str(const sofia_transport_t tp)
@@ -710,9 +738,10 @@
 		return "tcp";
 
 	case SOFIA_TRANSPORT_TCP_TLS:
-		return "tls";
+		return (tp & SOFIA_TRANSPORT_SIPS) ? "tcp" : "tls";
 
 	case SOFIA_TRANSPORT_SCTP:
+	case SOFIA_TRANSPORT_SCTP_TLS:
 		return "sctp";
 
 	default:
@@ -720,17 +749,30 @@
 	}
 }
 
+const char *sofia_glue_transport2scheme(const sofia_transport_t tp)
+{
+	if (tp & SOFIA_TRANSPORT_SIPS)
+		return "sips";
+
+	return "sip";
+}
+
 int sofia_glue_transport_has_tls(const sofia_transport_t tp)
 {
-	switch (tp) {
-	case SOFIA_TRANSPORT_TCP_TLS:
+	if (tp & SOFIA_TRANSPORT_SECURE)
 		return 1;
 
-	default:
-		return 0;
-	}
+	return 0;
 }
 
+int sofia_glue_transport_is_sips(const sofia_transport_t tp)
+{
+	if (tp & SOFIA_TRANSPORT_SIPS)
+		return 1;
+
+	return 0;
+}
+
 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)
 {
@@ -738,7 +780,7 @@
 	char *new_uri = NULL;
 	char *p;
 
-	stripped = sofia_glue_get_url_from_contact(stripped, 0);
+	stripped = sofia_glue_get_url_from_contact(stripped, 0, 1);
 
 	/* remove our params so we don't make any whiny moronic device piss it's pants and forget who it is for a half-hour */
 	if ((p = (char *)switch_stristr(";fs_", stripped))) {
@@ -748,30 +790,30 @@
 	if (transport && transport != SOFIA_TRANSPORT_UDP) {
 
 		if (switch_stristr("port=", stripped)) {
-			new_uri = switch_core_session_sprintf(session, "%s%s%s", uri_only ? "" : "<", stripped, uri_only ? "" : ">");
+			new_uri = switch_core_session_sprintf(session, "%s%s%s%s", uri_only ? "" : "<", sofia_glue_transport2scheme(transport), stripped, uri_only ? "" : ">");
 		} else {
 
 			if (strchr(stripped, ';')) {
 				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 ? "" : ">");
+					new_uri = switch_core_session_sprintf(session, "%s%s%s&transport=%s;%s%s",
+														  uri_only ? "" : "<", sofia_glue_transport2scheme(transport), 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%s&transport=%s%s",
+														  uri_only ? "" : "<", sofia_glue_transport2scheme(transport), 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 ? "" : ">");
+					new_uri = switch_core_session_sprintf(session, "%s%s%s;transport=%s;%s%s",
+														  uri_only ? "" : "<", sofia_glue_transport2scheme(transport), 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%s;transport=%s%s",
+														  uri_only ? "" : "<", sofia_glue_transport2scheme(transport), stripped, sofia_glue_transport2str(transport), uri_only ? "" : ">");
 				}
 			}
 		}
 	} else {
 		if (params) {
-			new_uri = switch_core_session_sprintf(session, "%s%s;%s%s", uri_only ? "" : "<", stripped, params, uri_only ? "" : ">");
+			new_uri = switch_core_session_sprintf(session, "%ssip:%s;%s%s", uri_only ? "" : "<", stripped, params, uri_only ? "" : ">");
 		} else {
 			if (uri_only) {
 				new_uri = stripped;
@@ -1098,7 +1140,7 @@
 			return SWITCH_STATUS_FALSE;
 		}
 
-		if ((d_url = sofia_glue_get_url_from_contact(tech_pvt->dest, 1))) {
+		if ((d_url = sofia_glue_get_url_from_contact(tech_pvt->dest, 1, 0))) {
 			url = d_url;
 		} else {
 			url = tech_pvt->dest;
@@ -1119,7 +1161,7 @@
 		}
 
 		rpid_domain = switch_core_session_strdup(session, use_from_str);
-		sofia_glue_get_url_from_contact(rpid_domain, 0);
+		sofia_glue_get_url_from_contact(rpid_domain, 0, 0);
 		if ((rpid_domain = strrchr(rpid_domain, '@'))) {
 			rpid_domain++;
 			if ((p = strchr(rpid_domain, ';'))) {
@@ -2636,12 +2678,17 @@
 	}
 }
 
-char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup)
+char *sofia_glue_get_url_from_contact(char *buf, const uint8_t to_dup, const uint8_t strip_proto)
 {
-	char *url = NULL, *e;
+	char *url = NULL, *e, *p;
 
 	if ((url = strchr(buf, '<')) && (e = strchr(url, '>'))) {
 		url++;
+
+		if (strip_proto && (p = strchr(buf, ':'))) {
+			url = ++p;
+		}
+
 		if (to_dup) {
 			url = strdup(url);
 			e = strchr(url, '>');
@@ -2649,12 +2696,17 @@
 
 		*e = '\0';
 	} else {
+		if (strip_proto && (p = strchr(buf, ':'))) {
+			buf = ++p;
+		}
+
 		if (to_dup) {
 			url = strdup(buf);
 		} else {
 			url = buf;
 		}
 	}
+
 	return url;
 }
 
