Hello..... Does anyone know if there is a way to have a BLF (presence monitor) for an object that is NOT a device. I would like to have the BLF lamp toggle red/green based on a status of a variable that is a field in the database... For example: A user dials *85x If the use dials *850, this can mean turn the light OFF If the use dials *85n, this can mean turn the light ON Then the device (x301) has a BLF set for *851. The sip_subscriptions table will have the following: *************************** 1. row *************************** proto: sip sip_user: 301 sip_host: domain sub_to_user: *851 sub_to_host: domain presence_hosts: event: dialog contact: "user"<sip:301@ip:port;fs_nat=yes;fs_path=sip%3Aa.b.c.d%3Annn%3Btransport%3Dudp> call_id:508931318-14314-3@BA.CEG.HG.ED full_from:<sip:301@domain>;tag=673185170 full_via: SIP/2.0/UDP ip:port;branch=z9hG4bK1903845623;rport=...;received=..... expires: 1631421776 user_agent: xyz accept: application/dialog-info+xml, multipart/related, application/rlmi+xml profile_name: customer hostname: host network_port: ... network_ip: a.b.c.d version: 121 orig_proto: full_to:<sip:*852@domain>;tag=HQrMabwmsTlX *************************** 1. row *************************** Thanks, any help would be great...
Hi Jerry, yes there is a way. We use a BLF Key to determine if we're in or out of office hours, which changes depending on time and/or other parameters. There is a hook-setting in conf/autoload_configs/lua.conf.xml. <hook event="all" script="events.lua"/> In that file there are a few event-paramters, which you can get with for example event:getHeader("Event-Name"). Which gives you the event name/type. I think you are looking for the PRESENCE_PROBE Event. Regards, Stefan -----Ursprüngliche Nachricht----- Von: FreeSWITCH-users <freeswitch-users-bounces@lists.freeswitch.org> Im Auftrag von Jerry Kendall Gesendet: Sonntag, 12. September 2021 07:00 An: freeswitch-users@lists.freeswitch.org Betreff: [Freeswitch-users] BLF for database flag Hello..... Does anyone know if there is a way to have a BLF (presence monitor) for an object that is NOT a device. I would like to have the BLF lamp toggle red/green based on a status of a variable that is a field in the database... For example: A user dials *85x If the use dials *850, this can mean turn the light OFF If the use dials *85n, this can mean turn the light ON Then the device (x301) has a BLF set for *851. The sip_subscriptions table will have the following: *************************** 1. row *************************** proto: sip sip_user: 301 sip_host: domain sub_to_user: *851 sub_to_host: domain presence_hosts: event: dialog contact: "user"<sip:301@ip:port;fs_nat=yes;fs_path=sip%3Aa.b.c.d%3Annn%3Btransport%3Dudp> call_id:508931318-14314-3@BA.CEG.HG.ED full_from:<sip:301@domain>;tag=673185170 full_via: SIP/2.0/UDP ip:port;branch=z9hG4bK1903845623;rport=...;received=..... expires: 1631421776 user_agent: xyz accept: application/dialog-info+xml, multipart/related, application/rlmi+xml profile_name: customer hostname: host network_port: ... network_ip: a.b.c.d version: 121 orig_proto: full_to:<sip:*852@domain>;tag=HQrMabwmsTlX *************************** 1. row *************************** Thanks, any help would be great... _________________________________________________________________________ The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform. Join our online community to chat in real time https://signalwire.community 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
Of course if the lamp depends on a session-state of a call, you can just set the presence_id field in your dialplan. The other method I described in my last mail is for things that don’t get triggered/changed by a session-state or a call. This will automatically trigger the presence events. https://freeswitch.org/confluence/display/FREESWITCH/presence_id Regards, -----Ursprüngliche Nachricht----- Von: FreeSWITCH-users <freeswitch-users-bounces@lists.freeswitch.org> Im Auftrag von Jerry Kendall Gesendet: Sonntag, 12. September 2021 07:00 An: freeswitch-users@lists.freeswitch.org Betreff: [Freeswitch-users] BLF for database flag Hello..... Does anyone know if there is a way to have a BLF (presence monitor) for an object that is NOT a device. I would like to have the BLF lamp toggle red/green based on a status of a variable that is a field in the database... For example: A user dials *85x If the use dials *850, this can mean turn the light OFF If the use dials *85n, this can mean turn the light ON Then the device (x301) has a BLF set for *851. The sip_subscriptions table will have the following: *************************** 1. row *************************** proto: sip sip_user: 301 sip_host: domain sub_to_user: *851 sub_to_host: domain presence_hosts: event: dialog contact: "user"<sip:301@ip:port;fs_nat=yes;fs_path=sip%3Aa.b.c.d%3Annn%3Btransport%3Dudp> call_id:508931318-14314-3@BA.CEG.HG.ED full_from:<sip:301@domain>;tag=673185170 full_via: SIP/2.0/UDP ip:port;branch=z9hG4bK1903845623;rport=...;received=..... expires: 1631421776 user_agent: xyz accept: application/dialog-info+xml, multipart/related, application/rlmi+xml profile_name: customer hostname: host network_port: ... network_ip: a.b.c.d version: 121 orig_proto: full_to:<sip:*852@domain>;tag=HQrMabwmsTlX *************************** 1. row *************************** Thanks, any help would be great... _________________________________________________________________________ The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform. Join our online community to chat in real time https://signalwire.community 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
Hello Jerry, here is some minimal ruby code, we use to send presence data via ESL interface # Send BLF presence event def self.send_presence(presence_id,status,hostname,direction=nil) uuid=UUID.new.generate if status==:up answer_state='confirmed' elsif status==:down answer_state='terminated' elsif status==:ringing answer_state='early' end direction="outbound" if !direction msg=<<EOF1 sendevent PRESENCE_IN proto: sip from: #{presence_id} login: #{presence_id} event_type: presence alt_event_type: dialog event_count: 1 unique-id: #{uuid} Presence-Call-Direction: #{direction} Answer-State: #{answer_state} EOF1 hostname=MY_GW_IP if !hostname f=FsSendEvent.new(hostname,port=8021) f.send_plain(msg) end For "FsSendEvent.new" and "f.send_plain" you should however do with standard esl module, which can be compiled from Freeswitch sources. We have created our own module here. On https://freeswitch.org/confluence/display/FREESWITCH/Event+Socket+Library you will find an example under the bgapi section. Presence_id can be formatted as you like, we sometimes do e.g. **123*456789 and a phone then can subscribe to this. Best regards Peter Am 12.09.21 um 06:59 schrieb Jerry Kendall:
Hello.....
Does anyone know if there is a way to have a BLF (presence monitor) for an object that is NOT a device.
I would like to have the BLF lamp toggle red/green based on a status of a variable that is a field in the database...
For example:
A user dials *85x
If the use dials *850, this can mean turn the light OFF
If the use dials *85n, this can mean turn the light ON
Then the device (x301) has a BLF set for *851.
The sip_subscriptions table will have the following:
*************************** 1. row *************************** proto: sip sip_user: 301 sip_host: domain sub_to_user: *851 sub_to_host: domain presence_hosts: event: dialog contact: "user"<sip:301@ip:port;fs_nat=yes;fs_path=sip%3Aa.b.c.d%3Annn%3Btransport%3Dudp> call_id:508931318-14314-3@BA.CEG.HG.ED full_from:<sip:301@domain>;tag=673185170 full_via: SIP/2.0/UDP ip:port;branch=z9hG4bK1903845623;rport=...;received=..... expires: 1631421776 user_agent: xyz accept: application/dialog-info+xml, multipart/related, application/rlmi+xml profile_name: customer hostname: host network_port: ... network_ip: a.b.c.d version: 121 orig_proto: full_to:<sip:*852@domain>;tag=HQrMabwmsTlX *************************** 1. row ***************************
Thanks, any help would be great...
_________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
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
participants (3)
-
Jerry Kendall
-
Peter P GMX
-
Stefan Kainz