Time and Temp

PSBITGuy

Joined
Aug 18, 2009
Messages
12
Likes
0
Points
0
#1
Just wanted to put this here, so that I could find it later. If you have any suggestions on this, please comment.
All this does is add a current temperature to your time module. (*60)

Modify /etc/extensions_override_freepbx.conf and add the following lines:

Code:
[app-speakingclock]
; Modified 8/17/09 to add temperature jj
include => app-speakingclock-custom
exten => *60,1,Answer
exten => *60,n,Wait(1)
exten => *60,n,Set(NumLoops=0)
exten => *60,n(start),Set(FutureTime=$[${EPOCH} + 11])
exten => *60,n,Playback(at-tone-time-exactly)
exten => *60,n,GotoIf($["${TIMEFORMAT}" = "kM"]?hr24format)
exten => *60,n,SayUnixTime(${FutureTime},,IM 'and' S 'seconds' p)
exten => *60,n,Goto(waitloop)
exten => *60,n(hr24format),SayUnixTime(${FutureTime},,kM 'and' S 'seconds')
exten => *60,n(waitloop),Set(TimeLeft=$[${FutureTime} - ${EPOCH}])
exten => *60,n,GotoIf($[${TimeLeft}  *60,n,Wait(1)
exten => *60,n,Goto(waitloop)
exten => *60,n(playbeep),Playback(beep)
exten => *60,n,Wait(1)
exten => *60,n,Set(PATH_TO_FILE=/tmp/temp.txt)
exten => *60,n,Set(FILE_STATUS=${STAT(e,${PATH_TO_FILE})})
exten => *60,n,GotoIf($["${FILE_STATUS}" = "" | "${FILE_STATUS}" = "0"]?no_file,1)
exten => *60,n,Set(MAX_FILE_CHARACTERS=256)
exten => *60,n,ReadFile(TEMPERATURE=${PATH_TO_FILE},${MAX_FILE_CHARACTERS})
exten => *60,n,GotoIf($[${ISNULL(${TEMPERATURE})}]?no_file,1)   
exten => *60,n,Playback(the&temperature&is-currently)
exten => *60,n,SayNumber(${TEMPERATURE})
exten => *60,n,Playback(degrees)-+
exten => *60,n,Wait(1)
exten => *60,n,Playback(goodbye)
exten => *60,n,Hangup

exten => no_file,1,Verbose(2,File does not exist)
exten => no_file,n,Playback(silence/1)
exten => no_file,n,Playback(goodbye)
exten => no_file,n,Hangup

; end of [app-speakingclock]
create a file called temperature.pl and put it in /usr/sbin/ and setup cron to run it every 15 minutes or so.
I use webmin to setup cron jobs.
Modify this file to point to your zip code.

Code:
;temperature.pl
curl -s 'http://www.google.com/ig/api?weather=47429' | awk -F'temp_f data="' '{ print $2 }' | awk -F'"/> /tmp/temp.txt
This will create a file called temp.txt with the current temperature and put it in /tmp
copy the file 'the.gsm' to /var/lib/asterisk/sounds and chown it to asterisk with 0664 rights
You will have to change something in elastix (so that the apply settings will come up) and apply settings for this to take effect. http://forum.elastix.org/old_files/the.zip
 

gamba47

Joined
May 28, 2009
Messages
595
Likes
0
Points
0
#2
Looks pretty good!

Thanks for share it!

gamba47
 

Patiniotakis

Joined
Jul 26, 2012
Messages
24
Likes
0
Points
1
#3
Is this possible with Elastix 2.3?
 

PSBITGuy

Joined
Aug 18, 2009
Messages
12
Likes
0
Points
0
#4
I haven't tested this on 2.3, but I don't see why not.
 

Patiniotakis

Joined
Jul 26, 2012
Messages
24
Likes
0
Points
1
#5
For example, I cannot find the file /etc/extensions_override_freepbx.conf.
 

PSBITGuy

Joined
Aug 18, 2009
Messages
12
Likes
0
Points
0
#6
probably changed in one of the newer versions.
Maybe try extensions-override-freepbx.
I can't confirm this, not using 2.3.
 

jgutierrez

Joined
Feb 28, 2008
Messages
5,737
Likes
0
Points
0
#7
/etc/asterisk/extensions_override_elastix.conf
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,901
Messages
130,885
Members
17,561
Latest member
marouen
Top