support at telium.io Guest
|
Posted: Wed Nov 17, 2021 12:18 am Post subject: [Freeswitch-users] How to retrieve all waiting events via ES |
|
|
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@lists.freeswitch.org] On Behalf Of Telium Technical Support
Sent: Tuesday, November 16, 2021 4:47 PM
To: 'FreeSWITCH Users Help' <freeswitch-users@lists.freeswitch.org>
Subject: [Freeswitch-users] How to retrieve all waiting events via ESL in C/C++
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? |
|