Yate Community Forum

Yate server => Yate bugs => Topic started by: andr04 on May 09, 2017, 07:37:37 AM

Title: TCP external modules and Engine::dispatch
Post by: andr04 on May 09, 2017, 07:37:37 AM
I have the following function which returns CallEndpoint by channel id:
Code: [Select]
static CallEndpoint* locateChan(const String& id, bool peer = false)
{
    if (id.null())
return 0;
    Message m("chan.locate");
    m.addParam("id",id);
    if (!Engine::dispatch(m))
return 0;
    CallEndpoint* ce = static_cast<CallEndpoint*>(m.userObject(YATOM("CallEndpoint")));
    if (!ce)
return 0;
    return peer ? ce->getPeer() : ce;
}

This code is used from ExtModReceiver::processLine as follows (http://forum.yate.ro/index.php?action=dlattach;topic=1414.0;attach=179). And this works if external module is a pipe script, but doesn't work if it a TCP socket. I tried to debug it without success: Engine::dispatch doesn't work.

The difference which I've found is TCP extmodule starts from an additional thread of ExtListener which is a server for processing incoming connections (it's true approach). Can this broke Engine::dispatch? Or may be other reasons?
Title: Re: TCP external modules and Engine::dispatch
Post by: marian on May 10, 2017, 01:02:42 AM
Can you tell what happens?
- channel id is empty: add debug to see it
- chan.locate fails: check message with sniffer enabled
- chan.locate returns NULL or a non CallEndpoint descendant: NULL may be checked with message sniffer
- returned CallEndpoint has no peer and peer was requested: add debug to see it