How-To: determine DND status (and turn off/on from Asterisk CLI)

Using Asterisk 1.8.11.x and FreePBX 2.9 with Yealink phones.
All Yealink phones have *78 and *79 in their settings for “PBX DND usage”. The FreePBX DND module is installed and working.

I would like to SSH into a box, use the CLI to determine if any phone has their DND process “ON / active”.

I would like to be able to do something from the Asterisk CLI to trigger a SIP notify message to the phone(s) and have them turn OFF the DND process for the phone (*79) for example

Also, is there a way to determine or toggle DND status on a phone which does not use “PBX DND” but rather the settings for DND pre-programmed int the phone.

I’ve used a database search in the past to determine if a Cisco or Polycom phone had DND on, but I do not recall what that database search from the CLI was (lost script search).

Also, I could not figure out a way to turn off DND for phones with their DND setting inside the phone (I do not have direct access to the phone most of the time).

A few points:

  1. If you have the Yealinks issuing server-side DND (using the feature codes as you describe) then you can check it on Asterisk by running:

Where XXX of course is your target extension number. If will return “Value: YES” if DND is on, or “Entry not found” if DND is off.

  1. As far as I am aware Yealink does not have any support for you disabling the local DND through a SIP notify message. If you can figure out the notify syntax you could try setting it up and testing it out, but I have never come across anything to say this is possible. Do you have a notify message that you have used for Cisco or Polycoms in the past?

  2. I do not believe the Yealinks will give you any control over the local DND functionality through SIP messages. You can however use their action URI feature of recent firmware (V.60 or higher) to toggle the local DND. To do this you need to know the web interface username and password on the phone, and you need to have the command issued from somewhere that the phone’s local IP is accessible (i.e. a script on your FPBX box if the phone is on the LAN). Check out the Yealink Phone Manual for full details, but it would look something like this:

Where of course user and pass are your web interface creditials, and XXX.XXX.XXX.XXX is the IP address of the phone itself. You can use DNDOn or DNDOff as the key values to control DND. Unfortunately Yealink doesn’t seem to have any way to check the status of DND using this technique, but if you keep the DND feature codes programmed in then you know whatever is on the server will always be accurate.

Thanks,

-Rob

Building further on what jolouis said…

Determine DND Status of ext 201:

to make 201 DND:

to remove DND from 201

Unfortunately this will not update the DND hints so things like BLFs will not work properly unless you figure out how to change the hints via CLI. Not sure this is the best way to do this, but it works:

devstate change Custom:DND201 INUSE devstate change Custom:DND201 NOT_INUSE

Thank you so much for this great detail and reply.