summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/ncid
diff options
context:
space:
mode:
Diffstat (limited to 'abs/mv-core/ncid')
-rw-r--r--abs/mv-core/ncid/PKGBUILD63
-rwxr-xr-xabs/mv-core/ncid/cid.sh11
-rw-r--r--abs/mv-core/ncid/ncid-osd26
-rw-r--r--abs/mv-core/ncid/ncid.conf59
-rwxr-xr-xabs/mv-core/ncid/ncid.install17
-rwxr-xr-xabs/mv-core/ncid/ncid.py59
-rw-r--r--abs/mv-core/ncid/ncid.sql51
-rwxr-xr-xabs/mv-core/ncid/ncidclient.sh2
-rw-r--r--abs/mv-core/ncid/ncidd.conf143
-rwxr-xr-xabs/mv-core/ncid/ncidpermissions.sql8
10 files changed, 439 insertions, 0 deletions
diff --git a/abs/mv-core/ncid/PKGBUILD b/abs/mv-core/ncid/PKGBUILD
new file mode 100644
index 0000000..1f46b09
--- /dev/null
+++ b/abs/mv-core/ncid/PKGBUILD
@@ -0,0 +1,63 @@
+pkgname=ncid
+pkgver=0.71
+pkgrel=1
+pkgdesc="daemon to display callerid"
+url="http://ncid.sourceforge.net/"
+license=""
+depends=(ghosd python)
+makedepends=()
+conflicts=()
+replaces=()
+backup=()
+arch=('i686')
+install=ncid.install
+ #wget http://internap.dl.sourceforge.net/sourceforge/ncid/ncid-0.71-src.tar.gz
+
+source=(http://internap.dl.sourceforge.net/sourceforge/ncid/$pkgname-$pkgver-src.tar.gz ncidd.conf ncid.conf ncid.py ncidpermissions.sql ncid.sql)
+md5sums=()
+
+build() {
+cd $startdir/src/$pkgname
+#cd $startdir/src/
+ ./configure --prefix=/usr
+ make clean
+ make package || return 1
+ mkdir -p $startdir/pkg/usr/bin
+ mkdir -p $startdir/pkg/usr/sbin
+ mkdir -p $startdir/pkg/etc/ncid
+ cp $startdir/*.conf $startdir/pkg/etc/ncid
+ install -m 755 ncidd $startdir/pkg/usr/sbin
+ install -m 755 ncid $startdir/pkg/usr/bin
+
+ mkdir -p $startdir/pkg/usr/share/man/man1
+ mkdir -p $startdir/pkg/usr/share/man/man5
+ mkdir -p $startdir/pkg/usr/share/man/man8
+ cd man
+ install -m 644 ncid.1 ncidscripts.1 ncidtools.1 $startdir/pkg/usr/share/man/man1
+ install -m 644 ncid.conf.5 ncidd.conf.5 ncidd.alias.5 ncidscript.conf.5 $startdir/pkg/usr/share/man/man5
+ install -m 644 ncidd.8 $startdir/pkg/usr/share/man/man8
+ cd -
+ mkdir -p $startdir/pkg/var/log
+ touch $startdir/pkg/var/log/cidcall.log
+cd scripts
+
+mkdir -p $startdir/pkg/usr/share/ncid/
+install -m 755 $startdir/src/ncid-osd $startdir/pkg/usr/share/ncid
+install -m 755 ncidrotate ncid-page ncid-samba ncid-speak $startdir/pkg/usr/share/ncid
+install -m 644 README $startdir/pkg/usr/share/ncid/
+cd -
+cd tools
+mkdir -p $startdir/pkg/usr/bin
+install -m 755 cidlog cidalias cidlogupd $startdir/pkg/usr/bin
+cd -
+install -m 755 $startdir/src/ncid.py $startdir/pkg/usr/bin
+
+
+install -m 755 -D $startdir/src/ncid.sql $startdir/pkg/tmp/ncid.sql
+install -m755 -D $startdir/src/ncidpermissions.sql $startdir/pkg/tmp/ncidpermissions.sql
+chmod 777 $startdir/pkg/tmp
+ #make DESTDIR=$startdir/pkg install
+ #mkdir -p $startdir/pkg/usr/local/bin
+# cp putfifo $startdir/pkg/usr/local/bin/
+# cp onscreend $startdir/pkg/usr/local/bin/
+}
diff --git a/abs/mv-core/ncid/cid.sh b/abs/mv-core/ncid/cid.sh
new file mode 100755
index 0000000..43167c1
--- /dev/null
+++ b/abs/mv-core/ncid/cid.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+#CID: *DATE*10152007*TIME*0950*LINE*-*NMBR*4144229767*MESG*NONE*NAME*BORKOWSKI,MICHA*
+while read line ; do
+# echo $line
+ NUMBER=`echo $line | cut -d* -f9`
+ NAME=`echo $line | cut -d* -f13`
+ /usr/bin/notify.py PHN $NUMBER
+ /usr/bin/notify.py PH2 $NAME
+
+
+done
diff --git a/abs/mv-core/ncid/ncid-osd b/abs/mv-core/ncid/ncid-osd
new file mode 100644
index 0000000..e115561
--- /dev/null
+++ b/abs/mv-core/ncid/ncid-osd
@@ -0,0 +1,26 @@
+#!/bin/sh
+#set -x
+# most of this program is taken from nciduser by Mace Moneta
+# requires festival: http://www.cstr.ed.ac.uk/projects/festival
+
+# input is 4 lines obtained from ncid using the "-all" option
+# input: DATE\nTIME\nNUMBER\nNAME
+# ncid calls a external program with the "--call-prog" option
+# default program: /usr/share/ncid/ncid-page
+#
+# ncid usage examples:
+# ncid --all --call-prog
+# ncid --all --call-prog --program ncid-osd
+# ncid --no-gui --all --call-prog --program ncid-osd
+
+read CIDDATE
+read CIDTIME
+read CIDNMBR
+read CIDNAME
+#CIDNAME="test name"
+#CIDNMBR="(414) 282 5011"
+ConfigDir=/etc/ncid
+ConfigFile=$ConfigDir/ncidscript.conf
+info="$CIDNMBR $CIDNAME"
+osdClient.pl localhost 5000 "$info:::SYS"
+exit 0
diff --git a/abs/mv-core/ncid/ncid.conf b/abs/mv-core/ncid/ncid.conf
new file mode 100644
index 0000000..91c3167
--- /dev/null
+++ b/abs/mv-core/ncid/ncid.conf
@@ -0,0 +1,59 @@
+# tcl/tk configuration file
+
+# Directory NCID uses to find the helper scripts
+set ProgDir /usr/share/ncid
+
+# default helper script
+set EXTPROG ncid-osd
+
+# Set Host to the NCID server address
+# Host defaults to 127.0.0.1
+set Host 127.0.0.1
+#set Host 192.168.1.5
+
+# The NCID port default is 3333
+set Port 3333
+
+# If the connection to the server is lost,
+# try every Delay seconds to reconnect
+# The Default: 60
+set Delay 20
+
+# If set to 1, display raw data received from the NCID server
+# If set to 0, do not display raw data received from the NCID server
+# Default: 0
+set Raw 0
+
+# If set to 1, output: date time number name
+# If set to 0, output: name number
+# Default: 0
+set All 1
+
+# If set to 1, display formatted CID, and CID log file on connect
+# If set to 0, ddo not isplay formatted CID, and CID log file on connect
+# Default: 0
+set Verbose 0
+
+# If set to 1, display information in terminal progran or external program
+# If set to 0, display information using a GUI
+# Default: 0
+set NoGUI 1
+
+# output name and number to external program
+# Default: 0
+set Callprog 1
+
+# ring number to call external program
+# Default: 0
+set CallOnRing 0
+
+# external called program
+set Program [list $ProgDir/$EXTPROG]
+
+# TiVo Flag: send output in format to use OUT2OSD
+# Default: 0
+set TivoFlag 0
+
+# Message Flag: send messages to output modules
+# Default: 0
+set MsgFlag 0 \ No newline at end of file
diff --git a/abs/mv-core/ncid/ncid.install b/abs/mv-core/ncid/ncid.install
new file mode 100755
index 0000000..e000b3b
--- /dev/null
+++ b/abs/mv-core/ncid/ncid.install
@@ -0,0 +1,17 @@
+
+post_install() {
+
+ mysql -u root -e 'create database ncid;'
+ echo installing the default database
+ mysql ncid < /tmp/ncid.sql
+ mysql < /tmp/ncidpermissions.sql
+ rm /tmp/ncid.sql
+ rm /tmp/ncidpermissions.sql
+}
+post_upgrade() {
+ echo "nothing to do"
+}
+
+op=$1
+shift
+$op $*
diff --git a/abs/mv-core/ncid/ncid.py b/abs/mv-core/ncid/ncid.py
new file mode 100755
index 0000000..7ffcefe
--- /dev/null
+++ b/abs/mv-core/ncid/ncid.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+import MySQLdb
+import sys
+import getopt
+import socket
+import os
+db = MySQLdb.connect(host="127.0.0.1", user="mythtv", passwd="mythtv", db="mythconverg")
+cdb = MySQLdb.connect(host="127.0.0.1", user="mythtv", passwd="mythtv", db="ncid")
+#log to logger?
+
+
+
+#log to db
+
+def main(argv):
+
+ DATE=sys.stdin.readline().strip()
+ TIME=sys.stdin.readline().strip()
+ NUMBER=sys.stdin.readline().strip()
+ NAME=sys.stdin.readline().strip()
+
+
+ #print "start of line"
+ #print DATE
+ #print TIME
+ #print NUMBER
+ #print NAME
+ #print "$$$$$$$$$$$$$$$$$$"
+
+#notify
+
+
+ # create a cursor
+ cursor = db.cursor()
+ # execute SQL statement
+ cursor.execute("SELECT DISTINCT(hostname) from settings where not hostname is NULL")
+ result = cursor.fetchall()
+
+ port1=str(5000)
+ port2=str(5001)
+
+
+ message = NAME + " :::" + "PHN"
+ message2 = NUMBER + " :::" + "PH2"
+ for row in result:
+ os.system("/usr/bin/osdClient.pl " + row[0] + " " + port1 + " "+ "\"" + message + "\"" + " 2>/dev/null &" )
+ os.system("/usr/bin/osdClient.pl " + row[0] + " " + port2 + " "+ "\"" + message2 + "\"" + " 2>/dev/null &" )
+ #print ("/usr/bin/osdClient.pl " + row[0] + " " + port2 + " "+ "\"" + message2 + "\"" + " 2>/dev/null &" )
+
+
+ ncursor=cdb.cursor()
+ ncursor.execute ("""INSERT INTO cid (date,time,name,number) VALUES ('%s', '%s','%s','%s');""" %(DATE,TIME,NAME,NUMBER ) )
+
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
+
diff --git a/abs/mv-core/ncid/ncid.sql b/abs/mv-core/ncid/ncid.sql
new file mode 100644
index 0000000..556b4ba
--- /dev/null
+++ b/abs/mv-core/ncid/ncid.sql
@@ -0,0 +1,51 @@
+-- MySQL dump 10.11
+--
+-- Host: localhost Database: ncid
+-- ------------------------------------------------------
+-- Server version 5.0.27
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `cid`
+--
+
+DROP TABLE IF EXISTS `cid`;
+CREATE TABLE `cid` (
+ `id` int(11) NOT NULL auto_increment,
+ `date` varchar(36) NOT NULL default '',
+ `time` varchar(32) default NULL,
+ `name` varchar(32) default NULL,
+ `number` varchar(32) default NULL,
+ `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `cid`
+--
+
+LOCK TABLES `cid` WRITE;
+/*!40000 ALTER TABLE `cid` DISABLE KEYS */;
+/*!40000 ALTER TABLE `cid` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2007-10-29 14:36:50
diff --git a/abs/mv-core/ncid/ncidclient.sh b/abs/mv-core/ncid/ncidclient.sh
new file mode 100755
index 0000000..0d2be3f
--- /dev/null
+++ b/abs/mv-core/ncid/ncidclient.sh
@@ -0,0 +1,2 @@
+ncid --no-gui --all --call-prog --program /usr/bin/ncid.py 127.0.0.1 3333
+
diff --git a/abs/mv-core/ncid/ncidd.conf b/abs/mv-core/ncid/ncidd.conf
new file mode 100644
index 0000000..daa2e79
--- /dev/null
+++ b/abs/mv-core/ncid/ncidd.conf
@@ -0,0 +1,143 @@
+# ncid - Network CallerID Server Config File
+
+################################
+# Definitions and Line formats #
+################################
+
+# lines can be blank, or start with the words: send, set #
+#
+# A line is divided into words, separated by spaces
+#
+# A word is either a string of non-blank characters, everything
+# between double quotes, or an equal sign.
+#
+# SEND LINE FORMAT:
+# send DATATYPE [DATATYPE] ...
+# where DATATYPE = cidlog, cidinfo
+#
+# SET LINE FORMAT:
+# set ITEM = VALUE [ITEM = VALUE] ...
+# where ITEM = cidalias, cidlog, datalog, initcid, initstr,
+# lockfile, port, ttyclocal, ttyport, ttyspeed,
+# nomodem
+
+############################
+# Log and Info for Clients #
+############################
+
+# Send the call log to a client when connected
+# The default is not to send the call log file
+send cidlog
+
+# Send call info (LINE and RING) to a client at each ring
+# The default is not to send the call info line
+send cidinfo
+
+############################
+# NCID Communications Port #
+############################
+
+# The default TCP/IP port is 3333
+ set port = 3333
+
+#######################
+# Alias and Log Files #
+#######################
+
+# The default CID alias file: /etc/ncid/ncidd.alias
+# set cidalias = /etc/ncid/ncidd.alias
+
+# The default CID call log file: /var/log/cidcall.log
+# the log file must exist, ncidd will not create it
+# (also make the change in /etc/logrotate.d/ncidd
+# and also /etc/ncid/ncidrotate.conf)
+# set cidlog = /var/log/cidcall.log
+
+# The default tty data log file: /var/log/ciddata.log
+# the log file must exist, ncidd will not create it
+# (also make the change in /etc/logrotate.d/ncidd
+# and also /etc/ncid/ncidrotate.conf)
+# set datalog = /var/log/ciddata.log
+
+#####################
+# TTY Configuration #
+#####################
+
+# The default tty port: /dev/modem
+# set ttyport = /dev/cu.modem # Macintosh OS X
+ set ttyport = /dev/ttyS1
+
+# The default tty port speed: 19200
+# The tty speed can be one of: 38400, 19200, 9600, 4800
+# set ttyspeed = 4800 # NetCallerID port speed
+
+# Ignore tty control signals for internal modems and 3 wire serial cables
+# Disable tty control signals: ttyclocal = 1
+# Enable tty control signals: ttyclocal = 0 (default)
+# set ttyclocal = 1
+
+# The lockfile name is generated automatically
+# If tty port is /dev/modem, lockfile is: /var/lock/LCK..modem
+# set lockfile = /var/lock/LCK..ttyS0
+
+#####################
+# Modem or No Modem #
+#####################
+
+# Obtain CallerID from a CID device or a modem
+# device: nomodem = 1 (do not send AT commands)
+# modem: nomodem = 0 (default - send AT commands)
+# set nomodem = 1
+
+########################
+# Modem Initialization #
+########################
+
+# The default modem initialization is: "AT Z S0=0 E1 V1 Q0"
+# set initstr = "ATE1V1Q0"
+#
+# Alternate modem initialization string
+# set initstr = "AT&FE1V1Q0+VIP"
+
+# Addon strings to set modem for Distinctive Ring:
+# http://www.modemsite.com/56k/dring.asp
+#
+# 3Com/USR/TI chipset: ATS41=1
+# Reported Ring Codes: RING A, RING B, RING C
+# Rockwell/Conexant chipset: AT-SDR=7
+# Reported Ring Codes: RING 1, RING 2, RING 3
+# Lucent/Agere chipset: AT+VDR=1,0
+# Reported DROF/DRON messages: DRON=5 DROF=11, DRON=5 DROF=34
+#
+# Example adds 3Com DR to the default modem initialization
+# set initstr = "ATE1V1Q0S41=1"
+
+# The default for ncidd is to try two CID strings to setup
+# CallerID: "AT+VCID=1" and if that fails: "AT#CID=1".
+# set initcid = "AT#CID=1"
+#
+# Alternate CID strings to try if default does not work:
+# set initcid = "AT+FCLASS=8;+VCID=1"
+# set initcid = "AT-STE=1;+VCID=1"
+# set initcid = "AT-STE=1;#CID=1"
+
+#################
+# TiVo Settings #
+#################
+# set ttyclocal = 1 # TiVo requires CLOCAL
+# set ttyport = /dev/ttyS1 # TiVo Modem Port
+# set lockfile = /var/tmp/modemlock # needed for TiVo Modem Port
+#
+# To use a modem on the TiVo serial port
+# Tivo (stereo mini jack) ->
+# -> (stereo mini plug) TiVo serial cable (9-pin male) ->
+# -> (9-pin Female) PC modem cable (25-pin Male ->
+# -> (25-pin Female) Modem
+# if the modem has switches, disable DTR
+# Use this string to set the modem before attaching it to the TiVo:
+# AT&F0&D0&B1&W
+#
+# set ttyport = /dev/ttyS3 # TiVo Serial Port
+#
+# End TiVo Settings
+
diff --git a/abs/mv-core/ncid/ncidpermissions.sql b/abs/mv-core/ncid/ncidpermissions.sql
new file mode 100755
index 0000000..eb660fa
--- /dev/null
+++ b/abs/mv-core/ncid/ncidpermissions.sql
@@ -0,0 +1,8 @@
+
+GRANT ALL ON ncid.* TO mythtv@localhost IDENTIFIED BY "mythtv";
+GRANT ALL ON ncid.* TO mythtv@"%" IDENTIFIED BY "mythtv";
+GRANT FILE ON *.* TO 'mythtv'@'%';
+FLUSH PRIVILEGES;
+
+FLUSH PRIVILEGES;
+ALTER DATABASE ncid DEFAULT CHARACTER SET latin1;