Simple Hot-desking

From Etel

Jump to: navigation, search

Contents

Title

Simple Hot-desking

Problem

The number of phones you have don't match the number of people you have to use them. Either:

  • you have people working on rotating shifts (call centers), or
  • you have people that don't always work at the same desk (temporary work centers)

In either case, your users need a phone number that follows them around as they use different desks or many users share the same desk. In other words, a specific user needs a telephone number that is unique to them, regardless of where they are sitting. This practice is called "hot-desking".

Solution

The trick is to assign a number to each phone and a number to each user, then dynamically mask one with the other. At its simplest, you need the user to tell Asterisk the number for the phone where they're sitting. (Warning: depending on what you actually allow, this doesn't necessarily mean that they have to be in the building. Be careful what you allow! This feature is easily abused.)

You'll need to create the following sound files and place them in the /var/lib/asterisk/sounds/ directory:

  • "EnterYourExtension" should contain "Enter your extension"
  • "EnterYourPasscode" should contain "Enter your pass code"
  • "InvalidLogin" should contain "Invalid login"
  • "Accepted" should contain "Accepted"
  • "MainHDMenu" should contain "Press 1 to hear your hot desk number. Press 2 to change your hot desk number. Press 3 to delete your hot desk number. Press 9 to hang up."
  • "YoureCurrentlyLoggedInAt" should contain "You are currently logged in at "
  • "EnterYourNewExtension" should contain "Enter your new hot desk extension"

Next, set up the dial plan for logging in. In /etc/asterisk/extensions.conf, add something like:

exten => 501,1,Answer
exten => 501,n,Set(HCOUNT=0)
exten => 501,n(top),Wait(1)
exten => 501,n,Read(HUSER,EnterYourExtension,4)
exten => 501,n,Read(HPASS,EnterYourPasscode,4) 
exten => 501,n,GotoIf($[${DB(hotdeskpass/${HUSER})}=${HPASS}]?hcontinue:)
exten => 501,n,Playback(InvalidLogin)
exten => 501,n,Set(HCOUNT=$[${HCOUNT}+1])
exten => 501,n,GotoIf($[${HCOUNT}>2]?hhangup:)
exten => 501,n,Goto(top)
exten => 501,n(hcontinue),Playback(Accepted) 
exten => 501,n(hmenu),Read(HMENU,MainHDMenu,1) 
exten => 501,n,GotoIf($[${HMENU}=1]?hcurrent:)
exten => 501,n,GotoIf($[${HMENU}=2]?hnewnum:)
exten => 501,n,GotoIf($[${HMENU}=3]?hkillit:)
exten => 501,n,GotoIf($[${HMENU}=9]?hhangup:hmenu)
exten => 501,n(hcurrent),Playback(YoureCurrentLoggedInAt)
exten => 501,n,SayDigits(${DB(hotdesknum/${HUSER})})
exten => 501,n,Goto(hmenu)
exten => 501,n(hnewnum),Read(HTEMP,EnterYourNewExtension,4)
exten => 501,n,Set(DB(hotdesknum/${HUSER})=${HTEMP})
exten => 501,n,Goto(hmenu)
exten => 501,n(hkillit),DBDel(hotdesknum/${HUSER})
exten => 501,n,Goto(hmenu)
exten => 501,n(hhangup),Hangup()

The above gives the caller 3 tries to log in before automatically hanging up.

Next, assign a 3-digit number to each user. When someone dials the user's number, it will actually be a 4-digit number (starting with "4"). To facilitate this, add the following to your dial plan:

exten => _4XXX,1,Dial(${DB(hotdesknum/${EXTEN:1})})

Finally, add a key to Asterisk's built-in database for each user and their pass code. Here's an example of how this is done (via the Asterisk console):

CLI> database put hotdeskpass 604 5555

So if a user dials "501", logs in with a extension of "604" and a pass code of "5555", and enters "1703" as the extension for the telephone that they're setting near, anyone else who dials 4604 will actually be connecting to extension "1703" in the dial plan. Note: the telephone must also exist in the dial plan. To go with the above example, something like the following must be in the dial plan:

exten => 1703,1,Dial(SIP/1703)

Discussion

The above is quite basic in nature and may take a little getting used to if you acutally use it in production. If you have Caller ID configured properly for each phone, you should be able to remove the part where you ask the user for the telephone's extension number. Then you would only need to have your users log in and log out.

A variant of the above might allow your users to work from home. The author has done this and have moved the database portion from the Asterisk database to a MySQL database via use of the AGI commands. This allows the use of a web front-end to see if a user is logged into the phone system and from where, as well as creating quite elegant click-to-call systems for your teleworkers.

Note: You may want to redo all of your "number" sound files as it can be a bit disconcerting to hear a deep male voice say "You're currently logged in at" followed by Allison Smith's voice reading the extension number. (An alternative to this would be to purchase the Allison voice set for Cepstral and use that to generate the sound files.)

Note: For any of the Read statements in the dial plan, you can drop the trailing number in the statement if you want to use extensions of varying length. "4" is just arbitrary. If you remove it from the Read statement, your users will need to remember to hit the "#" key to enter the value (or wait a bit for the timeout).

See Also:

Metadata

  • By: Tim Kramer
Personal tools