forked from binerry/RaspberryPi
-
Notifications
You must be signed in to change notification settings - Fork 22
/
sipcall-sample.sh
executable file
·49 lines (43 loc) · 1.78 KB
/
sipcall-sample.sh
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
#!/bin/bash
#
#=================================================================================
# Name : sipcall-sample.sh
# Version : 0.1
#
# Copyright (C) 2012 by Andre Wussow, 2012, [email protected]
#
# Description :
# Sample Script for checking average load and making call with sipcall.
#
# Dependencies:
# - sipcall
#
# References :
# http://binerry.de/post/29180946733/raspberry-pi-caller-and-answering-machine
#
#================================================================================
#This script is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
#
#This script is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#Lesser General Public License for more details.
#================================================================================
# define sip-settings
sip_domain="fritz.box";
sip_user="620";
sip_password="password";
play_file="play.wav";
# define number to call
phone_number="**1";
# read actual load values
avgload1="$(uptime |awk -F'average: ' '{print $2}' |awk -F', ' '{print $1}')";
avgload5="$(uptime |awk -F'average: ' '{print $2}' |awk -F', ' '{print $2}')";
avgload15="$(uptime |awk -F'average: ' '{print $2}' |awk -F', ' '{print $3}')";
# creating text to speak
tts="$(echo This is raspberry pi and the load is high. The average load within the last 5 minutes was $avgload5)";
# make call with sipcall
$(./sipcall -sd $sip_domain -su $sip_user -sp $sip_password -pn $phone_number -s 1 -mr 2 -tts "$tts" -ttsf $play_file > /dev/null);