Hello Everyone,
I’m running into a problem in asterisk inside kubernetes, when kamailio is sending OPTIONS ping it sends with it’s own pod ip but kamailio tries to match it with service IP.
My Setup
- Two pods:
- Asterisk
- Kamailio
- Kamailio is configured to send SIP pings (OPTIONS) to Asterisk.
- The Asterisk destination in Kamailio is defined like this:
- name: AST_IP
value: asterisk-external.xxxxxxx-dev.svc.cluster.local
This works fine — Kamailio sends OPTIONS to Asterisk, and Asterisk receives them.
My Problem
- Asterisk expects traffic from the service IP (
10.104.140.207) - Kamailio actually sends traffic from the pod IP (
10.244.10.8)
On the Asterisk side, I have it configured like this:
[kamailio-proxy]
type=identify
endpoint=kamailio-proxy
match={{KAM_RP_IP}}
and inside the deployment like this:
- name: KAM_RP_IP
value: kamailio-reverse-proxy.xxxxxxx-dev.svc.cluster.local
But when Kamailio actually sends the OPTIONS, it uses the pod IP instead of the service IP:
<--- Received SIP request (337 bytes) from UDP:10.244.10.8:5001 --->
OPTIONS sip:10.99.122.141:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.190:5001;branch=z9hG4bKac55.85247603000000000000000000000000.0
To: <sip:10.99.122.141:5060>
From: <sip:proxy@10.244.10.8>;tag=2a9844c03de3ba89f5d5d94180a1a6c0-012e09d6
CSeq: 10 OPTIONS
Call-ID: 4bd5f8594eeae31d-55@10.244.10.8
Max-Forwards: 70
Content-Length: 0
[2025-09-03 16:31:56.750] NOTICE[72]: res_pjsip/pjsip_distributor.c:673 log_failed_request: Request 'OPTIONS' from '<sip:proxy@10.244.10.8>' failed for '10.244.10.8:5001' (callid: 4bd5f8594eeae31d-55@10.244.10.8) - No matching endpoint found
<--- Transmitting SIP response (560 bytes) to UDP:10.244.10.8:5001 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.190:5001;rport=5001;received=10.244.10.8;branch=z9hG4bKac55.85247603000000000000000000000000.0
Call-ID: 4bd5f8594eeae31d-55@10.244.10.8
From: <sip:proxy@10.244.10.8>;tag=2a9844c03de3ba89f5d5d94180a1a6c0-012e09d6
To: <sip:10.99.122.141>;tag=z9hG4bKac55.85247603000000000000000000000000.0
CSeq: 10 OPTIONS
WWW-Authenticate: Digest realm="asterisk",nonce="1756913516/a80003e9f5c974e6989300ea2e467320",opaque="0a7e7e844ec00492",algorithm=MD5,qop="auth"
Server: Asterisk PBX 18.24.3
Content-Length: 0
Any Ideas on a way to fix this issue?
Thank you.