[Freeswitch-users] How to retrieve all waiting events via ESL in C/C++

Telium Technical Support support at telium.io
Tue Nov 16 21:47:00 UTC 2021


I am trying to retrieve all waiting events via ESL, using the
esl_recv_event_timed function. The documentation doesn't offer much help.

 

My code below is intended to retrieve all events waiting. But it doesn't
work...I just gather an increasing number of headers (always appending onto
the last), and the body is the same, for each event. As if the events are
not dequeuing.

 

As well, events I expect (eg HEARTBEAT) are not appearing. So it seems I'm
not really iterating through the list of waiting events:

 

QStringList body;

esl_event_t *save_event = NULL;

while (true) {

    esl_status_t connectionStatus = esl_recv_event_timed(&m_EslHandle, 0, 0,
&save_event);

    if (connectionStatus == ESL_SUCCESS) {

        if (save_event) {

            esl_event_header_t* nextHeader = save_event->headers;

            while ((nextHeader != NULL) && (nextHeader !=
save_event->last_header)) {

                headerList <<
TL_KeyValuePair(nextHeader->name,nextHeader->value);

                nextHeader = nextHeader->next;

            }

            body =
QString(m_EslHandle.last_sr_event->body).split("\n",Qt::SkipEmptyParts);

        }

        else break;

    }

    else {

        return false;

    }

}

 

 

Can someone offer a simple code (using C ESL) on how to retrieve all waiting
events?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20211116/7eab347f/attachment-0001.html>


More information about the FreeSWITCH-users mailing list