-
Notifications
You must be signed in to change notification settings - Fork 0
/
asterisk-extensions.conf
54 lines (46 loc) · 3.08 KB
/
asterisk-extensions.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
; These are the relevant parts of my extensions.conf related to the heating control system:
; Preshared SSH keys should be configured so communication does not require any manual username/password to be entered.
; Heating control extension
exten => 100,1,Goto(heating,s,1)
[inbound_calls]
...
exten => s,n,GotoIf($["${DB(homeowners/${CALLERID(num)})}" = "1"]?heating)
...
exten => s,n(heating),Goto(heating,s,1)
...
[heating]
exten => s,1,Answer()
exten => s,n,Background(/var/lib/asterisk/sounds/heating/1-to-check-heating-status-2-to-turn-on-heating-3-to-turn-off-heating-4-to-set-target-temperature-5-to-call-house-telephone-english-female)
exten => s,n,WaitExten()
exten => 1,1,Answer()
exten => 1,n,Set(result=${SHELL(ssh [email protected] "/usr/bin/python3.5 /home/pi/heating-control-system/thermostat.py client get_heating_on_off_status ${CALLERID(num)}"):0:-1})
exten => 1,n,NoOp(Result is ${result})
exten => 1,n,ExecIf($["${result}" = "0"]?Playback(/var/lib/asterisk/sounds/heating/heating-is-currently-off-english-female))
exten => 1,n,ExecIf($["${result}" = "1"]?Playback(/var/lib/asterisk/sounds/heating/heating-is-currently-on-english-female))
exten => 1,n,Set(result=${SHELL(ssh [email protected] "/usr/bin/python3.5 /home/pi/heating-control-system/thermostat.py client get_current_temperature_status lounge ${CALLERID(num)}"):0:-1})
exten => 1,n,NoOp(Result is ${result});
exten => 1,n,Playback(/var/lib/asterisk/sounds/heating/current-temperature-in-lounge-is-english-female)
exten => 1,n,SayNumber(${result})
exten => 1,n,Playback(/var/lib/asterisk/sounds/heating/point-english-female)
exten => 1,n,Set(resultP=${CUT(result,".",2)})
exten => 1,n,SayAlpha(${resultP})
exten => 1,n,Playback(/var/lib/asterisk/sounds/heating/degrees-english-female)
exten => 1,n,Goto(heating,s,1)
exten => 1,n,HangUp()
exten => 2,1,System(ssh [email protected] "/usr/bin/python3.5 /home/pi/heating-control-system/thermostat.py client on ${CALLERID(num)}")
exten => 2,n,Playback(/var/lib/asterisk/sounds/heating/heating-activated-goodbye-english-female)
exten => 2,n,HangUp()
exten => 3,1,System(ssh [email protected] "/usr/bin/python3.5 /home/pi/heating-control-system/thermostat.py client off ${CALLERID(num)}")
exten => 3,n,Playback(/var/lib/asterisk/sounds/heating/heating-deactivated-goodbye-english-female)
exten => 3,n,HangUp()
exten => 4,1,Playback(/var/lib/asterisk/sounds/heating/enter-target-temperature-followed-by-the-pound-key-english-female)
exten => 4,n,Read(required-temperature,,2)
exten => 4,n,Playback(/var/lib/asterisk/sounds/heating/you-have-entered-english-female)
exten => 4,n,SayNumber(${required-temperature})
exten => 4,n,Playback(/var/lib/asterisk/sounds/heating/degrees-english-female)
exten => 4,n,Playback(/var/lib/asterisk/sounds/heating/goodbye-english-female)
exten => 4,n,System(ssh [email protected] "/usr/bin/python3.5 /home/pi/heating-control-system/thermostat.py client set_target_temperature lounge ${required-temperature}")
exten => 4,n,HangUp()
exten => 5,1,Playback(/var/lib/asterisk/sounds/heating/you-are-now-being-connected-please-wait-english-female)
exten => 5,n,Goto(inbound_calls,s,open)
exten => 5,n,HangUp()