TUTORIAL PIAF Hospitality Management System

Joined
May 2, 2008
Messages
44
Reaction score
1
Hi everyone,

It's a stable version.

Project page: http://code.google.com/p/piafhms/

Features:
  1. Rooms inventory management with bulk import from Freepbx extensions
  2. Rates management: by prefix, with minute rate and fixed rate
  3. Check-In and Check-Out (and associated actions)
  4. Bills with search by dates and/or by rooms with details of calls
  5. Integrated with Hotel wake-up module (you can delete it and insert new wake-up from web)
  6. Delete every voicemail message and wake-up on check-out for the room/s (thanks TheShniz)
To install it:

cd /var/www/html
wget http://piafhms.googlecode.com/files/hotel.tar.gz
tar zxvf hotel.tar.gz
cd hotel
./loadmysql.sh

Go to http://MYPBX/hotel/index.php

To update it:

cd /var/www/html
wget http://piafhms.googlecode.com/files/hotel.tar.gz
tar zxvf hotel.tar.gz

Enjoy!!

Post errors or problems in the forum.

To Do:
Bugs fix?

P.S.
In my country if the room don't have check-in opened, you can call only the reception.
To control this actions put this in extensions_custom

Code:
exten => _X.,1,Set(result=${CURL(http://MYPBX/hotel/checkuser.php?Ext=${CALLERID(num)})}) 
exten => _X.,2,NoOp(Results: ${result})
exten => _X.,3,GotoIf($["${result}" = "OK"]?OK)
exten => _X.,4,GotoIf($["${result}" = "KO"]?KO)
exten => _X.,5(OK),Goto(outbound-allroutes,${DIAL},1)
exten => _X.,6,Hangup()
exten => _X.,7(KO),DIAL(SIP/RECEPTION)
exten => _X.,8,Hangup()
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
This is a phenomenal piece of software. I've unfortunately been sitting on it for several months waiting for a spare moment to review it on Nerd Vittles. Anyone in the hospitality business will love it. Period!
 

bobvr

New Member
Joined
Nov 17, 2007
Messages
23
Reaction score
0
Getting this error on install....

root@pbx:/var/www/html $ cd hotel
root@pbx:/var/www/html/hotel $ ./loadmysql.sh
-bash: ./loadmysql.sh: Permission denied
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
chmod 775 /var/www/html/hotel/loadmysql.sh

Then try again.
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
This is an exciting lil piece of software you've got right here...

While having an interface for Wake-Up Calls would be nice, the really, really important thing is to have the voicemailbox cleared out of any messages upon Check Out. Also, an added bonus would be for any mailbox greetings to be defaulted as well, but that could be handled by setting the files to read-only. The reason for this is so the next guest in doesn't get some risque' message for the one prior and is very important.

...could you give an example of what's expected under Rates, specifically with the Prefix and Type? I got it to work when they're set to blank, but that's all.
 
Joined
May 2, 2008
Messages
44
Reaction score
1
Thanks,
here an example of Rates
Description Type Prefix Minute Rate Fixed Rate
Italy Landline 0 0.25 0.10
Italy Cellular 3 0.30 0.20
USA All 0011 0.30 0
UK All 0044 0.30 0.10

For each call, if a prefix match, the price is (Min.Rate/60 * secs of call from asterisk cdr) + Fixed Rate (if exist and > 0)

Do you use voicemail in hotel? When i prepare the extensions (normally pstn phones connected to fxs gateway) i set in freepbx no voicemail.
If you want i can put in the next release the clearing of voicemail in the check-out.

Insert the wake-up from web is MANDATORY in the next release.

Thanks for testing and suggestions.
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
Thanks for the description, I'll give the rates another shot...

Most (not all) of the hotels of any notable size (not a 10 room motel) here in the USA do have voicemail; The analog telephones do have MWL's, and only require the proper gateway to support it.

While I may not use voicemail in a hotel myself, I can easily imagine those that do. A possible example might be a large group that checks out multiple rooms and leaves messages from one room to another. This ability would be mandatory here for its use.

...I look forward to what you have in mind!
 

risi_petillo

New Member
Joined
May 28, 2009
Messages
2
Reaction score
0
I think this is an excellent addition to PBIAF, My uncle has a small hotel on the beach in Belize, Central America and I setup trixbox as his Hotel Phone system in April 2007, i think he's due a refresh, and thus this will be a welcomed addition to system - Viva PBIAF !!!
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
The voicemail deletion on checkout & wakeups works great, thanks for that; but for the life of me I still can't get the Bills to report the call log.

This is what I've got entered into 'Rates':
ID / Description / Type / Prefix / Min Rate / Fixed Rate
6 Local Numbers Land Line 954 0.0000 1.0000 Delete
7 Toll Free Land Line 1800 0.0190 1.0000 Delete
8 Everything Else 0.0000 2.0000 Delete
9 Dade 1305 0.0190 3.0000

This is what I've dialed and confirmed both in the telephone's call log as well as Asterisk CDR:
800XXXXXXX
1800XXXXXXX
1954XXXXXXX
1305XXXXXXX
*214 (leave voicemail for 214)
*97

The only entries that are apearing in the Bills is *214 and *97... this leads me to believe that it's accessing the CDR just fine, or it wouldn't even get that (all or nothing). At first I thought it was a problem of dialing 1+800 versus just dialing 800, but neither seem to list.

A couple things I noticed:
1.) Wake Up Calls is showing the Room ID instead of the Room Name or Extension Number
2.) Checking Out does not cancel any scheduled wakeup calls (even though no longer listed on web)
3.) Can't run a Bill Report until the party has checked out
4.) Would be nice if there were a link to Bill Report upon successfull checkout

