BLF with DND

Hi,

I have a question about BLF combined with the DND function.
We have Linksys SPA942 and Cisco SPA504g phones and BLF works fine with Asterisk/Freepbx when a user is called or in a call.

One of the last things we are trying to get to work is the BLF function when a user presses the DND button on his phone. It just should go red and Asterisk should not send any more calls to that extension.
On the Linksys phones I’m able to configure the DND button to any extension I would like so no problems here. I just need to know how to get this to work in Asterisk /Freepbx.

I’ve found an oreilly document (http://ofps.oreilly.com/titles/9780596517342/ch14.html#DeviceStates_id265385)
but so far no succes with it.

Anyone here who can help me out?

When I type: “dialplan show” and look for *76 I get these results.
And only these, I do not see anything custom?

[ Context ‘app-dnd-toggle’ created by ‘pbx_config’ ]
’*76’ => 1. Answer() [pbx_config]
2. Wait(1) [pbx_config]
3. Macro(user-callerid,) [pbx_config]
4. GotoIf($["${DB(DND/${AMPUSER})}" = “”]?activate:deactivate) [pbx_config]
[activate] 5. Set(DB(DND/${AMPUSER})=YES) [pbx_config]
[hook_on] 6. Playback(do-not-disturb&activated) [pbx_config]
7. Macro(hangupcall,) [pbx_config]
[deactivate] 8. Noop(Deleting: DND/${AMPUSER} ${DB_DELETE(DND/${AMPUSER})}) [pbx_config]
[hook_off] 9. Playback(do-not-disturb&de-activated) [pbx_config]
10. Macro(hangupcall,) [pbx_config]
Include => ‘app-dnd-toggle-custom’ [pbx_config]

Furthermore I checked the phone’s dialplan and it is ok, I can put up to 6 characters after the *. Also tried on softphone client Hayibo.

Hi james can you do asterisk -rx “dialplan show” | grep “*76” you should definitely see something like this (where 300 is an extension):
’*76300’ => hint: Custom:DEVDND300 [pbx_config]
1. Goto(app-dnd-toggle,*76,1) [pbx_config]

This is created automatically by freepbx, within extensions_additional.conf

I’ve tested it on both plain asterisk + freepbx as well as Elastix with freepbx installed. Watch the SPA942’s built in dialplan by default it probably will auto dial once you dial *XX (in other words it wont listen to any further digits that you enter) One way to eliminate that as the issue would be to use a softphone like zoiper for testing.

Thanks for the help but unfortunately that doesn’t do it…

When I press *76 on either hardphone or softphone and look at the hints they both remain idle, status does not change to busy.
However I noticed that when I try to call the extension I do get a ‘busy’ tone and cannot reach the extension.

Calling *76 followed by extension gets no result. i.e when I try *766801 (where 6801 is my extension) it just says destination not found…

I think what you need to look at is “core show hints” (e.g. asterisk -rx “core show hints” then take a look at the hints you can monitor.

Freepbx registers quite a few hints for various functions you want to monitor with your phones BLF the “hint” *76XXX where XXX is the extension on the phone. if you’ve got it working correctly you will see the watchers as > 0.

When DND is enabled at the PBX side the devstate changes from idle to busy. Make sure you’ve disabled the phones built-in DND.

You can also call *76XXX so you should be able to use the same key on the phone to change BLF colour as well as dial the number to disable/enable DND.

I set BLF to show DND and busy/ring status, when i click BLF and call to myself i use DND toggle macro. Also is posible to catch/pickup ringing call. All modifications below, extensions are 2 digits.

extension_custom.conf:
[blf_all]
exten => _XX,hint,SIP/${EXTEN}&Custom:DND${EXTEN}

[blf_pickup]
exten => _**5XX,1,Pickup(${EXTEN:2})
exten => _**5XX,2,Hangup

[macro-mydnd-selfcall]
exten => s,1,GotoIf($["${CALLERID(num)}" = “${MACRO_EXTEN}”]?selfcall:nodndcall)
exten => s,n(selfcall),Noop(Toogle DND)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Macro(user-callerid,)
exten => s,n,GotoIf($["${DB(DND/${MACRO_EXTEN})}" = “”]?activate:deactivate);
exten => s,n(activate),Set(DB(DND/${MACRO_EXTEN})=YES)
exten => s,n,Set(STATE=BUSY)
exten => s,n,Gosub(app-dnd-toggle,sstate,1)
exten => s,n(hook_on),Playback(do-not-disturb&activated)
exten => s,n,Macro(hangupcall,)
exten => s,n(deactivate),Noop(Deleting: DND/${MACRO_EXTEN} ${DB_DELETE(DND/${MACRO_EXTEN})})
exten => s,n,Set(STATE=NOT_INUSE)
exten => s,n,Gosub(app-dnd-toggle,sstate,1)
exten => s,n(hook_off),Playback(do-not-disturb&de-activated)
exten => s,n,Macro(hangupcall,)
exten => s,n(nodndcall),Noop(Not self call, no DND toogle)

[from-internal-additional-custom]
include => blf_pickup
exten => _XX,1,Macro(mydnd-selfcall)

sip_custom.conf: (i cut lines with my config not related with blf and dnd)
[general]
subscribecontext=blf_all

Thats all, should work.

Hi lukaszsokolik,

Thanks for replying, I was almost about to give up on this issue.

I would like to try your solution but I’m wondering, what do I need to change when my extension length is 4 characters? (my extensions are 6801 to 6811).

I have some problems on one Asterisk where I have many addons/script when trying catch event when I call to my self exten (selfcall). I disable this future and use Future codes.

Don’t check it but it should be like this:

extension_custom.conf:
[blf_all]
exten => _XXXX,hint,SIP/${EXTEN}&Custom:DND${EXTEN}

[blf_pickup]
exten => _**5XXXX,1,Pickup(${EXTEN:2})
exten => _**5XXXX,2,Hangup

[macro-mydnd-selfcall]
exten => s,1,GotoIf($["${CALLERID(num)}" = “${MACRO_EXTEN}”]?selfcall:nodndcall)
exten => s,n(selfcall),Noop(Toogle DND)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Macro(user-callerid,)
exten => s,n,GotoIf($["${DB(DND/${MACRO_EXTEN})}" = “”]?activate:deactivate);
exten => s,n(activate),Set(DB(DND/${MACRO_EXTEN})=YES)
exten => s,n,Set(STATE=BUSY)
exten => s,n,Gosub(app-dnd-toggle,sstate,1)
exten => s,n(hook_on),Playback(do-not-disturb&activated)
exten => s,n,Macro(hangupcall,)
exten => s,n(deactivate),Noop(Deleting: DND/${MACRO_EXTEN} ${DB_DELETE(DND/${MACRO_EXTEN})})
exten => s,n,Set(STATE=NOT_INUSE)
exten => s,n,Gosub(app-dnd-toggle,sstate,1)
exten => s,n(hook_off),Playback(do-not-disturb&de-activated)
exten => s,n,Macro(hangupcall,)
exten => s,n(nodndcall),Noop(Not self call, no DND toogle)

[from-internal-additional-custom]
include => blf_pickup
exten => _XXXX,1,Macro(mydnd-selfcall)

When Y have problem with call to your self extension to toggle DND, then leave this macro. Extension will be like that:

extension_custom.conf:
[blf_all]
exten => _XXXX,hint,SIP/${EXTEN}&Custom:DND${EXTEN}

[blf_pickup]
exten => _**5XXXX,1,Pickup(${EXTEN:2})
exten => _**5XXXX,2,Hangup

[from-internal-additional-custom]
include => blf_pickup

i’ve got a system with no DND BLFs as well… using the FreePBX distro, core show hints doesn’t show anything w/ *76 in front of it…

wondering how to get those custom hints to show when a user is DND as well as busy…

[blf_all]
exten => _XXXX,hint,SIP/${EXTEN}&Custom:DND${EXTEN}

Here we check is busy or DND. If is busy led is red, if is DND led is red too.

I know this post is old, I hope I can still get in on it. I am trying to setup AAstra phones to show Busy/DND status. I set the button on the phone to BLF and it lights when the phone is active. The Button I use to activate the DND function on the server doesn’t stay lit either. When I show hints this is what I get
*[email protected] : Custom:DEVDND123 State:Idle
This hint NEVER changes
Is there a way to keep the DND button lite as well? That way the user has a visual indication he is still in DND?

Thanks