-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecho_end
178 lines (155 loc) · 5.42 KB
/
echo_end
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/bin/bash
# $Id: echo_end,v 1.9 2004/10/06 20:20:27 repeater Exp $
# $Log: echo_end,v $
# Revision 1.9 2004/10/06 20:20:27 repeater
# Possible work around for timeout audo message.
#
# Revision 1.8 2004/09/01 14:01:15 repeater
# Fix to either run custom_off or echo_status so echostatus is only run once.
#
# Revision 1.7 2004/08/29 21:57:54 repeater
# Correct to add > to one of the &>/dev/null redirects for a tbdcmd.
#
# Revision 1.6 2004/08/29 17:00:37 repeater
# Hide output from tbdcmd.
#
# Revision 1.5 2004/08/25 00:04:08 repeater
# Removed echolinkoff from echo_wavplay announcements.
#
# Revision 1.4 2004/08/19 05:45:52 repeater
# Change the disconnect audio logic to match echo_inbound and echo_call.
#
# Revision 1.3 2004/08/19 04:28:50 repeater
# Changed the disconnect audio to include the standard hi-low tones.
#
# Revision 1.2 2004/08/17 04:44:44 repeater
# Add monitor disable to disconnect.
#
# Revision 1.1 2004/08/17 04:09:27 repeater
# Initial revision
#
###########################################################
# #
# Released under the GNU Public License #
# #
# Script : echo_end #
# Author : Marcus Xenakis WA2DCI #
# Version: .15 Beta #
# Date : 3/22/03 #
# About : This script tests to see if the last call #
# was EchoLink or IRLP. Passes to normal IRLP #
# "end" script if not an EchoLink call #
# CHANGELOG: #
# 06-Mar-04 VK2XJG: Modification for status updates #
# #
###########################################################
[ -z "$ECHO_SCRIPT" ] && ECHO_SCRIPT=/home/EchoIRLP/scripts
source $ECHO_SCRIPT/echo_common
# Abort if no connection in progress to prevent killing echo-idle
if [ -f "$LOCAL"/echoidle ]; then
# EchoIRLP is active, need to check if connection in place
if [ ! -f "$LOCAL"/active ]; then
echo "${0##*/:} Restoring EchoIdle connection."
# No official connection, check that imike and ispeaker are running
# then abort
"$ECHO_SCRIPT"/sfswrapper
killall imike
# Set Environment Variables for Speak Freely
export SPEAKFREE_CNAME="CALLSIGN"
export SPEAKFREE_ID="$ECHO_NODE_DESC"::"$ECHO_TBD_PASSWD"
IMIKEFLAG="-t"
IMIKEFLAG3="$ECHO_TBD_HOST":"$ECHO_TBD_LISTEN"
if [ "$FORCE_8BIT" = "YES" ] ; then
"$BIN"/imike -8 "$IMIKEFLAG" $IMIKEFLAG2 $IMIKEFLAG3 &>/dev/null &
else
"$BIN"/imike "$IMIKEFLAG" $IMIKEFLAG2 $IMIKEFLAG3 &>/dev/null &
fi
exit 0
fi
fi
# I not an EchoLink connection call normal IRLP end
if [ ! -f "$LOCAL"/echo_active ] ; then
"$SCRIPT"/end &
exit 0
fi
# Check that disconnect not already in progress
if [ -f "$LOCAL"/echo_disconnecting ] ; then
echo "${0##*/}: Disconnect already in progress, aborting..."
exit 0
fi
# Set "in progress" flag
touch $LOCAL/echo_disconnecting
if [ -f "$CUSTOM/timeoutvalue.temp" ] ; then #KF7FLY
mv -f "$CUSTOM/timeoutvalue.temp" "$CUSTOM/timeoutvalue" &>/dev/null
killall dtmf &>/dev/null
"$CUSTOM"/rc.mixer &>/dev/null
dtmf &>/dev/null
fi #KF7FLY
killall imike &>/dev/null
killall ispeaker &>/dev/null
#$BIN/key
"$SCRIPT"/fifoecho "$STATIONID" disconnect
"$SCRIPT"/dropcall
NODE_CALL=`cat "$LOCAL"/echo_call`
echo "${0##*/}: $NODE_CALL"
#LOGS the disconnect
log "Node Disconnect from EchoLink `cat $LOCAL/echo_active` `cat $LOCAL/echo_call`"
if [ -f "$LOCAL"/echoirlp ] ; then
# Disconnect from destination node
TBD_COMMAND -q monitor disable $NODE_CALL &>/dev/null
TBD_COMMAND -q disconnect $NODE_CALL &>/dev/null
echo "${0##*/}: TBD_COMMAND" $NODE_CALL
rm -f "$LOCAL"/echoirlp
else
# Otherwise we're using a shared conference - update our status
"$ECHO_SCRIPT"/echo_status
fi
# Save Node numbers
NODE_ID=`cat "$LOCAL"/echo_active`
CONVERTED_STATIONID=`cat "$LOCAL"/active`
usleep 500000
#JUNK=`pgrep -xf "/bin/bash /home/irlp/scripts/off timeout"`
JUNK=`ps x | grep "/bin/bash /home/irlp/scripts/off timeout$"`
if [ "$JUNK" != "" ] ; then
echo "$JUNK" &>/dev/null
elif [ "$ECHO_SAY_NODE" = "NO" ] ; then
"$ECHO_SCRIPT"/echo_wavplay echo_off
else
# callsing or node
if [ "$ECHO_SAY_NODE" = "YES" ] ; then
"$ECHO_SCRIPT"/echo_wavgen "$LOCAL"/echo_active
else
"$ECHO_SCRIPT"/echo_wavgen "$LOCAL"/echo_call
fi
"$ECHO_SCRIPT"/echo_wavplay echo_id echo_off
fi
# remove status flags
rm -f "$LOCAL"/echo_active &>/dev/null
rm -f "$LOCAL"/echo_call &>/dev/null
rm -f "$LOCAL"/codec &>/dev/null
rm -f "$LOCAL"/selectcodec &>/dev/null
rm -f "$LOCAL"/udp_port &>/dev/null
rm -f "$LOCAL"/preaccess &>/dev/null
rm -f "$LOCAL"/connectedip &>/dev/null
rm -f "$LOCAL"/calledip &>/dev/null
rm -f "$RUN"/* &>/dev/null
rm -f "$LOCAL"/active &>/dev/null
rm -f "$LOCAL"/node_id &>/dev/null
rm -f "$LOCAL"/echoirlp &>/dev/null
# Reset timeout
touch "$LOCAL"/timeout
#added for the really fast machines :)
sleep 1
if [ "$CUSTOM_OFF" = "YES" ] && [ -f "$CUSTOM"/custom_off ] ; then
"$CUSTOM"/custom_off $1
else
"$ECHO_SCRIPT"/echo_status &
fi
# Update IRLP status
"$SCRIPT"/statupdate &
# Update Status
#"$ECHO_SCRIPT"/echo_status &
#"$BIN"/unkey
# Clear disconnect lock
rm -f $LOCAL/echo_disconnecting
exit 0