FOP2 & hot desking
I recently deployed a vanilla Asterisk 10 server with MySQL based hot desking (more or less as per the example here: http://ofps.oreilly.com/titles/97805965 ... sk-DB.html). Since I'm not using the "private queue" workaround for the hot desk users, I don't really have a fixed device to monitor for my users other than a custom device I'm manipulating through dialplan magic, and FOP2 kicks a fuss if I try to tell it to use [Custom/${EXTEN}] (I fill in the substitution myself, but for example's sake...)
Two questions:
1) Is there a straightforward way for me to get FOP2 to monitor my users instead of a device?
2) Is there a supported way to get FOP2 to use the login credentials out of my existing MySQL database for the hotdesking, so I can let people have the same PIN for logging into both the phones and FOP2?
Two questions:
1) Is there a straightforward way for me to get FOP2 to monitor my users instead of a device?
2) Is there a supported way to get FOP2 to use the login credentials out of my existing MySQL database for the hotdesking, so I can let people have the same PIN for logging into both the phones and FOP2?
Comments
[USER/200]
The thing is that the mode in freepbx requires several astdb entries to be set in a kind of unorganized manner, and also userevents in the manager should be fired whenever a user logs in or out.
Regarding the user/passwords, you can customize the autoconfig-users-freepbx.sh to your needs or write any custom script accesing any kind of database or system.
Best regards,
[USER/200]
type=extension
extension=200
domain=from-internal
label=John
The hard part is to replicate the ASTDB entries and fire the proper UserEvents when a user logs in or out. I do not recall from memory, and it is not straightforward at all, it seems in FreePBX the feature was an after though or a kind of convoluted implementation, because there are several ASTDB entries to set/check.
Here is an example entry:
/AMPUSER/1002/device : 1002
/DEVICE/1002/dial : SIP/john
Whit those entries, fop2 will monitor SIP/john for USER/1002
Then the manager userevent should have this information when a user logs in or out:
Event: UserDeviceAdded
Data: 1002,SIP/john
Event: UserDeviceRemoved
Data: 1002,SIP/john
Best regards,
My magics for other poor souls that might stumble across this via google or whatever...
1) For the sake of getting up and going, I manually created /AMPUSER/EXTEN/device: EXTEN entries in my AstDB. I probably should set up some sort of bash script or something that goes through my hotdesk MySQL table and keeps the extensions up to date, but that'll be a "later" project.
2) Within the dialplan, when a user successfully logs in, fire this dialplan logic (besides the part to log the user in). Note that ${LOCATION} is the SIP device the user logged into, and ${E} is the user's extension. 3) Within the dialplan, when a user successfully logs out, fire this dialplan logic (besides the part to log the user out). NOte that ${LOCATION} is the SIP device the user logged out of, and ${E} is the user's extension.
4) Within the FOP2 config files:
fop2.cfg:
autousers.sh:
autobuttons.cfg:
autobuttons.sh:
It's important to have cid_name last in your mysql query if you have spaces in your cid_names, otherwise the bash script will split on the space within the cid_name and everything will be messy.
---
I do have two questions. I see some reference in the documentation to "when fop2 is reloaded". Is it possible to fire an event that will reload fop2 from within the Asterisk dialplan?
Related... If I am logged into FOP2 in IE when I change the buttons config file on the server and run service fop2 restart from the server CLI, when IE "reconnects" to FOP2, it doesn't pickup the changed buttons config (and usually this winds up with the "existing" buttons being horribly messed up). Is there a way to fix this, or something I have misconfigured that is causing it?
A module reload in asterisk should trigger a FOP2 reload too.
The client is supposed to detect button configuration changes and force a reload when that happens, but now that I think of it, it might do that on reload only and not on restart. I will make some tests next monday/tuesday and try to remember to update this post with my findings.
Best regards,