Wakeup.php

Discussion in 'General' started by veritech, Sep 1, 2008.

  1. veritech

    Joined:
    Jul 16, 2008
    Messages:
    92
    Likes Received:
    0
    I am trying to test wakeup.php in the agi-bin folder.

    according to instructions, my extensions_custom.conf contains:
    Code:
    ; This file contains the contexts the agents login for the module call center.
    ; and contains the context conferences for module conferences of elastix 1.0.
    
    [from-internal-custom]
    
    exten => *62,1,Answer
    exten => *62,2,AGI(wakeup.php)
    exten => *62,3,Hangup
    
    and I uncommented the line
    include extensions_custom.conf
    in extensions.conf

    when I try *62 on the phone, it comes back with an error that the feature is not available.


    any suggestions?

    I did find a different wakeup.php at http://www.voip-info.org/tiki-index.php ... p+Call+PHP but I don't know if I should try it as I can't get this one to work.


    Thanks
     
  2. Telco

    Joined:
    Oct 4, 2007
    Messages:
    275
    Likes Received:
    0
    What version of elastix are you using?

    If you are using elastix 1.1 You have to create the custom destination in freepbx then create the misc application in elastix. then it should work.

    Add Custom Destination
    Custom Destination: custom-app-wakeup,s,1
    Description: Wakeup
    Notes:

    Add Misc Application
    Description: Wakeup
    Feature Code: *62
    Feature Status: enabled

    Destination:

    Custom Applications: Choose from the drop down the custom destination you created, Wakeup.
     
  3. veritech

    Joined:
    Jul 16, 2008
    Messages:
    92
    Likes Received:
    0
    I added:
    Code:
    exten => *61,1,Answer
    exten => *61,2,AGI(nv-weather.php)
    exten => *61,3,Hangup
    
    exten => *62,1,Answer
    exten => *62,2,AGI(wakeup.php)
    exten => *62,3,Hangup
    
    
    to [from-internal]
    in /etc/asterisk/extensions.conf. It seems to work. Nv-weather just hangs up though.

    The wakeup seems interesting that it asks for the time. It calls back with music. I kinda expected a system recording about a wakeup call.
     
  4. wiseoldowl

    Joined:
    Aug 19, 2008
    Messages:
    251
    Likes Received:
    0
    I'm pretty sure that the weather and wakeup scripts came from the Nerd Vittles site (before they came out with their own distribution). You can find (possibly updated) scripts and installation instructions at http://bestof.nerdvittles.com/applications/ - I think Wakeup is now called "Telephone Reminders" but I'm not sure.

    There are two things I would definitely check if things aren't working. First, do the scripts call any system recordings and if so, are the permissions properly set on the recordings (and their containing directory)? Do you need to download any additional sound files from the Nerd Vittles site (I don't think so on those particular scripts, but I don't recall for sure).

    Second, the weather uses a synthesized voice of some kind and if it's not installed, you won't hear anything. I once installed weather on a system using one of the Cepstral voices, following the second set of instructions on the page at http://www.pbx.in/voip-info/wiki/view/M ... ather.html (the ones under "Alternative Change", starting about a third of the way down the page, and it sounded 1000% better than the original Nerd Vittles weather, both because of the better voice and because it eliminates the unnatural pauses), But after going to Elastix I didn't bother to reinstall it because it's so much easier to just grab the AccuWeather podcast for the area and play it - I originally used the instructions here http://michigantelephone.wordpress.com/ ... rt-2-of-3/ but I think I had to tweak it a bit with Elastix - here is a sample AGI script that I'm now using (this is for the Twin Cities, just search and replace msp with a more local podcast designator - a list of available podcasts is at http://www.accuweather.com/promotion.as ... ge=podcast ):

    Code:
    #!/usr/bin/perl
    
    use XML::Simple;
    use Asterisk::AGI;
    use LWP::Simple;
    
    $AGI = new Asterisk::AGI;
    $xml = new XML::Simple;
    $noext = "/tmp/mspweather";
    $resampled = $noext . ".mp3";
    
    $AGI->verbose("Getting XML file\n",1);
    $data = $xml->XMLin(get("http://podcast.accuweather.com/podcast_rss/msp.xml"));
    $url = $data->{channel}->{item}->{enclosure}->{url};
    $AGI->verbose("Extracted URL $url from XML file",1);
    $url =~ m#(?:.*/)(.*)$#;
    $podcast = "/tmp/" . $1;
    if (-s $podcast)
    {
      $AGI->verbose("$podcast already exists - skipping download\n",1);
    }
    else
    {
      system ('rm /tmp/MSP*.mp3');
      $AGI->verbose("Getting $url\n",1);
      getstore("$url", "$podcast") or die "Could not retrieve podcast";
      $AGI->verbose("$podcast retrived\n",1);
      system("/usr/bin/lame --silent --mp3input --scale 20 --abr 32 -m m -h $podcast $resampled")==0 or die "Could not convert file";
      $AGI->verbose("$pd converted to $resampled\n",1);
    }
    # $podcast =~ s/\.\w*$//;
    $AGI->answer;
    $AGI->exec("ControlPlayback","$noext|5000|6|4|#|*|1");
    exit;
    This is called from extensions_custom.conf as follows:

    Code:
    [custom-accuweather-msp]
    exten => _.,1,Noop(Entering Custom Context: AccuWeather Minneapolis-Saint Paul)
    exten => _.,n,Ringing
    exten => _.,n,AGI(mspweather.agi)
    exten => _.,n,GotoIf($["x${IVR_CONTEXT}" = "x"]?app-blackhole,hangup,1:${IVR_CONTEXT},return,1)
    exten => _.,n,Goto(app-blackhole,hangup,1)
    exten => h,1,Macro(hangupcall,)
    And then you have to make a Custom Destination and Misc Application as shown in Telo's post, but substitute the proper custom context name (example, custom-accuweather-msp rather than custom-app-wakeup) and pick a feature code you like that doesn't conflict with anything else (I use *23, you might like *61 or whatever isn't already used).
     
  5. Telco

    Joined:
    Oct 4, 2007
    Messages:
    275
    Likes Received:
    0
    Here is the weather that I use. It will allow you to enter a zip code and then get the weather for that zipcode.

    Add to extensions_custom.conf

    [custom-app-weather]
    exten => s,1,Answer
    exten => s,n,Playback(welcome)
    exten => s,n,Wait(1)
    exten => s,n,Playback(to-hear-weather-status&please-enter-your&zip-code)
    exten => s,n,Read(APCODE,beep,5)
    exten => s,n,Playback(auth-thankyou&one-moment-please)
    exten => s,n,StartMusicOnHold()
    exten => s,n,System(/usr/bin/curl -o /tmp/zip.mp3 -s http://audio.pirateweather.com/${APCODE}.mp3)
    exten => s,n,System(lame --decode /tmp/zip.mp3 /tmp/zip.wav)
    exten => s,n,System(sox -V /tmp/zip.wav -r 8000 -c 1 -w /tmp/zip.raw)
    exten => s,n,StopMusicOnHold()
    exten => s,n,Playback(/tmp/zip)
    exten => s,n,System(rm /tmp/zip.mp3 /tmp/zip.wav /tmp/zip.raw -f)
    exten => s,n,Playback(thank-you-for-calling)
    exten => s,n,Wait(1)
    exten => s,n,Playback(goodbye)
    exten => s,n,Hangup

    Note: If you don
     
  6. veritech

    Joined:
    Jul 16, 2008
    Messages:
    92
    Likes Received:
    0
    Thanks everone,
    I got the wakeup script working. I was expecting a little more than music playing on the wakeup call. I thought there would be an annoyance thing. Like "This is your wakeup call, press x now to accept otherwise you will be called again in 5 minutes"

    I was looking at the weather script, you need zip code, fine in the United states, but the rest of the world.......
    There is a version that supports airport codes at nerd vittles. I haven't been able to check it out yet.
     

Share This Page