FreePBX | Register | Issues | Wiki | Portal | Support

Simple weather app in FreePBX


I wanted to have an option to get the weather from my desk phone easily. I use FreePBX as my IP PBX at home and quickly found a module for weather. This of course would be the preferred method to get the weather info as you upload the module and it becomes a part of FreePBX. Sadly though the module had issues and when I did some searching around I discovered that it does not appear to be maintained anymore (or at least there have not been any updates in quite some time). I thought “FreePBX(Asterisk) and linux should make this simple to do on my own.” I figured this little project should consist of three areas. The first would be to get the weather info downloaded to my server as a simple text file. The second would be to convert that text file to a .wav file (using flite which is already on FreePBX.) The third would be to configure FreePBX in a manner that when I dial a feature code the system will playback the .wav file. I have accomplished all 3 steps successfully and as of right now I may only want to tweak my formatting of the text file so that flite pauses between sections of the file. In other words sometimes playback runs the different parts together.

Here is a link to a pdf that I have created if anyone wants to try this out.

I wanted to post the whole howto in the forum but could not get the pictures to display. If anyone can let me know how to get the images in the post I will create a new one and remove this post.

I am sure this can be made into a module for FreePBX. If I have time I may attempt that but I have no clue where to start with it…



If your feeling ambitious a rest app would be really cool.

(Jerson Jr) #3

Using the Amazon Polly TTS I easily accomplished with SSML: break time = 2s

(Seth Dunn) #5

Full disclosure before I ask anything, total n00b with freepbx and python scripting

Jersonjunior, how exactly did you pass the parameters to Polly to get the TTS to work properly?

I’ve followed this a forum post on here that indicates how to integrate aws Polly as a TTS engine sorry I can’t post the link to that forum, but when I replace this line:

os.system("flite -f /root/weather.txt -o /root/weather.wav") with os.system("node /root/weather.txt -o /root/weather.wav") I end up with the following error:

SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions…js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
cp: cannot stat ‘/root/weather.wav’: No such file or directory

I’m sure i’m probably missing something obvious, but any help you can provide is appreciated.

(Dave Burgess) #6

My first guess is:

All files in the /root directory are read-write by ‘root’ and unreadable by everyone else.

All processes operated by Asterisk are owned by ‘_asterisk’ and not ‘root’.


Why recreating the wheel? There are already XML apps on phones which will display the weather on your screen.