[Freeswitch-users] Restrict SIP registration

Mehroz Ashraf mehroz.ashraf85 at gmail.com
Wed Dec 18 20:17:01 MSK 2013


That is just great and a nice suggestion by peter. What other secrets does
FS have for us? :-)
On Dec 6, 2013 9:25 PM, "Peter Steinbach" <lists at telefaks.de> wrote:

>  Nice,
>
> wouldn't it make sense then to include this filter also in the
> <directory>.xml. Thus we are able to restrict a certain extension to a
> certain phone type.
>
> Best regards
> Peter
>
> On 12/06/13 10:46, Andrew Cassidy wrote:
>
> No, you literally just put a regex in sofia.conf.xml in the profile
> clients register to (internal in the default configuration) , for example:
>
>  <param name="user-agent-filter" value="SipDroid" />
>
>  Brian, the variable isn't documented so noone was to know it existed!
>
>
> On 6 December 2013 05:58, Mehroz Ashraf <mehroz.ashraf85 at gmail.com> wrote:
>
>> Brian ,It looks interesting but you should be confident enough altering a
>> FS source code :) , that I wont bother at least. And I guess, you have to
>> recompile FS each time you are making a change in that string?
>>
>>  A code snippet :
>>  if (user_agent_filter) {
>>                 if (switch_regex_match(user_agent, user_agent_filter) ==
>> SWITCH_STATUS_SUCCESS) {
>>                         if (sofia_test_pflag(profile,
>> PFLAG_LOG_AUTH_FAIL)) {
>>                                 switch_log_printf(SWITCH_CHANNEL_LOG,
>> SWITCH_LOG_DEBUG,
>>                                                                   "SIP
>> auth OK (REGISTER) due to user-agent-filter.  Filter \"%s\" User-Agent
>> \"%s\"\n", user_agent_filter, user_agent);
>>                         }
>>                 } else {
>>                         ret = AUTH_FORBIDDEN;
>>                         if (sofia_test_pflag(profile,
>> PFLAG_LOG_AUTH_FAIL)) {
>>                                 switch_log_printf(SWITCH_CHANNEL_LOG,
>> SWITCH_LOG_WARNING,
>>                                                                   "SIP
>> auth failure (REGISTER) due to user-agent-filter.  Filter \"%s\" User-Agent
>> \"%s\"\n", user_agent_filter,
>>
>> user_agent);
>>                         }
>>                         goto end;
>>                 }
>>         }
>>
>>   can block a specific User-agent comparing that value in the first
>> nested IF condition.
>> But my vote goes to xml_curl method !
>>
>>
>>
>>
>>  On Fri, Dec 6, 2013 at 1:41 AM, Brian West <brian at freeswitch.org> wrote:
>>
>>>  You guys try way too hard.
>>>
>>> sofia_reg.c:                    if (!strcasecmp(var,
>>> "user-agent-filter")) {
>>>
>>> This is a sofia profile param that you can put a regex in and filter it
>>> out.  ;)
>>>
>>> --
>>> Brian West
>>> brian at freeswitch.org
>>> FreeSWITCH Solutions, LLC
>>> PO BOX 2531
>>> Brookfield, WI 53008-2531
>>> Twitter: @FreeSWITCH_Wire , @briankwest
>>> http://www.freeswitchbook.com
>>> http://www.freeswitchcookbook.com
>>>
>>> T: +1.918.420.9001  |  F: +1.918.420.9002  |  M: +1.918.424.WEST
>>> iNUM: +883 5100 1420 9001 <%2B883%205100%201420%209001>
>>> ISN: 410*543
>>> Skype:briankwest
>>> PGP Key: http://www.bkw.org/key.txt (AB93356707C76CED)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Dec 5, 2013, at 11:59 AM, Peter Steinbach <lists at telefaks.de> wrote:
>>>
>>> > xml_curl looks a server URL with the registration params.
>>> >
>>> > So you will need to set up a web server (e.g. with apache/php, Ruby,
>>> Perl, Python or anything else), manage these parameters and return an XML
>>> to Freeswitch based on the parameters.
>>> > Some programming skills will be needed for that.
>>> >
>>> > Best regards
>>> > Peter
>>>
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
>
>  --
> *Andrew Cassidy BSc (Hons) MBCS SSCA*
> Managing Director
>
>
>  *T <info at cassidywebservices.co.uk> *03300 100 960  *F
> <info at cassidywebservices.co.uk> *03300 100 961
> *E <info at cassidywebservices.co.uk> *andrew at cassidywebservices.co.uk
> *W <info at cassidywebservices.co.uk> *www.cassidywebservices.co.uk
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:consulting at freeswitch.orghttp://www.freeswitchsolutions.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>
> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://wiki.freeswitch.orghttp://www.cluecon.com
>
> FreeSWITCH-users mailing listFreeSWITCH-users at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org
>
>
>
> --
> With kind regards
> Peter Steinbach
>
> Telefaks Services GmbHmailto:lists <lists> (att) telefaks.de
> Internet: www.telefaks.de
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131218/0a9f4328/attachment-0001.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list