1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. If you had a PIAF Forum account in the vBulletin days, log in with your old credentials. Otherwise, sign up again and we'll get you back in business as soon as we can.
  3. A serious FreePBX vulnerability has been reported. Update your Framework Module immediately. Click here for details.

Simple Hotel Style Wake-Up Calls

Discussion in 'Add-On Install Instructions' started by tshif, Nov 20, 2008.

  1. tshif Guru

    Simple Hotel Style Wake-Up Calls
    (This work is based on this thread: http://trixbox.org/forums/trixbox-forums/open-discussion/wake-calls-trixbox-ce-how-five-easy-steps) (Updated 12/19/08. The attached scripts have changed. ) These steps and attached scripts should work for any FreePBX based Asterisk installation. (Callback is dependent upon the presence of context: from-internal)

    For quite a while, I have been hoping to make the simple, hotel style wake-up function, well, functional again. (Nerd Vittles Voice Reminders is a great application - but it serves a different purpose.)

    This procedure will provide the "hotel style" wakeup calls, and will even support "snooze" functions. An “operator” mode is available which allows specific phones to set wake up calls for any extension.

    This approach differs from the TrixThread in that only one Dial Plan Fragment is used, instead of two. This version also better uses the FreePBX extension registry, and is easier to change to respond to a phone number other than *62. I have made changes to the attached scripts – thus they are not the same as those on the TrixThread. These should be "drop and run" ready for you when used with the steps outlined below.

    Step One:
    Create a custom destination.
    Custom Destination: custom-wakeup-calls,s,1
    Description: Wake Up Calls

    Step Two:
    Then create a misc application
    Description:Wake Up Calls
    Feature Code:*62,
    Feature Status: Enabled
    Destination: Custom Destinations: Wake Up Calls

    (You can use any feature code you like here – we use *62.)

    Step Three:
    Add the following new context, in
    extensions_override_freepbx.conf

    [custom-wakeup-calls]
    exten => s,1,Answer
    exten => s,2,AGI(wakeup.php)
    exten => s,3,Hangup


    Step Four:
    Next, get the files attached to this article and copy them to /var/lib/asterisk/agi-bin


    The PHP files should already be executable if not then, and change ownership to asterisk:asterisk.
    cd /var/lib/asterisk/agi-bin
    chown asterisk:asterisk wake*
    chmod +x wakeup.php
    chmod +x wakeconfirm.php
    amportal restart

    Everything should be running now.
    Some folks have had troubles at this point - when they dial *62, they here nothing and nothing happens. Sometimes then they get hung up on. Should this happen to you, try running update-fixes.

    Here are some notes about some settings inside /var/lib/asterisk/agi-bin

    // Operator Mode, Allow an extension to key in wakeup calls for other extensions
    $parm_operator_mode = 1;

    // Operator Extension
    // Enter any extension that is allowed to enter in operator mode - Caller ID is used to validate
    $parm_operator_extensions= array( 0, 15 );

    // The max length of an extension when entering by operator
    $parm_operator_ext_len = 4;

    If you want to change the script so it can run from another number than *62, its easy. In Step 2, Above, enter whatever extension or star code you wish to use in place of *62.

    Then edit /var/lib/asterisk/agi-bin/wake.inc:
    // Caller ID of who the wakeup call is from Change this to the extension [FONT=&quot] $parm_wakeupcallerid = '"Wake Up Call" <*62>';

    I'd like to know how this works for anyone who tries it out.

    Next Steps? I would like to learn how to turn this into a module for FreePBX. Some time ago, before getting this version working, I tried using some of the ones that are in the FreePBX user repository - MISTAKE - they reacted poorly with my system. If anyone reading this understand module creation - I'd like to hear from you. :D

    Do you have all this working now and want to go the next step? Check Outside the Box Wake Up calls.

    [/FONT]

    Attached Files:

  2. dad311 Guru

    Not getting much joy here. When I dial *62, I just get a disconnect, nothing else.

    Also is there a typo in the instructions? Why is the Custom Applications: wake-up-calls,s,1 but the context is wake-up-call,s,1 (calls vs call)?

    -- Executing [*62@from-internal:1] Answer("SIP/202-083a5000", "") in new stack
    -- Executing [*62@from-internal:2] AGI("SIP/202-083a5000", "wakeup.php") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/wakeup.php
    -- AGI Script wakeup.php completed, returning 0
    -- Executing [*62@from-internal:3] Hangup("SIP/202-083a5000", "") in new stack
    == Spawn extension (from-internal, *62, 3) exited non-zero on 'SIP/202-083a5000'
    -- Executing [h@from-internal:1] Macro("SIP/202-083a5000", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/202-083a5000", "w") in new stack
    -- Executing [s@macro-hangupcall:2] NoCDR("SIP/202-083a5000", "") in new stack
    -- Executing [s@macro-hangupcall:3] GotoIf("SIP/202-083a5000", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,6)
    -- Executing [s@macro-hangupcall:6] GotoIf("SIP/202-083a5000", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] GotoIf("SIP/202-083a5000", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,11)
    -- Executing [s@macro-hangupcall:11] Hangup("SIP/202-083a5000", "") in new stack
    == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/202-083a5000' in macro 'hangupcall'
  3. dad311 Guru

    Success, however I had to use the wake.php and wakeconfirm.php from the Trixbox forum link.
  4. tshif Guru

    More Info?

    Did any one else experience trouble with the .php files from my first post in this thread?

    Can you describe the nature of the problem you had with them?
  5. RizSher Guru

    Works perfectly. Just a note, do we really need to create the Custom Destination and Misc Application as indicated in step 1 and 2?.

    The fact that we put

    exten => *62,1,Answer
    exten => *62,2,AGI(wakeup.php)
    exten => *62,3,Hangup

    in extensions_custom.conf means *62 is available as a valid extension number to be dialled anyway. I followed the instructions as detailed by tshift, got the wakeup calls working, then went and deleted the cus det and misc appl, and things work as before.
  6. tshif Guru

    Custom Destination / Msic Application are to register the number (*62) so FreePBX wont let ou use it again by accident. Other than that, no you dont *have* to do those steps.
  7. cjkeeme Guru

    Works perfectly! Thanks. Time to send some proposals over to all the local hotels/motels. :eurob:
  8. tshif Guru

    Please review the first article in this thread - Improvements have been made. Recommended update.
  9. jrglass Guru

    The new instructions worked well. How would one cancel the wakeup call if it was set wrong?

    Good job,

    jeff
  10. tshif Guru

    Just Dial into the wakeup system again, it recognizes that you already have a call setup, and lets you delete it or update it.
  11. dad311 Guru

    Again, I could only get *62 to work with the script in the Trixbox link. Very strange, do you know what the differences are between the to scripts?
  12. tshif Guru

    Several. A lot of the script that dealt with cutsie-pie word games (making the recipient do math to prove they were really awake) was removed, plus a change in dial out context that will prevent the TrixBox scripts from working correctly using the context as I outlined them in the steps.

    I honestly cant figure out how you are making it work the way you describe. :crazy:

    When you tried this new method, did you fully remove the previous attempt?
  13. dad311 Guru

    I was copying the wakeup2.zip file to /var/lib/asterisk/agi-bin and unzipping the file. This creates the hang-up issue.

    If I manually create each file and copy/paste the info everything seems to work. :lol:


  14. ajmorris New Member

    Works great for me!!!
  15. tshif Guru

    A little Twist - Outside the Box

    Excellent! You have me wondering if its because that zip file was created with Windows instead of Centos. I'll watch and see if anyone else has that issue.

    Outside The Box Wakeup Calls
    If you're still with me after all this, here's another little twist for wake up calls. If you have your inbound CallerID working - the Hotel Style WakeUp Calls Feature can easily work "outside the box" - meaning its not restricted to calling inside extensions.

    As sorry as it sounds -
    :out: - Iv'e stayed at hotels during business travel that I'd wished I could have had a "Wakeup call by cellphone" rather than rely on the hotel WakeUp service. This works nice for us in those cases - but it should work for any phone that sends proper Caller ID information.

    First – get familiar with, and get the scripts working as outlined in the first article of this thread. Then com back here, and continue on making a special Wakeup context for acess from outside lines.

    Step One:
    Create a custom destination.
    Custom Destination: custom-wakeup-calls-pin,s,1
    Description: Outside Wake Up Calls

    Step Two:
    Then create a misc application
    Description:Outside Wake Up Calls
    Feature Code:*63,
    Feature Status: Enabled
    Destination: Custom Destinations: Outside Wake Up Calls

    (You can use any feature code you like here – we use *63.)

    Step Three:
    Add the following new context, in extensions_override_freepbx.conf

    [custom-wakeup-calls-pin]
    exten => s,1,Answer

    exten => s,2,Wait(1)
    exten => s,3,Authenticate(1234567)
    exten => s,4,AGI(wakeup.php)
    exten => s,5,Hangup


    Obviously, change line s,3 1234567 to be your own complex pin.

    Step Four:
    Create in inbound route from any available DID, or ENUM should work also.
    Set Destination: Custom Destinations: Outside Wakeup Calls

    In Step 4 you could just as easily make `Outside Wakeup Calls` a choice from an IVR - stealth or not-stealth. We use a dedicated DID.


    Here are some notes about some settings inside /var/lib/asterisk/agi-bin
    // Operator Extension
    // Enter any extension that is allowed to enter in operator mode - Caller ID is used to validate. If used WITH inside WakeUp service, then outside numbers may be mixed with extensions.
    $parm_operator_extensions= array(0, 15, 5559996666, 8001234567 );


    Remember, this setting is in common with the inside-Wakeup calls. If you external wakeup calls, the system will wait longer before proceeding unless the operator presses the pound key at the end of entry.

    // The max length of an extension when entering by operator
    $parm_operator_ext_len = 10;

    Step Five:
    I always do a reread config from inside the config editor., and your gonna wanna do an amportal restart for absolute sure.

    Test it. Pick up any telephone that sends proper Caller ID info (This works great for me with my cell phone), and call the DID assigned to Outside Wake Up Calls.


    Like always - let me know if this works for you -

    Tony
  16. angoyr Guru

    Success Finally.

    I was having the exact same problem as dad311 for 2 days and I did what he did.
    I unzipped the files to a folder on my windows machine. Deleted the ones in /var/lib/asterisk/agi-bin. I opened the wake* files in notepad and copied them to the clipboard and pasted them into new files created by webmin. I then changed the ownership to asterisk and dialed *62.

    It just worked.

    Thanks guys, I needed this one.

    Robin.
  17. rossiv Guru

    Problems!

    I get a hang up every time. I tried update-fixes, no luck.
    Code:
        -- Executing [*62@from-internal:1] NoOp("SIP/2001-088fd018", "Running miscapp 4: Wake Up Calls") in new stack
        -- Executing [*62@from-internal:2] Goto("SIP/2001-088fd018", "custom-wakeup-calls|s|1") in new stack
        -- Goto (custom-wakeup-calls,s,1)
        -- Executing [s@custom-wakeup-calls:1] Answer("SIP/2001-088fd018", "") in new stack
        -- Executing [s@custom-wakeup-calls:2] AGI("SIP/2001-088fd018", "wakeup.php") in new stack
        -- Launched AGI Script /var/lib/asterisk/agi-bin/wakeup.php
        -- AGI Script wakeup.php completed, returning 0
        -- Executing [s@custom-wakeup-calls:3] Hangup("SIP/2001-088fd018", "") in new stack
      == Spawn extension (custom-wakeup-calls, s, 3) exited non-zero on 'SIP/2001-088fd018'
    
  18. angoyr Guru

    rossiv,

    Follow the instructions above and see if you have any success. That has worked for a few people.

    Good Luck.
  19. rossiv Guru

    How do you do that in Webmin? I have not used it before. Also changing ownership. Sorry if I am making this hard, but I am new to the commands.
  20. angoyr Guru

    rossiv,

    You do not have to use webmin, you can use one of the editors in Linux, like joe, vi or nano.
    From any of the above, you login as root, cd /folderwithwake*files, open the editor and paste the contents from within windows. Save it then change the ownership with cd /var/lib/asterisk/agi-bin
    chown asterisk:asterisk wake*
    chmod +x wakeup.php
    chmod +x wakeconfirm.php

    I think this information is listed earlier in the thread.

    To start webmin, open a browser session and go to http://yourserveraddress:9001/
    This assumes you're using PIAF. If not, can't help. One of the experts will take over.

    Good luck.

Share This Page