mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-10 14:39:54 +00:00
mod_sofia: Fix memleak and mwi event not generated on first register
This commit is contained in:
parent
2e8ece4fba
commit
04b9b3e2a6
@ -1315,6 +1315,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
if (regtype == REG_REGISTER) {
|
||||
char exp_param[128] = "";
|
||||
char date[80] = "";
|
||||
switch_event_t *s_mwi_event = NULL;
|
||||
|
||||
s_event = NULL;
|
||||
|
||||
@ -1324,10 +1325,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) ||
|
||||
(reg_count == 1 && sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER))) {
|
||||
if (switch_event_create(&s_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", mwi_user, mwi_host);
|
||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name);
|
||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Call-ID", call_id);
|
||||
if (switch_event_create(&s_mwi_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(s_mwi_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", mwi_user, mwi_host);
|
||||
switch_event_add_header_string(s_mwi_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name);
|
||||
switch_event_add_header_string(s_mwi_event, SWITCH_STACK_BOTTOM, "VM-Call-ID", call_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1361,6 +1362,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
switch_event_fire(&s_event);
|
||||
}
|
||||
|
||||
if (s_mwi_event) {
|
||||
switch_event_fire(&s_mwi_event);
|
||||
}
|
||||
|
||||
if (*contact_str && sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE_SYLANTRO)) {
|
||||
sofia_sla_handle_register(nua, profile, sip, exptime, contact_str);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user