blueFast
blueFast

Reputation: 44371

How to provision a test user in kamailio?

I have just (for the first time) compiled and installed kamailio, following this guide. For configuration, I am following the documentation here

I am trying to test a new SIP user. I have created it with:

» kamctl add test testpasswd

The user is there:

» kamctl db show subscriber
|----+----------+--------------------+------------+---------------+----------------------------------+----------------------------------+------|
| id | username | domain             | password   | email_address | ha1                              | ha1b                             | rpid |
|----+----------+--------------------+------------+---------------+----------------------------------+----------------------------------+------|
|  5 | test     | tethys.wavilon.net | testpasswd |               | 5cf40781f33c6f43a26244046564b67e | eb898de815bc16092e4c2e8c04bfe188 | NULL |
|----+----------+--------------------+------------+---------------+----------------------------------+----------------------------------+------|

I try to connect with my sip client, and the registration times out (Request Timeout (408)). I have tried to verify what is going on by doing:

» kamailio -l <my-ip> -E -ddddd -D 1

And I see lots of messages, one of them interesting:

0(15818) DEBUG: auth [api.c:86]: pre_auth(): auth:pre_auth: Credentials with realm '<my-ip>' not found

But I do not know how to solve this problem. How can I verify what credentials associated to realm <my-ip> are configured? What is a "realm"? I do not find any beginners guide for kamailio. Is there a simple how-to on how to setup a simple kamailio configuration?

Upvotes: 2

Views: 11579

Answers (3)

miconda
miconda

Reputation: 1817

The log message you pasted in the question is for debug purposes (hence DEBUG level) and it could be printed for first SIP requests that come with no credentioals (e.g., first REGISTER) -- in such case it is all ok. Those requests are challenged for authentication with 401 replies, then they are resent by phone with credentials in Autorization header.

If for those requests with credentials you don't get the same realm as used in challenge function parameters (e.g., www_challenge(), auth_challenge()...), then the SIP phone might be misconfigured. Typically the realm is the same as SIP domain in order to ensure it is unique, but that is not a must. With default kamailio configuration, the realm is the From header URI domain.

However, you say you get 408 timeout for registration, then the issues might be something else. When the credentials matching the realm are not found, then 401reply is sent back, not 408.

The reason for timeout could be that the REGISTER didn't get to kamailio or kamailio tries to send it somewhere else. You should look at the SIP traffic on the kamailio server to see what happens. You can use ngrep for that purpose, like:

ngrep -d any -qt -W byline . port 5060

Watch to see if the REGISTER comes to kamailio server and if it is attempted to be sent to another IP.

Upvotes: 4

nguyentran
nguyentran

Reputation: 458

I got the same issue. I that add the alias record in kamailio.cfg and it works well.

alias="tethys.wavilon.net"

Upvotes: 0

arheops
arheops

Reputation: 15257

Kamailio is a proxy. It is not simple, so if you want something simple, try Asterisk instead. Kamailio configuration requires knowledge of SIP.

For this problem: you set the realm somewhere (in config file or in database) but are not using it for registration. Possible solutions would be to:

  1. Remove the realm or set it to the correct domain name (and use it!). In the default config, that means disabling domains.
  2. Use tethys.wavilon.net as you described in the subscriber table.

For more info, go to the Kamailio site and read this document.

Upvotes: -1

Related Questions