Time & Temp Announcer Script

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()

https://www.voip-info.org/asterisk-func-strftime/

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
https://wiki.asterisk.org/wiki/display/AST/Contexts%2C+Extensions%2C+and+Priorities

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
https://www.asterisksounds.org/en/sounds?s=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/

@don4444

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
https://wiki.freepbx.org/display/FDT/FreePBX+Dialplan+Customization
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]

2 Likes

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

well you put it indirectly in the dialplan perhaps using shell(), probably easier after RTFM again, (how did it go the last time, you were real quick!)

1 Like

Read the fleeting manual. It’s a quick read.

You mean the one with small print that comes with the bottle with a tube? If so, yep real quick results.

So how do I write the bash or php script I have this for the temperature.

curl http://api.openweathermap.org/data/2.5/weather?zip=10001,&appid=(apikeyredactedbymod)&units=imperial

pipe that though jq, there are FM’s for that too :slight_smile:

(you just gave away your family jewels :wink: )

So I need to put that in jq?

No, you need to ‘pipe’ it through jq (that’s in the FM also)

How do I do that?

By RTFM ! (or should I say “By RTFM |”)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.