]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add mwi-use-reg-callid
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 21 May 2012 18:55:50 +0000 (13:55 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 21 May 2012 18:55:50 +0000 (13:55 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index c0fc7dfba45dbec6ec1c46b2a1a6d579740044f4..abbd1c226a99ced87f6598aea145b98abcd8b117 100644 (file)
@@ -267,6 +267,7 @@ typedef enum {
        PFLAG_PRESENCE_DISABLE_EARLY,
        PFLAG_CONFIRM_BLIND_TRANSFER,
        PFLAG_THREAD_PER_REG,
+       PFLAG_MWI_USE_REG_CALLID,
        /* No new flags below this line */
        PFLAG_MAX
 } PFLAGS;
@@ -1139,7 +1140,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_core_session_t *session, sip_t const *sip, const char *prefix);
 char *sofia_glue_get_extra_headers_from_event(switch_event_t *event, const char *prefix);
index 8eb122b310cd01a506d74416710d7c1770665064..549c8cd246bbdcb6ddb2dfcfe02b6250db46b9e5 100644 (file)
@@ -1415,7 +1415,7 @@ void sofia_msg_thread_start(int idx)
                mod_sofia_globals.msg_queue_len = idx + 1;
 
                if (!mod_sofia_globals.msg_queue) {
-                       switch_queue_create(&mod_sofia_globals.msg_queue, SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.cpu_count, mod_sofia_globals.pool);
+                       switch_queue_create(&mod_sofia_globals.msg_queue, SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.max_msg_queues, mod_sofia_globals.pool);
                }
 
 
@@ -3195,6 +3195,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                                                } else {
                                                        sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER);
                                                }
+                                       } else if (!strcasecmp(var, "mwi-use-reg-callid")) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_MWI_USE_REG_CALLID);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_MWI_USE_REG_CALLID);
+                                               }
                                        } else if (!strcasecmp(var, "presence-proto-lookup")) {
                                                if (switch_true(val)) {
                                                        sofia_set_pflag(profile, PFLAG_PRESENCE_MAP);
@@ -3994,6 +4000,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                } else {
                                                        sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER);
                                                }
+                                       } else if (!strcasecmp(var, "mwi-use-reg-callid")) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_MWI_USE_REG_CALLID);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_MWI_USE_REG_CALLID);
+                                               }
                                        } else if (!strcasecmp(var, "presence-proto-lookup")) {
                                                if (switch_true(val)) {
                                                        sofia_set_pflag(profile, PFLAG_PRESENCE_MAP);
index 2039116b41e0e4626971a3ce67131d59bba2d13a..85799d6c8a54df329fdab627c517fe28e8e281c1 100644 (file)
@@ -6643,7 +6643,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;
@@ -6706,6 +6706,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
                           TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
                           SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"),
                           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);
index 800ba66cd2bbf4395845c94cbb7588a8d2032330..23ae0175314ea46defef91909d076593aa5dfe44 100644 (file)
@@ -558,11 +558,11 @@ 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 hostname='%q' and profile_name='%q' and mwi_user='%q' and mwi_host='%q'", 
                                                         stream.data, mod_sofia_globals.hostname, profile->name, 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 hostname='%q' and profile_name='%q' and call_id='%q'", 
                                                         stream.data, mod_sofia_globals.hostname, profile->name, call_id);
        }
@@ -2914,6 +2914,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;
@@ -2925,7 +2926,11 @@ 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);
+       if (!sofia_test_pflag(profile, PFLAG_MWI_USE_REG_CALLID)) {
+               call_id = NULL;
+       }
+
+       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);
index c5fb57bb4dfdd77a2f930caf3f589748e9474cc1..a7a384ebe296ab54d70c5ce7988bf58577344023 100644 (file)
@@ -587,7 +587,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)