cxw
cxw

Reputation: 31

Does Kamailio provide API for other program to creating sip account

I am developing a IOS VoIP app using SIP protocol stack. I am going to use Kamailio as the sip server.

But a sip address (sip account) is required for each VoIP client to make a VoIP call, which means I should manually register a sip account and configure it with the client. Now I want to make this easier. What I want to do is that when the user register to my user account server using the App, My user account server can call some API (maybe provided by Kamailio) to create a sip account associate with this user, and pass it back to the client, the client then configures itself using this sip account automatically.

However, I does not find any API from Kamailio to do such a thing. does Kamailio provides such API, or other open source sip server allow me to do so?

I google that Kamailio can add a user using 'kamctl add' command, can I call similar function from my user account server using RPC. if so, which RPC function of Kamailio can I call? Thanks in advance!

Upvotes: 3

Views: 3807

Answers (2)

miconda
miconda

Reputation: 1817

If you use auth_db for user authentication with mysql backend (db_mysql module), like in default configuration file for kamailio, then the simplest way is to connect to kamailio database and add records to subscriber table.

Here is an example of adding user '[email protected]' with password 'test123' using the realm for authentication 'test.com' (realm is the same as domain):

INSERT INTO subscriber (username, domain, password, ha1, ha1b) VALUES 
  '101', 'test.com', 'test123',
  MD5('101:test.com:test123'), MD5('[email protected]:test.com:test123')
);

The special values here are for ha1 and ha1b columns, which have to be:

  • ha1 = md5(username:realm:password)
  • ha1b = md5(username@domain:realm:password)

Upvotes: 3

arheops
arheops

Reputation: 15257

You can setup kamailio to use ANY sql query from ANY db.

Also you can use http auth, any other auth you can implement.

See

http://kamailio.org/docs/modules/stable/modules/auth_db.html

http://kamailio.org/docs/modules/stable/modules/avpops.html

Upvotes: 1

Related Questions