DND status indication - hints and BLF
System:
CentOS 6.2 (2.6.32-220.13.1.el6.x86_64)
Asterisk 1.8.11.1
FreePBX 2.10.0.4
FOP2 2.26
Hi,
I've just recently installed FOP2 and it is working very well. I had a query regarding DND and presence indication - I am able to toggle DND successfully from an extension (*76) and it appears on FOP2 (also updates the relevant database entries and hints).
When however setting DND from within FOP2 the database entries are updated as expected but the hints are not set - therefore BLF subscriptions on the phones show the extension as 'Idle'
Is this the expected behaviour when setting the presence indication from within FOP2?
Many thanks
Sean
CentOS 6.2 (2.6.32-220.13.1.el6.x86_64)
Asterisk 1.8.11.1
FreePBX 2.10.0.4
FOP2 2.26
Hi,
I've just recently installed FOP2 and it is working very well. I had a query regarding DND and presence indication - I am able to toggle DND successfully from an extension (*76) and it appears on FOP2 (also updates the relevant database entries and hints).
When however setting DND from within FOP2 the database entries are updated as expected but the hints are not set - therefore BLF subscriptions on the phones show the extension as 'Idle'
Is this the expected behaviour when setting the presence indication from within FOP2?
Many thanks
Sean
Comments
If not, do it
/usr/local/fop2/generate_override_contexts.pl -w
Then try again.
Yes I ran the generate_override_contexts.pl script when I first did the installation, and extensions_override_fop2.conf is working very nicely.
My simple question is; does FOP2 actually set hints - and I think the answer is 'no' (but just wanted to double check)? I've got BLF buttons subscribed to hints which show a particular extension as "not in use" which has in fact been set to DND using FOP2.
However executing a *76 (with the FOP2 mods included) does actually set the BLF hint (and also update the asterisk DB) as expected.
Does that make sense?
Fop2 does not set hints, but you can modify what fop2 does but modifying FOP2Callbacks.pm
Unfortunately the hint setting is a moving target, I cannot add it as standard feature, not everyone uses the same asterisk version, let alone FreePBX versions.
In Fop2callbacks you could originate a call to a custom dialplan using Local/xxx and write it so it set states the way it is done in your current freepbx version.. that could work.
I am struggling with this issue as well. I would be happy to have even as much as simcity has working:
I am afraid to break the FOP2 settings, which, presently, are working very well.
I have had a look at extensions_override_fop2.conf and was toying with trying to add in a line like: and adding into extensions_custom.conf something like: but this is a bit over my head.
What I am trying to achieve is have the BLF on my Grandstream GXP2120 display red when dnd is on, and green when off.
I can set the DND status using FOP2 and this works well, but there is no indication on the phone itself what the DND state is.
I am asking on the FOP2 forum due to the fact that extensions_override_fop2.conf defines the [app-dnd-toggle] and it seems to me that if the Device_State setting is to be added in, it should be here?
I would appreciate any assistance..
Hi,
extensions_override_fop2.conf is generated with the generate_override_contexts.pl script. This script will take the DND macros from your current FreePBX version and add to them 2 or 3 priorities to fire a UserEvent so FOP2 can reflect a change when you *dial* the feature code from the phone. All of this means that it is NOT the extensions_override_fop2.conf file what you need to change, as those contexts are not used when you change presence in FOP2, but when you dial the feature codes from your phone.
What you need to modify is FOP2Callbacks.pm , that file will intercept a presence change in the FOP2 GUI and set and ASTDB entry for DND in Asterisk, and only set that astdb entry. So, you need to modify that code block to set the proper device state.
I have not tried this, I am typing it directly in here, but you might want to follow this route and go from here, edit FOP2Callbacks.pm, notice that I am adding another command (setvar) to send to AMI when you set/unset the presence in fop2, somwhere neer the beginning of the file:
After modifying FOP2Callbacks.pm, you might want to see if there are no syntax errors by running it like this:
perl FOP2Callbacks.pm
It should not output anything on screen. Then restart FOP2 and try to change presence from it. I am not sure if the above is correct, it might have a syntax error, or perhaps there is an additional DEVICE_STATE that needs to be set for your phone. But you will get the idea.
If you have it working, please let us know.
Best regards,
It compiled without error. I restarted fop2.
It has not changed the result.
I cannot see, in the CLI, any reaction at all when I change the presence state in the FOP2.
When I set the DND presence via *76, I can see the CLI react (ie, it scrolls through various steps it is taking). This does not happen when I set DND via FOP2. FOP2 does recognise the DND setting if I set it using *76, OR using the FOP2 interface.
I think the problem is related to the fact that, once the dnd status is toggled, the CLI still shows:
Should this not be showing as "Busy" ?
I have active watchers watching for the status, but they are all showing idle: (this is from core show hints)
However, if I try to dial that extension from another phone, the system reports that the user is 'on the phone', so it is responding to the DND setting.
I have BLF's set to watch the status of 216, and they accurately reflect when the phone is in use, but they stubbornly continue to show the extension as idle when DND is set.
What I wrote tries to replicate the variable set for Custom:DND, but perhpas the phone is subscribed to DEVDND as the 2nd appearance. But I am not sure if DEVDND expect the device name or the extension number. If it is the device, then you should use another parameter in FOP2Callbacks.pm, you will have to uncomment the debug print lines to know what index to use, probably 4 or 5, so you can add another block like:
In any case, start FOP2 in debug mode level 3 and inspect the commands being sent via AMI and the asterisk responses:
log into fop2 and set presence to something, wait a while, set back to available, and then stop the capture:
You will have the capture.log file to review, and see if the device state variables are being set and what are the manager responses.
Best regards,
I have made significant progress, but there is still an issue, if you can bear with me explaining where I have got to.
Firstly, for the benefit of others out there, I have discovered that there is a default setting in FreePBX that needs to be changed before you can get custom hints to work.
Specifically, you need to go to the "Advanced Settings" page, and change "Enable Custom Device States" to "True"
Once I did this, I started seeing signs of progress (core show hints started showing lots of monitored hints)
Then I revisited the instructions Nicolas gave earlier, and re-set my /usr/local/fop2/FOP2Callbacks.pm changes to match my earlier post (I had made some changes since then trying different things, none of which worked)
I then reloaded asterisk (core reload) and restarted fop2 (service fop2 restart)
At this stage, BLF started to work for DND set via the FOP2 interface.
This is a huge step forward and I am already very grateful and happy to have it working this far.
The next issue, though, is that the BLF continues to ignore changes made by dialling *76 on the phone.
It is important to note that FOP2 DOES pick up these changes, and updates its status accordingly - however the BLF lamp does not change unless the DND status is changed via the FOP2 interface.
(this tells me that Nicolas' changes to FOP2Callbacks.pm are working well - it is now the underlying settings that are not working. )
Presently, the BLF lamp will get 'out-of-sync' if the DND status is set via the *76 - it will continue to show Red unavailable if it was set to DND via FOP2 then turned off via *76, even though FOP2 recognises the change back to avaialable.
I have read what Nicolas said about how the FOP2Callbacks.pm works, and it seems it is only called when the FOP2 user interface is used. So, either we need somehow to have FOP2Callbacks.pm called when *76 is used, or we need to have the system set the presence correctly when FOP2Callbacks.pm is not called.
I have had another look at app-dnd-toggle in extensions_additional.conf and compared it with app-dnd-toggle in extensions_override_fop2.conf
It seems that, with the fop2 override, the exten => *76,n,Set(STATE=BUSY or NOT_INUSE) lines are omitted:
From extensions_additional.conf
From extensions_override_fop2.conf
I suspect this may be the reason the state is not getting set correctly when set via *76 ?
I did try re-inserting these lines into extensions_override_fop2.conf but it did not work. I am thinking perhaps the State being set is the device state, rather than the extension state, and it seems the system is happily reading the extension state.
Are you able to suggest what I can do to make the *76 change behave in the same way as when set via FOP2 ?
Thanks again
/usr/local/fop2/generate_override_contexts.pl -w
Then compare the two macros again, there should be equal except for the ; added for fop2 and ;end addition blocks.
Also, just for your viewing pleasure, this is a copy of the macro for FreePBX 2.8 , kind of old I know, but it is what I have around:
When I re-generated the override contexts, they included the "set state" lines which had previously been missing.
All is working now. It even works using *78 and *79 to directly activate and deactivate DND, rather than *76 (toggle).
Awesome, thank you!
Here is the full file:
The only changes are the insertion of these two sections: and:
and FreePBX 2.10.0.8
on CentOS_64 bit : Linux 2.6.18-274.3.1.el5 x86_64
Works for me!