[Freeswitch-users] Option to log registrations/deregistrations?

mario_fs mario_fs at mgtech.com
Mon Mar 18 16:21:28 UTC 2019


Thanks Adridan this worked great! My only issue was I needed the agent but it’s not available for custom, so I used contact which has the IP address of the push server when needed. Thanks also to David but I don’t know anything about ESL and the wiki was of little help. I know already had a LUA script.

I don’t know what the last “if” block does, I don’t think it applies to me, not much on the wiki, it seems to work fine with it commented out.

local username  = event:getHeader("username");
local from_user = event:getHeader("from-user");
--local agent     = event:getHeader("variable_sip_user_agent");
local contact = event:getHeader("contact");
freeswitch.consoleLog("INFO","LUA logout_callcenter.lua username: " .. (username or "") .." from-user: " .. (from_user or "") .."\n");
freeswitch.consoleLog("INFO"," contact: " .. (contact or "") .."\n");
--freeswitch.consoleLog("INFO","agent: " .. (agent or "") .."\n");

--if (username ~= nil) then
--    api = freeswitch.API();
--    result = api:execute("callcenter_config", "agent set status "..username.." 'Logged Out'");
--    freeswitch.consoleLog("INFO", "Execute on unregister: ".. result .. "\n")
--end

> On Mar 12, 2019, at 4:30 PM, David Villasmil <david.villasmil.work at gmail.com> wrote:
> 
> Hello,
> 
> You can use ESL to log that, just connect to localhost:8021 and log everything you see coming in:
> 
> checkout https://freeswitch.org/confluence/display/FREESWITCH/Python+ESL <https://freeswitch.org/confluence/display/FREESWITCH/Python+ESL>
> and just log.
> 
> hope this helps.
> 
> 
> 
> Regards,
> 
> David Villasmil
> email: david.villasmil.work at gmail.com <mailto:david.villasmil.work at gmail.com>
> phone: +34669448337
> 
> 
> On Tue, Mar 12, 2019 at 10:21 PM mario_fs <mario_fs at mgtech.com <mailto:mario_fs at mgtech.com>> wrote:
> Thanks! I know enough LUA to already have a LUA script in FreeSwitch so will give this a try. This should drastically help with debugging Bria PUSH staying registered issues! I found sofia::unregister on the wiki and check the lua.conf.xml file. Thanks a LOT!
> Mario G
> 
>> On Mar 12, 2019, at 11:46 AM, Adridan Tudor <tudor.gabriell at gmail.com <mailto:tudor.gabriell at gmail.com>> wrote:
>> 
>> You can use an event hook from mod_lua to execute a lua script on unregister event. 
>> Add "<hook event="custom" subclass="sofia::unregister" script="logout_callcenter.lua" />" in lua.conf.xml
>> 
>> In the script you can do whatever you want, for example logout from callcenter.
>> >>freeswitch.consoleLog("INFO","Executing logout_callcenter.lua\n");
>> >>local username = event:getHeader("username");
>> >>local from_user = event:getHeader("from-user");
>> >>freeswitch.consoleLog("INFO","username: " .. (username or "") .."\n");
>> >>freeswitch.consoleLog("INFO","from-user: " .. (from_user or "") .."\n");
>> >>
>> >>if (username ~= nil) then
>> >>    api = freeswitch.API();
>> >>    result = api:execute("callcenter_config", "agent set status "..username.." 'Logged Out'");
>> >>    freeswitch.consoleLog("INFO", "Execute on unregister: ".. result .. "\n")
>> >>end
>> 
>> On Tue, Mar 12, 2019 at 8:26 PM mario_fs <mario_fs at mgtech.com <mailto:mario_fs at mgtech.com>> wrote:
>> Still no luck on this and I really need to know date/time when a particular extension is unregistering. Anyone else have an idea that does not involve programming? Thanks,
>> Mario G
>> 
>>> On Feb 20, 2019, at 9:16 AM, mario_fs <mario_fs at mgtech.com <mailto:mario_fs at mgtech.com>> wrote:
>>> 
>>> I have been searching the wiki and web and still nothing simple to log de-registrations. I find it hard to believe there is not a simple way to do this, anyone have a good idea?
>>> Mario G
>>> 
>>>> On Feb 15, 2019, at 9:46 AM, mario_fs <mario_fs at mgtech.com <mailto:mario_fs at mgtech.com>> wrote:
>>>> 
>>>> Hmmmm…. Logging de-registrations would be a useful enhancement to FreeSwitch for debugging issues like this. I know a SIP trace does it but that’s a LOT of data when we're talking days. Thanks.
>>>> Mario G
>>>> 
>>>>> On Feb 15, 2019, at 12:05 AM, Avi Marcus <avi at avimarcus.net <mailto:avi at avimarcus.net>> wrote:
>>>>> 
>>>>> Here's some old nodejs code relying on `esl` lib to monitor for de-registrations and send me an email. I haven't used it in ages.
>>>>> 
>>>>> https://gist.github.com/avimar/9645dd3134476d458e68cca077f4ed16 <https://gist.github.com/avimar/9645dd3134476d458e68cca077f4ed16>
>>>>> 
>>>>> 
>>>>> -Avi Marcus
>>>>> BestFone
>>>>> 
>>>>> 
>>>>> On Fri, Feb 15, 2019 at 12:13 AM mario_fs <mario_fs at mgtech.com <mailto:mario_fs at mgtech.com>> wrote:
>>>>> Does anyone know if there is something I can do to log device registrations, and more importantly when devices lose registration, without having a ton of other log data. I know I can turn on a higher level of diagnostics, but it may be several days before I find what I need and don’t want to flood the log.
>>>>> 
>>>>> I am working with Counterpath on Bria Push service and need to find when their push server stops registering. Since they don’t send a notification for that and it’s not in the normal FS log, I may not know for days when this happens. It would be nice to be able to scan the log for lost registrations. Thanks!
>>>>> Mario G
>>>>> _________________________________________________________________________
>>>>> Professional FreeSWITCH Services
>>>>> sales at freeswitch.com <mailto:sales at freeswitch.com>
>>>>> https://freeswitch.com <https://freeswitch.com/>
>>>>> 
>>>>> Official FreeSWITCH Sites
>>>>> https://freeswitch.com/oss <https://freeswitch.com/oss>
>>>>> https://freeswitch.org/confluence <https://freeswitch.org/confluence>
>>>>> https://cluecon.com <https://cluecon.com/>
>>>>> 
>>>>> FreeSWITCH-users mailing list
>>>>> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>> https://freeswitch.com <https://freeswitch.com/>_________________________________________________________________________
>>>>> Professional FreeSWITCH Services
>>>>> sales at freeswitch.com <mailto:sales at freeswitch.com>
>>>>> https://freeswitch.com <https://freeswitch.com/>
>>>>> 
>>>>> Official FreeSWITCH Sites
>>>>> https://freeswitch.com/oss <https://freeswitch.com/oss>
>>>>> https://freeswitch.org/confluence <https://freeswitch.org/confluence>
>>>>> https://cluecon.com <https://cluecon.com/>
>>>>> 
>>>>> FreeSWITCH-users mailing list
>>>>> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>> https://freeswitch.com <https://freeswitch.com/>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Services
>>>> sales at freeswitch.com <mailto:sales at freeswitch.com>
>>>> https://freeswitch.com <https://freeswitch.com/>
>>>> 
>>>> Official FreeSWITCH Sites
>>>> https://freeswitch.com/oss <https://freeswitch.com/oss>
>>>> https://freeswitch.org/confluence <https://freeswitch.org/confluence>
>>>> https://cluecon.com <https://cluecon.com/>
>>>> 
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>> https://freeswitch.com <https://freeswitch.com/>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Services
>>> sales at freeswitch.com <mailto:sales at freeswitch.com>
>>> https://freeswitch.com <https://freeswitch.com/>
>>> 
>>> Official FreeSWITCH Sites
>>> https://freeswitch.com/oss <https://freeswitch.com/oss>
>>> https://freeswitch.org/confluence <https://freeswitch.org/confluence>
>>> https://cluecon.com <https://cluecon.com/>
>>> 
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>> https://freeswitch.com <https://freeswitch.com/>
>> _________________________________________________________________________
>> Professional FreeSWITCH Services
>> sales at freeswitch.com <mailto:sales at freeswitch.com>
>> https://freeswitch.com <https://freeswitch.com/>
>> 
>> Official FreeSWITCH Sites
>> https://freeswitch.com/oss <https://freeswitch.com/oss>
>> https://freeswitch.org/confluence <https://freeswitch.org/confluence>
>> https://cluecon.com <https://cluecon.com/>
>> 
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
>> https://freeswitch.com <https://freeswitch.com/>_________________________________________________________________________
>> Professional FreeSWITCH Services
>> sales at freeswitch.com <mailto:sales at freeswitch.com>
>> https://freeswitch.com <https://freeswitch.com/>
>> 
>> Official FreeSWITCH Sites
>> https://freeswitch.com/oss <https://freeswitch.com/oss>
>> https://freeswitch.org/confluence <https://freeswitch.org/confluence>
>> https://cluecon.com <https://cluecon.com/>
>> 
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
>> https://freeswitch.com <https://freeswitch.com/>
> _________________________________________________________________________
> Professional FreeSWITCH Services
> sales at freeswitch.com <mailto:sales at freeswitch.com>
> https://freeswitch.com <https://freeswitch.com/>
> 
> Official FreeSWITCH Sites
> https://freeswitch.com/oss <https://freeswitch.com/oss>
> https://freeswitch.org/confluence <https://freeswitch.org/confluence>
> https://cluecon.com <https://cluecon.com/>
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
> https://freeswitch.com <https://freeswitch.com/>_________________________________________________________________________
> 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/20190318/59917f22/attachment-0001.html>


More information about the FreeSWITCH-users mailing list