choppy audio when using play_media

22 views
Skip to first unread message

AC

unread,
Oct 23, 2025, 2:45:39 PMOct 23
to Sipwise rtpengine
Hello,

I'm just trying to determine when injecting media during an active call, why the playback of the audio is choppy. Before and after the playback, audio is fine.

What's being used:
Kamailio v-5.8.6
rtpengine v-13.4.1.8

Call flow:
Softphone (a/b) <--> Kamailio/rtpengine <--> Freeswitch
* Softphone A sends call to kamailio, kamailio forwards it to fs, and fs sends call back to kamailio, kamailio forwards request to softphone B.

When placing a call, audio quality is fine throughout. When injecting audio into the active call via 'play_media("file://path/to/wav/file")', the playback is choppy ( at the moment I'm only injecting the audio between the softphone A and Kamailio, so the A-leg side of the call). The Wav file is encoded with pcmu, 8000hz mono/ using audacity. I've also used ffmpeg as well, with the same results. Tested a 8000hz sample sound file from freeswitch's sound/ as well as forcing PCMU/PCMA as the codec during calls, with the same results. During the test call, CPU usage is barely anything.

What would be a good next step to determining on what's causing the playback of the injected audio? Anything that I should be looking out for, in my rtpengine logs?

Thank you.

Richard Fuchs

unread,
Oct 31, 2025, 8:36:53 AMOct 31
to rtpe...@googlegroups.com
On 23/10/2025 14.45, AC wrote:
> What would be a good next step to determining on what's causing the
> playback of the injected audio? Anything that I should be looking out
> for, in my rtpengine logs?

Typically I would capture the RTP with Wireshark and use its RTP
analyser to see if there are any obvious problems.

A common mistake is usage of "play media" that results in an additional
outgoing RTP stream towards the destination when another RTP stream (the
one relayed from the other call leg) already exists. RTP clients
typically don't handle this well. If this is your issue, then you need
to think about what you want to do with the media that's being played by
rtpengine with respect to the media that already exists towards the
destination.

Cheers

AC

unread,
Nov 3, 2025, 10:24:07 AMNov 3
to Sipwise rtpengine
Hello, 

Question, as well as to clarify what I'm trying to accomplish, I'm trying to utilize rtpengine's recording daemon to record a call, when call recording is active mid-call, I want to inject the audio stating that the call is being recorded. Can this be accomplished with my existing setup? 

Thank you.

Richard Fuchs

unread,
Nov 3, 2025, 10:38:36 AMNov 3
to rtpe...@googlegroups.com
On 03/11/2025 11.24, AC wrote:
> Question, as well as to clarify what I'm trying to accomplish, I'm
> trying to utilize rtpengine's recording daemon to record a call, when
> call recording is active mid-call, I want to inject the audio stating
> that the call is being recorded. Can this be accomplished with my
> existing setup?

Yes, but again it depends on what you mean with "injected."

Most easily you would block the existing RTP stream and have the
generated media replace it, by using the `block-egress` option with the
"play media" command.

Cheers

AC

unread,
Nov 3, 2025, 11:02:32 AMNov 3
to Sipwise rtpengine
Hello,

Thank you Rich, adding "block-egress" fixed it.
Reply all
Reply to author
Forward
0 new messages