[Freeswitch-users] ring all devices other than self with registration id as same

Steven Ayre steveayre at gmail.com
Tue Sep 25 18:46:05 UTC 2018


Thanks for sharing the script! Always helps avoid https://xkcd.com/979/

On Tue, 25 Sep 2018 at 15:44, Bipin Patel <bipin at xbipin.com> wrote:

> hi,
>
> after day of readings docs etc i wasnt able to find anything useful so
> ended up writing a lua script (first time working with lua), i had figured
> by then there was no other way without writing a script.
>
> below is the script if it helps any1 else, its not perfect but works. I
> pass the calling party's username and his contact ip:port
>
> function string:split(delimiter)
>     local result = { }
>     local from = 1
>     local delim_from, delim_to = string.find( self, delimiter, from )
>     while delim_from do
>         table.insert( result, string.sub( self, from , delim_from-1 ) )
>         from = delim_to + 1
>         delim_from, delim_to = string.find( self, delimiter, from )
>     end
>     table.insert( result, string.sub( self, from ) )
>     return result
> end
>
> function isempty(s)
>     return s == nil or s == ''
> end
>
> vps_id = argv[1]
> vps_ip = argv[2]
> check_ip = vps_ip:match("(%d+%.%d+%.%d+%.%d+%:%d+)")
> api = freeswitch.API();
> result = api:execute("sofia_contact",vps_id);
> if (result == "error/user_not_registered") then
>     session:execute("bridge","error/user_not_registered");
> else
>     t = {}
>     array_list = string.split(result,",")
>     if (#(array_list) > 1) then
>         for x,y in pairs(array_list) do
>             if isempty(string.find(y,check_ip)) then
>                 t[#t+1] = tostring(y)
>             end
>         end
>         out_myvar = table.concat(t,",")
>     else
>         for x,y in pairs(array_list) do
>             if isempty(string.find(y,check_ip)) then
>                 out_myvar = tostring(y)
>             end
>         end
>     end
>     if isempty(out_myvar) then
>         session:execute("bridge","error/user_not_registered");
>     else
>         session:execute("bridge", out_myvar);
>     end
> end
>
>
> Regards,
> Bipin
>
>
> ------------------------------
> -------- Original Message --------
> Subject: Re: [Freeswitch-users] ring all devices other than self with
> registration id as same
> From: Steven Ayre <steveayre at gmail.com> <steveayre at gmail.com>
> To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
> <freeswitch-users at lists.freeswitch.org>
> Date: 9/24/2018, 4:19:20 PM
>
> You could write and call a script that calls sofia_contact and filters out
> their device.
>
> On Wed, 19 Sep 2018 at 21:49, Bipin Patel <bipin at xbipin.com> wrote:
>
>> hi,
>>
>> i have a client registered to FS using same id on 2 devices and i created
>> a dialplan entry such that if he calls 000 then it can ring all devices
>> registered with same id, problem is the call also comes to himself on the
>> device he calls 000 from, is there a way to ring all other devices
>> registered other than his (multiple registration is enabled on profile)
>>
>> the bridge statement im using is as below currently where 5656 is his
>> registered userid
>>
>> <action application="bridge" data="${sofia_contact(5656)}"/>
>>
>>
>> --
>> Regards,
>> Bipin
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Services
>> sales at freeswitch.com
>> https://freeswitch.com
>>
>> Official FreeSWITCH Sites
>> https://freeswitch.com/oss
>> https://freeswitch.org/confluence
>> https://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
>> https://freeswitch.com
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Servicessales at freeswitch.comhttps://freeswitch.com
>
> Official FreeSWITCH Siteshttps://freeswitch.com/osshttps://freeswitch.org/confluencehttps://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-usershttps://freeswitch.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20180925/78e9fb0c/attachment-0001.html>


More information about the FreeSWITCH-users mailing list