I am working on a time and temperature announcer for FreePBX. I have been recording the announcement, but I have read that I could set it up so FreePBX would get the weather automatically. I use the talking clock, which works well, but I would like to pull the weather so I dont forget to do it. Thank you for your help.
I don’t think there is an existing module for FreePBX to do this. You could program it to do this.
This is how you cause violence in Arizona… This is something that would need to be done manually… Note that could be as simple as a script calling a .call file to do the page.
There was one weather by zip but it does not work; it has issues, so I had to delete it. I was able to get an api but was not sure how to do it. I’m searching the web. One of the guys suggests I request help here, so I’m doing that.
I’ve used
in various projects. There is a generous free tier, simple API and it’s been reliable, though it requires attribution, e.g., “From OpenWeather, temperature on the Las Vegas Strip is 102 Fahrenheit.”
There’s a whole pile of weather recordings in /var/lib/asterisk/sounds/en/
(e.g. westerly
, sunny
, patchy
) and even more in /var/lib/asterisk/sounds/en/wx/
so it would just be a matter of writing an AGI script to pull some kind of weather API, parse the result, decide how you want to match the results up with recordings, and then play it. In pseudo code:
$data = get_weather_api();
$result = parse_data($data);
if ($result->conditions == "sunny") $conditions = "clear";
if ($result->conditions == "cloudy") $conditions = "cloudy";
...
$hightemp = parse_number_to_recordings($result->high);
$agi->play("conditions&$conditions&silence/1&high&temperature&is&$hightemp");
I’d be pretty surprised if nobody had done this already.
I was told something about it. But now i’m trying to understand API’s and how they work. I put my key in for a weather website. I have the talking clock going but having issues with the text to speach.
I had an issue. The recording I did sounds good, but when it’s played over the phone, it starts to sound bad. I tried to use the text-to-speech with FreePBX, and I have not been successful.