support

Asterisk DND indicator on GXP2000

madivad
Posts: 7
Member Since:
2008-06-03

Is there some way that when setting asterisk to DND mode, that it could light one of the BLF indicators on the GXP2000? If we setup 2 fake extensions for the purpose of say DND and FollowMe, then when you hit the corrosponding indicator/button, it toggles a flag value which turns this extension on/off.. and the status of the extension be visible using one/two of the 7 BLF indicators...

I know what I am thinking, but it doesn't sound like it has come out to clear.

If you have understood this, can you tell me if it is possible? or has someone done it?



gstreammkt
Posts: 229
Member Since:
2006-11-07
What you are looking for is

What you are looking for is to have DND visible to the user, you can use XML code for Idle Screen or SIP Notify for that, please check on GS document for more detail.



madivad
Posts: 7
Member Since:
2008-06-03
Yes, that is what I want but

Yes, that is what I want but I can't find any grandstream documentation that covers any API type interface that I can use to communicate with it. Obviously there is a way...

So I want to start working on a work around.

Here is what I want to achieve at this point, if anyone has a better idea then you're welcome to share it, but please refrain from the old "But why do that?" if you don't have any other form of solution. Let's break this into steps:

1) create a pseudo extension (done)
I simply created a new extension with ID:280

2) set BLF in asterisk for extension 280 (done)
easy part, this is done

3) when extension is called, it activates a feature code
in my case, it is feature code *280
I'm thinking I need to add a misc app or misc destination for this one, or maybe something else, but when extension '280' is called, I want it basically to redirect to *280
I tried using the follow-me, but that didn't quite work

4) edit the Day/Night reception to include make an extension appear busy
Basically when Day/Night Reception is enabled, then extension 280 will be off-hook and it will appear busy (which will report back to the grandstream 20000 and the BLF LED will be red).

Any ideas?



timborino
Posts: 9
Member Since:
2008-02-05
I think I might have this

I think I might have this working on asterisk 1.4, but I don't have a GXP in front of me to see the actual lamps.

In the below example, user 101 would setup a BLF key for '280101'. Press that key to enable DND, and the lamp should turn red. Press it again to disable DND, and the lamp should turn green.

; user extensions
exten => 101,1,Dial(SIP/101)
exten => 102,1,Dial(SIP/102)
exten => 103,1,Dial(SIP/103)

; custom "DND" device hints
exten => 280101,hint,Custom:dnd101
exten => 280102,hint,Custom:dnd102
exten => 280103,hint,Custom:dnd103

exten => _280XXX,1,Macro(dnd)

[macro-dnd]
; toggle DND on/off and update the custom "DND" device status accordingly
exten => s,1,GotoIf(${DB_EXISTS(DND/${EXTEN:3})}?disable)
exten => s,n(enable),Set(DB(DND/${EXTEN:3})=1)
exten => s,n,Set(DEVSTATE(Custom:dnd${EXTEN:3})=INUSE)
exten => s,n,Goto(quit)
exten => s,n(disable),NoOp(${DB_DELETE(DND/${EXTEN:3})})
exten => s,n,Set(DEVSTATE(Custom:dnd${EXTEN:3})=NOT_INUSE)
exten => s,n(quit),Hangup()

The DEVSTATE() function is new and not included with asterisk 1.4, so you'll need to add it. See http://www.asterisk.org/node/48325 and http://www.asterisk.org/node/48360 for details.

*CLI> core show function DEVSTATE
*CLI>
  -= Info about function 'DEVSTATE' =-

[Syntax]
DEVSTATE(device)

[Synopsis]
Get or Set a device state

[Description]
  The DEVSTATE function can be used to retrieve the device state from any
device state provider.  For example:
   NoOp(SIP/mypeer has state ${DEVSTATE(SIP/mypeer)})
   NoOp(Conference number 1234 has state ${DEVSTATE(MeetMe:1234)})

  The DEVSTATE function can also be used to set custom device state from
the dialplan.  The "Custom:" prefix must be used.  For example:
  Set(DEVSTATE(Custom:lamp1)=BUSY)
  Set(DEVSTATE(Custom:lamp2)=NOT_INUSE)
