[Freeswitch-users] Generate uniqueid like asterisk

Mickael Hubert mickael at winlux.fr
Tue Nov 20 16:06:54 UTC 2018


HI Ryan,
thanks a lot !
it works like a charm.

++

Le mar. 20 nov. 2018 à 15:40, Ryan Harris <ryharris at airmail.cc> a écrit :

> On 11/16/18 3:29 AM, Mickael Hubert wrote:
> > Hi all,
> > currently, I use asterisk uniqueid to lot of internals processes Ex:
> > 001-1542296620.1319230
> > I want to change asterisk by FS, but I have to keep this uniqueid format.
> > I know the format of the uniqueid : [server id]-[timestamp].[random
> > integer]
> >
> > How can I generate it from FS please ?
>
> Touch and edit /usr/share/freeswitch/scripts/uniqueid.lua
>
> Write this to the file:
>
> local server_id = argv[1] or '001' -- defaults system id to '001' if you
> don't pass an arg
> stream:write(server_id .. '-' .. os.time() .. '.' ..
> math.random(1000000,9999999))
>
> Then use this in your XML dialplan:
>
> <action application="set" data="server_id=003"/>
>
> <action application="set" data="UNIQUEID=${lua(uniqueid.lua
> ${server_id})}"/>
>
> Now you have a UNIQUEID channel variable in the format you requested.
>
>
> _________________________________________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20181120/3ffbebb1/attachment-0001.html>


More information about the FreeSWITCH-users mailing list