-
Notifications
You must be signed in to change notification settings - Fork 1
/
singlelinecheck
91 lines (79 loc) · 1.83 KB
/
singlelinecheck
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
#
# Single Line Outbound Caller ID Check
#
# written by Frank Baris
#
#
# v.01 - 12/15/17 -- fork of outbound.callerid.check
#
#
#
# ./singlelinecheck
#
#
# SYNTAX
# ---------
#
# ./singlelinecheck [CallerID.to.Check] [Test.Line.to.Call]
#
# EXAMPLE
# ---------
#
# ./singlelinecheck 303-303-3031 970-970-9700
# ./singlelinecheck 3033033031 9709709700
print_syntax_message () {
echo
echo
echo SYNTAX
echo ----------
echo
echo $0 [CallerID.to.Check] [Test.Number.to.Call]
echo
echo EXAMPLE
echo -----------
echo
echo $0 303-303-3031 970-970-9700
echo -or-
echo $0 3033033031 9709709700
echo
echo
}
# function build_call_file($numtocall,$callerid)
#
# builds the call file in /tmp
build_call_file () {
echo "Channel: DAHDI/g0/"$1 > /tmp/auto-$1.$2.call
echo "Callerid: "$2 >> /tmp/auto-$1.$2.call
echo "WaitTime: 11" >> /tmp/auto-$1.$2.call
echo "Application: Playback" >> /tmp/auto-$1.$2.call
echo "Data: silence/3" >> /tmp/auto-$1.$2.call
execute_call /tmp/auto-$1.$2.call
}
# function output_to_screen($numtocall,$callerid)
#
# out to screen to track progress
output_to_screen () {
echo "Outbound Call to: "$1
echo "Using Caller ID: "$2
echo "-----------------------------"
}
# function execute_call($callfile)
#
# moves individual call file from /tmp to /var/spool/asterisk/outgoing to execute call
execute_call () {
mv $1 /var/spool/asterisk/outgoing/
}
if [ $# -lt 3 ]; then
if [ $# -gt 1 ]; then
# call build_call_file()
build_call_file $2 $1
# call output_to_screen()
output_to_screen $2 $1
else
print_syntax_message
fi
else
print_syntax_message
fi
sleep 3