1 |
slords |
1.1 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-freepbx-0.1/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi mezzanine_patched_smeserver-freepbx-0.1/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi |
2 |
|
|
--- smeserver-freepbx-0.1/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi 1970-01-01 01:00:00.000000000 +0100 |
3 |
|
|
+++ mezzanine_patched_smeserver-freepbx-0.1/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi 2008-11-26 20:36:16.000000000 +0100 |
4 |
|
|
@@ -0,0 +1,42 @@ |
5 |
|
|
+#!/bin/bash |
6 |
|
|
+ |
7 |
|
|
+declare -a array |
8 |
|
|
+while read -e ARG && [ "$ARG" ] ; do |
9 |
|
|
+array=(` echo $ARG | sed -e 's/://'`) |
10 |
|
|
+export ${array[0]}=${array[1]} |
11 |
|
|
+done |
12 |
|
|
+ |
13 |
|
|
+DOMAIN=`dnsdomainname` |
14 |
|
|
+HOST=`hostname` |
15 |
|
|
+ |
16 |
|
|
+EMAIL=admin@$DOMAIN |
17 |
|
|
+ |
18 |
|
|
+DATE=`date "+%d-%m-%Y %H:%M"` |
19 |
|
|
+ |
20 |
|
|
+CID=`echo $agi_callerid` |
21 |
|
|
+CIDNAME=`echo $agi_calleridname` |
22 |
|
|
+EXTENSION=`echo $agi_extension` |
23 |
|
|
+#CHANNEL=`echo $agi_channel` |
24 |
|
|
+TYPE=`echo $agi_type` |
25 |
|
|
+DNID=`echo $agi_dnid` |
26 |
|
|
+ |
27 |
|
|
+REPORT=$EXTENSION |
28 |
|
|
+ |
29 |
|
|
+if [ "$EXTENSION" = "s-CHANUNAVAIL" ]; then |
30 |
|
|
+ REPORT="Channel Unavailable" |
31 |
|
|
+elif [ "$EXTENSION" = "s-CONGESTION" ]; then |
32 |
|
|
+ REPORT="Congestion" |
33 |
|
|
+fi |
34 |
|
|
+ |
35 |
|
|
+# Message Formating |
36 |
|
|
+ |
37 |
|
|
+MSG="\n\n A call from \"$CIDNAME\" <$CID> (Type $TYPE)\n" |
38 |
|
|
+MSG="$MSG To : $DNID\n" |
39 |
|
|
+MSG="$MSG Has failed on host $HOST.$DOMAIN at $DATE\n\n" |
40 |
|
|
+MSG="$MSG The error is : $REPORT \n\n" |
41 |
|
|
+ |
42 |
|
|
+# Send an email |
43 |
|
|
+ |
44 |
|
|
+echo -e "$MSG" | mail -s "[FAILED CALL] on host $HOST.$DOMAIN" "$EMAIL" |
45 |
|
|
+ |
46 |
|
|
+ |