Anybody experiences with Kamailio IMS modules (ims_registrar_scscf, ims_usrloc_scscf, ims_isc, ........) and the use of IPv6 addresses?
Any pitfalls? DNS issues?
Thanks,
Christoph
Hello,
I am using letsencrypt cert and key and do not want to restart kamailio
every 3 months to load new ones.
I know that there is: kamcmd tls.reload method but it has an error for me.
error: 500 - Error while fixing TLS configuration (consult server log)
I am checking the logs and see:
kamailio[3865480]: INFO: tls [tls_domain.c:345]: ksr_tls_fill_missing():
TLSs<default>: tls_method=3
kamailio[3865480]: INFO: tls [tls_domain.c:357]: ksr_tls_fill_missing():
TLSs<default>: certificate='/etc/kamailio/certs/my_cert.crt'
kamailio[3865480]: INFO: tls [tls_domain.c:364]: ksr_tls_fill_missing():
TLSs<default>: ca_list='(null)'
kamailio[3865480]: INFO: tls [tls_domain.c:371]: ksr_tls_fill_missing():
TLSs<default>: ca_path='(null)'
kamailio[3865480]: INFO: tls [tls_domain.c:378]: ksr_tls_fill_missing():
TLSs<default>: crl='(null)'
kamailio[3865480]: INFO: tls [tls_domain.c:382]: ksr_tls_fill_missing():
TLSs<default>: require_certificate=0
kamailio[3865480]: INFO: tls [tls_domain.c:390]: ksr_tls_fill_missing():
TLSs<default>: cipher_list='(null)'
kamailio[3865480]: INFO: tls [tls_domain.c:397]: ksr_tls_fill_missing():
TLSs<default>: private_key='/etc/kamailio/certs/private.key'
kamailio[3865480]: INFO: tls [tls_domain.c:401]: ksr_tls_fill_missing():
TLSs<default>: verify_certificate=0
kamailio[3865480]: INFO: tls [tls_domain.c:406]: ksr_tls_fill_missing():
TLSs<default>: verify_depth=9
kamailio[3865480]: INFO: tls [tls_domain.c:410]: ksr_tls_fill_missing():
TLSs<default>: verify_client=0
kamailio[3865480]: NOTICE: tls [tls_domain.c:1168]: ksr_tls_fix_domain():
registered server_name callback handler for socket [:0],
server_name='<default>' ...
kamailio[3865480]: ERROR: tls [tls_domain.c:590]: load_cert():
TLSs<default>: Unable to load certificate file
'/etc/kamailio/certs/my_cert.crt'
kamailio[3865480]: ERROR: tls [tls_util.h:49]: tls_err_ret():
load_cert:error:03000072:digital envelope routines::decode error (sni:
unknown)
kamailio[3865480]: ERROR: tls [tls_util.h:49]: tls_err_ret():
load_cert:error:0A00018F:SSL routines::ee key too small (sni: unknown)
Any advice ?
It's interesting that there are not any errors in case I restart kamailio.
I can make TLS calls without problems.
deb 12.5
version: kamailio 5.7.4 (x86_64/linux)
Dear Kamailio Team,
I hope this email finds you well.
I am currently working on a project where Kamailio is being utilized as a
load balancer to distribute calls across multiple FreeSWITCH instances. I
am using the round-robin technique for load distribution, and it is working
perfectly for regular call scenarios.
However, I am encountering an issue when handling attended transfer calls.
Specifically, for a normal call, Kamailio assigns one FreeSWITCH instance,
but during the attended transfer call, it assigns another FreeSWITCH
instance. This behavior disrupts the continuity of the call handling.
My requirement is for Kamailio to use the same FreeSWITCH instance for the
entire call, including any attended transfers. I believe maintaining the
same FreeSWITCH instance for the entire call flow would ensure consistency
and avoid potential issues.
Could you please guide me on how to configure Kamailio to achieve this
behavior? I would greatly appreciate any suggestions, configurations, or
modules that can help resolve this issue.
Thank you for your time and assistance.
Looking forward to your response.
Best regards,
Kotappa Y Gandudi
Hi List
To handle CPE which can only handle a limited number of route header
(PacketCable SIP specification), I need to store and restore the route
header (limited topology hiding only affecting Route Header) to present
the CPE only one Route or RR header.
I pass the ID of the stored route-set via RR param.
So when I get a message back from the CPE is:
* Take ID from RR param and pull stored route set from cache.
* remove_hf("Route");
* insert_hf("Route: $avp(stored-routeset)\r\n");
* msg_apply_changes();
* loose_route();
I found loose_route() only to be able to correctly determine the next
hop, if I first did apply the changes.
But after adding rtpengine to the mix, I got back into the known
situation that calling rtpengine (on the branch route) after calling
msg_apply_changes() results in duplicate SDP.
Is there a way to get loose_route() to operate on freshly added header
without calling msg_apply_changes?
--
Mit freundlichen Grüssen
-Benoît Panizzon- @ HomeOffice und normal erreichbar
--
I m p r o W a r e A G - Leiter Commerce Kunden
______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00
CH-4133 Pratteln Fax +41 61 826 93 01
Schweiz Web http://www.imp.ch
______________________________________________________
Hi all!
still struggling with Async HTTP Client ...
My current configuration is very simple:
#!define HTTP_API_ROUTING_ENDPOINT_MAIN "
http://MY_HTTP_REST_API:18085/Endpoint"
include_file "listen.cfg"
loadmodule "pv"
loadmodule "tm"
loadmodule "http_async_client"
loadmodule "xlog"
loadmodule "tmx"
loadmodule "sl"
loadmodule "textops"
loadmodule "cfgutils"
loadmodule "siputils"
loadmodule "rr"
loadmodule "ctl"
loadmodule "jsonrpcs.so"
loadmodule "jansson.so"
modparam("pv", "shvset", "http_async=i:8");
modparam("http_async_client", "workers", 1);
modparam("http_async_client", "connection_timeout", 500)
modparam("http_async_client", "curl_verbose", 1) # for debug purpose
#modparam("tm", "fr_timer", 750)
#modparam("tm", "fr_inv_timer", 20000)
#modparam("tm", "remap_503_500", 0)
modparam("tm", "failure_reply_mode", 3)
modparam("tm", "max_inv_lifetime",5000)
# ----- jsonrpcs params -----
modparam("jsonrpcs", "pretty_format", 1)
/* set the path to RPC fifo control file */
modparam("jsonrpcs", "fifo_name", "/tmp/kamailio_rpc.fifo")
/* set the path to RPC unix socket control file */
modparam("jsonrpcs", "dgram_socket", "/tmp/kamailio_rpc.sock")
debug=2
children=16
log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} "
disable_sctp = yes
force_rport = yes
rundir="/tmp"
request_route {
$avp(REQUEST_URL) = HTTP_API_ROUTING_ENDPOINT_MAIN;
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
t_relay();
}
exit;
}
if(is_method("OPTIONS")){
sl_reply("200", "OK");
exit;
}
if(is_method("CANCEL")){
sl_reply("200","OK");
sl_reply("487","Request Terminated");
exit;
}
jansson_set("string","from" , $hdr(From) , "$var(req)");
jansson_set("string","to" , $hdr(To) , "$var(req)");
jansson_set("string","r-uri" , $ru , "$var(req)");
jansson_set("string","contact" , $hdr(Contact) , "$var(req)");
jansson_set("string","call-id" , $ci , "$var(req)");
xinfo("MAIN-ROUTE - Setting From=$hdr(From) To=$hdr(To)
Contact=$hdr(Contact) ci=$ci \n");
if ( is_present_hf("Identity") )
jansson_set("string","identity" ,
$hdr(Identity) , "$var(req)");
if ( is_present_hf("P-Identity-Bypass") )
jansson_set("string","p-identity-bypass" ,
$hdr(P-Identity-Bypass) , "$var(req)");
if ( is_present_hf("P-Asserted-Identity") )
jansson_set("string","p-asserted-identity" ,
$hdr(P-Asserted-Identity) , "$var(req)");
if ( is_present_hf("P-STSH-UC") )
jansson_set("string","p-stsh-uc" ,
$hdr(P-STSH-UC) , "$var(req)");
jansson_set("string", "request-time" , $avp(requestTime),
"$var(req)");
## Create transaction before http_async_query;
if (is_method("INVITE")){
t_newtran();
xinfo("MAIN-ROUTE - Sending request [$var(req)]\n");
route(HTTP_ASYNC_REQUEST);
}
exit;
}
route[HTTP_ASYNC_REQUEST] {
xinfo("HTTP_ASYNC_REQUEST - Sending request [$var(req)]\n");
$http_req(all) = $null;
$http_req(suspend) = 1;
$http_req(timeout) = 1500; # 1 second timeout
$http_req(method) = "POST";
$http_req(hdr) = "Content-Type: application/json";
$http_req(body) = $var(req);
if ( !http_async_query($avp(REQUEST_URL), "HTTP_REPLY") ) {
xinfo("HTTP_ASYNC_REQUEST - http_async_query $ci FAILED. Return is
[$rc]\n");
}else{
send_reply("503", "Server Error");
exit;
}
}
route[HTTP_REPLY] {
xinfo("HTTP_REPLY - Xphere Response Code $http_rs - $ci\n");
if ( $http_ok && $http_rs==200) {
xinfo("HTTP_REPLY - $ci reply ok\n");
jansson_xdecode($http_rb, "json");
xinfo("HTTP_REPLY - HTTP JSON Response: $http_rb \n");
if ( $xavp(json=>sip-response-code) == 300 ){
remove_hf("Contact");
append_to_reply("Contact: $xavp(json=>contact)\r\n");
## "touch" the ruri to add the contact header for 3xx:
$ru = $ru;
send_reply("300", "Multiple Choice");
exit;
}else{
xinfo("HTTP_REPLY - $ci Error Replied
$xavp(json=>sip-response-code) - $xavp(json=>sip-response-text) \n");
send_reply("$xavp(json=>sip-response-code)","$xavp(json=>sip-response-text)");
exit;
}
}
else {
xinfo("HTTP_REPLY - HTTP Response Code $ci - $http_rs and
error $http_err \n");
if (!$http_ok){
sl_reply("503", "No Connection to HTTP");
exit;
}else if ($http_rs>=500){
sl_reply("503", "HTTP Processing Error");
exit;
}
else{
sl_reply("503", "Cannot Connect to HTTP");
exit;
}
}
exit;
}
The configuration is based on Ben Kaufman's kamailio_http_async
<https://github.com/whosgonna/kamailio_http_async> example, but I have
extended it a bit.
Currently all the requests are being sent to the HTTP REST API. I can't
find queue/buffering issues...
What I am experiencing is that , using SNGREP, I get this flow:
10.240.12.209:5060 10.242.17.146:5060
----------*---------- ----------*----------
17:33:46.689852 x INVITE (SDP) x
+0.000530 x --------------------------> x
17:33:46.690382 x 100 trying -- your call is x
+1.499822 x <-------------------------- x
17:33:48.190204 x 503 No Connection to HTTP x
+0.000029 x <-------------------------- x
17:33:48.190233 x 500 I'm terribly sorry, se x
+0.002130 x <-------------------------- x
17:33:48.192363 x ACK x
+0.485836 x --------------------------> x
17:33:48.678199 x 500 I'm terribly sorry, se x
+0.004881 x <<<------------------------ x
17:33:48.683080 x ACK x
+0.973295 x ------------------------>>> x
17:33:49.656375 x 500 I'm terribly sorry, se x
+0.004105 x <<<------------------------ x
17:33:49.660480 x ACK x
+1.995420 x ------------------------>>> x
17:33:51.655900 x 500 I'm terribly sorry, se x
+0.005361 x <<<-------------------------x
17:33:51.661261 x ACK x
x ------------------------>>> x
I suspected issues with the HTTP REST service, but when using tcpdump, I
can find the Request from Kamailio and a reply back from the REST API
service, so doesn't seem to be a problem on the HTTP REST service
So my questions are:
- why is Kamailio sending a "SIP 500 I'm terribly sorry..." error after a
503 No Connection to HTTP is sent and an "exit" command is executed?
- how can I get rid of these messages?
- Why Kamailio keeps sending responses back to SBC after the ACK when it is
set to just "exit"?
- Why is Kamailio not processing the response from HTTP REST API when it is
correctly received?
Logs are also weird:
- I find a lot of these warnings:
"Dec 29 17:38:34 ire-nprod-sip1 /usr/local/sbin/kamailio[590864]: WARNING:
http_async_client [http_async_client_mod.c:529]: ah_get_status(): an async
variable was read after http error, use $http_ok to check the request's
status"
and
"Dec 29 17:38:34 ire-nprod-sip1 /usr/local/sbin/kamailio[590864]: ERROR:
http_async_client [http_multi.c:621]: check_multi_info(): handle
0x7f375f786b30 returned error 7:"
(I am still not using EVAPI module, that will be my next step, after the
holiday season)
(I suspect, however, that the REST API is not being able to handle the load
in this test environment (between 400 to 600 CAPS), but that is another
matter.)
In attach, TCPDUMP, if anyone wishes to analyse.
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
Just to share, and thanks for your valuable help. My conclusion after tests (on my scenario) is
http backend:
is a golang http server with a 250ms delay to answer, and answering back a json, running in 10 replicas inside a K8 with 4 nodes.
test (from kamailio perspective):
receive INVITE
send 100
call the http, get the result, get a key from the result and set it as the value of Contact header
send 302
receive ACK (discard on sync scenario because it’s stateless, use it in async to end transaction)
Kamailio host:
1vcpu
kamailio 3.8.4 bookworm running inside containerd (with podman)
16GB RAM
sipp:
run from the K8 nodes hosts (directly from OS) (everything is LAN connected on 2 different physical servers, hypervisor is VMWare i guess 7.0.3)
using http_client (sync with stateless):
8 children -M8 -m64 no more than 60 calls/sec (15cps on each sipp instance) until sipp start to retransmit the INVITES
using async_http_client:
8 children -M8 -m2048 it’s been ~36 hours now at 250cps each sipp instance with 0 errors 0 retransmission and the kamailio host is
userlab@sblb1:~$ vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
4 0 0 10285460 364684 5444240 0 0 0 22 36 68 0 0 100 0 0
1 0 0 10285460 364684 5444240 0 0 0 0 5284 6822 27 14 58 0 0
4 0 0 10285460 364684 5444240 0 0 0 0 5306 6752 29 15 57 0 0
3 0 0 10285460 364684 5444240 0 0 0 0 5304 6823 26 16 57 0 0
2 0 0 10285460 364684 5444240 0 0 0 12 5287 6761 26 16 57 0 0
2 0 0 10285460 364684 5444240 0 0 0 0 5337 6838 27 14 58 0 0
1 0 0 10285460 364684 5444240 0 0 0 0 5101 6724 25 17 59 0 0
3 0 0 10285460 364684 5444240 0 0 0 0 5066 6650 26 14 60 0 0
1 0 0 10285460 364684 5444240 0 0 0 0 5306 6829 23 17 59 0 0
1 0 0 10285460 364684 5444240 0 0 0 0 5219 6725 23 19 58 0 0
1 0 0 10285460 364684 5444240 0 0 0 0 5274 6770 26 13 61 0 0
1 0 0 10285460 364684 5444240 0 0 0 0 5295 6756 26 18 56 0 0
1 0 0 10285460 364684 5444240 0 0 0 0 5235 6786 22 16 62 0 0
1 0 0 10285460 364684 5444240 0 0 0 0 5315 6833 21 20 59 0 0
at least for my scenario, it worths to pay the price of the memory tradeoff.
again, Ben, Alex, Sergio, all, thanks for your help.
regards
Hello all, moving just a bit aside of the http and async_http.
After all the real useful and interesting thread on that topic what helped me, im facing a problem i cant deal with and need a hint at least.
Scenario
INVITE -> Kamailio
on request_route
...
if(is_method("INVITE")){
t_newtran();
http_async_query("http://nuc:8080", "HTTP_REPLY");
}
…
Kamailio -> 100 - Trying
then
route[HTTP_REPLY] {
if ($http_ok) {
xlog("L_INFO", "route[HTTP_REPLY]: status $http_rs\n");
xlog("L_INFO", "route[HTTP_REPLY]: body $http_rb\n");
t_reply(302,"Redirect");
} else {
xlog("L_INFO", "route[HTTP_REPLY]: error $http_err)\n");
}
}
Kamailio -> 302 Redirect
ACK -> Kamailio
This last ACK, how can i read it and use it to terminate the transaction? because Kamailio keeps transmitting the 302 message 3 more times until the transaction is finished by a timer
42(44) DEBUG: tm [t_reply.c:1723]: t_retransmit_reply(): reply retransmitted. buf=0x7f4c44f9d680: SIP/2.0 3..., shmem=0x7f4c3fce7900: SIP/2.0 3
42(44) DEBUG: tm [t_reply.c:1723]: t_retransmit_reply(): reply retransmitted. buf=0x7f4c44f9d680: SIP/2.0 3..., shmem=0x7f4c3fce7900: SIP/2.0 3
42(44) DEBUG: tm [t_reply.c:1723]: t_retransmit_reply(): reply retransmitted. buf=0x7f4c44f9d680: SIP/2.0 3..., shmem=0x7f4c3fce7900: SIP/2.0 3
42(44) DEBUG: tm [timer.c:642]: wait_handler(): finished transaction: 0x7f4c3fcd35a0 (p:0x7f4c3fad85d0/n:0x7f4c3fad85d0)
42(44) DEBUG: tm [h_table.c:133]: free_cell_helper(): freeing transaction 0x7f4c3fcd35a0 from timer.c:651
in request_route i have
if(is_method("ACK")){
if(!t_check_trans()){
t_release();
}
exit;
}
Hello all, how can avoid to append_branch do this call to call
SIP/2.0 302 Redirect
Via: SIP/2.0/UDP 192.168.86.250:5060;branch=z9hG4bK-65665-5-0
From: sipp <sip:sipp@192.168.86.250:5060>;tag=65665SIPpTag005
To: 123456 <sip:123456@192.168.86.128:5060>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-deb8da2e
Call-ID: 5-65665(a)192.168.86.250
CSeq: 1 INVITE
Contact: <sip:4093823670@otherdomain.com>, <sip:8888576523@otherdomain.com>, <sip:9719533197@otherdomain.com>, <sip:5302579529@otherdomain.com>, <sip:4972010218@otherdomain.com>
Server: kamailio (5.8.4 (x86_64/linux))
Content-Length: 0
What i mean with “avoid”, call to call, contact should have only 1 branch, no a stack of previous.
thanks
Hello, after the discussion regarding http and http_async, I started some labs to make a comparison and see what’s the trade off and the associated cost.
Main problem (to me) is im not clear on how transactions behave. Im running some fast tests now before I start to deploy the final scenarios and
1. A new transaction is created before the http_async call (as the module example shows for http_async_query function
2. The http_async_query call is executed, receives a response and the HTTP_REPLY route for http_async_query is executed.
3. As we need to redirect the call, im adding Contact information with append_to_reply and then calling t_reply(302,”Redirect)
Up to here INVITE is received, a 100 is answered and then the 302 with the expected Contact information (collected and built from the http_async_query response), problem is that the 302 is retransmitted 3 more times.
So, im not even sure that im doing the correct actions to process the call this way. Is there a document/book/reference I can read to understand transactions better?
By now I can not handle the call to be processed correctly (without the retransmissions) and finish the transaction the correct way.
Any help, link, guide, will be appreciated.
Regards.