if (msg->message_id == SWITCH_MESSAGE_INDICATE_SIGNAL_DATA) {
sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) msg->pointer_arg;
switch_mutex_lock(tech_pvt->sofia_mutex);
+ if (switch_core_session_in_thread(session)) {
+ de->session = session;
+ }
sofia_process_dispatch_event(&de);
switch_mutex_unlock(tech_pvt->sofia_mutex);
goto end;
return;
}
} else if (!zstr(sofia_private->uuid)) {
- if ((session = switch_core_session_locate(sofia_private->uuid))) {
+ if ((session = de->session) || (session = switch_core_session_locate(sofia_private->uuid))) {
tech_pvt = switch_core_session_get_private(session);
channel = switch_core_session_get_channel(session);
if (tech_pvt) {
switch_mutex_lock(tech_pvt->sofia_mutex);
locked = 1;
} else {
- switch_core_session_rwunlock(session);
+ if (session != de->session) switch_core_session_rwunlock(session);
return;
}
switch_mutex_unlock(tech_pvt->sofia_mutex);
}
- if (session) {
+ if (session && session != de->session) {
switch_core_session_rwunlock(session);
}
}