FS-10903: [mod_sofia,mod_valet_parking] Fix Issue with subscriptions and Valet Parking #resolve

This commit is contained in:
Brian West 2018-01-13 15:46:39 -06:00 committed by Mike Jerris
parent 583bcded23
commit 9b61add5e9
2 changed files with 16 additions and 0 deletions

View 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; char *dup_to = NULL, *lot_name, *dup_lot_name = NULL, *domain_name;
valet_lot_t *lot; valet_lot_t *lot;
int found = 0; int found = 0;
const char *call_id;
if (!to || strncasecmp(to, "park+", 5) || !strchr(to, '@')) { if (!to || strncasecmp(to, "park+", 5) || !strchr(to, '@')) {
return; return;
@ -801,6 +802,8 @@ static void pres_event_handler(switch_event_t *event)
*domain_name++ = '\0'; *domain_name++ = '\0';
} }
call_id = switch_event_get_header(event, "sub-call-id");
dup_lot_name = switch_mprintf("%q@%q", lot_name, domain_name); 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)))) { 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, "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, "answer-state", "confirmed");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound"); 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); switch_event_fire(&event);
} }
found++; 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, "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, "answer-state", "terminated");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound"); 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); 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, "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, "answer-state", "confirmed");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", token->bridged == 0 ? "outbound" : "inbound"); 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); 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, "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, "answer-state", "terminated");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound"); 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); switch_event_fire(&event);
} }

View File

@ -4364,6 +4364,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, "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, "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, "expires", exp_delta_str);
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "sub-call-id", call_id);
switch_event_fire(&sevent); switch_event_fire(&sevent);
} }