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

++

Le mar. 20 nov. 2018 à 15:40, Ryan Harris <ryharris@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@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com