Nando
April 23, 2025, 5:09pm
1
Hello everyone,
I’m running into an issue with SIP calls in my current setup and would really appreciate some help.
Setup:
I have a machine named sip00 (IP: 192.168.1.75) running Kamailio + RTPengine.
Kamailio is dispatching calls to sip:192.168.1.190:32210;transport=tcp. This IP points to another machine running Asterisk inside a Kubernetes cluster.
RTPengine is configured with an RTP port range of 10000–20000, and my router is set to allow that same range.
Asterisk Kubernetes Service Configuration:
spec:
ports:
- name: tcp-port
protocol: TCP
port: 5060
targetPort: 5060
nodePort: 32210
- name: udp-port
protocol: UDP
port: 5060
targetPort: 5060
nodePort: 32210
Problem:
When I initiate a SIP call, the router forwards traffic to Kamailio + RTPengine, which then sends it to the Asterisk server on 192.168.1.190.
Everything seems fine initially, but at exactly 32 seconds into the call, Asterisk sends a BYE and no longer responds with 200 OK to the SIP dialog — even though I’m still receiving and sending audio. Then, at around 1:04, I get a 408 Request Timeout.
Questions:
Do I need to explicitly expose the RTP port range (10000–20000) in the Asterisk Kubernetes service as well?
Why is Asterisk sending a BYE so early if audio is still flowing?
Could it be a signaling timeout or an issue with SIP dialog tracking?
Any help or pointers would be greatly appreciated!
Thanks in advance!
I don’t understand the Kubernetes side of this, although I wonder about nodePort.
However, if you mean 32 seconds, rather the 320 milliseconds that you actually wrote, an Asterisk is initiating the close, that will be because it is never getting an ACK to its 200 OK, and the 200 OK is reaching its maximum re-transmissions. That often means that the Contact header it is sending contains the wrong address. Again I can’t really factor in the Kubernetes aspects, but a common reason for that is failing tell Asterisk its address, as seen from outside NAT. Normally that would have the same port number, as inside, although i beileve it is possible to specify a different one.
Nando
April 24, 2025, 8:37am
3
Yeah, I meant 32 seconds. I posted on another forum and got the same suggestion. I’ll look into it. Thank you very much.
Nando
April 24, 2025, 10:34am
4
I’ve checked the Contact header, and it’s indeed incorrect, it’s getting
Contact: sip:10.244.9.200:5060;transport=TCP . I’ve been trying to fix it but haven’t had any success so far. I’m using the configuration from This Kamailio example , and in my Kubernetes-based Asterisk setup, I’m setting the correct external IP address, but I’m still getting the wrong Contact header.
Here’s the relevant part of my Asterisk config:
[transport-tcp-nat]
type=transport
protocol=tcp
bind=0.0.0.0
local_net=10.244.0.0/16
external_media_address=192.168.1.190
external_signaling_address=192.168.1.190
[6007]
type=endpoint
context=public
disallow=all
allow=g722
allow=ulaw
auth=6007
aors=6007
transport=transport-tcp-nat
force_rport=yes
ice_support=yes
rewrite_contact=yes
Do you happen to know where the issue might be in my configuration?
jcolp
April 24, 2025, 10:47am
5
What is the IP address of what Asterisk is talking to? If it is in this range:
Nando:
local_net=10.244.0.0/16
Then external_* will not take effect because it is on the same network according to configuration.
Nando
April 24, 2025, 11:08am
6
Kamailio and RTPengine are running on the IP address 192.168.1.75
for media handling.
The Kubernetes machine is running on IP address 192.168.1.190
Asterisk talks to 192.168.1.75 to send the media to the client but also talks locally to get the media from the different services such as whisper…
jcolp
April 24, 2025, 11:10am
7
Show the actual output of an attempt using “pjsip set logger on”.
Nando
April 24, 2025, 11:20am
8
[Apr 24 11:19:59] NOTICE[109]: src/mrcp_sofiasip_client_agent.c:617 Receive SIP Event [nua_i_state] Status 0 INVITE sent [speech-unimrcp-mrcp2]
[Apr 24 11:19:59] NOTICE[109]: src/mrcp_sofiasip_client_agent.c:555 SIP Call State TTS-74 [calling]
[Apr 24 11:19:59] NOTICE[109]: src/mrcp_sofiasip_client_agent.c:617 Receive SIP Event [nua_r_invite] Status 200 OK [speech-unimrcp-mrcp2]
[Apr 24 11:19:59] NOTICE[109]: src/mrcp_sofiasip_client_agent.c:617 Receive SIP Event [nua_i_state] Status 200 OK [speech-unimrcp-mrcp2]
[Apr 24 11:19:59] NOTICE[109]: src/mrcp_sofiasip_client_agent.c:555 SIP Call State TTS-74 [ready]
[Apr 24 11:19:59] NOTICE[109]: src/mrcp_sofiasip_client_agent.c:441 Remote SDP TTS-74
v=0
o=UniMRCPServer 8477256441630536174 1866339450635921754 IN IP4 10.244.9.198
s=-
c=IN IP4 10.244.9.198
t=0 0
m=application 1544 TCP/MRCPv2 1
a=setup:passive
a=connection:new
a=channel:a411b056a43d4856@speechsynth
a=cmid:1
m=audio 10328 RTP/AVP 9
a=rtpmap:9 G722/8000
a=sendonly
a=ptime:20
a=mid:1
[Apr 24 11:19:59] NOTICE[109]: src/mrcp_sofiasip_client_agent.c:617 Receive SIP Event [nua_i_active] Status 200 Call active [speech-unimrcp-mrcp2]
[Apr 24 11:19:59] NOTICE[106]: src/mrcp_client_session.c:149 Receive Answer TTS-74 [c:1 a:1 v:0] Status 200
[Apr 24 11:19:59] NOTICE[107]: src/mrcp_client_connection.c:346 Established TCP/MRCPv2 Connection 10.244.9.200:46136 ↔ 10.244.9.198:1544
[Apr 24 11:19:59] NOTICE[107]: src/mrcp_client_connection.c:456 Add Control Channel a411b056a43d4856@speechsynth 10.244.9.200:46136 ↔ 10.244.9.198:1544 [1]
[Apr 24 11:19:59] NOTICE[108]: src/mpf_rtp_stream.c:331 Enable RTP Session 10.244.9.200:10260
[Apr 24 11:19:59] NOTICE[108]: src/mpf_rtp_stream.c:505 Open RTP Receiver 10.244.9.200:10260 ← 10.244.9.198:10328 playout [50 ms] bounds [0 - 200 ms] adaptive [0] skew detection [1]
[Apr 24 11:19:59] NOTICE[108]: src/mpf_bridge.c:111 Media Path TTS-74 Source->[G722/16000/1]->Bridge->[G722/16000/1]->Sink
[Apr 24 11:19:59] NOTICE[106]: src/mrcp_client_session.c:453 Raise App Response TTS-74 [2] SUCCESS [0]
[Apr 24 11:19:59] NOTICE[106]: app_synthandrecog.c:275 speech_on_channel_add: (TTS-74) Channel ready codec=G722, sample rate=16000
[Apr 24 11:19:59] NOTICE[106]: src/mrcp_client_session.c:390 Receive App MRCP Request TTS-74
[Apr 24 11:19:59] NOTICE[106]: src/mrcp_client_session.c:620 Send MRCP Request TTS-74 a411b056a43d4856@speechsynth [1]
[Apr 24 11:19:59] NOTICE[107]: src/mrcp_client_connection.c:551 Send MRCPv2 Data 10.244.9.200:46136 ↔ 10.244.9.198:1544 [185 bytes]
MRCP/2.0 185 SPEAK 1
Channel-Identifier: a411b056a43d4856@speechsynth
Content-Type: text/plain
Content-Length: 65
1745489996.376007
Olá Carlos, como te posso ajudar hoje?`TTS_MS
[Apr 24 11:19:59] NOTICE[107]: src/mrcp_client_connection.c:656 Receive MRCPv2 Data 10.244.9.200:46136 ↔ 10.244.9.198:1544 [83 bytes]
MRCP/2.0 83 1 200 IN-PROGRESS
Channel-Identifier: a411b056a43d4856@speechsynth
[Apr 24 11:19:59] NOTICE[106]: src/mrcp_client_session.c:498 Raise App MRCP Response TTS-74
> 0x7f8f8002e1e0 – Strict RTP switching to RTP target address 62.28.2xx.1xx:129xx as source
[Apr 24 11:19:59] NOTICE[108]: src/mpf_rtp_stream.c:1218 Generate RTCP SR [ssrc:2405374445 s:3 o:480 ts:3200]
[Apr 24 11:19:59] NOTICE[108]: src/mpf_rtp_stream.c:1405 Send Compound RTCP Packet [BYE] [76 bytes] 10.244.9.200:10259 → 10.244.9.198:10327
[Apr 24 11:20:00] NOTICE[108]: src/mpf_rtp_stream.c:1218 Generate RTCP SR [ssrc:2405374445 s:45 o:7200 ts:10000]
[Apr 24 11:20:00] NOTICE[108]: src/mpf_rtp_stream.c:1405 Send Compound RTCP Packet [BYE] [76 bytes] 10.244.9.200:10259 → 10.244.9.198:10327
[Apr 24 11:20:02] NOTICE[107]: src/mrcp_client_connection.c:656 Receive MRCPv2 Data 10.244.9.200:46136 ↔ 10.244.9.198:1544 [122 bytes]
MRCP/2.0 122 SPEAK-COMPLETE 1 COMPLETE
Channel-Identifier: a411b056a43d4856@speechsynth
Completion-Cause: 000 normal
jcolp
April 24, 2025, 11:21am
9
That’s a third party set of modules. There is no logging from PJSIP in that provided output.
Nando
April 24, 2025, 11:53am
10
<— Transmitting SIP response (1372 bytes) to TCP:10.244.9.1:48370 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.1.75;rport=48370;received=10.244.9.1;branch=z9hG4bK8bf5.51acdbfec52258f922b24e940b93c31e.0;i=2
Via: SIP/2.0/TCP 2.81.7x.xxx:50394;rport=50394;received=2.81.7x.xxx;branch=z9hG4bKPje15f856b329f48a1bb6d99a000001ed9;alias
Record-Route: sip:192.168.1.75;transport=tcp;lr;ftag=215bd4ad79da46d3894d7b45a739f590
Call-ID: a2edd3677e0047c7a0bc65685b1a4ee4
From: “6007” sip:6007@62.28.2xx.1xx ;tag=215bd4ad79da46d3894d7b45a739f590
To: sip:100@62.28.2xx.1xx ;tag=e8cb3b33-9340-439e-9d4d-317beea2b37f
CSeq: 11528 INVITE
Server: Asterisk PBX 18.24.3
Contact: sip:10.244.9.200:5060;transport=TCP
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, INFO, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer
Content-Type: application/sdp
Content-Length: 461
<— Transmitting SIP request (520 bytes) to TCP:192.168.1.75:5060 —>
BYE sip:6007@2.81.7x.xxx:50394;transport=TCP;ob SIP/2.0
Via: SIP/2.0/TCP 192.168.1.190:5060;rport;branch=z9hG4bKPjab3d7053-ed82-450a-a31a-26d42c015286;alias
From: sip:100@62.28.2xx.1xx ;tag=e8cb3b33-9340-439e-9d4d-317beea2b37f
To: “6007” sip:6007@62.28.2xx.1xx ;tag=215bd4ad79da46d3894d7b45a739f590
Call-ID: a2edd3677e0047c7a0bc65685b1a4ee4
CSeq: 2368 BYE
Route: sip:192.168.1.75;transport=tcp;lr;ftag=215bd4ad79da46d3894d7b45a739f590
Max-Forwards: 70
User-Agent: Asterisk PBX 18.24.3
Content-Length: 0
<— Received SIP response (411 bytes) from TCP:192.168.1.75:5060 —>
SIP/2.0 481 Call/Transaction Does Not Exist
Via: SIP/2.0/TCP 192.168.1.190:5060;rport=12748;received=192.168.1.190;branch=z9hG4bKPjab3d7053-ed82-450a-a31a-26d42c015286;alias
Call-ID: a2edd3677e0047c7a0bc65685b1a4ee4
From: sip:100@192.168.1.75:5060 ;tag=e8cb3b33-9340-439e-9d4d-317beea2b37f
To: “6007” sip:6007@192.168.1.75:5060 ;tag=215bd4ad79da46d3894d7b45a739f590
CSeq: 2368 BYE
Content-Length: 0
jcolp
April 24, 2025, 11:55am
11
According to the output the TCP connection is originating from 10.244.9.1, so external_* wouldn’t kick in.
Nando
April 24, 2025, 12:02pm
12
Any tips on how I can fix this issue—either on the Asterisk side or maybe in Kamailio/RTPengine?
jcolp
April 24, 2025, 12:03pm
13
I can’t speak towards Kubernetes networking, but from an Asterisk perspective you could purposely configure local_net incorrectly.
airsay
April 24, 2025, 9:21pm
14
And you were answered on that mailing list about reviewing the Contact header and the c: in SDP. You have to use that SIP proxy to deal with this as indicated in the responses in the mailing list
Nando
May 13, 2025, 3:49pm
15
[SOLVED]
Changed the contact header with this code
subst("/^Contact:.*<sip:(10\.244\.[0-9\.]+):/Contact:<sip:SOME IP:/ig")