support at telium.io Guest
|
Posted: Tue Nov 16, 2021 6:31 pm Post subject: [Freeswitch-users] How to retrieve all waiting events via ES |
|
|
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? |
|