[SR-Users] [SR_USers] Authenticate asterisk-kamailio

Mauricio Tejeda mauricio.tejeda at outlook.cl
Thu Apr 30 19:37:07 CEST 2015


Front of my eyes and I did not see it.

Thank you very much.





-----Mensaje original-----
De: sr-users [mailto:sr-users-bounces at lists.sip-router.org] En nombre de
Daniel Tryba
Enviado el: jueves, 30 de abril de 2015 13:44
Para: sr-users at lists.sip-router.org
Asunto: Re: [SR-Users] [SR_USers] Authenticate asterisk-kamailio

On Thursday 30 April 2015 13:23:25 Mauricio Tejeda wrote:
> #!ifdef WITH_ASTERISK
> 
>                                if (!auth_check("$fd", "sipusers", "1"))
> {           ##### OK Asterisk Users are no problem
> 
> #!else

>                                         ##### But if the user is no 
> asterisk , simply refuse registration, without Respect the jump to 
> validate users Kamailio
> 
>                                if (!auth_check("$fd", "subscriber", "1"))
> {        
> 
> #!endif

I think you missed a fundamental part of the configuration and its parsing.
Above #!ifdef/#!else/#!endif structure is not a conditional in the
configuration file during runtime. It is a conditional during parsing.

If you define WITH_ASTERISK the used config during runtime is:
if (!auth_check("$fd", "sipusers", "1")) Otherwise it is if
(!auth_check("$fd", "subscriber", "1"))

I guess you are  looking for something like:

if(is_in_subnet($si, "10.1.2.3/32"))
{
	if(!auth_check("$fd", "sipusers", "1"))
	{
	#...
	}
}
else
{
	if (!auth_check("$fd", "subscriber", "1"))
	{
	#...
	}	
}

Where 10.1.2.3 is the ipadres of your asterisk server. But as ever:
timtowtdi You could use $si==10.1.2.3 of the adress table or whatever.

-- 

Telefoon: 088 0100 700
Sales: sales at pocos.nl | Service: servicedesk at pocos.nl http://www.pocos.nl/ |
Croy 9c, 5653 LC Eindhoven | Kamer van Koophandel
17097024


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




More information about the sr-users mailing list