FOP2 monitoring for asterisk plain (USERDEVICE MODE)
Hi FOP2,
Today i know how astdb working on userdevice mode, i can see script agi user_login_out and i think we can change the script using shell script and execute the script on dialplan asterisk
Here is the small script example :
LOGIN
asterisk -rx "database put DEVICE/${DEVICE} user ${USER}"
asterisk -rx "database put AMPUSER/${USER} device ${DEVICE}"
asterisk -rx "dialplan add extension ${USER},hint,SIP/${DEVICE} into ext-local"
exten => s,n,UserEvent(UserDeviceAdded,Action: UserEvent,Data: ${USER}\,${DEVICE}\)
LOGOUT
asterisk -rx "database del AMPUSER ${USER}/device"
asterisk -rx "database put DEVICE/${DEVICE} user none"
asterisk -rx "dialplan remove extension ${USER}@ext-local hint"
exten => s,n,UserEvent(UserDeviceRemoved,Action: UserEvent,Data: ${USER}\,${DEVICE}\)
And variable "database show" we can set on asterisk using CLI database put/del etc
/AMPUSER/${USER}/device : 4001
/DEVICE/${DEVICE}/user : 100
etc....
My Question are :
What should i do on fop2 configuration to support userdevice mode on asterisk plain?
I only need fop2 monitoring GREEN color if i run command Login, GREY if run script LOGOUT and RED if i call out from device.
Thanks
Today i know how astdb working on userdevice mode, i can see script agi user_login_out and i think we can change the script using shell script and execute the script on dialplan asterisk
Here is the small script example :
LOGIN
asterisk -rx "database put DEVICE/${DEVICE} user ${USER}"
asterisk -rx "database put AMPUSER/${USER} device ${DEVICE}"
asterisk -rx "dialplan add extension ${USER},hint,SIP/${DEVICE} into ext-local"
exten => s,n,UserEvent(UserDeviceAdded,Action: UserEvent,Data: ${USER}\,${DEVICE}\)
LOGOUT
asterisk -rx "database del AMPUSER ${USER}/device"
asterisk -rx "database put DEVICE/${DEVICE} user none"
asterisk -rx "dialplan remove extension ${USER}@ext-local hint"
exten => s,n,UserEvent(UserDeviceRemoved,Action: UserEvent,Data: ${USER}\,${DEVICE}\)
And variable "database show" we can set on asterisk using CLI database put/del etc
/AMPUSER/${USER}/device : 4001
/DEVICE/${DEVICE}/user : 100
etc....
My Question are :
What should i do on fop2 configuration to support userdevice mode on asterisk plain?
I only need fop2 monitoring GREEN color if i run command Login, GREY if run script LOGOUT and RED if i call out from device.
Thanks
Comments
So, in the button configuration on FOP2 you must have
[USER/100]
type=extension
extension=100
Label=Mary
...
At startup the ASTDB will be quieried to perform the device mapping with the user, and then UserEvents will be read to dynamically change that mapping.
Best regards,
I try to explore userdevice mode on asterisk plain.
USER : 2000
DEVICE : 100
Here is my config on fop2.cfg
user=2000:2000:dial::configonreload
buttonfile=buttons.cfg
buttons.cfg
[USER/2000]
type=extension
extension=2000
label=2000
context=from-internal
autoanswerheader=__SIPADDHEADER51=Call-Info=answer-after=0.001
After i restart fop2 and then login from http://ip/fop2 , user : 2000, password : 2000, it show green color (see pic on attachment fop2_box_green.png), in normal state (using freepbx), before not success login from xlite/softphone by press *11 it should be "GRAY" color
Here is i my config (asterisk)
sip.conf
[general]
#include sip_general_additional.conf
[authentication]
[100]
deny=0.0.0.0/0.0.0.0
secret=100@password
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
trustrpid=yes
sendrpid=no
type=friend
nat=no
port=5060
qualify=yes
qualifyfreq=60
transport=udp
avpf=no
icesupport=no
encryption=no
callgroup=
pickupgroup=
dial=SIP/100
mailbox=100@device
permit=0.0.0.0/0.0.0.0
callerid=100 <100>
callcounter=yes
faxdetect=no
cc_monitor_policy=generic
---
extensions.conf
[general]
static = yes
writeprotect = no
autofallthrough = yes
clearglobalvars = no
[globals]
[from-internal]
exten => 2000,hint,SIP/100
asterisk -rx "database show"
/AMPUSER/2000/device : 100
/AMPUSER/2000/password : 2000
/DEVICE/100/dial : SIP/100
/DEVICE/100/type : adhoc
/DEVICE/100/user : 2000
/SIP/Registry/100 : 27.111.XX.XX:36698:300:100:sip:100@27.111.XX.XX:36698;rinstance=55805cdce59f495c
[root@cls asterisk]# asterisk -rx "core show hints"
-= Registered Asterisk Dial Plan Hints =-
2000@from-internal : SIP/100 State:Idle Watchers 0
- 1 hints registered
Pls help me to solve this issue so i can using userdevice mode on asterisk plain.
Thanks
Best regards,