Kamailio SIP server

Today I wanted to test kamailio SIP server but I didn’t have prior experience on this software
and I experienced several problems.

After following the installation manual I created the username rtoo.

root@debian1:~# cat .kamctlrc 
SIP_DOMAIN=sip.rtoodtoo.net

root@debian1:~# kamctl add rtoo test123
MySQL password for user 'kamailio@localhost': 
new user 'rtoo' added

so far so good. Then I tried to connect to this server but I got
403 Not relaying” then I put the server in debug mode by adding

#!define WITH_DEBUG

on top of /usr/local/etc/kamailio/kamailio.cfg file and restarted the server

#/etc/init.d/kamailio restart

then I have found that I must add my domain name somewhere in the config.
After this, I added sip.rtoodtoo.net domain as follows in the same config file
and restarted the server again.

alias="sip.rtoodtoo.net"

Then it worked. However at the very beginning I even got an authentication error like

pre_auth: Credentials with realm sip.rtoodtoo.net not found. 

I don’t know how this error occurred after adding username via CLI. Then I
found the description of the authentication table of kamailio which is subscriber.

mysql> select * from subscriber;
+----+----------+------------------+----------+---------------+----------------------------------+----------------------------------+------+
| id | username | domain           | password | email_address | ha1                              | ha1b                             | rpid |
+----+----------+------------------+----------+---------------+----------------------------------+----------------------------------+------+
|  4 | rtoo     | sip.rtoodtoo.net | test123  |               | 74f3945dd7123f89761fb59d6708238c | e033a7e663fb83a07f818a093dad953a | NULL |
+----+----------+------------------+----------+---------------+----------------------------------+----------------------------------+------+
1 row in set (0.00 sec)

At the URL http://kamailio.org/docs/db-tables/kamailio-db-3.2.x.html#AEN429,
you can see that ha1 and ha1b is an MD5 of some values. According to the
ha1 description, I got the MD5, and updated the subscriber table than it worked.

>>> import hashlib
>>> m = hashlib.md5()
>>> m.update("rtoo:sip.rtoodtoo.net:test123")
>>> m.hexdigest()
'74f3945dd7123f89761fb59d6708238c'

You may not have this error as I didn’t receive it again.

I have found kamailio server quite powerful so far. I hope I will do some test with SRX as well.

Tags:

About: rtoodtoo

Worked for more than 10 years as a Network/Support Engineer and also interested in Python, Linux, Security and SD-WAN // JNCIE-SEC #223 / RHCE / PCNSE


You have a feedback?

Discover more from RtoDto.net

Subscribe now to keep reading and get access to the full archive.

Continue reading