Re-tested on latest Master: ``` # kamailio -V version: kamailio 6.0.0-dev2 (x86_64/linux) 2bcd29 flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: 2bcd29 compiled on 02:01:14 Sep 12 2024 with gcc 12.2.0 ```
Script to prepare config: ``` # cat cfg_prep.sh #!/bin/bash
KAM_LOCAL_IPV4=${1:-"192.168.0.114"}
mkdir -p /etc/kamailio/
curl -s https://raw.githubusercontent.com/kamailio/kamailio/master/etc/kamailio.cfg -o /etc/kamailio/kamailio.cfg_orig_master
sed -e "s|# listen=udp:10.0.0.10:5060|# listen=udp:10.0.0.10:5060\n\ listen=udp:${KAM_LOCAL_IPV4}:5060 advertise name3 name "sockname3"\n\ listen=udp:${KAM_LOCAL_IPV4}:5070 advertise name2:0 name "sockname2"\n\ listen=udp:${KAM_LOCAL_IPV4}:5080 advertise name1 name "sockname1"\n\ |g" \ -e 's|# - define WITH_PSTN|#!define WITH_PSTN|g' \ -e 's|pstn.gw_ip = "" desc "PSTN GW Address"|pstn.gw_ip = "8.8.8.8" desc "PSTN GW Address"|g' \ -e 's|pstn.gw_port = "" desc "PSTN GW Port"|pstn.gw_port = "5081" desc "PSTN GW Port"|g' \ -e 's|# normalize target number for pstn gateway|$fsn = "sockname1";|g' \ /etc/kamailio/kamailio.cfg_orig_master ``` To generate config issue the following(where 192.168.2.22 is local Kamailio ipv4): ``` bash ./cfg_prep.sh 192.168.2.22 > /etc/kamailio.cfg ```
Call from somewhere to udp:kamailio_ip:5070
This is export from sngrep while testing: ``` 2024/09/12 05:18:10.163960 192.168.1.201:63333 -> 192.168.1.114:5070 INVITE sip:00111111@192.168.1.114:5070 SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:63333;rport;branch=z9hG4bKPjKODU-8Rj6qEaa0zRs8y8YIXZizScJ0w9 Max-Forwards: 70 From: "www" sip:fff@192.168.1.114;tag=DFPm.aaF4b7t-6i.D4iPRlVKDhsERLmh To: sip:00111111@192.168.1.114 Contact: "www" sip:fff@192.168.1.201:63333;ob Call-ID: IWoCmeJg5FuclMQJxrRPYiEp.bKObBxV CSeq: 26703 INVITE Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS Supported: replaces, 100rel, norefersub User-Agent: Telephone 1.6 Content-Type: application/sdp Content-Length: 348
v=0 o=- 3935107090 3935107090 IN IP4 192.168.1.201 s=pjmedia b=AS:84 t=0 0 a=X-nat:0 m=audio 4004 RTP/AVP 8 0 101 c=IN IP4 192.168.1.201 b=TIAS:64000 a=rtcp:4005 IN IP4 192.168.1.201 a=sendrecv a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ssrc:566268823 cname:02ea4a2263a8ffac
2024/09/12 05:18:10.165079 192.168.1.114:5070 -> 192.168.1.201:63333 SIP/2.0 100 trying -- your call is important to us Via: SIP/2.0/UDP 192.168.1.201:63333;rport=63333;branch=z9hG4bKPjKODU-8Rj6qEaa0zRs8y8YIXZizScJ0w9;received=192.168.1.201 From: "www" sip:fff@192.168.1.114;tag=DFPm.aaF4b7t-6i.D4iPRlVKDhsERLmh To: sip:00111111@192.168.1.114 Call-ID: IWoCmeJg5FuclMQJxrRPYiEp.bKObBxV CSeq: 26703 INVITE Server: kamailio (6.0.0-dev2 (x86_64/linux)) Content-Length: 0
2024/09/12 05:18:10.165566 192.168.1.114:5080 -> 8.8.8.8:5081 INVITE sip:+111111@8.8.8.8:5081 SIP/2.0 Record-Route: sip:name1:5080;r2=on;lr Record-Route: sip:name2:5070;r2=on;lr Via: SIP/2.0/UDP name1:5080;branch=z9hG4bK9e32.8824aa0f912d2eef54ed88beef9ccede.0 Via: SIP/2.0/UDP 192.168.1.201:63333;received=192.168.1.201;rport=63333;branch=z9hG4bKPjKODU-8Rj6qEaa0zRs8y8YIXZizScJ0w9 Max-Forwards: 69 From: "www" sip:fff@192.168.1.114;tag=DFPm.aaF4b7t-6i.D4iPRlVKDhsERLmh To: sip:00111111@192.168.1.114 Contact: "www" sip:fff@192.168.1.201:63333;ob Call-ID: IWoCmeJg5FuclMQJxrRPYiEp.bKObBxV CSeq: 26703 INVITE Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS Supported: replaces, 100rel, norefersub User-Agent: Telephone 1.6 Content-Type: application/sdp Content-Length: 348
v=0 o=- 3935107090 3935107090 IN IP4 192.168.1.201 s=pjmedia b=AS:84 t=0 0 a=X-nat:0 m=audio 4004 RTP/AVP 8 0 101 c=IN IP4 192.168.1.201 b=TIAS:64000 a=rtcp:4005 IN IP4 192.168.1.201 a=sendrecv a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ssrc:566268823 cname:02ea4a2263a8ffac ```
We can see ports are present in headers: ``` Record-Route: sip:name1:5080;r2=on;lr Record-Route: sip:name2:5070;r2=on;lr Via: SIP/2.0/UDP name1:5080;branch=z9hG4bK9e32.8824aa0f912d2eef54ed88beef9ccede.0 Via: SIP/2.0/UDP 192.168.1.201:63333;received=192.168.1.201;rport=63333;branch=z9hG4bKPjKODU-8Rj6qEaa0zRs8y8YIXZizScJ0w9 ```
@miconda
Thank you