You can subscribe to the status of a custom device state using a hint in
the dialplan:
  exten => 1234,hint,Custom:lamp1

  The possible values for both uses of this function are:
UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING
RINGINUSE | ONHOLD


madivad
Posts: 7
Member Since:
2008-06-03
Thanks

I will try it tonight, that's great, thankyou

I am a bit of a newbie to this sort of thing, where is the functions directory? and do I have to (re)compile all of asterisk? Sorry if it's a stupid question, but neither of those links elaborate on the process



timborino
Posts: 9
Member Since:
2008-02-05
Yes, you need to recompile

Yes, you need to recompile asterisk, or at least just this one module. Sorry it's a little involved for a trixbox server since everything is already installed.

These are the commands I used to enable it in Trixbox CE 2.6.0.7 VMWare.

# yum -y install subversion gcc-c++
# cd /usr/src
# wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.21...
# svn checkout http://svncommunity.digium.com/svn/russell/asterisk-1.4/func_devs...
# tar xvfz asterisk-1.4.21.tar.gz
# cp func_devstate-1.4/func_devstate.c asterisk-1.4.21/funcs/
# cd asterisk-1.4.21
# make clean
# ./configure
# make menuselect
(func_devstate should be listed under 6. Dialplan Functions)
press 's' to save changes
# make all
# cp funcs/func_devstate.so /usr/lib/asterisk/modules/
# service asterisk restart

# asterisk -r
trixbox1*CLI> core show function DEVSTATE



madivad
Posts: 7
Member Since:
2008-06-03
I did it

First off, I want to apologise for not having responded to this much sooner, since I did actually get this done very soon after the last post. But I always had the intention of doing so much more with it, but never did. So here it is AS it is.

This does exactly what I want at this point, and it is based entirely on the posts above and my own research using the links above.

To accomplish the desired actions you need to:

1) read through previous posts and install the DEVSTATE function, you may have to compile it as I did, and all the information is above on this.

2) Program the GXP2000 button to be what you want it to be.
So in the GXP2000 web admin page, go to the "BASIC SETTINGS" and change the Multi Purpose Key [insert desired number - I used #7, bottom left] and change the Key Mode to "Busy Lamp Field" and make the User Id = [insert the desired dialed extension/feature code here - I used '299']
Leave all other settings as default

3) Through trixbox PBX --> Config File Editor, edit the file: extensions_custom.conf
and add the following code:

[from-internal-custom]
include => custom-global-dnd

[custom-global-dnd]
exten => 299,1,Noop()
exten => 299,n,GotoIf($[${DEVSTATE(Custom:dnd)}=INUSE]?deactivate)
exten => 299,n,Set(DEVSTATE(Custom:dnd)=INUSE)
exten => 299,n,Set(DB(DND/201)=YES)
#exten => 299,n,Set(DB(DND/202)=YES)
exten => 299,n,Playback(do-not-disturb&activated)
exten => 299,n,Goto(end)
exten => 299,n(deactivate),Noop()
exten => 299,n,Set(DEVSTATE(Custom:dnd)=NOT_INUSE)
exten => 299,n,dbDel(DND/201)
#exten => 299,n,dbDel(DND/202)
exten => 299,n,Playback(do-not-disturb&de-activated)
exten => 299,n(end),Hangup()
exten => 299,hint,Custom:dnd

now, how I have achieved global DND is simply ext 201 is the main extension and I am using the day/night module. I installed a set of rules for feature code 280 to toggle day/night for ext 201, day to ext, night to voicemail. I have THEN programed 299 to be the feature code that activates the above code in the custom area. and inside of which I used the db functions that the day/night code uses to specifically turn it on and off.

I did it this way, because in my head it just seemed to make sence to use trixbox for as much as I could and it does all the behind the scenes stuff like work out whether day/night is on/off when a call comes in. I don't have to worry about it.

I added two commented lines above which I think is all that you would need to turn other indial off (ie redirect to voicemail), but this is untested.

I hope others may find this useful



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.