Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
188 views
in Technique[技术] by (71.8m points)

javascript - Why playing back RTP packets doesn't work, and the other side don't hear an echo?

For about 48 hours, I'm trying to play audio for who is calling me all by using NodeJS SIP and RTP directly.

When we calling I get the call on port 5060, and then I'm answering using the SIP/SDP specification. Then I'm start getting is voice on my RTP port. The issue is I'm unable to send voice back to him. What am I'm doing wrong?

I don't know yet how to build RTP packets, so I'm using the exact packets I received from the other side, and sent it back. I thought that will hear an echo. But he don't hear nothing.

He is using SIP and initiate a call. I was able to receive the call and record his audio.

The INVITE command

INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 31.168.3.211:5060;branch=z9hG4bK071d7c26
Max-Forwards: 70
From: "0555042354" <sip:[email protected]>;tag=as710f47f3
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.18.0
Date: Fri, 05 Feb 2021 00:22:51 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 236

v=0
o=root 2117083987 2117083987 IN IP4 31.168.3.211
s=Asterisk PBX 11.18.0
c=IN IP4 31.168.3.211
t=0 0
m=audio 16006 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

I took it's port (15574) from the INVITE command: m=audio 15574 RTP/AVP 8 101 and the IP also from the INVITE command: c=IN IP4 31.168.3.195 Now I'm sending back every UDP packet he sent me. But he don't hear nothing.

(It's after OK, and ACK by him).

ourSocket.on('message', (rtpPacketBuffer) => {
  dgramServer.send(rtpPacketBuffer, 16006, 31.168.3.211)
})

In other words: According to RTP protocol, is sending back the packet can work, or do I need to reconstruct them?

(We're able to hear the other side, and record the call.)

question from:https://stackoverflow.com/questions/66061609/why-playing-back-rtp-packets-doesnt-work-and-the-other-side-dont-hear-an-echo

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...