Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
Jan 1, 2017


A rudimentary "dial your weather" application using AWS Polly, Asterisk, and Weather Underground.


After seeing some of the new tech released during AWS re:Invent 2016, a colleague and I began to wonder about the possibilities with AWS Lex and Polly, particularly with regard to integrating with existing telephony solutions. This simple program is the first foray into that effort.

In effect, this application replicates the old "dial your weather" forecast services that used to be popular before the days of the Internet and The Weather Channel.

From an end user's perspective, they simply call the number running this application, dial in a zip code, and hear the current conditions plus a 3 day forecast.

Currently, this demonstrates what can be done with AWS Polly and Asterisk. I do not yet have acess to the AWS Lex preview. When I do, I will be replacing the "dial your zipcode" functionality with the ability to ask weatherphone what the current weather conditions are in plain words.



Prerequisite Configuration - Asterisk

  • Asterisk HTTP module and ARI modules must be configured. See the Asterisk Configuration for ARI for more details.

  • As a part of the ARI configuration, ensure that you have a username and password configured in your ari.conf file:

    type = user
    read_only = no
    password = supersecret
  • Your dialplan will need to call out to the ARI application. Connecting ARI into the dialplan uses the Stasis application.

    • The application name as provided by weatherphone is aws-polly-weatherphone
      exten => 8000,1,NoOp(Test stuff here...)
      exten => 8000,n,Answer()
      exten => 8000,n,Stasis(aws-polly-weatherphone)
      exten => 8000,n,Hangup()
  • A shared directory where weatherphone can write audio files and where Asterisk can subsequently read them. I do not recommend allowing these files to be written in your existing Asterisk sound files tree.

Prerequisite Configuration - AWS

  • Create an AWS IAM account that has access to AWS Polly.
  • Generate the Access ID and Access Key in IAM.
  • Place the Access ID and Key into the AWS credentials file for the user that will be running weatherphone (Usually in ~/.aws/credentials.).

Setup and Installation

  1. This must be installed and configured either on the system running Asterisk directly or in such a way where Asterisk can directly see files generated by weatherphone.

  2. Ensure that Node.js and npm are installed correctly.

  3. Clone this Git repository from GitHub.

  4. Inside the weatherphone directory, run npm to install the required Node libraries:

    npm install
  5. Copy the sample configuration file, removing the ".sample" extension and edit it to contain reasonable values for your setup.

  6. Run weatherphone.

    node weatherphone.js

Known Limitations

  • AWS Polly returns audio streams as a list of bytes. Asterisk does not have the capability to handle any sort of streams (that I was able to find...). Therefore, all of the audio must be saved out as files, and must be directly accessible to the Asterisk server. There may be options to transport audio files to a remote Asterisk server in version 14, but I was not ready to upgrade my internal PBX for this effort...
  • Many conditions are not accounted for. Examples include entering in an incorrect zip code, hanging up early, etc.
  • Does not yet clean up after itself (e.g. audio files are not cleaned up after they are used).


This is a work in progress. It's ugly, but it proves the point. If you'd like to help improve it, by all means, participate by submitting Issues and Pull Requests via GitHub.


weatherphone is licensed under the MIT license.


A rudimentary "dial your weather" application using AWS Polly, Asterisk, and Weather Underground.




No releases published


No packages published
You can’t perform that action at this time.