I want to use opensips as SBC, When the agent registers to kamailio, the contact content is modified to the ip and port of kamailio, and then Register is forwarded to the agent.
remove_hf("Contact") can't remove the whole Contact( field, vlue).
here is my config:
route[REGISTRAR] {
if (!is_method("REGISTER")) return;
if(isflagset(FLT_NATS)) {
setbflag(FLB_NATB);
#!ifdef WITH_NATSIPPING
# do SIP NAT pinging
setbflag(FLB_NATSIPPING);
#!endif
}
fix_nated_contact();
if (!save("location","0x02")) {
#if (!save("location")) {
sl_reply_error();
}
$fs="udp:172.16.4.111:5461";
$du="sip:172.16.4.114:5060";
remove_hf("Contact");
$var(contact) = "Contact: <sip:" +$fU+"@"+"172.16.4.111:5461>;expires=120\r\n" ;
append_hf("$var(contact)");
route(RELAY);
exit;
}
here is the sip message:
2025/03/26 16:36:07.706093 172.16.4.111:5461 -> 172.16.4.114:5060
REGISTER sip:172.16.4.111:5460 SIP/2.0
Via: SIP/2.0/UDP 172.16.4.111:5461;branch=z9hG4bKfc7e.d2df36f3b5681afeb71e442e645de38d.0
Via: SIP/2.0/UDP 172.16.80.3:49309;received=172.16.80.3;rport=49309;branch=z9hG4bKPj8ab8bd1d3c3a4c1bb0cd639540fa3183
Max-Forwards: 69
From: <sip:1008@172.16.4.111>;tag=95f7f5601f8b40458a1efe6923ab0a29
To: <sip:1008@172.16.4.111>
Call-ID: f84b643f5d284d18a0d8175e1ef4d747
CSeq: 33264 REGISTER
User-Agent: MicroSIP/3.21.6
sip:1008@172.16.80.3:49309;obExpires: 120
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0
Contact: <sip:1008@172.16.4.111:5461>;expires=120
you can see the problem is that: sip:1008@172.16.80.3:49309;obExpires: 120
,
sip:1008@172.16.80.3:49309
is the value of the Contact field after fix_nated_contact().
(paste your debugging data here)
(paste your log messages here)
(paste your sip traffic here)
kamailio -v
version: kamailio 5.8.5 (x86_64/linux)
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:
compiled on 11:27:01 Mar 21 2025 with gcc 4.8.5
Centos7.9
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.