baresip / baresip

Baresip is a modular SIP User-Agent with audio and video support
BSD 3-Clause "New" or "Revised" License
1.7k stars 437 forks source link

Public IP-NAT-Local IP #900

Closed VicenteMoreno closed 4 years ago

VicenteMoreno commented 4 years ago

Greetings.

I have installed baresip on a raspberry pi3 and I have done several tests connecting it to a 4G router. Working correctly. For its location in the radio studios, my company has assigned me a fixed public IP with a NAT to a local IP. 217.12.XX.XXX </> 10.204.XXX.X

How do I have to configure the account and the config file so that it finishes correctly?

My knowledge about NAT is minimal and I need help.

This is my account file:

"CSR01" sip:user@iptel.org;regint=60;outbound="sip:iptel.org":answermode=auto;auth_pass=pass;

VicenteMoreno commented 4 years ago

Greetings again.

I have tried to change the configuration of the account file.

ACCOUNT

"CSR01" sip:100@217.12.xx.xxx;answermode=auto;regint=0;auth_pass=none;

TERMINAL RASPBERRY

pi@raspberry:~$ baresip baresip v0.6.1 Copyright (c) 2010 - 2019 Alfred E. Heggested et al. Local network address: IPv4=eth0:10.204.200.4 http: listening on 0.0.0.0:8000 aucodec: opus/48000/2 aucodec: G722/16000/1 aucodec: PCMU/8000/1 aucodec: PCMA/8000/1 aufilt: vumeter ausrc: alsa auplay: alsa Populated 1 account menu: redial enabled with 3 attempts and 0 seconds delay Populates 4 audio codecs Populated 1 audio filter Populated 0 video codecs Populated 0 video filters baresip is ready

(Calling from a smartphone with the linphone app to sip:100@217.12.xx.xxx)

call: no common audio codecs - rejected menu:call closed -- not redialing answering call from sip: +34 697xxxxxx@sip.linphone.org with 200 audio: Set audio decoder: opus 48000 2ch audio: player started with sample format S16LE audio: set audio encoder: opus 48000 2ch audio: source started with sample format S16LE audio tx pipeline: alsa---> vumeter ---> opus audio rx pipeline: alsa <--- vumeter <--- opus stream: Enable RTP timeout (10000 milisecconds) 100@217.12.xx.xxx: Call established: sip:+34697xxxxxx@sip.linphone.org stream: incoming rtp for "audio" stablished, receiving from 95.127.xxx.xx:59248 [0:00:08] audio=64480/33138 (bit/s)

(A few seconds later the call is interrupted alone.)

sip:+34697xxxxxx@sip.linphone.org: session closed: Connection reset by peer menu: call closed -- not redialing sip:100@10.204.200.4: Call with sip:+34697xxxxxx@sip.linphone.org terminated (duration: 31 secs)

NOTE:

During the time of the call does not send audio from the raspberry to Linphone, but Receive the Linphone audio on the raspberry.

If the call is made from the "baresip" application on the smartphone, it indicates the following fault: "failed call:403 relaying to someone elses IP not permitted".

alfredh commented 4 years ago

the 403 error probably comes from your SIP Server, check the SIP trace or the SIP server log.

for NAT handling, the general rules applies:

  1. for SIP use SIP outbound or a NAT aware SIP proxy (e.g. Kamailio).
  2. for RTP use stun,turn,ice or a NAT aware Proxy (e.g. Kamailio with rtpproxy).

This is a quite common setup and works fine with e.g. iptel.org or sip.antisip.org