[Freeswitch-users] Restrict SIP registration

Andrew Cassidy andrew at cassidywebservices.co.uk
Fri Dec 6 12:46:58 MSK 2013


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
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131206/49123853/attachment-0001.html 


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