{"id":213,"date":"2010-03-18T09:35:34","date_gmt":"2010-03-17T20:35:34","guid":{"rendered":"http:\/\/chillingsilence.wordpress.com\/?p=213"},"modified":"2010-03-18T09:35:34","modified_gmt":"2010-03-17T20:35:34","slug":"how-to-hotel-management-system-for-elastix","status":"publish","type":"post","link":"http:\/\/www.c2s.co.nz\/blog\/how-to-hotel-management-system-for-elastix\/","title":{"rendered":"How-To: Hotel Management System for Elastix"},"content":{"rendered":"<div class=\"8781ca4f97038dd0d58a1ad8af045721\" data-index=\"3\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-6411751809866006\";\r\n\/* BlogHorizontalSlim *\/\r\ngoogle_ad_slot = \"6442664612\";\r\ngoogle_ad_width = 468;\r\ngoogle_ad_height = 60;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p>Two blog posts in 24 hours? We&#8217;re on a roll here!<br \/>\nBased off PIAF&#8217;s Hotel Management System, we&#8217;re going to make some minor adjustments to have this work with Elastix. This is a brilliant Hotel Room Management system with the ability to restrict the calls from Ext&#8217;s when they are not checked in, per-second billing, and more!<\/p>\n<p>Contents:<\/p>\n<ol>\n<li>Installing the base system<\/li>\n<li>Updating the config<\/li>\n<li>Fixing up HTTPS<\/li>\n<li>Updating dial-plan<\/li>\n<li>Closing words<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<h2>1) Installing the base system<\/h2>\n<p>First you&#8217;re going to need to ssh in to your Elastix PBX System.<br \/>\nThen, run the following:<\/p>\n<pre>cd \/var\/www\/html\nwget http:\/\/www.kefa.it\/hotel.tar.gz\ntar zxvf hotel.tar.gz\nrm hotel.tar.gz\ncd hotel\nmysql -uroot -peLaStIx.2oo7 &lt; Hotel.sql<\/pre>\n<p>Very similar to the default steps taken on the official documentation, except we&#8217;re going to use the Elastix SQL password rather than the script they&#8217;ve got there. This is also easier than the official doco, just one step instead of two.<\/p>\n<h2>2) Updating the config<\/h2>\n<p>We&#8217;re now going to modify the configuration file so that it works with Elastix due to the different Username \/ Passwords used between distributions.<br \/>\nEdit config.inc.php with your favorite editor. In my case I use nano:<br \/>\nnano -w config.inc.php<\/p>\n<p>Now you&#8217;re going to modify the following three paragraphs so that they match below:<\/p>\n<pre>\/\/Hotel database\n$dbhost = \"localhost\";\n$dbpass = \"eLaStIx.2oo7\";\n$dbuser = \"root\";\n$dbname = \"Hotel\";\n\n\/\/Asterisk database\n$dbhost2 = \"localhost\";\n$dbpass2 = \"eLaStIx.2oo7\";\n$dbuser2 = \"root\";\n$dbname2 = \"asterisk\";\n\n\/\/Asteriskcdrdb database\n$dbhost3 = \"localhost\";\n$dbpass3 = \"eLaStIx.2oo7\";\n$dbuser3 = \"root\";\n$dbname3 = \"asteriskcdrdb\";<\/pre>\n<p>Save and exit and you&#8217;re done with the config.<\/p>\n<h2>3) Fixing up HTTPS<\/h2>\n<p>When you visit the Elastix WebGUI, there&#8217;s a condition that rewrites the URL to include HTTPS. However, when this system tries to check the state of an Extension, it must do it via HTTP and not HTTPS, so we add an exception.<\/p>\n<p>Edit \/etc\/httpd\/conf.d\/elastix.conf with your favorite editor and add these lines at the very bottom:<\/p>\n<pre>RewriteEngine Off<\/pre>\n<p>What this will do is add the \/hotel directory as an exception so you don&#8217;t have to use HTTPS to get to it. We leave HTTPS on for the rest of the PBX, just because there&#8217;s no real reason for us to turn it off.<br \/>\nNow, restart apache with:<\/p>\n<pre>\/etc\/init.d\/httpd restart<\/pre>\n<p>You should now be able to access your WebGUI without HTTPS at: http:\/\/pbxip\/hotel\/<br \/>\nIf not, then go back and try again, as this part is crucial to the redirection to Reception when a phone is not Checked In<\/p>\n<p>4) Updating dial-plan<\/p>\n<p>Now we&#8217;re going to add in to the Dial-Plan and tell the PBX what calls can and cannot be made when the phone is not Checked-In.<\/p>\n<p>Edit \/etc\/asterisk\/extensions_custom.conf in your favorite editor and add the following underneath the [from-internal-custom] header:<\/p>\n<pre>;lets guests call other rooms without being checked in\nexten =&gt; _XXX,1,Dial(SIP\/${EXTEN})\nexten =&gt; _XXX,n,Hangup()\n;lets guests call freephonenumbers without being checked in\nexten =&gt; _1800NXXXXXX,1,Goto(outbound-allroutes,${EXTEN},1)\nexten =&gt; _1800NXXXXXX,n,Hangup()\nexten =&gt; _X.,1,Set(result=${CURL(http:\/\/127.0.0.1\/hotel\/checkuser.php?Ext=${CALLERID(num)})})\nexten =&gt; _X.,n,NoOp(Results: ${result})\nexten =&gt; _X.,n,GotoIf($[\"${result}\" = \"OK\"]?OK)\nexten =&gt; _X.,n,GotoIf($[\"${result}\" = \"KO\"]?KO)\nexten =&gt; _X.,n(OK),Goto(outbound-allroutes,${EXTEN},1)\nexten =&gt; _X.,n,Hangup()\n;call front desk if not checked in\nexten =&gt; _X.,n(KO),Dial(SIP\/200) ; used for just one extension\n;exten =&gt; _X.,n(KO),Goto(ext-group,0,1) ; used for ring groups\nexten =&gt; _X.,n,Hangup()<\/pre>\n<p>If you want to allow additional free calling, just duplicate the lines with &#8220;1800&#8221; in them. Mines quite different for New Zealand, but I&#8217;ve left it as american to give you a good idea of what you can do there.<br \/>\nYou&#8217;re also going to want to adjust the third-to-last line where it says &#8220;SIP\/200&#8221;, replacing 200 with the Extension of Reception.<br \/>\nOr, you could just comment that line out, and uncomment the second-to-last line to use Ring Group 0 as your &#8220;Reception&#8221; extension. The choice is yours.<br \/>\nSave the file and run:<\/p>\n<pre>asterisk -rx \"dialplan reload\"<\/pre>\n<h2>5) Closing words<\/h2>\n<p>From here, you&#8217;re on your own. It&#8217;s dead easy to log in and get started. You&#8217;ll first need to import all the rooms which it takes from the Ext Caller ID name, so it pays to give your Ext&#8217;s decent names like &#8220;Room 201&#8221; for Ext 201, just for example.<br \/>\nIf you run into troubles, post here and myself or the Elastix team would be more than happy to assist.<br \/>\nIf you get this successfully installed, just leave us a quick comment to say Hi and tell us you&#8217;ve done so, it&#8217;s always nice to know our time is appreciated.<br \/>\nCheers<\/p>\n<p>Chill.<\/p>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Two blog posts in 24 hours? We&#8217;re on a roll here! Based off PIAF&#8217;s Hotel Management System, we&#8217;re going to make some minor adjustments to have this work with Elastix. This is a brilliant Hotel Room Management system with the ability to restrict the calls from Ext&#8217;s when they are not checked in, per-second billing, [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3,4],"tags":[20,36,37,55,87,88,116,140,150],"class_list":["post-213","post","type-post","status-publish","format-standard","hentry","category-elastix-org-blog","category-how-tos-guides-tech-info","tag-asterisk","tag-check-in","tag-check-out","tag-elastix","tag-hotel-integration","tag-hotel-management","tag-motel","tag-piaf","tag-rooms"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pWi3e-3r","jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=213"}],"version-history":[{"count":0,"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/posts\/213\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.c2s.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}