drachtio/drachtio-freeswitch-modules

crash switch_thread_cond_wait(cb->cond, cb->mutex);

Closed this issue · 6 comments

model audio_form .
function fork_session_init

switch_thread_cond_wait(cb->cond, cb->mutex);

lua code:
session:answer();
api = freeswitch.API();
local call_uuid = session:getVariable("uuid");
freeswitch.consoleLog("console", "-----------------call_uuid="..call_uuid.."\n")
api:executeString("uuid_audio_fork "..call_uuid.." start ws://192.168.0.205:9988 stereo 8k 234");

freeswitch version:1.6.20

Help, I've been stuck here.

Windows 10 System

I don't work on windows, so I may not be much help here. Also my testing is with freeswitch v1.8 not 1.6.

Having said that, are you sure the crash is in the thread you are referencing, and not the thread that is actually trying to do the connect? Can you provide a stack trace of both threads?

Its hard to understand why that line would crash, since at that point we have simply initialized a mutex and a condition variable, and then called that line of code to wait on the condition. Can you inspect the mutex and the condition variable in the debugger to see if they look valid?

What is happening there is

    switch_mutex_init(&cb->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
    switch_thread_cond_create(&cb->cond, switch_core_session_get_pool(session));
...
    switch_mutex_lock(cb->mutex);
...
    switch_thread_cond_wait(cb->cond, cb->mutex);

Are you sure you need this to work on Windows? I really dont see Windows as serious platform for server-based realtime communications, and would be interested to know why you are using it.

api:executeString("uuid_audio_fork "..call_uuid.." start ws://192.168.0.205:9988 mono 8k metadata");
the lua code is not executed down.

api = freeswitch.API();

local call_uuid = session:getVariable("uuid");

freeswitch.consoleLog("console", "-----------------call_uuid="..call_uuid.."\n")

api:executeString("uuid_audio_fork "..call_uuid.." start ws://192.168.0.205:9988 mono 8k metadata");

session2 = freeswitch.Session("sofia/internal/1000%192.168.0.205");

freeswitch.bridge(session, session2);

I'm unclear what you mean by "the lua code is not executed down." ?