From 57179f05380092f58716b89d6b3bcc5eae5b5da3 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 17 Apr 2024 21:28:46 -0500 Subject: [PATCH] Switch to higher-level DTMF API We can get a DTMF sender from the session or even the chat, rather than manually wrapping the track. --- main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 2e5ff65..7442120 100644 --- a/main.c +++ b/main.c @@ -12,7 +12,6 @@ // Globals, ew static void *chat = NULL; -static void *dtmf = NULL; static pa_simple *pulse = NULL; static pa_sample_spec ss_rec; static pa_simple *pulse_rec = NULL; @@ -118,9 +117,6 @@ void on_call_media(void* session, bool audio, bool video, void* dummy) { streams[cstreams++] = snikket_jingle_media_stream_make_audio(); size_t ctracks = snikket_jingle_media_stream_get_tracks(streams[cstreams-1], &tracks); for (size_t i = 0; i < ctracks; i++) { - if (!dtmf) { - dtmf = snikket_jingle_dtmf_sender_new(tracks[i]); - } snikket_jingle_media_stream_track_add_pcm_listener(tracks[i], &on_pcm, NULL); snikket_jingle_media_stream_track_add_ready_for_pcm_listener(tracks[i], &on_ready_for_pcm, tracks[i]); snikket_release(tracks[i]); @@ -235,8 +231,10 @@ int main(int argc, const char **argv) { return 1; } + void *dtmf = NULL; char tone[2] = " "; while ((tone[0] = fgetc(stdin)) != EOF && tone[0] != 4) { + if (!dtmf && chat) dtmf = snikket_chat_dtmf(chat); if (dtmf) snikket_jingle_dtmf_sender_insert_dtmf(dtmf, tone); } -- 2.45.2