Hello,

putting such conditions in the config file is possible, but if you have more than those listed user ids, probably is better to keep them in a database.

Anyhow, for doing the conditions in the config file, you can use the variable $rU (r-uri username) and $rd (r-uri domain) as well as $fU (From uri username) and $fd (From-uri domain) to compare with the values you want.

You can look at the core cookbook to understand the structure of the config file:

  * https://www.kamailio.org/wiki/cookbooks/devel/core

And the list of variables is available at:

  * https://www.kamailio.org/wiki/cookbooks/devel/pseudovariables

The default config file is also a good start point to play with Kamailio to get its basics.

Cheers,
Daniel

On 05.07.19 19:37, Ronald Hartmann wrote:

Good Day List,


I am very new to Kamailio and trying to understand at 10,000 feet how it may be able to be used. I was wondering if the following Scenario would be possible and if so what modules would accomplish this aspect.  (Any URLs for further reading would be appreciated)


Scenario:


Given 


1) SoftPhones will register as follows

sip uri, user@subdomain.myvoipserver.com 

2) The following users are authorized to connect (this would be stored in a config file etc):

1001,1003,1007 are valid users for apples.myvoipserver.com

1001,2213,5817 are valid users for oranges.myvoipserver.com


Is it possible for Kamailio to perform the following evaluation and then take the appropriate steps:


If [domain is apples.myvoipserver.com AND user portion is 1001]

then

Forward/Proxy the SIP/RTP packets to

Asterisk server responsible for registration and audio for the domain apples.myvoipserver.com

 

Else if [domain is oranges.myvoipserver.com AND user portion is 2213]

then

Forward/Proxy the SIP/RTP packets to

Asterisk server responsible for registration and audio for the domain oranges.myvoipserver.com

Else

Silently Drop packets etc.

 

given the above evaluation rules, a user who tries to register as 


1001@apples.myvoipserver.com 

would be granted access and their SIP Packets and subsequent RTP would be forwarded to the asterisk server at apples.myvoipserver.com, where said server would take care of the Registration, and any subsequent calls, subscriptions, Options etc.


1004@ apples.myvoipserver.com

Would not match the authorized list for apples.myvoipserver.com (1001,1003,1007), therefore this registration attempt would be silently dropped


2213@apples.myvoipserver.com 

would be granted access and their SIP Packets and subsequent RTP would be forwarded to the asterisk server at oranges.myvoipserver.com, where said server would take care of the Registration, and any subsequent calls, subscriptions, Options etc.


 Thanks for any information to assist me in understanding how this would work.


~ron



_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda