BLF and DND
You could add a DND button for the other user as dnd.php?user=[extension]&key=[key].
You then need to do some custom development in the sync.php script to allow for multiple users. You could then do something like set the action uri poll to sync.php?action=check&user=$$SIPUSERNAME$$&user2=[extension]
It's not cut and dry, but it's possible.
So, I have one of the expansion modules for the 57i and I have loaded it up with BLF buttons. I want our receptionist to be able to see if someone has placed themselves in DND either by flashing their BLF light or even putting the extension "Off Hook". I want a single visual indication for our receptionist that the user is on the phone, in DND or availible. So far the BLF button/light does on hook, off hook but does not indicate DND. So, by editing the DND and Sync applications I can make this happen, correct? I am not trying to be rude, i just want to make sure I understand.
This would require:
1. Asterisk to be patched with a back ported version of func_devstate.c which comes from 1.6 but is available for 1.4.
2. modifications to the DND module to set the devstate
3. modifications to the hints that get generated for an extension today, or a new hint to be created, to include the custom DND devstate status.
4. modifications to the Asterisk startup process to trigger something that will initialize the state of each phone upon Asterisk starting up since this is not retained.
5. writing the script or dialplan that will do (4) above
I think that is it. Then anyone subscribing to the BLF of what you generate above will get a response everytime DND is pressed for a phone.
I tried this using devstate and custom device hints in 1.4, but for a user to view his own DND status on his phone. It should also work on a sidecar, but it would require a separate BLF key for just the DND status. On the fancier AAstra sidecar with the LCD, you could setup another page just to monitor users' DND, but the receptionist would still have to check both places.
http://www.trixbox.org/forums/vendor-specific-unmoderated/grandst...
I don't think there's a way to create a single combined BLF key for the regular device status + DND since DEVSTATE() only works on custom devices.
philippel - I noticed CLI> 'show hints' kept the same device states after I stopped and restarted asterisk. It looks like custom device states are stored in the astdb.
timborino,
yes you would combine the hints to get a single button and in fact you can write some pretty fancy dialplan to make that same button do several things in addition to blf, dnd status and speedial. As far as retaining the dev state value for the custom hint, my testing shows that it is not retained upon a restart.
Well as I have learned along time ago to get a project started someone has to offer up some money. I feel this is an important feature and Schmooze will put up $250.00 to get things started. Lets all rally behind here and see if we can get enough money raised to get this project done.
Philippe can you give us an idea on what it would cost to have all the completed?
timborino,
further testing indicates you are correct and the device states are kept in astdb. The system I was testing on was 1.4.19 and it shows the state as unavailable after restart even though the devices that subscribe to it are getting the proper state. So that would mean 4 and 5 above are not needed and thus there should be a bit less work involved in doing this.
So, does this mean that I can use a similar solution to the one posted in the following link? If so, how would you modify this solution to fit this situation?
http://www.trixbox.org/forums/vendor-specific-unmoderated/grandst...
Obviously, this is my first trixbox implementation and am still somewhat ignorant to the inner workings of Asterisk. I am impressed with the responses I have so far. Thanks very much for the help.
I am impressed with the responses I have so far. Thanks very much for the help.
I have not had anything to contribute however I have been watching the thread with interest.
This is a great community and when someone like yourself jumps in and starts figuring out how things work and trying new applications it is a pleasure to help with the process.
Best of luck to you on your application.
Scott
Is the func_Devstate module already included when I perform the Trixbox upgrade instructions per the freePBX site or is this a module that I have to compile? I used the Trixbox upgrade tool but I am not really sure if the devstate module is working. Here's what I have done to test using Trixbox 2.6.1 and FreePBX 2.5 beta installed with the upgrade tool.
I have 2 extensions setup 100 and 104.
100 has a BLF button for 104. I put 104 on DND and the BLF light doesn't change. I did the USEDEVSTATE=true in the /etc/amportal.conf and reloaded asterisk.
Am I missing a step possibly?
Thanks again!
The trixbox guys could probably tell you better, but from the CLI type:
show function DEVSTATE
and
module show like devstate
do you see it? If so, it should be installed (for the latter, you would see func_devstate.so). If not, you may have to get it from source or talk to the trixbox team to see if they have an option to get it. It is not officially part of 1.4, but is a widely used and tested module that poses no issues or risk to include in 1.4, to the best of my knowledge.
Thanks Philippe and all the others for the help along the way! I can't thank the community enough for the help you've provided! Here's my specs and solution to the problem
Specs:
Trixbox CE 2.6.1 (asterisk 1.4.20)
Aastra-xml-scripts installed
FreePBX 2.5 RC3 (Performed the upgrade per the FreePBX documentation)
Aastra 57i
Problem: When a extension was put on DND using the aastra-xml-scripts DND application for a 57i the other subscribed users had no BLF light notification that the ext was on DND. The BLF light simply showed "On Hook". The desired result is: When 104 is on DND then ext 100 should have a visual notification. Thanks to the func_devstate module and the FreePBX 2.5 features, this is now possible.
Solution:
Compile and install the func_devstate module for asterisk 1.4.20
Verify that the module is working per Philippe's instructions above
use *76 to put your phone in DND to verify that your BLF button on the subscribed station changes.
Find the Aastra_manage_DNDAasterisk(user,action) section and add the noted 4 lines to AastraAsterisk.php in the /var/www/html/aastra/include directory (look for the "#add the following 2 lines" comment in the following code to see what to add and where)
##################################################################################################
# Aastra_manage_dnd_Asterisk(user,action)
#
# This function reads and write the DND value in Asterisk Database.
#
# Parameters
# @user user extension
# @action action to be performed, change or anything
#
# Returns
# Current DND value
###################################################################################################
function Aastra_manage_dnd_Asterisk($user,$action)
{
# Connect to AGI
$as = new AGI_AsteriskManager();
$res = $as->connect();
# DND GET
$res = $as->Command('database get DND '.$user);
$line=split("\n", $res['data']);
$value=split(' ', $line[0]);
if($value[1]=='YES') $dnd=1;
if($dnd==0)
{
$value=split(' ', $line[1]);
if($value[1]=='YES') $dnd=1;
}
# Reverse DND if requested
if($action=='change')
{
# change DND status
if($dnd==0)
{
$res = $as->Command('database put DND '.$user.' YES');
##############################################################
#add the following 2 lines
##############################################################
$res = $as->Command('core set global DEVSTATE(Custom:DEVDND'.$user.') BUSY');
$res = $as->Command('core set global DEVSTATE(Custom:DND'.$user.') BUSY');
$dnd=1;
}
else
{
$res = $as->Command('database del DND '.$user);
###############################################################
#add the following 2 lines
###############################################################
$res = $as->Command('core set global DEVSTATE(Custom:DEVDND'.$user.') IDLE');
$res = $as->Command('core set global DEVSTATE(Custom:DND'.$user.') IDLE');
$dnd=0;
}
}
# Disconnect properly
$as->disconnect();
# Return DND
return($dnd);
}
This may not be the most elegant PHP code in the world. I am NOT a developer of any sort. So, if someone sees a better way to accomplish the same thing, please speak up. For now, I know one thing, It works...
Thanks again for the help.
You may want to check with Stephane (or Ethan) if the XML script has been updated. I only glanced very very quickly above and noted:
$res = $as->Command('core set global DEVSTATE(Custom:DEVDND'.$user.') BUSY');
The DEVDND setting is tied to the Device and not the User, so doing this would not be correct for a deviceanduser setup, which needs the stated tied to that device. In extension mode it works because the User number == Device number but that is not always a given.
I THINK that the $user string in this case is used to specify the extension. when the DND button is pressed it does this
http://ip.of.trix.box:80/aastra/asterisk/dnd.php?user=104
So, when extension 104 goes into DND it would play out like this
...('core set global DEVSTATE(Custom:DEVDND104) BUSY');
At least that's what I've pieced together...I think.
When I use the updated PHP and do a "show hints" i see this:
-= Registered Asterisk Dial Plan Hints =-
104@ext-local : SIP/104&Custom:DND10 State:InUse Watchers 1
100@ext-local : SIP/100&Custom:DND10 State:Idle Watchers 0
*21104@ext-findmefollow : Custom:FOLLOWME104 State:Idle Watchers 0
*21100@ext-findmefollow : Custom:FOLLOWME100 State:Idle Watchers 0
*76104@ext-dnd-hints : Custom:DEVDND104 State:Busy Watchers 0
*76100@ext-dnd-hints : Custom:DEVDND100 State:Idle Watchers 0
and when I UN-DND I get:
-= Registered Asterisk Dial Plan Hints =-
104@ext-local : SIP/104&Custom:DND10 State:Idle Watchers 1
100@ext-local : SIP/100&Custom:DND10 State:Idle Watchers 0
*21104@ext-findmefollow : Custom:FOLLOWME104 State:Idle Watchers 0
*21100@ext-findmefollow : Custom:FOLLOWME100 State:Idle Watchers 0
*76104@ext-dnd-hints : Custom:DEVDND104 State:Idle Watchers 0
*76100@ext-dnd-hints : Custom:DEVDND100 State:Idle Watchers 0
Same thing as when I *76
Sound right?



Member Since:
2008-03-24