Hi Chris,

Thank you. lua presence.lua is now working without error output.
Calling via dial plan seems to have another problem.
EXECUTE sofia/internal/91@192.168.130.12 lua(set_presence.lua vm_blf_extension confirmed)
2015-03-31 10:47:20.995581 [ERR] mod_lua.cpp:203 /usr/local/freeswitch/scripts/presence.lua:6: attempt to index local 'self' (a nil value)
stack traceback:
/usr/local/freeswitch/scripts/presence.lua:6: in function 'new'
/usr/local/freeswitch/scripts/set_presence.lua:7: in main chunk

The line 6 contains the following:
  self.__index = self

Have you another idea?

The program versions are:
FreeSWITCH Version 1.4.15+git~20141229T185951Z~507a0f22c5~64bit (git 507a0f2 2014-12-29 18:59:51Z 64bit)
Lua 5.2.3  Copyright (C) 1994-2013 Lua.org, PUC-Rio
on ubuntu 14.04

Raphael

On 30 Mar 2015, at 22:55, Chris Tunbridge <blasterjr@gmail.com> wrote:

And that would be because my paste was also missing it, i apologize for that.

On Mon, Mar 30, 2015 at 2:55 PM, Chris Tunbridge <blasterjr@gmail.com> wrote:
Actually on your paste of the presence.lua file, i noticed that you're missing Presence = {} at the top, it should be the first item.

On Mon, Mar 30, 2015 at 2:52 PM, Chris Tunbridge <blasterjr@gmail.com> wrote:
When i run lua /usr/local/freeswitch/scripts/presence.lua i get an empty return with no errors, can you do lua -v so i can see what version of lua you're on?

Also which version of FreeSWITCH are you running?


On Mon, Mar 30, 2015 at 2:34 PM, Raphael Lechner <raphael.lechner@gmail.com> wrote:
still same error. It’s normal that when I call the presence.lua file directly with lua I got the same error?

tested with lua5.1 and lua5.2
root@rapbx:/usr/local/freeswitch# lua /usr/local/freeswitch/scripts/presence.lua
lua: /usr/local/freeswitch/scripts/presence.lua:1: attempt to index global 'Presence' (a nil value)
stack traceback:
/usr/local/freeswitch/scripts/presence.lua:1: in main chunk
[C]: in ?

calling via diaplan
EXECUTE sofia/internal/91@192.168.130.12 lua(set_presence.lua vm_blf_extension confirmed)
2015-03-30 22:25:57.535504 [ERR] mod_lua.cpp:203 /usr/local/freeswitch/scripts/presence.lua:2: attempt to index global 'Presence' (a nil value)
stack traceback:
/usr/local/freeswitch/scripts/presence.lua:2: in main chunk
[C]: in function 'dofile'
/usr/local/freeswitch/scripts/set_presence.lua:1: in main chunk


Thanks

On 30 Mar 2015, at 22:19, Chris Tunbridge <blasterjr@gmail.com> wrote:

try changing the dofile line to the full path to the file, which is probably /usr/local/freeswitch/scripts/presence.lua

so the line would look like this

dofile "/usr/local/freeswitch/scripts/presence.lua"

On Mon, Mar 30, 2015 at 1:20 PM, Raphael Lechner <raphael.lechner@gmail.com> wrote:
Thank you Chris for sharing your lua files with us.

I tried but probably I missed something, because I got that error:
EXECUTE sofia/internal/91@192.168.130.12 lua(set_presence.lua vm_blf_extension confirmed)
2015-03-30 21:13:31.775263 [ERR] mod_lua.cpp:203 scripts/presence.lua:2: attempt to index global 'Presence' (a nil value)
stack traceback:
scripts/presence.lua:2: in main chunk
[C]: in function 'dofile'
/usr/local/freeswitch/scripts/set_presence.lua:1: in main chunk

Any idea?

I have named the files set_presence.lua and presence.lua(for the functions) and both are located under scripts.

Thanks!
 

On 30 Mar 2015, at 20:43, Chris Tunbridge <blasterjr@gmail.com> wrote:

This can be done with lua, what i've done is created a small lua set of functions that make presence easy to handle.

here's the presence function file: http://pastie.org/private/8qfyjbwzsmwm2a4uz7owq

then you setup a lua file (call it scripts/set_presence.lua) that is similar to the following

dofile "presence.lua"

state = argv[2]
user = argv[1]
domain = session:getVariable('domain')

local p = Presence:new()
p:init{user = user, domain = domain, uuid = 'custom_blf_key'};

p:set(state,false);

you can execute this by adding the following line into your extension that controls it.

<action application="lua" data="set_presence.lua vm_blf_extension confirmed"/>

you can swap out the "vm_blf_extension" with anything you want, and as long as the phone "Subscribes" to this, it will work.

You can use early, confirmed, terminated for the statuses.


On Mon, Mar 30, 2015 at 9:37 AM, Andrew Cassidy <andrew@cassidywebservices.co.uk> wrote:
There's always the SEND_PRESENCE esl event...

On 30 March 2015 at 16:25, Raphael Lechner <raphael.lechner@gmail.com> wrote:
We migrated a customer from asterisk to FreeSWITCH 2 weeks ago and they had also a lamp for indicating if the “today closed” playback or call forward to voicemail is enabled or not.

Raphael


On 30 Mar 2015, at 17:17, Sean Devoy <sdevoy@bizfocused.com> wrote:

I have a customer who had this same request as well as one for a lamp indicating a call parked using “valet parking”.  They are worried a parked call could get forgotten.  I would love to hear a solution to either/both.
 
Sean
 
From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Paul Atreides
Sent: Monday, March 30, 2015 10:32 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Changing BLF lamp persistently
 
I want to have an indicator if the company voice mail is active or not.

At the moment I am calling a number and setting a global variable to activate the central company voice mail.
But I would like to use the BLF from a dummy account so that the user can see at the phone whether the voice mail is

active or not.

 
On Mon, Mar 30, 2015 at 4:08 PM, Michael Jerris <mike@jerris.com> wrote:
Can you describe a bit more exactly what you are trying to accomplish?  Presence changes in reaction to events that happen in calls.
 
On Mon, Mar 30, 2015 at 9:46 AM, Paul Atreides <paul.atreides83@googlemail.com> wrote:
Hi,

does someone know how to change the BLF lamp persistently? I found the channel variable
presence id but this one will only last as long as the channel is active. Is there a way to change
it permerently?

Thanks for helping.



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.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
http://www.freeswitch.org

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.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
http://www.freeswitch.org


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.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
http://www.freeswitch.org



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.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
http://www.freeswitch.org