Hi all,
I’m currently playing with the UAC module to hand off remote registrations with trunks to Kamailio.
I want to keep Kamailio’s external connections low, so I’m planning to use db_text to load the UAC info, and populate the flat file via other methods.
When attempting to load my UAC DB via db_text however, I get the following:
Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_lib.c:143]: dbt_cache_get_db(): database [/etc/kamailio/uac.db] does not exists! Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31902]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/31902 Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_base.c:102]: dbt_init(): cannot get the link to database Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: uac [uac_reg.c:1318]: uac_reg_load_db(): failed to connect to the database
When running using WITH_DEBUG flag, it does not appear to attempt on normal start. A kamcmd uac.reg_reload yields:
Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) DEBUG: ctl [io_listener.c:442]: handle_new_connect(): handle_stream read: new connection (1) on /var/run/kamailio//kamailio_ctl Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) DEBUG: <core> [core/sr_module.c:632]: find_mod_export_record(): found export of <db_bind_api> in module db_text [/usr/local/lib64/kamailio/modules/db_text.so] Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) DEBUG: <core> [db.c:210]: db_bind_mod(): using db bind api for db_text Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) DEBUG: db_text [dbt_base.c:55]: dbt_init(): initializing for db url: [text:///etc/kamailio/uac.db] Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) DEBUG: db_text [dbt_lib.c:125]: dbt_cache_get_db(): looking for db /etc/kamailio/uac.db! Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) ERROR: db_text [dbt_lib.c:143]: dbt_cache_get_db(): database [/etc/kamailio/uac.db] does not exists! Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) ERROR: db_text [dbt_base.c:102]: dbt_init(): cannot get the link to database Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) ERROR: uac [uac_reg.c:1318]: uac_reg_load_db(): failed to connect to the database Mar 26 05:07:52 ip-10-0-0-2 kamailio: 22(32177) DEBUG: ctl [io_listener.c:495]: handle_stream_read(): handle_stream read: eof on /var/run/kamailio//kamailio_ctl
The file of course does exist, and has fine permissions (Kamailio runs as root in this case):
-rw-r--r-- 1 root root 169 Mar 26 04:49 /etc/kamailio/uac.db
Contents of file:
l_uuid(str) l_username(str) l_domain(str) r_username(str) r_domain(str) realm(str) auth_username(str) auth_password(str) auth_proxy(str) expires(int) flags(int) reg_delay(int) 123:test:test.com:test:test.com:test.com:user:pass:10.0.0.100:600::
(At this stage I just want to see the reg packet in Wireshark).
1) Is this the correct method to do UAC? Load credentials, then Kamailio will handle the registration and renewal? I’ve struggled a bit to understand the documentation, hence the testing 2) Why is my db_text failing to load the file?
Thanks!
________________________________
Andrew White - Director uConnected Email: andrew@uconnected.com.au Web: www.uConnected.com.au
Andrew White andrew@uconnected.com.au:
I’m currently playing with the UAC module to hand off remote registrations with trunks to Kamailio.
I want to keep Kamailio’s external connections low, so I’m planning to use db_text to load the UAC info, and populate the flat file via other methods.
When attempting to load my UAC DB via db_text however, I get the following:
Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_lib.c:143]: dbt_cache_get_db(): database [/etc/kamailio/uac.db] does not exists! Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31902]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/31902 Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_base.c:102]: dbt_init(): cannot get the link to database Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: uac [uac_reg.c:1318]: uac_reg_load_db(): failed to connect to the database . . . 2) Why is my db_text failing to load the file?
Hi
I think your db_url should point to directory instead of file.
Here is one working example using other modules: --- modparam("mtree", "db_url", "text:///opt/stuff/cfg/db_text") modparam("htable", "db_url", "text:///opt/stuff/cfg/db_text") ---
In directory /opt/stuff/cfg/db_text I have files "htable", "mtrees" and "version":
--- $ cat version htable:2 mtrees:2 $ cat mtrees id(int,auto) tname(string) tprefix(string) tvalue(string) 1:uni:3581234567:24 $ cat htable id(int,auto) key_name(string) key_type(int) value_type(int) key_value(string) 0:3581234567::timerc:0:1:30 ---
Thanks so much Miko!
You’re completely right. This is also in the docs for the module, it appears I’ve skimmed over that part!
It appears the DB is now loading without error, however I don’t see any attempting for registration in Wireshark. A kamcmd uac.reg_dump doesn’t return any result.
I’ve copied config shown to be working from a GitHub issue on an unrelated problem (https://github.com/kamailio/kamailio/issues/936 https://github.com/kamailio/kamailio/issues/936). Relevant lines below:
#!define DBURL "text:///etc/kamailio/dbtext"
modparam("rr", "append_fromtag", 1) modparam("dialog", "dlg_flag", 4) modparam("dialog", "track_cseq_updates", 1) modparam("uac", "restore_dlg", 1) modparam("uac", "reg_db_url", DBURL) modparam("uac", "reg_timer_interval", 60) modparam("uac", "reg_retry_interval", 60) modparam("uac", "reg_contact_addr", "1.2.3.4:5060")
And /etc/kamailio/dbtext/uacreg:
l_uuid(string) l_username(string) l_domain(string) r_username(string) r_domain(string) realm(string) auth_username(string) auth_password(string) auth_proxy(string) expires(int) flags(int) reg_delay(int) 12345678:user:domain.local:11111111:sip.example.org:sip.example.org:11111111:XXXXXXXXXXXXXXXX:sip:sip.example.org:600:0:0
Both an lsof and a WITH_DEBUG show uac.so is being loaded without issue, however no messages relevant to registration are showing, and no REGISTER messages appear in Wireshark.
A kamcmd to query the record shows it does not appear loaded:
[root@ip-10-0-0-2 kamailio]# kamcmd uac.reg_info l_uuid 12345678 error: 404 - Record not found
I feel like I’m missing something obvious here! ________________________________
Andrew White - Director uConnected Email: andrew@uconnected.com.au Web: www.uConnected.com.au
On 26 Mar 2019, at 8:06 pm, Mikko Lehto mslehto@iki.fi wrote:
Andrew White andrew@uconnected.com.au:
I’m currently playing with the UAC module to hand off remote registrations with trunks to Kamailio.
I want to keep Kamailio’s external connections low, so I’m planning to use db_text to load the UAC info, and populate the flat file via other methods.
When attempting to load my UAC DB via db_text however, I get the following:
Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_lib.c:143]: dbt_cache_get_db(): database [/etc/kamailio/uac.db] does not exists! Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31902]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/31902 Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_base.c:102]: dbt_init(): cannot get the link to database Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: uac [uac_reg.c:1318]: uac_reg_load_db(): failed to connect to the database . . . 2) Why is my db_text failing to load the file?
Hi
I think your db_url should point to directory instead of file.
Here is one working example using other modules:
modparam("mtree", "db_url", "text:///opt/stuff/cfg/db_text") modparam("htable", "db_url", "text:///opt/stuff/cfg/db_text")
In directory /opt/stuff/cfg/db_text I have files "htable", "mtrees" and "version":
$ cat version htable:2 mtrees:2 $ cat mtrees id(int,auto) tname(string) tprefix(string) tvalue(string) 1:uni:3581234567:24 $ cat htable id(int,auto) key_name(string) key_type(int) value_type(int) key_value(string) 0:3581234567::timerc:0:1:30
-- Mikko
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Update:
I’ve just tried the config from the GitHub issue on another server (CentOS 7) and get the following console output:
Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: <core> [core/resolve.c:1699]: sip_hostport2su(): could not resolve hostname: "sip.example.org" Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: tm [ut.h:309]: uri2dst2(): failed to resolve "sip.example.org" Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: tm [uac.c:452]: t_uac_prepare(): no socket found Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: uac [uac_reg.c:1181]: uac_reg_update(): failed to send request for [12345678]
This looks to me like it is attempting registration and failing.
I’ve tried this same config on my main server (Amazon Linux 2) and am not getting any such messages.
Both are built from the same master commit:
AL2:
version: kamailio 5.3.0-dev4 (x86_64/linux) 97189d flags: STATS: Off, 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_BLACKLIST, HAVE_RESOLV_RES 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: 97189d compiled on 13:18:22 Mar 26 2019 with gcc 7.3.1
CentOS 7:
version: kamailio 5.3.0-dev4 (x86_64/linux) 97189d flags: STATS: Off, 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_BLACKLIST, HAVE_RESOLV_RES 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: 97189d compiled on 13:52:08 Mar 23 2019 with gcc 4.8.5
I’m assuming we’re missing a package, a socket definition varies, something like that. How can I further debug this?
Thanks!
Andrew
On 27 Mar 2019, at 12:01 am, Andrew White andrew@uconnected.com.au wrote:
Thanks so much Miko!
You’re completely right. This is also in the docs for the module, it appears I’ve skimmed over that part!
It appears the DB is now loading without error, however I don’t see any attempting for registration in Wireshark. A kamcmd uac.reg_dump doesn’t return any result.
I’ve copied config shown to be working from a GitHub issue on an unrelated problem (https://github.com/kamailio/kamailio/issues/936 https://github.com/kamailio/kamailio/issues/936). Relevant lines below:
#!define DBURL "text:///etc/kamailio/dbtext text:///etc/kamailio/dbtext"
modparam("rr", "append_fromtag", 1) modparam("dialog", "dlg_flag", 4) modparam("dialog", "track_cseq_updates", 1) modparam("uac", "restore_dlg", 1) modparam("uac", "reg_db_url", DBURL) modparam("uac", "reg_timer_interval", 60) modparam("uac", "reg_retry_interval", 60) modparam("uac", "reg_contact_addr", "1.2.3.4:5060")
And /etc/kamailio/dbtext/uacreg:
l_uuid(string) l_username(string) l_domain(string) r_username(string) r_domain(string) realm(string) auth_username(string) auth_password(string) auth_proxy(string) expires(int) flags(int) reg_delay(int) 12345678:user:domain.local:11111111:sip.example.org http://sip.example.org/:sip.example.org http://sip.example.org/:11111111:XXXXXXXXXXXXXXXX:sip:sip.example.org:600 http://sip.example.org:600/:0:0
Both an lsof and a WITH_DEBUG show uac.so is being loaded without issue, however no messages relevant to registration are showing, and no REGISTER messages appear in Wireshark.
A kamcmd to query the record shows it does not appear loaded:
[root@ip-10-0-0-2 kamailio]# kamcmd uac.reg_info l_uuid 12345678 error: 404 - Record not found
I feel like I’m missing something obvious here! ________________________________
Andrew White - Director uConnected Email: andrew@uconnected.com.au mailto:andrew@uconnected.com.au Web: www.uConnected.com.au
On 26 Mar 2019, at 8:06 pm, Mikko Lehto <mslehto@iki.fi mailto:mslehto@iki.fi> wrote:
Andrew White <andrew@uconnected.com.au mailto:andrew@uconnected.com.au>:
I’m currently playing with the UAC module to hand off remote registrations with trunks to Kamailio.
I want to keep Kamailio’s external connections low, so I’m planning to use db_text to load the UAC info, and populate the flat file via other methods.
When attempting to load my UAC DB via db_text however, I get the following:
Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_lib.c:143]: dbt_cache_get_db(): database [/etc/kamailio/uac.db] does not exists! Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31902]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/31902 Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_base.c:102]: dbt_init(): cannot get the link to database Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: uac [uac_reg.c:1318]: uac_reg_load_db(): failed to connect to the database . . . 2) Why is my db_text failing to load the file?
Hi
I think your db_url should point to directory instead of file.
Here is one working example using other modules:
modparam("mtree", "db_url", "text:///opt/stuff/cfg/db_text text:///opt/stuff/cfg/db_text") modparam("htable", "db_url", "text:///opt/stuff/cfg/db_text text:///opt/stuff/cfg/db_text")
In directory /opt/stuff/cfg/db_text I have files "htable", "mtrees" and "version":
$ cat version htable:2 mtrees:2 $ cat mtrees id(int,auto) tname(string) tprefix(string) tvalue(string) 1:uni:3581234567:24 $ cat htable id(int,auto) key_name(string) key_type(int) value_type(int) key_value(string) 0:3581234567::timerc:0:1:30
-- Mikko
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org mailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi all,
I’ve done a completely fresh machine using the config from the GitHub issues using Amazon Linux 2 and registration is sending. I’m unsure what is varying, but I think I’ll rebuild this whole thing as an Ansible playbook anyway so I can redeploy quickly.
Here’s the bash history for anyone curious:
1 yum install -y gcc gcc-c++ bison flex make ruby-devel git 2 git clone https://github.com/kamailio/kamailio.git 3 cd kamailio/ 4 make include_modules="app_ruby" cfg 5 make all && make install 6 cd /usr/local/etc/kamailio/ 7 ls 8 vim kamailio.cfg 9 vim /etc/systemd/system/multi-user.target.wants/kamailio.service 10 systemctl daemon-reload 11 systemctl start kamailio 12 tail -f /var/log/messages 13 ls 14 mkdir /usr/local/etc/kamailio/dbtext 15 cd /usr/local/etc/kamailio/dbtext 16 ls 17 vim uacreg 18 systemctl restart kamailio 19 tail -f /var/log/messages
Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: <core> [core/resolve.c:1698]: sip_hostport2su(): could not resolve hostname: "sip.example.org" Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: tm [ut.h:309]: uri2dst2(): failed to resolve "sip.example.org" Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: tm [uac.c:452]: t_uac_prepare(): no socket found Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: uac [uac_reg.c:1181]: uac_reg_update(): failed to send request for [12345678]
If anyone can help find the issue I’d be very interested, however it looks like issue is package/config somewhere rather than kamailio.
Thanks
________________________________
Andrew White - Director uConnected Email: andrew@uconnected.com.au Web: www.uConnected.com.au
On 27 Mar 2019, at 12:23 am, Andrew White andrew@uconnected.com.au wrote:
Update:
I’ve just tried the config from the GitHub issue on another server (CentOS 7) and get the following console output:
Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: <core> [core/resolve.c:1699]: sip_hostport2su(): could not resolve hostname: "sip.example.org http://sip.example.org/" Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: tm [ut.h:309]: uri2dst2(): failed to resolve "sip.example.org http://sip.example.org/" Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: tm [uac.c:452]: t_uac_prepare(): no socket found Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: uac [uac_reg.c:1181]: uac_reg_update(): failed to send request for [12345678]
This looks to me like it is attempting registration and failing.
I’ve tried this same config on my main server (Amazon Linux 2) and am not getting any such messages.
Both are built from the same master commit:
AL2:
version: kamailio 5.3.0-dev4 (x86_64/linux) 97189d flags: STATS: Off, 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_BLACKLIST, HAVE_RESOLV_RES 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: 97189d compiled on 13:18:22 Mar 26 2019 with gcc 7.3.1
CentOS 7:
version: kamailio 5.3.0-dev4 (x86_64/linux) 97189d flags: STATS: Off, 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_BLACKLIST, HAVE_RESOLV_RES 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: 97189d compiled on 13:52:08 Mar 23 2019 with gcc 4.8.5
I’m assuming we’re missing a package, a socket definition varies, something like that. How can I further debug this?
Thanks!
Andrew
On 27 Mar 2019, at 12:01 am, Andrew White <andrew@uconnected.com.au mailto:andrew@uconnected.com.au> wrote:
Thanks so much Miko!
You’re completely right. This is also in the docs for the module, it appears I’ve skimmed over that part!
It appears the DB is now loading without error, however I don’t see any attempting for registration in Wireshark. A kamcmd uac.reg_dump doesn’t return any result.
I’ve copied config shown to be working from a GitHub issue on an unrelated problem (https://github.com/kamailio/kamailio/issues/936 https://github.com/kamailio/kamailio/issues/936). Relevant lines below:
#!define DBURL "text:///etc/kamailio/dbtext text:///etc/kamailio/dbtext"
modparam("rr", "append_fromtag", 1) modparam("dialog", "dlg_flag", 4) modparam("dialog", "track_cseq_updates", 1) modparam("uac", "restore_dlg", 1) modparam("uac", "reg_db_url", DBURL) modparam("uac", "reg_timer_interval", 60) modparam("uac", "reg_retry_interval", 60) modparam("uac", "reg_contact_addr", "1.2.3.4:5060")
And /etc/kamailio/dbtext/uacreg:
l_uuid(string) l_username(string) l_domain(string) r_username(string) r_domain(string) realm(string) auth_username(string) auth_password(string) auth_proxy(string) expires(int) flags(int) reg_delay(int) 12345678:user:domain.local:11111111:sip.example.org http://sip.example.org/:sip.example.org http://sip.example.org/:11111111:XXXXXXXXXXXXXXXX:sip:sip.example.org:600 http://sip.example.org:600/:0:0
Both an lsof and a WITH_DEBUG show uac.so is being loaded without issue, however no messages relevant to registration are showing, and no REGISTER messages appear in Wireshark.
A kamcmd to query the record shows it does not appear loaded:
[root@ip-10-0-0-2 kamailio]# kamcmd uac.reg_info l_uuid 12345678 error: 404 - Record not found
I feel like I’m missing something obvious here! ________________________________
Andrew White - Director uConnected Email: andrew@uconnected.com.au mailto:andrew@uconnected.com.au Web: www.uConnected.com.au http://www.uconnected.com.au/
On 26 Mar 2019, at 8:06 pm, Mikko Lehto <mslehto@iki.fi mailto:mslehto@iki.fi> wrote:
Andrew White <andrew@uconnected.com.au mailto:andrew@uconnected.com.au>:
I’m currently playing with the UAC module to hand off remote registrations with trunks to Kamailio.
I want to keep Kamailio’s external connections low, so I’m planning to use db_text to load the UAC info, and populate the flat file via other methods.
When attempting to load my UAC DB via db_text however, I get the following:
Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_lib.c:143]: dbt_cache_get_db(): database [/etc/kamailio/uac.db] does not exists! Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31902]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/31902 Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_base.c:102]: dbt_init(): cannot get the link to database Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: uac [uac_reg.c:1318]: uac_reg_load_db(): failed to connect to the database . . . 2) Why is my db_text failing to load the file?
Hi
I think your db_url should point to directory instead of file.
Here is one working example using other modules:
modparam("mtree", "db_url", "text:///opt/stuff/cfg/db_text text:///opt/stuff/cfg/db_text") modparam("htable", "db_url", "text:///opt/stuff/cfg/db_text text:///opt/stuff/cfg/db_text")
In directory /opt/stuff/cfg/db_text I have files "htable", "mtrees" and "version":
$ cat version htable:2 mtrees:2 $ cat mtrees id(int,auto) tname(string) tprefix(string) tvalue(string) 1:uni:3581234567:24 $ cat htable id(int,auto) key_name(string) key_type(int) value_type(int) key_value(string) 0:3581234567::timerc:0:1:30
-- Mikko
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org mailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Am Dienstag, 26. März 2019, 15:23:05 CET schrieb Andrew White:
I’ve done a completely fresh machine using the config from the GitHub issues using Amazon Linux 2 and registration is sending. I’m unsure what is varying, but I think I’ll rebuild this whole thing as an Ansible playbook anyway so I can redeploy quickly.
Hello Andrew,
the error below is from the config, that it can't resolve the sip.example.com domain. You need to replace this domain with a domain that you own, or use IP addresses.
Best regards,
Henning
Here’s the bash history for anyone curious:
1 yum install -y gcc gcc-c++ bison flex make ruby-devel git 2 git clone https://github.com/kamailio/kamailio.git 3 cd kamailio/ 4 make include_modules="app_ruby" cfg 5 make all && make install 6 cd /usr/local/etc/kamailio/ 7 ls 8 vim kamailio.cfg 9 vim /etc/systemd/system/multi-user.target.wants/kamailio.service
10 systemctl daemon-reload 11 systemctl start kamailio 12 tail -f /var/log/messages 13 ls 14 mkdir /usr/local/etc/kamailio/dbtext 15 cd /usr/local/etc/kamailio/dbtext 16 ls 17 vim uacreg 18 systemctl restart kamailio 19 tail -f /var/log/messages
Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: <core> [core/resolve.c:1698]: sip_hostport2su(): could not resolve hostname: "sip.example.org" Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: tm [ut.h:309]: uri2dst2(): failed to resolve "sip.example.org" Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: tm [uac.c:452]: t_uac_prepare(): no socket found Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: uac [uac_reg.c:1181]: uac_reg_update(): failed to send request for [12345678]
If anyone can help find the issue I’d be very interested, however it looks like issue is package/config somewhere rather than kamailio.
Thanks
Andrew White - Director uConnected Email: andrew@uconnected.com.au Web: www.uConnected.com.au
On 27 Mar 2019, at 12:23 am, Andrew White andrew@uconnected.com.au wrote:
Update:
I’ve just tried the config from the GitHub issue on another server (CentOS 7) and get the following console output:
Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: <core> [core/resolve.c:1699]: sip_hostport2su(): could not resolve hostname: "sip.example.org http://sip.example.org/" Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: tm [ut.h:309]: uri2dst2(): failed to resolve "sip.example.org http://sip.example.org/" Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: tm [uac.c:452]: t_uac_prepare(): no socket found Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: uac [uac_reg.c:1181]: uac_reg_update(): failed to send request for [12345678]
This looks to me like it is attempting registration and failing.
I’ve tried this same config on my main server (Amazon Linux 2) and am not getting any such messages.
Both are built from the same master commit:
AL2:
version: kamailio 5.3.0-dev4 (x86_64/linux) 97189d flags: STATS: Off, 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_BLACKLIST, HAVE_RESOLV_RES 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: 97189d compiled on 13:18:22 Mar 26 2019 with gcc 7.3.1
CentOS 7:
version: kamailio 5.3.0-dev4 (x86_64/linux) 97189d flags: STATS: Off, 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_BLACKLIST, HAVE_RESOLV_RES 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: 97189d compiled on 13:52:08 Mar 23 2019 with gcc 4.8.5
I’m assuming we’re missing a package, a socket definition varies, something like that. How can I further debug this?
Thanks!
Andrew
On 27 Mar 2019, at 12:01 am, Andrew White <andrew@uconnected.com.au mailto:andrew@uconnected.com.au> wrote:
Thanks so much Miko!
You’re completely right. This is also in the docs for the module, it appears I’ve skimmed over that part!
It appears the DB is now loading without error, however I don’t see any attempting for registration in Wireshark. A kamcmd uac.reg_dump doesn’t return any result.
I’ve copied config shown to be working from a GitHub issue on an unrelated problem (https://github.com/kamailio/kamailio/issues/936 https://github.com/kamailio/kamailio/issues/936). Relevant lines below:
#!define DBURL "text:///etc/kamailio/dbtext text:///etc/kamailio/dbtext"
modparam("rr", "append_fromtag", 1) modparam("dialog", "dlg_flag", 4) modparam("dialog", "track_cseq_updates", 1) modparam("uac", "restore_dlg", 1) modparam("uac", "reg_db_url", DBURL) modparam("uac", "reg_timer_interval", 60) modparam("uac", "reg_retry_interval", 60) modparam("uac", "reg_contact_addr", "1.2.3.4:5060")
And /etc/kamailio/dbtext/uacreg:
l_uuid(string) l_username(string) l_domain(string) r_username(string) r_domain(string) realm(string) auth_username(string) auth_password(string) auth_proxy(string) expires(int) flags(int) reg_delay(int) 12345678:user:domain.local:11111111:sip.example.org http://sip.example.org/:sip.example.org http://sip.example.org/:11111111:XXXXXXXXXXXXXXXX:sip:sip.example.org :600 http://sip.example.org:600/:0:0
Both an lsof and a WITH_DEBUG show uac.so is being loaded without issue, however no messages relevant to registration are showing, and no REGISTER messages appear in Wireshark.
A kamcmd to query the record shows it does not appear loaded:
[root@ip-10-0-0-2 kamailio]# kamcmd uac.reg_info l_uuid 12345678 error: 404 - Record not found
I feel like I’m missing something obvious here! ________________________________
Andrew White - Director uConnected Email: andrew@uconnected.com.au mailto:andrew@uconnected.com.au Web: www.uConnected.com.au http://www.uconnected.com.au/
On 26 Mar 2019, at 8:06 pm, Mikko Lehto <mslehto@iki.fi mailto:mslehto@iki.fi> wrote:>>> Andrew White <andrew@uconnected.com.au
mailto:andrew@uconnected.com.au>:
I’m currently playing with the UAC module to hand off remote registrations with trunks to Kamailio.
I want to keep Kamailio’s external connections low, so I’m planning to use db_text to load the UAC info, and populate the flat file via other methods.
When attempting to load my UAC DB via db_text however, I get the following:
Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_lib.c:143]: dbt_cache_get_db(): database [/etc/kamailio/uac.db] does not exists! Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31902]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/31902 Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_base.c:102]: dbt_init(): cannot get the link to database Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: uac [uac_reg.c:1318]: uac_reg_load_db(): failed to connect to the database . . . 2) Why is my db_text failing to load the file?
Hi
I think your db_url should point to directory instead of file.
Here is one working example using other modules:
modparam("mtree", "db_url", "text:///opt/stuff/cfg/db_text text:///opt/stuff/cfg/db_text") modparam("htable", "db_url", "text:///opt/stuff/cfg/db_text text:///opt/stuff/cfg/db_text") ---
In directory /opt/stuff/cfg/db_text I have files "htable", "mtrees" and "version":
$ cat version htable:2 mtrees:2 $ cat mtrees id(int,auto) tname(string) tprefix(string) tvalue(string) 1:uni:3581234567:24 $ cat htable id(int,auto) key_name(string) key_type(int) value_type(int) key_value(string) 0:3581234567::timerc:0:1:30
Hi Henning,
Thanks for this! That’s not actually the issue though. On one of my instances no registration at all was being sent. On the other, it was. I was using dummy credentials just to see if I could get a REGISTER message.
I’ve since rebuilt my deployment as a playbook and launched to a fresh AL2/EC2 instance, and all is working. Guess it was something specific to the old machine.
Thanks for your help all!
Cheers,
________________________________
Andrew White - Director uConnected Email: andrew@uconnected.com.au Web: www.uConnected.com.au
On 27 Mar 2019, at 6:33 am, Henning Westerholt hw@kamailio.org wrote:
Am Dienstag, 26. März 2019, 15:23:05 CET schrieb Andrew White:
I’ve done a completely fresh machine using the config from the GitHub issues using Amazon Linux 2 and registration is sending. I’m unsure what is varying, but I think I’ll rebuild this whole thing as an Ansible playbook anyway so I can redeploy quickly.
Hello Andrew,
the error below is from the config, that it can't resolve the sip.example.com domain. You need to replace this domain with a domain that you own, or use IP addresses.
Best regards,
Henning
Here’s the bash history for anyone curious:
1 yum install -y gcc gcc-c++ bison flex make ruby-devel git 2 git clone https://github.com/kamailio/kamailio.git 3 cd kamailio/ 4 make include_modules="app_ruby" cfg 5 make all && make install 6 cd /usr/local/etc/kamailio/ 7 ls 8 vim kamailio.cfg 9 vim /etc/systemd/system/multi-user.target.wants/kamailio.service 10 systemctl daemon-reload 11 systemctl start kamailio 12 tail -f /var/log/messages 13 ls 14 mkdir /usr/local/etc/kamailio/dbtext 15 cd /usr/local/etc/kamailio/dbtext 16 ls 17 vim uacreg 18 systemctl restart kamailio 19 tail -f /var/log/messages
Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: <core> [core/resolve.c:1698]: sip_hostport2su(): could not resolve hostname: "sip.example.org" Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: tm [ut.h:309]: uri2dst2(): failed to resolve "sip.example.org" Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: tm [uac.c:452]: t_uac_prepare(): no socket found Mar 26 14:18:00 ip-10-0-0-3 /usr/local/sbin/kamailio[17873]: ERROR: uac [uac_reg.c:1181]: uac_reg_update(): failed to send request for [12345678]
If anyone can help find the issue I’d be very interested, however it looks like issue is package/config somewhere rather than kamailio.
Thanks
Andrew White - Director uConnected Email: andrew@uconnected.com.au Web: www.uConnected.com.au
On 27 Mar 2019, at 12:23 am, Andrew White andrew@uconnected.com.au wrote:
Update:
I’ve just tried the config from the GitHub issue on another server (CentOS 7) and get the following console output:
Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: <core> [core/resolve.c:1699]: sip_hostport2su(): could not resolve hostname: "sip.example.org http://sip.example.org/" Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: tm [ut.h:309]: uri2dst2(): failed to resolve "sip.example.org http://sip.example.org/" Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: tm [uac.c:452]: t_uac_prepare(): no socket found Mar 26 13:08:48 voice-test2 /usr/local/sbin/kamailio[29762]: ERROR: uac [uac_reg.c:1181]: uac_reg_update(): failed to send request for [12345678]
This looks to me like it is attempting registration and failing.
I’ve tried this same config on my main server (Amazon Linux 2) and am not getting any such messages.
Both are built from the same master commit:
AL2:
version: kamailio 5.3.0-dev4 (x86_64/linux) 97189d flags: STATS: Off, 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_BLACKLIST, HAVE_RESOLV_RES 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: 97189d compiled on 13:18:22 Mar 26 2019 with gcc 7.3.1
CentOS 7:
version: kamailio 5.3.0-dev4 (x86_64/linux) 97189d flags: STATS: Off, 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_BLACKLIST, HAVE_RESOLV_RES 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: 97189d compiled on 13:52:08 Mar 23 2019 with gcc 4.8.5
I’m assuming we’re missing a package, a socket definition varies, something like that. How can I further debug this?
Thanks!
Andrew
On 27 Mar 2019, at 12:01 am, Andrew White <andrew@uconnected.com.au mailto:andrew@uconnected.com.au> wrote:
Thanks so much Miko!
You’re completely right. This is also in the docs for the module, it appears I’ve skimmed over that part!
It appears the DB is now loading without error, however I don’t see any attempting for registration in Wireshark. A kamcmd uac.reg_dump doesn’t return any result.
I’ve copied config shown to be working from a GitHub issue on an unrelated problem (https://github.com/kamailio/kamailio/issues/936 https://github.com/kamailio/kamailio/issues/936). Relevant lines below:
#!define DBURL "text:///etc/kamailio/dbtext text:///etc/kamailio/dbtext"
modparam("rr", "append_fromtag", 1) modparam("dialog", "dlg_flag", 4) modparam("dialog", "track_cseq_updates", 1) modparam("uac", "restore_dlg", 1) modparam("uac", "reg_db_url", DBURL) modparam("uac", "reg_timer_interval", 60) modparam("uac", "reg_retry_interval", 60) modparam("uac", "reg_contact_addr", "1.2.3.4:5060")
And /etc/kamailio/dbtext/uacreg:
l_uuid(string) l_username(string) l_domain(string) r_username(string) r_domain(string) realm(string) auth_username(string) auth_password(string) auth_proxy(string) expires(int) flags(int) reg_delay(int) 12345678:user:domain.local:11111111:sip.example.org http://sip.example.org/:sip.example.org http://sip.example.org/:11111111:XXXXXXXXXXXXXXXX:sip:sip.example.org :600 http://sip.example.org:600/:0:0
Both an lsof and a WITH_DEBUG show uac.so is being loaded without issue, however no messages relevant to registration are showing, and no REGISTER messages appear in Wireshark.
A kamcmd to query the record shows it does not appear loaded:
[root@ip-10-0-0-2 kamailio]# kamcmd uac.reg_info l_uuid 12345678 error: 404 - Record not found
I feel like I’m missing something obvious here! ________________________________
Andrew White - Director uConnected Email: andrew@uconnected.com.au mailto:andrew@uconnected.com.au Web: www.uConnected.com.au http://www.uconnected.com.au/
On 26 Mar 2019, at 8:06 pm, Mikko Lehto <mslehto@iki.fi mailto:mslehto@iki.fi> wrote:>>> Andrew White <andrew@uconnected.com.au
mailto:andrew@uconnected.com.au>:
I’m currently playing with the UAC module to hand off remote registrations with trunks to Kamailio.
I want to keep Kamailio’s external connections low, so I’m planning to use db_text to load the UAC info, and populate the flat file via other methods.
When attempting to load my UAC DB via db_text however, I get the following:
Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_lib.c:143]: dbt_cache_get_db(): database [/etc/kamailio/uac.db] does not exists! Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31902]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/31902 Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: db_text [dbt_base.c:102]: dbt_init(): cannot get the link to database Mar 26 04:59:30 ip-10-0-0-2 /usr/local/sbin/kamailio[31904]: ERROR: uac [uac_reg.c:1318]: uac_reg_load_db(): failed to connect to the database . . . 2) Why is my db_text failing to load the file?
Hi
I think your db_url should point to directory instead of file.
Here is one working example using other modules:
modparam("mtree", "db_url", "text:///opt/stuff/cfg/db_text text:///opt/stuff/cfg/db_text") modparam("htable", "db_url", "text:///opt/stuff/cfg/db_text text:///opt/stuff/cfg/db_text") ---
In directory /opt/stuff/cfg/db_text I have files "htable", "mtrees" and "version":
$ cat version htable:2 mtrees:2 $ cat mtrees id(int,auto) tname(string) tprefix(string) tvalue(string) 1:uni:3581234567:24 $ cat htable id(int,auto) key_name(string) key_type(int) value_type(int) key_value(string) 0:3581234567::timerc:0:1:30
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services