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

Telium Technical Support support at telium.io
Tue Nov 16 22:52:39 UTC 2021

Well, I got the code working, but still unsure about the event struct.


So I'm freeing the struct with esl_safe_free which I found used in some fs
code.  Hope that's correct.


From: FreeSWITCH-users
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Telium
Technical Support
Sent: Tuesday, November 16, 2021 4:47 PM
To: 'FreeSWITCH Users Help' <freeswitch-users at lists.freeswitch.org>
Subject: [Freeswitch-users] How to retrieve all waiting events via ESL in


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,

    if (connectionStatus == ESL_SUCCESS) {

        if (save_event) {

            esl_event_header_t* nextHeader = save_event->headers;

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

                headerList <<

                nextHeader = nextHeader->next;


            body =


        else break;


    else {

        return false;





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

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

More information about the FreeSWITCH-users mailing list