summaryrefslogtreecommitdiffstats
path: root/abs/core/ncid/ncid-linhes
blob: faa10563a57b1454eb2ed4876a538ed9f85fe8d9 (plain)
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
#!/bin/sh
# keep "ncid-" in the name
# input is 6 lines obtained from ncid
# input: DATE\nTIME\nNUMBER\nNAME\nLINE\nTYPE\n
#
# input is 6 lines if a message was sent
# input: \n\n\n<MESSAGE>\n\nMSG\n
# Message will be in $CIDNAME
#
# ncid usage:
#   ncid --no-gui [--message] --program ncid-linhes

# $CIDTYPE is one of:
#   CID: incoming call
#   OUT: outgoing call
#   HUP: blacklisted hangup
#   MSG: message instead of a call
MYTH_RUN_STATUS=1
. /etc/profile

ConfigDir=/etc/ncid
ConfigFile=$ConfigDir/ncidmodules.conf

[ -f $ConfigFile ] && . $ConfigFile

read CIDDATE
read CIDTIME
read CIDNMBR
read CIDNAME
read CIDLINE
read CIDTYPE

LOC=''

#areacode=`echo $CIDNMBR | cut -d "(" -f2 | cut -d ")" -f1`
areacode=`echo $CIDNMBR | cut -d "-" -f1`
if [ -e $MV_ROOT/templates/ncid/areacodes.csv ]
then
    LOC=`grep $areacode $MV_ROOT/templates/ncid/areacodes.csv  |cut -d ","  -f2`
fi




#echo "$CIDDATE|$CIDTIME|$CIDNMBR|$CIDNAME|$CIDLINE|$CIDTYPE" > /dev/tty

/usr/LH/bin/msg_client.py --clear
/usr/LH/bin/msg_client.py --kill
sleep .2
/usr/LH/bin/msg_client.py --msg "$CIDNMBR\n$CIDNAME\n$CIDTYPE\n$LOC"
exit 0