WebRTC: RTP packets sent to private IP address

Hello Everybody,

I am currently using Asterisk 11.4 (as part of the FreePBX solution), where I have enabled WebRTC.

I have all required ports forwarded from my Public IP to FreePBX private IP (192.168.0.23). When using Windows Based sip clients, I have no issues.
When I try to use (from internet) sipml5 installed on another box in the same private network and connecting using WebSocket (not using webrtc2sip), I am getting RTP Packets send to private IP, which is causing me No Audio issues. When I connect to my private network using VPN, everyting is working just fine.

How come, that the Remote client (me via sipml5) does not know the correct (public) IP? Where is the private IP come from? I am not setting it anywhere, I am always using FQDN. Except of Externip in sip.conf.

Any help is much appreciated.
Thanks

recv=SIP/2.0 200 OK
Via: SIP/2.0/WS df7jal23ls0d.invalid;rport=33468;received=79.123.AA.BB;branch=z9hG4bKoAKrTaEcA5XZ3UCDdzXfGytev
From: "1001"<sip:1001@pbx.tld>;tag=d5u3pfsfmp5Ka327kT
To: <sip:*43@pbx.tld>;tag=as56e183c9
Contact: <sip:*43@91.AAA.BBB.CCC;transport=WS>
Call-ID: c10dd797-9620-b435-3a9e-13db536dcdb2
CSeq: 50484 INVITE
Content-Type: application/sdp
Content-Length: 579
Server: FPBX-2.11.0(11.4.0)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer

v=0
o=root 1008714939 1008714939 IN IP4 91.AAA.BBB.CCC
s=Asterisk PBX 11.4.0
c=IN IP4 91.AAA.BBB.CCC
t=0 0
m=audio 12482 RTP/SAVPF 0 8 101
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=ice-ufrag:6d7a8caf68124354b6e4ef10aca577e
a=ice-pwd:49a2a23bcfb22221ff441bc6362d206
a=candidate:Hc0a8c8e8 1 UDP 2130706431 192.168.0.23 12482 typ host
a=candidate:Hc0a8c8e8 2 UDP 2130706430 192.168.0.23 12483 typ host
a=sendrecv
a=crypto:0 AES_CM_128_HMAC_SHA1_32 inline:W4pd+xM8TiFMNrtgastV/AEeTWFypijJqj32yw

Check your code at the sipml5 level and set properly the ICE servers.

Thanks.

These are my settings:

rtp_aditional.conf

rtp_custom.conf

On the sipml5 side. Check your JS code about your ICE servers.

I did not change anything to the sipml5 code.
I filled:

ws://pbx.tld:port/ws
udp://pbx.tld:port
Disable Video = X
RTCWeb Breaker = X (now I found out, I get at least one way audio when enabled)

I tried also:

