don4444
(Time & Temp)
March 11, 2021, 12:58am
1
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.
Thanks
billsimon
(Bill Simon)
March 11, 2021, 3:25am
3
Looks like you have been working on this project a long time!
I have a WeatherFone Time and temp announcer system that no longer works and needs to be replaced what it does is when someone calls the phone number it gives them a recorder message with the time, temperature and short whether forecast. I was wondering if this would be possible to do with free PBX. The WeatherFone has an outdoor temperature sensor that reads the temperature and the weather forecast is recorded every few days. If you know how this could be done or have any ideas please let me kn…
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).
don4444
(Time & Temp)
March 11, 2021, 1:15pm
5
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 ]
don4444
(Time & Temp)
March 11, 2021, 1:49pm
6
billsimon
(Bill Simon)
March 11, 2021, 3:51pm
7
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
TMTOWTDI.
1 Like
dicko
(dicko)
March 11, 2021, 3:56pm
8
Add to that recipe
api.weather.gov # to get the weather
jq #to parse that data
TTS from google , amazon, whoever
don4444
(Time & Temp)
March 11, 2021, 3:58pm
9
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 .
dicko
(dicko)
March 11, 2021, 4:12pm
10
no need to scrape they have an API
https://weather-gov.github.io/api/general-faqs
Get the lat/lon from your site snd plug it into that
1 Like
dicko
(dicko)
March 11, 2021, 4:16pm
11
don4444
(Time & Temp)
March 11, 2021, 4:17pm
12
Ok but I want to use the Pat Fleet voice library not TTS.
dicko
(dicko)
March 11, 2021, 4:29pm
13
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
don4444
(Time & Temp)
March 11, 2021, 4:36pm
14
I need her to say
ETC time is (TIME) temperature (TEMP) Thank you for calling ETC.
Yes she did all the WX sounds.
dicko
(dicko)
March 11, 2021, 4:47pm
15
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/
don4444
(Time & Temp)
March 11, 2021, 4:51pm
16
So how do I set that up in FreePBX.
billsimon
(Bill Simon)
March 11, 2021, 4:55pm
17
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.
jfinstrom
(James Finstrom)
March 11, 2021, 5:01pm
18
@lgaetz is a bit of a dialplan demigod and has done some write-ups such as.
Despite the frequency with which it arises here in the forum, there is not yet a good resource for learning to use dialplan hooks in FreePBX. This will probably end up in the wiki at some point, but until that happens, here are the broad strokes for leveraging dialplan hooks in FreePBX 14.
What is a dialplan hook?
A dialplan hook refers to several pre-defined FreePBX contexts that exist solely for users to add their own Asterisk Macros to be run at specific locations in the call flow. They all …
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/
lgaetz
(Lorne Gaetz)
March 11, 2021, 5:05pm
19
@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
don4444
(Time & Temp)
March 11, 2021, 5:08pm
21
So do I put |jq ‘[.[]]|.[3].periods[0].temperature’ in the dial plan?