I have a sip trunk provided by a VOS2009 server.
When I use the trunk in my asterisk server(13.6/pjsip stack), the RTP doesn't work.
So I try to locate the problem.
After debugging, I find the remote trunk send a 127.0.0.1 as media address.
Log data below: (a incoming call, 211.137.139.138 is the trunk IP, 218.60.133.132 is my asterisk IP, 66066 is the callerid, 87909 is the trunk number)
- Code: Select all
<--- Received SIP request (837 bytes) from UDP:211.137.139.138:5060 --->
INVITE sip:s@218.60.133.132:5060 SIP/2.0
Via: SIP/2.0/UDP 211.137.139.138:5060;branch=z9hG4bK682eb24966ce784f
From: <sip:66066@211.137.139.138>;tag=3e1952a3669683f3
To: <sip:87909@211.137.139.138>
Call-ID: 3d3e37bd63616c6c000a73a6@211.137.139.138
CSeq: 2140 INVITE
Contact: <sip:66066@211.137.139.138:5060>
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, UPDATE, PRACK
Supported: timer, linknat
Original-Info: TGQzZODtHxEzZDNlchdHAEENQA4TNHE9E1UdXR1WBEu2
Max-Forwards: 70
User-Agent: VOS2009 V2.1.4.0
Session-Expires: 600
Content-Type: application/sdp
Content-Length: 239
v=0
o=- 23929 23929 IN IP4 127.0.0.1
s=VOS2009
c=IN IP4 127.0.0.1
t=0 0
m=audio 14430 RTP/AVP 8 0 3 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
<--- Transmitting SIP response (340 bytes) to UDP:211.137.139.138:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 211.137.139.138:5060;rport=5060;received=211.137.139.138;branch=z9hG4bK682eb24966ce784f
Call-ID: 3d3e37bd63616c6c000a73a6@211.137.139.138
From: <sip:66066@211.137.139.138>;tag=3e1952a3669683f3
To: <sip:87909@211.137.139.138>
CSeq: 2140 INVITE
Server: Asterisk PBX 13.6.0
Content-Length: 0
<--- Transmitting SIP response (1142 bytes) to UDP:211.137.139.138:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 211.137.139.138:5060;rport=5060;received=211.137.139.138;branch=z9hG4bK682eb24966ce784f
Call-ID: 3d3e37bd63616c6c000a73a6@211.137.139.138
From: <sip:66066@211.137.139.138>;tag=3e1952a3669683f3
To: <sip:87909@211.137.139.138>;tag=57ba1dea-b4dd-4066-acda-44e29ac6fab0
CSeq: 2140 INVITE
Server: Asterisk PBX 13.6.0
Contact: <sip:218.60.133.132:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REGISTER, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 600;refresher=uac
Require: timer
Content-Type: application/sdp
Content-Length: 485
v=0
o=- 23929 23931 IN IP4 211.137.139.138
s=Asterisk
c=IN IP4 211.137.139.138
t=0 0
m=audio 10738 RTP/AVP 0 8 101
a=ice-ufrag:452f14ee222220bc32ecb074119892fa
a=ice-pwd:5e2826ce4629dc125358baab339f115e
a=candidate:Hac1efbd7 1 UDP 2130706431 172.30.251.215 10738 typ host
a=candidate:Hac1efbd7 2 UDP 2130706430 172.30.251.215 10739 typ host
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
<--- Received SIP request (347 bytes) from UDP:211.137.139.138:5060 --->
ACK sip:218.60.133.132:5060 SIP/2.0
Via: SIP/2.0/UDP 211.137.139.138:5060;branch=z9hG4bK712180c377f51bd8
From: <sip:66066@211.137.139.138>;tag=3e1952a3669683f3
To: <sip:87909@211.137.139.138>;tag=57ba1dea-b4dd-4066-acda-44e29ac6fab0
Call-ID: 3d3e37bd63616c6c000a73a6@211.137.139.138
CSeq: 2140 ACK
Max-Forwards: 70
Content-Length: 0
Sent RTP packet to 127.0.0.1:14430 (type 00, seq 028670, ts 000160, len 000160)
Sent RTP packet to 127.0.0.1:14430 (type 00, seq 028671, ts 000320, len 000160)
Sent RTP packet to 127.0.0.1:14430 (type 00, seq 028672, ts 000480, len 000160)
Sent RTP packet to 127.0.0.1:14430 (type 00, seq 028673, ts 000640, len 000160)
- Code: Select all
v=0
o=- 23929 23929 IN IP4 127.0.0.1
s=VOS2009
c=IN IP4 127.0.0.1
t=0 0
The SIP trunk send a RTP address of 127.0.0.1, and my server trust it, send RTP media stream to 127.0.0.1:14430
How can I setup my pjsip to overwrite this remote media address to the trunk's external address?
I tried some other softswitches and sip clients, all of them work well with the same 127.0.0.1 media address provided. They all replace the external address instead of the local address