[ { urls: "stun:stun.ekiga.net } , { urls:"turn:numb.viagenie.ca", username: "myuser", credential:"mypassword"} ]

What I recall from the past, when I called from sipml5 to another softphone, there was only one way audio. When I did it the other way around, everything worked just fine!
With the current Chrome and sipml5 svn 203 I somehow can not accept the call.

I also tried the sipml5 demo on their web page as well as jssip. :frowning:

Here is another fresh packet:

setRemoteDescription(answer) v=0 o=root 2076461195 2076461195 IN IP4 91.AAA.BBB.CCC s=Asterisk PBX 11.4.0 c=IN IP4 91.AAA.BBB.CCC t=0 0 m=audio 12226 RTP/SAVPF 0 8 101 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=ice-ufrag:59a96fe8ae0621636f1580ýľc27c8 a=ice-pwd:53e361c3a293e94e60779a6944c59a9 a=candidate:Hc0a8c8e8 1 UDP 2130706431 192.168.0.23 12226 typ host a=candidate:S5bdd7150 1 UDP 1694498815 91.AAA.BBB.CCC 12226 typ srflx a=candidate:Hc0a8c8e8 2 UDP 2130706430 192.168.0.23 12227 typ host a=candidate:S5bdd7150 2 UDP 1694498814 91.AAA.BBB.CCC 12226 typ srflx a=sendrecv a=crypto:0 AES_CM_128_HMAC_SHA1_32 inline:AbrgbbfgdUiffZf/vxiyWYi/g3Ml63BHiKd790

You need to show us both debugs and complete debugs. The JS debug using firebug and the sip debug from the console with the rtp.

Thank you for your help, much appreciated!

Herewith the JS Debug:

http://pastebin.com/i4414FEN

And this is hopefully the RTP Debug from the console:

http://pastebin.com/cdiccL2p

Now its two different calls from two different devices using the same webpage sipml5. JS is from Chrome on PC and the RTP is from Chrome on Android. Both to *43.

And here is one more:

http://pastebin.com/fZyqgvEH

This is when I connect to my private network using VPN as client PC 192.168.0.11. In this case everything is working just fine.

sip_additional.conf

[2222] deny=0.0.0.0/0.0.0.0 secret=******* dtmfmode=rfc2833 canreinvite=no context=from-internal host=dynamic trustrpid=yes sendrpid=no type=friend nat=yes port=5060 qualify=yes qualifyfreq=60 transport=udp,tcp,tls encryption=yes callgroup= pickupgroup= dial=SIP/2222 permit=0.0.0.0/0.0.0.0 callerid=2222 <2222> callcounter=yes faxdetect=no cc_monitor_policy=generic

sip_custom_post.conf

[2222](+) avpf=yes transport=udp,ws,wss directmedia=no icesupport=yes

sip_general_additional.conf

faxdetect=yes vmexten=*97 context=from-sip-external callerid=Unknown notifyringing=yes notifyhold=yes tos_sip=cs3 tos_audio=ef tos_video=af41 alwaysauthreject=yes useragent=FPBX-2.11.0(11.4.0) disallow=all allow=ulaw allow=alaw allow=gsm transport=udp,ws,wss accept_outofcall_message=yes outofcall_message_context=sipmessages allow=silk8 allow=silk12 allow=silk16 allow=silk24 fromdomain=pbx.tld callevents=no language=cz bindport=40160 jbenable=no defaultexpiry=120 allowguest=yes srvlookup=no minexpiry=60 maxexpiry=3600 registerattempts=0 registertimeout=20 notifyhold=yes g726nonstandard=no videosupport=no maxcallbitrate=384 canreinvite=no rtptimeout=30 rtpholdtimeout=300 rtpkeepalive=0 checkmwi=10 notifyringing=yes nat=yes externip=91.AAA.BBB.CCC localnet=192.168.0.0/255.255.255.0

rtp_additional.conf

[general] icesupport=yes rtpend=13000 rtpstart=12000

Seems like you are using FreePBX, join the freepbx IRC. I built a webrtc module for FreePBX and today was forked by tm1000 developer of freepbx. He can give you more about the installation and the recently changes made to the GUI, paramters like icesupport, avpf and transport are added to the GUI as well.

In the meantime i take a look on your debugs.

Checking your debugs, the sipml5 in the sdp transaction set the Your Public IP and port based on the ice candidates, but your asterisk sent the packets to another port. I didn’t saw the port 55626 negotiated. Maybe a wrong call?

Just to be sure generate the logs again. To get the complete output from asterisk use: asterisk -rnvvvvvv | tee sipdebug.txt Use your same method for the JS sip using firebug. Then call, complete the call and exit from the console with ctrl+c then in your current location you will find the file sipdebug.txt pastebin that file.

Hello,

It took a while but here it is - logs for a single call:

JS Debug from Chrome:

http://pastebin.com/VUkMppBB

sipdebug.txt

http://pastebin.com/cR6AajB4

I am getting one way audio, but guess, you can see that from the log.

The logs in the previous threat were from 3 different calls, because I only had access to one PC, thus I could not VPN, Firebug and Console at the same time.

Thanks, much appreciated.

Hi,

First try to upgrade Asterisk to 11.5.1(always try to use latest sipml5 api & latest asterisk for best results), then check if the core for FreePBX is updated to use WebRTC and manage that from the GUI(not important your configs from files are OK).

I saw your logs and now asterisk & sipml5 are using the same IP & port to send the audio in this case: 92.AA.BB.CC:53058. Unfortunately you the sip debug isn’t present but again the RTP are sent to correct IP and port based on the sipml5 negotiated sdp.

Now if you want that sipml5 choose the private IP instead the public IP in the sipml5 API set the stun to ‘null’(if you are using the sipml5 page demo remove the single quote if not set like: ice_servers: [{url: ‘stun:null’}]).

Also take a note that webrtc doesn’t work well behind proxies :’(

Hi navaismo,

I hope I got it at least this time right, with the sip debug. It was just not enabled.

JS Debug
http://pastebin.com/4yRUcGE1

SIP Debug
http://pastebin.com/tGZn7rtr

I am playing with this for months. I got as far as you can see. Just yesterday I found a blog mentioning Asterisk 11.5 working with WebRTC without patches (my system is not patched). I give it a go, thank you for your advice and time.
Again. Much appreciated.

I mentioned it already above:

sipml5(WebRTC) -> FreePBX -> softphone (SIP) = [color=#FF0000]one way no audio[/color]

but when I call:
softphone (SIP) -> FreePBX -> sipml5(WebRTC) = [color=#008000]works just fine[/color]

Share the debug of the sip client.

Will do, once I get the chance. I will be AFK for about a week.

Today I managed to upgrade to 11.5.1 and latest FreePBX. Nothing has changed in terms of the issue, but I did not have enough time to try out different things.

Hello,

I am back with the latest SIP Debug files. I have setup 2 extensions 2225 for WebSocket, 2224 as normal SIP one.

When I call from 2225 -> 2224 = one way audio
When I call from 2224 -> 2225 = its working

Here is the corresponding SIP Debug:

Chrome SIP Debug
http://pastebin.com/TngseNi5

VMobile SIP Debug
http://pastebin.com/wWtEacba

Asterisk SIP Debug
http://pastebin.com/gP9dB8JJ

It might be important to mention, that I have also Disabled SIP ALG on my router.

Based on your logs I confirmed that I have told you before: sipml5 is using the public IP address in the sdp (IP 92.AAA.B.CC) while the other sip client is using a private IP address (c=IN IP4 192.168.1.102).

Now if you are in the same lan, try this for the SIPML5 Client go to expert settings and set the ice servers to null. Just type null and save, then try again.

If you are outside the lan configure properly the NAT settings for the PBX and the extension, don’t touch the ice servers on sipml5 then try again.

If everything fails attach logs as usual.

Best Regards.

FAKE ALARM :frowning:

Thanks navaismo,

I have set the ICE servers in sipml5 to null and its working now as expected.

I am pretty sure I tried that with the older version of Asterisk as well, but it did not work.

Thank you once again for your patience and support. Much appreciated.

Regards,
K.K.