Wednesday, June 13, 2012

Hotel Systems with Asterisk and FreePBX

Over the past few days, we’ve been working on APIs to work with a Hotel system middleware called JDS PMS which links a the Hotel Information System (HIS) and Asterisk.
It’s like this
HIS <–> JDS <—> Asterisk
Our client needed Asterisk to perform several legacy hotel related functions controlled straight from the HIS and parsed via JDS to Asterisk. Functions include
1) Checking in of guest with guest data parsed from the HIS
2) Checking out of rooms
3) Guest move rooms (including moving of user info, messages etc..)
4) Room call barring set automatically when a checkout happens (and allow when check in)
5) Wake up call (centrally done by help of staff or self-help by each guest)
6) Number obfuscation for VIP guest calling rooms (but to service desks its shown)
7) Do not disturb function override (DND override)
8) Update room statuses via phone (Asterisk sends back codes to PMS)
9) Charge mini bar usage via phone (Asterisk sends back codes to PMS)
10) Integrate the billing into the hotel billing system (reading our custom DB)
11) SMS function for phone to phone SMSing within hotel rooms (also used for periodical advertisements). This is central blasting of SIP Messaging
12) Centrally manage call forwards, DND, wake up calls and other user set features

We took the opportunity to make the API cross platform, thus, not only working for JDS but we believe just about any Hotel frontdesk system and middleware system there is.
We needed also to use FreePBX for its powerful features and ease of management and decided to backdoor the programming of FreePBX to achieve all those without breaking the FreePBX framework.
The processes are handled by websockets and is purely on TCI-IP no more old style SMDR or serial raw data! A the point of writing this, we just signed the integration completion document with the client and JDS team to fully certify Asterisk with their hotel system.
These above are just a simple beginning and we know we can do lots and lots more now with JDS PMS.

The picture below is where the hotel is  Smile neat huh…, its an island within Sabah, a state in East Malaysia. Can’t mention much details for privacy purposes Winking smile

Thursday, June 7, 2012

FreePBX/Asterisk Override DND (or Do Not Disturb)

There are cases where you want to make urgent calls and override the DND set by the user on their phones. These scenarios include
1) Hotel style wake up call (download the hotel wake up module for freePBX)
2) Emergency internal calling
NOTE:
This dialplan only works with Asterisk/FreePBX level DND setting (i.e. setting the DND value in ASTDB). It will not work for phone level DND setting)
Use Asterisk 1.8 or higher only
What it does;
1) It unsets the DND value
2) Makes the call
3) Sets back the DND Value
The Dialplan, put these in /etc/asterisk/extensions_custom.conf (for freepbx) or extensions.conf in vanilla installs
[dnd-override]
exten => _X.,1,NoOp(This context overrides DND)
same => n,Set(IFDNDENABLED=${DB(DND/${EXTEN})})
same => n,ExecIf($["${IFDNDENABLED}"="YES"]?Noop(Deleting: DND/${EXTEN} ${DB_DELETE(DND/${EXTEN})}))
same => n,Goto(from-internal,${EXTEN},1)
same => n,Hangup()
;
exten => h,1,NoOp(Adding back DND status if that existed for user ${CONNECTEDLINE(num)})
exten => h,n,ExecIf($["${IFDNDENABLED}"="YES"]?Set(DB(DND/${CONNECTEDLINE(num)})=YES))
exten => h,n,Hangup

Since this context is handling the hangup, therefore we can invoke the h extension to write back the DND value after the channel gets hanged up. If you use any of those hotel calling modules, simply call this dialplan above to invoke DND override.
You can use this context in many different ways, such as the one shown below, where we “authenticate” a request for DND override first, then ask for the extension to dial.
[macro-dnd-override]
exten => s,1,NoOp(DND Override Call)
exten => s,n,Authenticate(12345,a) ;; 12345 is the password here
exten => s,n,Read(DNDOVERRIDECALLNUM,please-enter-your-extension-then-press-pound,,,4)
exten => s,n,Goto(dnd-override,${DNDOVERRIDECALLNUM},1)
exten => s,n,Hangup

You can invoke the macro inside FreePBX by enabling it via Custom Destination, then create a Feature Code via Misc. Applications. Then you can invoke by any dialing you’ve configured there.