From 9b086c4beac23e4bd28e225eae0b0d2336e1c6b3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Feb 2012 11:59:57 -0600 Subject: [PATCH] FS-3881 try this, i think the contact in the notify is causing the phone to change the destination for future subs --- src/mod/endpoints/mod_sofia/sofia_presence.c | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 2818d7c5f6..75c663ef07 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1835,7 +1835,7 @@ static void _send_presence_notify(sofia_profile_t *profile, sofia_destination_t *dst = NULL; char *contact_str, *contact, *user_via = NULL; - char *route_uri = NULL, *o_contact_dup = NULL, *tmp; + char *route_uri = NULL, *o_contact_dup = NULL, *tmp, *to_uri, *dcs = NULL; const char *tp; tmp = (char *)o_contact; @@ -1882,6 +1882,27 @@ static void _send_presence_notify(sofia_profile_t *profile, } else { contact_str = our_contact; } + + + if ((to_uri = sofia_glue_get_url_from_contact((char *)full_to, 1))) { + char *p; + + if ((p = strstr(to_uri, "sip:"))) { + char *q; + + p += 4; + if ((q = strchr(p, '@'))) { + *q++ = '\0'; + + if ((dcs = switch_string_replace(contact_str, "mod_sofia", p))) { + contact_str = dcs; + } + + } + } + + free(to_uri); + } dst = sofia_glue_get_destination((char *) o_contact); switch_assert(dst); @@ -1980,6 +2001,7 @@ static void _send_presence_notify(sofia_profile_t *profile, switch_safe_free(route_uri); + switch_safe_free(dcs); switch_safe_free(contact); sofia_glue_free_destination(dst);