Hello,
please keep the list in CC, that others can comment as well.
Beside from the obvious (improving the performance of the lua API call), you could use indeed asynchronous processing. If you just use the lua code to emit the REST request, using a native http client module would be probably also faster as doing it over lua.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com<https://gilawa.com/>
From: Giovanni Jose <gio.jose(…
[View More]a)gmail.com>
Sent: Wednesday, March 30, 2022 5:17 PM
To: Henning Westerholt <hw(a)gilawa.com>
Subject: Re: [SR-Users] More than TCP 800 concurrent calls, slows Kamailio (LUA FILE API REQUESTS)
Hello Henning, Thanks so much for the fast response
I just commented the loop and I was hitting the backend and it's slow anyway maybe it's because, for this type of implementation when the destination of the call is decided by the API backend, I need to use the http_async_client module? I am noticing that for high volume calls kamailio slows the traffic and shows errors because there's a delay that is been added when the backend responds for every call.
On Tue, Mar 29, 2022 at 11:53 PM Henning Westerholt <hw(a)gilawa.com<mailto:hw@gilawa.com>> wrote:
Hello,
why are you sleeping for 1s in the loop? This will cause Kamailio to block processing. I also do not see any stop condition on the loop, so it will loop until the limit.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com<https://gilawa.com/>
From: sr-users <sr-users-bounces(a)lists.kamailio.org<mailto:sr-users-bounces@lists.kamailio.org>> On Behalf Of Giovanni Jose
Sent: Tuesday, March 29, 2022 9:46 PM
To: sr-users(a)lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
Subject: [SR-Users] More than TCP 800 concurrent calls, slows Kamailio (LUA FILE API REQUESTS)
Hello Guys I am having this issue where kamailio is receiving requests from SIPp (we are currently testing the platform and doing QA) but if we do more than 800 concurrent calls kamailio starts failing and slowing the requests, The scenario is the following:
I am sending 5000 calls at 100 CPS on TCP and I am having this route in the configuration file:
# Handle the calls to api
route[CALL_API] {
xlog("L_NOTICE"," Call request $var(call_request) method: $rm \n");
$var(loop_true)=1;
while ($var(loop_true)) {
if(!lua_run("call_request","$var(call_request)","$sht(token=>new_token)")) {
xlog("L_NOTICE", "SCRIPT: failed to execute lua function!\n");
}
if ($var(loop_true)){
sleep("1");
}
}
xlog("L_NOTICE", "SCRIPT: Sucess to execute lua function!\n");
}
So I am executing a LUA script for the requests and the API response will tell the destination of the call.
At 800 concurrent calls, I can notice SLOWLINESS in the SIPp testing tool, and then I will start receiving 408 timeouts.
This sounds like a load issue or something because I believe there's a time that it's been added every time we hit the backend and wait for the response.
any help will be appreciated
Regards
Gio
[View Less]
Hello,
I'm having some trouble with what I think is the dialog module.
I've got Kamailio 5.5.4 running well for some time. Recently I added
Asterisk to the mix and have come across an issue.
Call to Kamailio. Kamailio sends it to Asterisk. Asterisk may decide
to "forward" the call. To do this it will place a new outbound call
through Kamailio. From the user perspective, this works absolutely fine
(invite, ringing, ok, bye). The acc module handles it …
[View More]fine also.
However dialog does not, and the events for ok and bye do not fire on
the original call. They do fire for the forwarded call.
I've added some logging output to try to isolate the problem, but I'm no
further ahead. Here's what I have. Any suggestions?
** Call initiated **
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=100
ru=<null> tu=sip:destination@endpoint DLG_status=<null> dlg-h-id=3360
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=100
ru=<null> tu=sip:fwddest@0.0.0.1:5060 DLG_status=<null> dlg-h-id=12036
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=183
ru=<null> tu=sip:fwddest@0.0.0.1:5060 DLG_status=<null> dlg-h-id=12036
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=183
ru=<null> tu=sip:destination@endpoint DLG_status=<null> dlg-h-id=3360
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=200
ru=<null> tu=sip:fwddest@0.0.0.1:5060 DLG_status=<null> dlg-h-id=12036
CRITICAL: dialog [dlg_timer.c:200]: update_dlg_timer(): Trying to update
a bogus dlg tl=0x7fa0494006e8 tl->next=(nil) tl->prev=(nil)
ERROR: dialog [dlg_hash.c:1329]: update_dlg_timeout(): failed to update
dialog lifetime
CRITICAL: dialog [dlg_timer.c:200]: update_dlg_timer(): Trying to update
a bogus dlg tl=0x7fa0494006e8 tl->next=(nil) tl->prev=(nil)
ERROR: dialog [dlg_hash.c:1329]: update_dlg_timeout(): failed to update
dialog lifetime
ERROR: dialog [dlg_profile.c:1028]: dlg_set_timeout_by_profile(): Unable
to set timeout on 3306:12036
NOTICE: acc [acc.c:270]: acc_log_request(): ACC: transaction answered:
timestamp=1648611824;time_unix=1648611824.346;method=INVITE;from_tag=as292200a1;to_tag=as75834dc4;call_id=7cef233547dca0ac7882ce5249b3b54c;code=200;reason=OK
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=200
ru=<null> tu=sip:destination@endpoint DLG_status=<null> dlg-h-id=<null>
NOTICE: acc [acc.c:270]: acc_log_request(): ACC: transaction answered:
timestamp=1648611824;time_unix=1648611824.354;method=INVITE;from_tag=as730369e7;to_tag=as3b06b3e2;call_id=53bad4f0034b61a5745163d82daef402;code=200;reason=OK
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=200
ru=<null> tu=sip:destination@endpoint DLG_status=<null> dlg-h-id=<null>
WARNING: dialog [dlg_handlers.c:1328]: dlg_onroute(): unable to find
dialog for ACK with route param '161.02d' [353:3360] and call-id
'53bad4f0034b61a5745163d82daef402'
WARNING: dialog [dlg_handlers.c:1328]: dlg_onroute(): unable to find
dialog for ACK with route param '161.02d' [353:3360] and call-id
'53bad4f0034b61a5745163d82daef402'
** The call is answered and endpoints can talk to each other **
** Now the original caller hangs up **
WARNING: dialog [dlg_handlers.c:1328]: dlg_onroute(): unable to find
dialog for BYE with route param '161.02d' [353:3360] and call-id
'53bad4f0034b61a5745163d82daef402'
NOTICE: acc [acc.c:270]: acc_log_request(): ACC: transaction answered:
timestamp=1648611831;time_unix=1648611831.933;method=BYE;from_tag=as730369e7;to_tag=as3b06b3e2;call_id=53bad4f0034b61a5745163d82daef402;code=200;reason=OK
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=100
ru=<null> tu=sip:fwddest@0.0.0.1:5060 DLG_status=<null> dlg-h-id=12036
INFO: <script>: onreply_route[MANAGE_REPLY] branch [0] rm=INVITE rs=200
ru=<null> tu=sip:fwddest@0.0.0.1:5060 DLG_status=<null> dlg-h-id=12036
ERROR: <script>: got result for bye = Bye!; DLG_lifetime = 8
NOTICE: acc [acc.c:270]: acc_log_request(): ACC: transaction answered:
timestamp=1648611832;time_unix=1648611832.115;method=BYE;from_tag=as292200a1;to_tag=as75834dc4;call_id=7cef233547dca0ac7882ce5249b3b54c;code=200;reason=OK
ERROR: dialog [dlg_handlers.c:363]: dlg_terminated_confirmed(): failed
to get dialog from params!
** Everything ends cleanly on the other SIP endpoints **
What can I do from here to try to isolate this further?
Thanks,
--
Trevor Peirce
AcroVoice Solutions Inc
[View Less]
Hello community,
We made some modifications to Kamailio PCSCF sample cfg file, so when PCSCF receiving an tcp SUBSCRIBE message it add ;transport=tcp to the end of Contact URI. Below is what we added the route block right after if (is_method("INVITE|SUBSCRIBE")) logic
if (is_method("SUBSCRIBE") && proto=='tcp') {
$var(original_contact_header) = $ct;
$var(new_contact_header) = $(var(original_contact_header){re.subst,/(.*:.*)(>);/\1;transport=tcp>/…
[View More]g});
remove_hf("Contact");
append_hf("Contact: $var(new_contact_header)\r\n");
msg_apply_changes();
}
We did see the ;transport=tcp been added but we also seeing a bad line ;alias=[...] is added before the To: line
[cid:image001.png@01D84375.8D109B20]
Does anyone know what function might cause this ;alias been added before To: line?
BR,
Weiqi
[View Less]
Hello Guys I am having this issue where kamailio is receiving requests from
SIPp (we are currently testing the platform and doing QA) but if we do more
than 800 concurrent calls kamailio starts failing and slowing the requests,
The scenario is the following:
I am sending 5000 calls at 100 CPS on TCP and I am having this route in the
configuration file:
# Handle the calls to api
route[CALL_API] {
xlog("L_NOTICE"," Call request $var(call_request) method: $rm \n");
$var(loop_true)=1;
…
[View More]while ($var(loop_true)) {
if(!lua_run("call_request","$var(call_request)","$sht(token=>new_token)")) {
xlog("L_NOTICE", "SCRIPT: failed to execute lua function!\n");
}
if ($var(loop_true)){
sleep("1");
}
}
xlog("L_NOTICE", "SCRIPT: Sucess to execute lua function!\n");
}
So I am executing a LUA script for the requests and the API response will
tell the destination of the call.
At 800 concurrent calls, I can notice SLOWLINESS in the SIPp testing tool,
and then I will start receiving 408 timeouts.
This sounds like a load issue or something because I believe there's a time
that it's been added every time we hit the backend and wait for the
response.
any help will be appreciated
Regards
Gio
[View Less]
Hello guys,
Im starting kamailio with listen=0.0.0.0:5060 and in my dispatcher list i
have in the attrs something like: socket=udp:172.17.0.2:5060
That IP address belongs to kamailio's host and it is binging to it.
Is it right i can't set a specific IP in the socket attribute if listen is
0.0.0.0?
maybe i should be able to?
Regards,
David Villasmil
email: david.villasmil.work(a)gmail.com
phone: +34669448337
Dear all,
I don't belive to connect Kamailio to a remote Mariadb will take too much time.
STEP 1 : KAMAILIO :
--------------------------------
$ sudo kamailio -v
version: kamailio 5.5.4 (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, 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, …
[View More]TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_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: unknown
compiled with gcc 10.2.1
STEP 2 : Set the kamctlrc config
------------------------------------------------
KAMAILIO IP : 192.168.1.41
MARIADB IP : 192.168.1.39
- /etc/kamailio/kamctlrc
SIP_DOMAIN=example.be
DBENGINE=MYSQL
DBHOST=192.168.1.39 // where the mariadb is installed
DBNAME=kamailio
DBRWUSER="kamailio"
DBRWPW="XX"
DBROUSER="kamailioro"
DBROPW="XX"
DBACCESSHOST=192.168.1.41 // where kamctl is launched (here kamailio srv)
DBROOTUSER="root"
DBROOTPW="kamailio"
CHARSET="latin1"
STEP 3 : MARIADB : hosted on different srv than kamailio
--------------------------------------------------------------------------------------
IP : 192.168.1.39
- /etc/mysql/mariadb.conf.d/50-server.cnf
# this is only for the mysqld standalone daemon
[mysqld]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
bind-address = 0.0.0.0
STEP 4 : TEST : Reote connection with the DB
----------------------------------------------------------------------
REMOTE IP : 192.168.1.41
DB IP : 192.168.1.39
$ sudo mysql -u root -h 192.168.1.39 -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 298
Server version: 10.5.15-MariaDB-1:10.5.15+maria~bullseye mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>The connection is established with success.
STEP 5 : KAMAILIO DB : creation
----------------------------------------------------
$ sudo kamdbctl create
-e \E[37;33mINFO: creating database kamailio ...
-e \E[37;33mINFO: granting privileges to database kamailio ...
-e \E[37;33mINFO: creating standard tables into kamailio ...
-e \E[37;33mINFO: Core Kamailio tables successfully created.
Create the presence related tables? (y/n): y
-e \E[37;33mINFO: creating presence tables into kamailio ...
-e \E[37;33mINFO: Presence tables successfully created.
Create the tables for imc cpl siptrace domainpolicy carrierroute
drouting userblocklist htable purple uac pipelimit mtree sca mohqueue
rtpproxy rtpengine secfilter? (y/n): y
-e \E[37;33mINFO: creating extra tables into kamailio ...
-e \E[37;33mINFO: Extra tables successfully created.
Create the tables for uid_auth_db uid_avp_db uid_domain uid_gflags
uid_uri_db? (y/n): y
-e \E[37;33mINFO: creating uid tables into kamailio ...
-e \E[37;33mINFO: UID tables successfully created.
STEP 6 : DB : verify the users creation and rights
--------------------------------------------------------------------------
MariaDB [(none)]> select user, host from mysql.user;
+-------------+--------------+
| User | Host |
+-------------+--------------+
| kamailio | 192.168.1.39 |
| kamailioro | 192.168.1.39 |
| kamailio | 192.168.1.41 |
| kamailioro | 192.168.1.41 |
| root | 192.168.1.41 |
| kamailio | localhost |
| kamailioro | localhost |
| mariadb.sys | localhost |
| mysql | localhost |
| root | localhost |
+-------------+--------------+
10 rows in set (0.001 sec)
MariaDB [(none)]> SHOW GRANTS FOR kamailio(a)192.168.1.41;
+--------------------------------------------------------------------------------------------------------------------+
| Grants for kamailio(a)192.168.1.41 |
+--------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `kamailio`(a)`192.168.1.41` IDENTIFIED BY PASSWORD '*157PASSWORD' |
| GRANT ALL PRIVILEGES ON `kamailio`.* TO `kamailio`(a)`192.168.1.41` |
+--------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)
MariaDB [(none)]> SHOW GRANTS FOR kamailio(a)192.168.1.39;
+--------------------------------------------------------------------------------------------------------------------+
| Grants for kamailio(a)192.168.1.39 |
+--------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `kamailio`(a)`192.168.1.39` IDENTIFIED BY PASSWORD '*157PASSWORD' |
| GRANT ALL PRIVILEGES ON `kamailio`.* TO `kamailio`(a)`192.168.1.39` |
+--------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)
MariaDB [(none)]> SHOW GRANTS FOR kamailio@localhost;
+-----------------------------------------------------------------------------------------------------------------+
| Grants for kamailio@localhost |
+-----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `kamailio`@`localhost` IDENTIFIED BY PASSWORD '*157PASSWORD' |
| GRANT ALL PRIVILEGES ON `kamailio`.* TO `kamailio`@`localhost` |
+-----------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)STEP 7 : ADDRESS TABLE : add new ip address$ sudo systemctl restart kamailio
sipsecure@kamailio:/etc$ sudo kamctl address add 0 192.168.1.26 32 0 HP
-e \E[37;33mINFO: execute '/sbin/kamctl address reload' to synchronize cache and database
STEP 8 : DB : verify if the new ip address is created ? Yes
MariaDB [(none)]> select * from kamailio.address;
+----+-----+--------------+------+------+------+
| id | grp | ip_addr | mask | port | tag |
+----+-----+--------------+------+------+------+
| 1 | 0 | 192.168.1.26 | 32 | 0 | HP |
+----+-----+--------------+------+------+------+
1 row in set (0.000 sec)
STEP 9 : Reload the content of the DB into kamailio. It failed
----------------------------------------------------------------------------------------
The host: '192.168.1.41' is kamailio (remote client)$ sudo kamctl address reload
{
"jsonrpc": "2.0",
"error": {
"code": 500,
"message": "Reload failed."
},
"id": 12397
}
In /var/log/daemon.log
Mar 28 17:09:49 db04srv mariadbd[2430]: 2022-03-28 17:09:49 281 [Warning] Aborted connection 281 to db: 'kamailio' user: 'kamailio' host: '192.168.1.41' (Got an error reading communication packets)
Mar 28 17:09:49 db04srv mariadbd[2430]: 2022-03-28 17:09:49 273 [Warning] Aborted connection 273 to db: 'kamailio' user: 'kamailio' host: '192.168.1.41' (Got an error reading communication packets)
Mar 28 17:09:49 db04srv mariadbd[2430]: 2022-03-28 17:09:49 295 [Warning] Aborted connection 295 to db: 'kamailio' user: 'kamailio' host: '192.168.1.41' (Got an error reading communication packets)
Mar 28 17:09:49 db04srv mariadbd[2430]: 2022-03-28 17:09:49 264 [Warning] Aborted connection 264 to db: 'kamailio' user: 'kamailio' host: '192.168.1.41' (Got an error reading communication packets)
Now, if I am trying to restart "kamailio" service, I got an error :
Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: DEBUG: <core> [core/sr_module.c:940]: init_mod(): permissions
Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: DEBUG: permissions [address.c:179]: reload_address_db_table(): Number of rows in address table: 1
Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: DEBUG: permissions [address.c:191]: reload_address_db_table(): failure during checks of database value 1 (group) in address table
Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: ERROR: permissions [address.c:233]: reload_address_db_table(): database problem - invalid record
Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: CRITICAL: permissions [address.c:536]: init_addresses(): reload of address table failed
Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: ERROR: permissions [permissions.c:657]: mod_init(): failed to initialize the allow_address function
Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: ERROR: <core> [core/sr_module.c:942]: init_mod(): Error while initializing module permissions (/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so)
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/cfg.y:1860]: yyparse(): loading module permissions.so
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/sr_module.c:513]: ksr_locate_module(): found module to load </usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so>
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/sr_module.c:563]: load_module(): trying to load </usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so>
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/kemi.c:3090]: sr_kemi_modules_add(): adding module: permissions
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/cfg.lex:1963]: pp_define(): defining id: MOD_permissions
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/modparam.c:112]: set_mod_param_regex(): 'permissions' matches module 'permissions'
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/sr_module.c:811]: find_param_export(): found <db_url> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/modparam.c:128]: set_mod_param_regex(): found <db_url> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/modparam.c:112]: set_mod_param_regex(): 'permissions' matches module 'permissions'
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/sr_module.c:811]: find_param_export(): found <load_backends> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]
Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/modparam.c:128]: set_mod_param_regex(): found <load_backends> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]
Mar 28 17:36:31 kamailio kamailio: DEBUG: <core> [core/sr_module.c:719]: find_mod_export_record(): found export of <allow_source_address> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]
Mar 28 17:36:31 kamailio kamailio: DEBUG: <core> [core/sr_module.c:719]: find_mod_export_record(): found export of <allow_source_address_group> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.soIf I remove the record from the database manually, I can restart kamailio but no way to add any address.
Thanks if someone could highlight my path.
Best Regards,
--
Youssef
[View Less]
Hello guys,
Is it possible to use apvs on regexps like:
$avp(myvar)=$(re{uri.user}{re.subst,/^\+$avp(some_var)/$avp(some_var)/});
doesn't seem possible
Regards,
David Villasmil
email: david.villasmil.work(a)gmail.com
phone: +34669448337