From 53b0ecce6009db3247fcfa3369e11887d2fe64b7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Fri, 5 Aug 2011 11:09:45 -0500 Subject: [PATCH] use the call_id of the original register in the unsolicited notify for MWI --- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/mod/endpoints/mod_sofia/sofia_glue.c | 3 ++- src/mod/endpoints/mod_sofia/sofia_presence.c | 7 ++++--- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 07c917cbca..a7bd1e6843 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1096,7 +1096,7 @@ void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port); sofia_destination_t *sofia_glue_get_destination(char *data); void sofia_glue_free_destination(sofia_destination_t *dst); switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, - const char *body, const char *o_contact, const char *network_ip); + const char *body, const char *o_contact, const char *network_ip, const char *call_id); char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix); void sofia_glue_set_extra_headers(switch_channel_t *channel, sip_t const *sip, const char *prefix); void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 54c946ad58..006f002334 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -6319,7 +6319,7 @@ void sofia_glue_free_destination(sofia_destination_t *dst) } switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, - const char *body, const char *o_contact, const char *network_ip) + const char *body, const char *o_contact, const char *network_ip, const char *call_id) { char *id = NULL; nua_handle_t *nh; @@ -6376,6 +6376,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use TAG_IF(dst->route_uri, NUTAG_PROXY(route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), TAG_IF(event, SIPTAG_EVENT_STR(event)), + TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), TAG_IF(contenttype, SIPTAG_CONTENT_TYPE_STR(contenttype)), TAG_IF(body, SIPTAG_PAYLOAD_STR(body)), TAG_END()); switch_safe_free(contact); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index a85138b8f6..f7b7a0aa84 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -484,10 +484,10 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) } if (for_everyone) { - sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' " + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q',call_id " "from sip_registrations where mwi_user='%q' and mwi_host='%q'", stream.data, user, host); } else if (call_id) { - sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' " + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q',call_id " "from sip_registrations where mwi_user='%q' and mwi_host='%q' and call_id='%q'", stream.data, user, host, call_id); } @@ -1860,6 +1860,7 @@ static int sofia_presence_mwi_callback2(void *pArg, int argc, char **argv, char const char *body = argv[5]; const char *o_contact = argv[2]; const char *network_ip = argv[4]; + const char *call_id = argv[6]; char *profile_name = argv[3]; struct mwi_helper *h = (struct mwi_helper *) pArg; @@ -1871,7 +1872,7 @@ static int sofia_presence_mwi_callback2(void *pArg, int argc, char **argv, char } } - sofia_glue_send_notify(profile, user, host, event, contenttype, body, o_contact, network_ip); + sofia_glue_send_notify(profile, user, host, event, contenttype, body, o_contact, network_ip, call_id); if (ext_profile) { sofia_glue_release_profile(ext_profile); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 4b5422fab6..1d014aff80 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -519,7 +519,7 @@ void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const cha event = "reboot"; } - sofia_glue_send_notify(profile, user, host, event, contenttype, body, contact, network_ip); + sofia_glue_send_notify(profile, user, host, event, contenttype, body, contact, network_ip, NULL); } int sofia_sla_dialog_del_callback(void *pArg, int argc, char **argv, char **columnNames)