Time & Temp Announcer Script

I read on another website someone wrote a Asterisk script that would say the time and temperature with the Pat Fleet recorded prompts for Asterisk

I would like to recreate that script if you could let me know how to set that up that would be great.


Looks like you have been working on this project a long time!

No offense meant but if you read about it on another web site then why not use what they wrote there (and maybe post a link to it here for others who are interested).

I tried to post the link but it would not let me.

I tried to contact the person who created the script but did not get a response so I was wanting to recreate it.

[you should be able to post links now - mod]


I think the building blocks are the following, each of which you would have to research a bit and implement:

  • get a Pat Fleet sound library and upload it to your FreePBX server in the sounds location
  • write a bash or php script to return current time (easy, from server time) and temperature (harder, from internet source)
  • use those numbers in custom asterisk dial plan which plays the sound files you uploaded
  • point to the custom dial plan with an internal extension or a DID/Inbound Route


1 Like

Add to that recipe

api.weather.gov # to get the weather
jq #to parse that data
TTS from google , amazon, whoever

I have already uploaded the Pat Fleet sound library. I need help writing the bash or php script to get the time and temp the URL I would like to use is https://w1.weather.gov/xml/current_obs/display.php?stid=KDKK.

no need to scrape they have an API


Get the lat/lon from your site snd plug it into that

1 Like

Follow that and


Ok but I want to use the Pat Fleet voice library not TTS.

Ask her to say

curl “https://api.weather.gov/gridpoints/BUF/23,26/forecast”|jq -r ‘[[.[]]|.[3].periods[0].detailedForecast]’

Or splice together her words and the interpreted values from the api

did Pat do all the phrases in /var/lib/asterisk/sounds/en/wx because they will be useful

I need her to say

ETC time is (TIME) temperature (TEMP) Thank you for calling ETC.

Yes she did all the WX sounds.

Temp is

|jq  '[.[]]|.[3].periods[0].temperature'

For time extract piecemeal hours minutes am/pm whatever with strftimea()


So how do I set that up in FreePBX.

by this I meant use sources other than this forum to help fill in the knowledge gaps you have. Especially for tasks out of scope of this forum such as writing bash scripts to fetch data from the internet.

@lgaetz is a bit of a dialplan demigod and has done some write-ups such as.

It may be worth looking at that and possibly searching the forums for from-internal-custom

Also helpful

Asterisk + The National Weather Service = Free Weather Reports For 1,000 Cities From Any Touchtone Phone – Nerd Vittles may also be useful as a reference point but it uses TTS

Asterisk sound files - Asterisk Sounds, help Asterisk to speak your language has a listing of standard sound files.

search for weather

side note… If you use the standard sounds you can seamlessly use custom prompts from Allison (the voice of Asterisk) https://www.theivrvoice.com/


There are several projects/examples that read back time/weather to the caller floating around on the 'net. Most are open source so you can freely rip them off borrow from them with attribution. If you want to learn how to add custom dialplan to a FreePBX system, you might want to start here
The actual content won’t help you directly, but the concepts for Custom Destinations will.

The community is here to provide pointers when you get stuck, not do it for you.

Also there is the speaking clock built into FreePBX feature codes. If you want to see how that is done you can search the file /etc/asterisk/extensions_additional.conf for [app-speakingclock]


The curt answer, RTFM :slight_smile:

So do I put |jq ‘[.[]]|.[3].periods[0].temperature’ in the dial plan?

Yes, anywhere it fits!:rofl:

1 Like