[Freeswitch-users] BLF for database flag
Peter P GMX
Prometheus001 at gmx.net
Tue Sep 21 08:53:43 UTC 2021
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 at ip:port;fs_nat=yes;fs_path=sip%3Aa.b.c.d%3Annn%3Btransport%3Dudp>
> call_id:508931318-14314-3 at BA.CEG.HG.ED
> full_from:<sip:301 at 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 at 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 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
More information about the FreeSWITCH-users
mailing list