No RTP Stream in PJSIP Calls (Asterisk in Docker on Windows)

Hello there!

I’m experiencing an issue where SIP signaling works, but RTP media is not flowing in calls between two MicroSIP softphones connected to an Asterisk instance running in a Docker container on Windows.

Setup Details:

  • Asterisk version: 17.6.0

  • Deployment: Docker container (bridge network) on Windows

  • Softphones: MicroSIP running on two separate PCs in the same LAN

  • Network details:

    • Asterisk container IP (Docker network): 172.18.0.3/16
    • Asterisk host machine IP (LAN): 192.168.1.18
    • Softphone 1001 (on Asterisk host PC): SIP domain 127.0.0.1
    • Softphone 2001 (on separate PC, with IP 192.168.1.20): SIP domain 192.168.1.18
  • Ports:

    • SIP UDP: 5060 (open and reachable)
    • RTP UDP: 10000-10050 (confirmed open via nmap)
  • Firewall: Disabled on Windows

  • Docker compose configuration: exposing all the required ports and building the asterisk service in a network with driver: bridge, with IP 172.18.0.3

  • PJSIP configuration (pjsip.conf):

[global]
external_media_address=192.168.1.18
external_signaling_address=192.168.1.18
local_net=192.168.1.0/24
local_net=172.18.0.0/16

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
external_signaling_address=192.168.1.18
external_media_address=192.168.1.18
local_net=192.168.1.0/24
local_net=172.18.0.0/16

[1001]
type=endpoint
context=default             
disallow=all
allow=opus,ulaw
auth=1001                    
aors=1001                    
direct_media=no              
force_rport=yes
rewrite_contact=yes
rtp_symmetric=yes
transport=transport-udp


[1001]
type=auth
auth_type=userpass
password=1001                
username=1001

[1001]
type=aor
max_contacts=1               
remove_existing=yes
qualify_frequency=120       

[2001]
type=endpoint
context=default             
allow_transfer=yes
disallow=all
allow=opus,ulaw
auth=2001                   
aors=2001                  
direct_media=no             
force_rport=yes
rewrite_contact=yes
rtp_symmetric=yes
transport=transport-udp

[2001]
type=auth
auth_type=userpass
password=2001                
username=2001

[2001]
type=aor
max_contacts=1              
remove_existing=yes
qualify_frequency=120       

  • RTP configuration (rtp.conf):
[general]
rtpstart=10000
rtpend=10050
bindaddr=0.0.0.0

Problem Description:

  • SIP signaling works fine, and calls are established successfully.
  • However, RTP packets are not seen on the network when monitoring with Wireshark.
  • Wireshark shows SIP packets but no RTP packets.
  • RTP debugging in Asterisk (rtp set debug on) does not show any RTP traffic.
  • Both SIP endpoints use rtp_symmetric=yes, rewrite_contact=yes, and force_rport=yes.
  • An INVITE example shows:
<--- Transmitting SIP response (904 bytes) to UDP:172.18.0.1:34522 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.18:64436;rport=34522;received=172.18.0.1;branch=z9hG4bKPj91ccdd3670fd4d1a882968c0efe2131e
Call-ID: 1375892ce8d7482a95fa6043d3035d90
From: "1001" <sip:1001@192.168.1.18>;tag=56b4d44c10f542ee980166b2df0aef3d
To: <sip:2001@192.168.1.18>;tag=c561ebd3-336c-45af-9b0a-5e8d69bc9315
CSeq: 20930 INVITE
Server: Asterisk PBX 17.6.0
Contact: <sip:172.18.0.3:5060>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer
Content-Type: application/sdp
Content-Length:   233

v=0
o=- 3947750454 3947750456 IN IP4 172.18.0.3
s=Asterisk
c=IN IP4 172.18.0.3
t=0 0
m=audio 10042 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

Where c=IN IP4 172.18.0.3 refers to the Docker Network IP. Am I missing something?

Any help will be appreciated :slight_smile:

Please reproduce on a supported version of Asterisk. Asterisk 17 is more than three years beyond end of life.

Addresses can’t both be external and be on the local network.

@david551 thank you for the reply. Just to be sure I get it, how should I update my pjsip.conf?

That depends on your real network configuration.

My network configuration is like I mentioned:

  • Asterisk container IP (Docker network): 172.18.0.3/16
  • Asterisk host machine IP (LAN): 192.168.1.18
  • Softphone 1001 (on Asterisk host PC, same LAN): trying to connect to SIP domain 127.0.0.1
  • Softphone 2001 (on separate PC, with IP 192.168.1.20, same LAN): trying to connect to SIP domain 192.168.1.18
    Firewall is disabled on Windows’ side.

Should I provide more informations? Currently I am stuck on this problem so I really need some help, please :smiley:

I can tell that the configuration is wrong, but I don’t know enough about Docker, apart from its use being discouraged with Asterisk, because of things like severely constraining the number of ports available, to reliably interpret the information above. Maybe someone more familiar with Docker can give a definitive answer.

1 Like

If you are using docker or podman, you need to open an external port to the internal port of the container. Use docker compose. Networking | Docker Docs

Currently I’m exposing all of these ports:

ports:
  - '5060:5060/udp' # SIP signaling on UDP
  - '5038:5038/tcp' # AMI (Asterisk Manager Interface) on TCP
  - '8088:8088/tcp' # WebSocket (unsecured)
  - '8089:8089/tcp' # WebSocket (secured with TLS)
  - "10000-10050:10000-10050/udp" # Limited RTP range for media streams

Reflecting my RTP configuration (rtp.conf):

[general]
rtpstart=10000
rtpend=10050
bindaddr=0.0.0.0

And the rtp range is specified on the MicroSIP side as well. It should be enough, right?