Not able to send RTP Packets back to asterisk from NodeJS Server

Hi,

I am working on a project to send an audio stream to a WebSocket and play back the received audio on the Asterisk channel. Below is my current setup:

  • Asterisk Version: 16.9.0
  • Components:
    • ARI application (Java) to send RTP to an external media point
    • UDP Server/WebSocket Client (Node.js) for receiving and sending audio to Asterisk
    • External media processing server communicating over WebSocket

Current Progress:

  • Successfully initiated a call using a softphone
  • Answered the call in the dial plan and triggered the STASIS application
  • Managed the call via ARI, created a new Stasis bridge, and added the channel to the bridge
  • Integrated an external media endpoint (UDP Server) to send and receive audio Successfully:
  • Captured RTP audio from the softphone and sent it to the external media processing server
  • Received processed audio from the external media server over WebSocket and forwarded it to Asterisk for playback

Issue Faced:

When sending audio back to Asterisk, it plays as distorted and incomprehensible. I suspect this issue is related to the format of the RTP packet received from the external media processing server (voice bot). However, I have verified that the audio from the media server is correct, as it plays properly in a web browser.

Any help or guidance on this would be really appreciated.

Thanks

Asterisk expects an RTP stream. Are you actually providing one?

Hi Joshua, Thanks for the reply.

Yes i can see Asterisk receiving RTP from the UDPServer on asterisk CLI RTP debug logs and sending on the other channel in the bridge. but on the softphone sound is just garbage.

Is it actually timed as a stream? How does it sound in a packet capture in wireshark?

If you mean by timed as a stream to send packets every 20 ms, yes i am doing that. Also, earlier i have tried capturing packets on the softphone machine (this would be after asterisk) but i think it would be better to capture the packets before sending to asterisk on the server itself, I will do that now and see how it is coming.

Hi ,

So this is solved now. The stream Web socket is sending is without the RTP headers , so i had to add headers with the raw audio and send it to asterisk for asterisk to understand. i did not knew this before and now i am able to run complete flow.

Thankyou

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.