-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To trigger actions on DTMF rtp events' start and end. (AUD-5522) #1228
Comments
In my understanding, what's your needs is have a method to get when does DTMF event end, am I right? |
Hello @TempoTian , However for the discussion's sake, a better approach could be not to mix the raw audio stream and the DTMF event info. Similarly to pjsip's handling it could be a new callback containing the raw rtp frame or the raw rtp payload only. Potentially as a new member of
thanks for being so responsive, much appreciated |
I have implement it according your advice. if __esp_rtc_receive_dtmf provided, DTMF data will be callbacked by the new registered data callback, or else it will use old flow. The new library for esp32s3 is as attached, you can download and verify it, parse data is easy take following code as reference: #include <arpa/inet.h>
typedef struct {
uint8_t eventid;
uint8_t volume:6;
uint8_t reserve:1;
uint8_t end:1;
uint16_t duration;
} esp_rtp_dtmf_data_t;
static int _receive_dtmf(unsigned char *data, int len, void *ctx)
{
esp_rtp_dtmf_data_t* dtmf = (esp_rtp_dtmf_data_t*)data;
printf("receive id:%d vol:%d end:%d duration:%d\n",
dtmf->eventid, dtmf->end, dtmf->volume, ntohs(dtmf->duration));
return 0;
} |
Hi @TempoTian, Thanks a lot for this api! |
Hello @TempoTian Thanks a lot for providing these great APIs, (answering for !1227 too). We've integrated and tested it for our needs since a week and no issue arose 🥳 . |
Code merged to esp-adf-libs now: |
Describe the situation
I'm using the
config.data_cb.receive_audio()
callback to act on DTMF events coming from the VOIP (RTP/SIP). It is registered to the esp sip stack through esp_rtc_init(&config). The esp sip stack receives dtmf rtp events which come in a burst of multiple packets. The esp stack parses the event and calls the callback with aDTMF-<digit>
data buffer (I call themDTMF-<digit>
events below). Parsing the data lets me retrieve the digit which is good information of course. However I'm in need to trigger actions as soon as the first dtmf event packet arrives as well as the end of the event.Here is the data structure through which the callback is registered :
Describe the solution you'd like
DTMF-<digit>
event occurs on the first dtmf rtp event packet.config.data_cb.receive_audio()
is called.DTMF-
event signalling the end of the dtmf. This one could optionally contain the duration of the dtmf event. DTMF rtp events can send multiple end-packets where the event duration is final. It would be good to receive on the callback something likeDTMF-<digit>-<duration>
upon receiving the first end-packed of the ongoing RTP EVENT. For my purposes, a simple `DTMF--END event sent with minimum latency upon receiving the first end-packet would be sufficient.Describe the solution you'd NOT like
It could be tempting to delay the
DTMF-<digit>
event in order for it to contain the final duration, but the timing of the event-start detection is even more critical than that of the event-end.In the picture below, the the first end-packet is N°2478 that one would send the end event.
OS darwin arm64 23.5.0
Visual Studio Code version 1.90.2
Visual Studio Code language en
Visual Studio Code shell /bin/zsh
ESP-IDF Extension version 1.8.0
Git version 2.45.0
ESP-IDF version v4.4.5
ADF version v2.6-122-g28736657
Python version 3.12.4
Python's pip version 24.0
Chip used: ESP32-S3 custom board
Build system: idf.py
The text was updated successfully, but these errors were encountered: