]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10903: [mod_sofia,mod_valet_parking] Fix Issue with subscriptions and Valet Parkin...
authorBrian West <brian@freeswitch.org>
Sat, 13 Jan 2018 21:46:39 +0000 (15:46 -0600)
committerMuteesa Fred <muteesafred@hotmail.com>
Tue, 24 Jul 2018 07:21:39 +0000 (07:21 +0000)
src/mod/applications/mod_valet_parking/mod_valet_parking.c
src/mod/endpoints/mod_sofia/sofia_presence.c

index bcfe76d655b39bd81cb0dd2c4b4da7ec8bff650f..4bd9ac6e3d3ead2e66b574724dc662a34f6a201d 100644 (file)
@@ -786,6 +786,7 @@ static void pres_event_handler(switch_event_t *event)
        char *dup_to = NULL, *lot_name, *dup_lot_name = NULL, *domain_name;
        valet_lot_t *lot;
        int found = 0;
+       const char *call_id;
 
        if (!to || strncasecmp(to, "park+", 5) || !strchr(to, '@')) {
                return;
@@ -801,6 +802,8 @@ static void pres_event_handler(switch_event_t *event)
                *domain_name++ = '\0';
        }
 
+       call_id = switch_event_get_header(event, "sub-call-id");
+       
        dup_lot_name = switch_mprintf("%q@%q", lot_name, domain_name);
 
        if ((lot = valet_find_lot(lot_name, SWITCH_FALSE)) || (dup_lot_name && (lot = valet_find_lot(dup_lot_name, SWITCH_FALSE)))) {
@@ -821,6 +824,9 @@ static void pres_event_handler(switch_event_t *event)
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING");
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "confirmed");
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
+                               if (call_id) {
+                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-id", call_id);
+                               }
                                switch_event_fire(&event);
                        }
                        found++;
@@ -838,6 +844,9 @@ static void pres_event_handler(switch_event_t *event)
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_HANGUP");
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated");
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
+                               if (call_id) {
+                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-id", call_id);
+                               }
                                switch_event_fire(&event);
                        }
                }
@@ -883,6 +892,9 @@ static void pres_event_handler(switch_event_t *event)
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING");
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "confirmed");
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", token->bridged == 0 ? "outbound" : "inbound");
+                                               if (call_id) {
+                                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-id", call_id);
+                                               }
                                                switch_event_fire(&event);
                                        }
                                }
@@ -908,6 +920,9 @@ static void pres_event_handler(switch_event_t *event)
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_HANGUP");
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated");
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
+               if (call_id) {
+                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-id", call_id);
+               }
                switch_event_fire(&event);
        }
 
index ef3a4cfaad2ee6d7c1246d673a3a2ac2d865cfab..104a3ef4cb645823aeaf0c02c99170dbb42fa88e 100644 (file)
@@ -4366,6 +4366,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
                                switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "event_type", "presence");
                                switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
                                switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str);
+                               switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "sub-call-id", call_id);
                                switch_event_fire(&sevent);
 
                        }