This is most excellent stuff, and well written! I'm going to continue pecking at this to try and determine my Bills/Rates prob.
 
Joined
Nov 2, 2007
Messages
498
Reaction score
0
Very cool. Almost like A2Billing lite. Nice call on the index.php instead of default.php. Would be nice if it lived in a protected directory.

I too am having some report foibles. I am mimicking the example and so far I have only got billed for checking the time. I made local, ld and intl calls and no joy.

What might be really nice is this as a FreePBX module. Have you thought about going down that road and making this a contributed module?
 
Last edited by a moderator:
Joined
May 2, 2008
Messages
44
Reaction score
1
i can't find any logical error in the calculation.

Look checkout.php, this function calculate the call rate

function Coc($dst, $sec, $data) {
$sum = 0;
foreach($data as $v) {
$Pref = $v["Pref"];
$Min = $v["Min"];
$Risp = $v["Risp"];
$strLength = strlen($Pref);
if (substr($dst,0,$strLength) == $Pref AND $sec > 0) {
$sum = $Risp + (($Min / 60) * $sec);
}
}
return round($sum,2);
}

The data passed to the funcion are extracted from asterisk cdr with this select:

$query = "SELECT calldate, dst, billsec FROM `cdr` WHERE calldate BETWEEN '" . $Checkin . "' AND '" . $Checkout ."' AND src = " . $Ext;

//Calculate total looping cdr database
$total = 0;
while ($row = mysql_fetch_array($result)) {
$total = $total + Coc($row["dst"], $row["billsec"], $data);
}

P.S. $data is an array with loaded the rates and prefixs

If the number dialed is 1900XXX and the prefix is 1900 the function calculate the rate.
If the room is not billed for a call look to billsec in cdr and look if dst have matched prefix in rates
 
Joined
May 2, 2008
Messages
44
Reaction score
1
New release (donwload new version from first post):

1.) Wake-Up insert dropdown is showing the Room ID instead of the Room Name or Extension Number (FIXED now show room name)
2.) Checking Out does not cancel any scheduled wakeup calls (even though no longer listed on web) FIXED

New features: when you insert a new wake-up for a room, any previous wake-up for this room is deleted (no need to delete previous wake-up).
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
New features: when you insert a new wake-up for a room, any previous wake-up for this room is deleted (no need to delete previous wake-up).

^^^ this is very bad. What if my wiffle & I are staying at a hotel, and I need a wakeup for 4am so I can go fishing... and she needs a wakeup at 8am to meet up for breakfast. So you definately need to support multiple wakeups (for others, you can disable this by commenting out lines 25-28 in wakeup.php) I'm going to see if I can't make sense of the Bill reports later today, specifically what information it's pulling in... hopefully get that figured out for me :)

Keep up the excellent work, this is great!
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Another great example of what open source is all about. :wink5:
 
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top