Hello,
I am currently working on a scenario where I need to use Kamailio in the failure_route to process SIP responses, specifically handling negative SIP replies (e.g., 486 Busy Here) that Kamailio may receive.
Here is the topology:
##B2BUA (acts as a UAC with the Kamailio, because it sends the INVITE) -> Kamailio -> Callee##
In my setup, Kamailio needs to extract all Via headers from the received SIP response in the failure_route, focusing particularly on the bottom Via header (from the B2BUA' UAC part). However, I am encountering difficulties in achieving this. Here is what I have tried so far:
1. To extract the Via headers, I used the following line of code in the failure_route:
```$var(viaHeaderValues) = $T_rpl($hdr(Via));```
However, this only returns the topmost Via header.
2. I attempted to get the first and last Via headers values with:
```$var(viaHeaderValueFirst) = $T_rpl($hdr(Via)[0]);
$var(viaHeaderValueLast) = $T_rpl($hdr(Via)[1]);```
Unfortunately, this also only returns the topmost Via header, which contains the address of Kamailio.
My goal is to make sure that when Kamailio sends the SIP reply to the UAC with send_reply method on the failure_route, it uses the extracted *Via header* of the incoming SIP response (only the bottom one). Here is an example scenario:
- Received SIP Response in kamailio:
```
SIP/2.0 486 Busy Here
Via: SIP/2.0/UDP 200.200.200.4;branch=z9hG4bK9157.090080a91105c0ec6279bb56882d1dc8.0
Via: SIP/2.0/UDP 200.200.200.3;received=200.200.200.3;rport=5060;branch=z9hG4bKF1aaZ7ea7yc2m
From: <sip:caller@200.200.200.3>;tag=222222
To: <sip:callee@200.200.200.4:5060>;tag=4545454
Call-ID: 65695DSQ(a)200.200.200.3
CSeq: 1 INVITE
Content-Length: 0
```
- Desired SIP Response from kamailio:
```
SIP/2.0 486 Busy Here
Via: SIP/2.0/UDP 200.200.200.3;received=200.200.200.3;rport=5060;branch=z9hG4bKF1aaZ7ea7yc2m
From: <sip:caller@200.200.200.3>;tag=222222
To: <sip:callee@200.200.200.4:5060>;tag=4545454
Call-ID: 65695DSQ(a)200.200.200.3
CSeq: 1 INVITE
Content-Length: 0
```
The current issue is that Kamailio modifies the Via header when sending the reply with send_reply method, resulting in:
```
SIP/2.0 486 Busy Here
Via: SIP/2.0/UDP 200.200.200.3;rport=5060;branch=z9hG4bKF1aaZ7ea7yc2m;received=200.200.200.3
From: <sip:caller@200.200.200.3>;tag=222222
To: <sip:callee@200.200.200.4:5060>;tag=4545454
Call-ID: 65695DSQ(a)200.200.200.3
CSeq: 1 INVITE
Content-Length: 0
```
Due to this change, the UAC does not correctly react to or understand the SIP response "SIP Reply follows the RFC standards, but my current UAC waits for a Via that looks like Via of the previous SIP messages in the structure of parameters.". It is crucial for the Via header to maintain the same important order such as the branch, received, and rport values as the previous exchanged SIP messages.
Could you please provide guidance on how to force Kamailio to send the SIP reply using send_reply method with the extracted bottom Via header from the incoming SIP response? Any advice or examples on handling this situation would be greatly appreciated.
Thank you for your time and assistance.
Hello all,
I am using a very simple scritp with corex module enabled . Normal calls works fine, but a scenario where INVITE does not
receive response and the call is released with SIP 408 (request timeout) leads to memmory leak. I verified it making a lot of
calls with this scenario and printing the shared memory (using kamcmd core.shmmem) . Its ocurred with modparam("corex", "nio_intercept", 1).
If I modify to modparam("corex", "nio_intercept", 0) the memmory leak does not ocurr anymore.
The problem also occurs in another scenario where the SIP Cancel message is not responded to.
My script has this event route
# event route
event_route[network:msg] {
xlog("L_INFO", "Dentro do Event_Route \n");
if (is_incoming()) {
xlog("L_INFO", "Received message '$mb' \n");
$avp(msg) = $mb;
xinfo("avp(msg) = $avp(msg)");
} else {
xlog("L_INFO", "Sending message '$mb' \n");
$avp(msg) = $mb;
};
}
Test done wtih 4000 calls:
[root@labcom070 kamailio]# kamctl stats shmem
{
"jsonrpc": "2.0",
"result": [
"shmem:fragments = 900",
"shmem:free_size = 6180368",
"shmem:max_used_size = 66980272",
"shmem:real_used_size = 60928496",
"shmem:total_size = 67108864",
"shmem:used_size = 54884944"
],
"id": 393115
}
[root@labcom070 kamailio]# kamcmd mod.stats all shm
Module: core
{
create_avp(178): 52257504
counters_prefork_init(211): 53760
cfg_clone_str(132): 112
cfg_shmize(221): 832
main_loop(1381): 16
init_pt(104): 16
init_pt(103): 16
init_pt(102): 6224
cfg_register_ctx(47): 96
init_tcp(5197): 8192
init_tcp(5191): 32768
init_tcp(5182): 16
init_tcp(5175): 16
init_tcp(5167): 16
init_tcp(5161): 16
init_tcp(5149): 16
init_avps(92): 16
init_avps(91): 16
init_dst_blocklist(435): 16384
init_dst_blocklist(427): 16
timer_alloc(494): 96
init_dns_cache(368): 16
init_dns_cache(359): 16384
init_dns_cache(351): 16
init_dns_cache(343): 16
init_timer(264): 16
init_timer(263): 16384
init_timer(262): 16
init_timer(261): 16
init_timer(250): 16
init_timer(218): 16
init_timer(207): 278544
init_timer(206): 16
init_timer(194): 16
cfg_child_cb_new(832): 64
sr_cfg_init(371): 16
sr_cfg_init(364): 16
sr_cfg_init(356): 16
sr_cfg_init(344): 16
sr_cfg_init(332): 16
ksr_shutdown_phase_init(123): 16
rpc_hash_add(118): 16
qm_shm_lock_init(1463): 16
Total: 52687808
}
I attached my kamailio script used and a log with one call using the command "kamcmd corex.shm_summary" with modparam("corex", "nio_intercept", 1)
and modparam("corex", "nio_intercept", 0)
Regards,
Vanderlei
Hello,
Kamailio SIP Server v5.7.6 stable release is out.
This is a maintenance release of the latest stable branch, 5.7, that
includes fixes since the release of v5.7.5. There is no change to
database schema or configuration language structure that you have to do
on previous installations of v5.7.x. Deployments running previous v5.7.x
versions are strongly recommended to be upgraded to v5.7.6.
For more details about version 5.7.6 (including links and guidelines to
download the tarball or from GIT repository), visit:
* https://www.kamailio.org/w/2024/07/kamailio-v5-7-6-released/
RPM, Debian/Ubuntu packages will be available soon as well.
Note that 5.7.x is currently the previous stable release series, the
latest is 5.8.x and v5.8.2 was released on June 12, 2024.
Many thanks to all contributing and using Kamailio!
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Hello,
I am considering to release Kamailio v5.7.6 (out of branch 5.7) on
Tuesday, July 2, 2024. If anyone is aware of issues not yet on the bug
tracker, report them there asap in order to have a better chance to be
fixed.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Hello guys,
I'm trying to use an SRV as an advertised address but kamailio fails to
start. Is this not possible?
Thanks,
David Villasmil
email: david.villasmil.work(a)gmail.com
Hi everyone. Wanting to see if someone could point me in the right
direction. Still very knew to Kamailio but I am beginning to understand it
better. I'm making an outbound proxy and have everything working well
besides stir/shaken. I'm looking at the module page and have went back and
forth with chatGPT and can't seem to figure this part out. I keep getting
errors on the modparam lines.
Obviously this is a self signed cert because I'm just testing. I am able to
reach and download the cert from the Web server.
Thank you for any assistance.
# SECSIPID for Stir/Shaken
modparam("secsipid", "private_key", "/etc/kamailio/secsipid/private.key")
modparam("secsipid", "certificate", "/etc/kamailio/secsipid/cert.crt")
modparam("secsipid", "authority_cert", "/etc/kamailio/secsipid/ca.crt")
modparam("secsipid", "expire", 600) modparam("secsipid", "timeout", 2)
route[STIRSHAKEN] {
if (is_method("INVITE")) {
if (!secsipid_add_identity("$fU", "$rU", "A", "", "
http://myIPaddress.com/stir_shaken_cert.crt
<http://myipaddress.com/stir_shaken_cert.crt>",
"/etc/kamailio/secsipid/private.key")) {
xlog("L_ERR", "Failed to sign call with ID: $ci - From: $fU\n");
send_reply("500", "Internal Server Error");
exit;
} else {
xlog("L_INFO", "Successfully signed call with ID: $ci - From:
$fU\n");
}
}
# Relay the call after signing
route(RELAY);
}