pax_global_header00006660000000000000000000000064112513326650014516gustar00rootroot0000000000000052 comment=13e633c57629d0f926f4cd8f85a1da9d79ec36a8 mithraen-pbx-0.2/000075500000000000000000000000001125133266500137535ustar00rootroot00000000000000mithraen-pbx-0.2/.gear/000075500000000000000000000000001125133266500147475ustar00rootroot00000000000000mithraen-pbx-0.2/.gear/rules000064400000000000000000000000101125133266500160130ustar00rootroot00000000000000tar: . mithraen-pbx-0.2/.gitignore000064400000000000000000000000031125133266500157340ustar00rootroot00000000000000*~ mithraen-pbx-0.2/crontab000064400000000000000000000001161125133266500153240ustar00rootroot00000000000000* * * * * root /bin/bash -c '/usr/sbin/mithraen-pbx-systemtest > /dev/tty11' mithraen-pbx-0.2/fax-send000075500000000000000000000050711125133266500154110ustar00rootroot00000000000000#!/usr/bin/tclsh #============================================================================# # Script, runned after fax receieved # #============================================================================# # - convert to pdf # - sent to users #============================================================================# # (C) Denis Smirnov 26 Jan 2005 # #============================================================================# # Requires: libtiff-utils (tiff2pdf) # Requires: tcllib package require mime package require smtp package require cmdline set options { {t "send tiff files"} {d "delete tiff files after send"} {D "delete tiff and pdf files after send"} } set usage ": fax-send \[options] filename email from frommail\noptions:" array set params [::cmdline::getoptions argv $options $usage] if {$params(D) == 1} {set params(d) 1} puts $params(D) puts $params(d) return set filename [lindex $argv 0] set email [lindex $argv 1] set from [lindex $argv 2] set frommail [lindex $argv 3] set servername [info hostname] set f [clock format [clock seconds] -format "%Y-%m-%d_%H-%M.pdf" -gmt 0] # 8 bytes -- only TIFF header # if size is too little, tham fax was not received if {[file size $filename] <= 8} { # bad fax received file delete $filename set token [::mime::initialize \ -header "From $frommail" \ -header "Return-Path {$frommail}" \ -header "Subject {fax from $from not received}" \ -header "To {$email}"] ::smtp::sendmessage $token -recipients $email -servers "127.0.0.1 $servername" exit } set dirname [file dirname $filename] set rootname [file rootname $filename] set pdfname [file join $dirname "$rootname.pdf"] exec /usr/bin/tiff2pdf -p a4 -z "$filename" -a "$from" -s "$from" -t "$from" > "$pdfname" if {$params(t) == 1} { set token [::mime::initialize \ -file "$pdfname" \ -canonical application/pdf \ -header "From {$frommail}" \ -header "Return-Path {$frommail}" \ -header "Content-Disposition {attachment; filename=$f}" \ -header "Subject {fax from $from}" \ -header "To {$email}"] } else { set token [::mime::initialize \ -file "$filename" \ -canonical application/tiff \ -header "From {$frommail}" \ -header "Return-Path {$frommail}" \ -header "Content-Disposition {attachment; filename=$f}" \ -header "Subject {fax from $from}" \ -header "To {$email}"] } ::smtp::sendmessage $token -recipients $email -servers "127.0.0.1 $servername" if {$params(d) == 1} {file delete $filename} if {$params(D) == 1} {file delete $pdfname} mithraen-pbx-0.2/mithraen-pbx-systemtest000075500000000000000000000014211125133266500205170ustar00rootroot00000000000000#!/bin/bash # TODO: test for USB presence (recommend to off usb from BIOS) # TODO: test for power control (ACPI button) # TODO: test for processor speed control presence export LANG=POSIX if [ "$1" = "-q" ]; then export VERBOSE=0 else export VERBOSE=1 fi if [ "$TERM" == "" ]; then export TERM=linux fi if [ "$TERM" == "dumb" ]; then export TERM=linux fi /usr/bin/clear /bin/date | csed '/./ p blue,bold' /usr/share/mithraen-pbx-systemtest/cpu /usr/share/mithraen-pbx-systemtest/apic /usr/share/mithraen-pbx-systemtest/is_lvm /usr/share/mithraen-pbx-systemtest/fb /usr/share/mithraen-pbx-systemtest/interrupts-conflict | csed '/.*/ p red,bold' /usr/share/mithraen-pbx-systemtest/zaptel /usr/share/mithraen-pbx-systemtest/ide /usr/share/mithraen-pbx-systemtest/diskspace mithraen-pbx-0.2/mithraen-pbx.spec000064400000000000000000000036371125133266500172360ustar00rootroot00000000000000Name: mithraen-pbx Summary: Asterisk fax support scripts Version: 0.2 Release: alt3 License: GPL Group: System/Servers BuildArch: noarch Packager: Denis Smirnov Source: %name-%version.tar %package fax Summary: Asterisk fax support scripts Group: System/Servers BuildArch: noarch Obsoletes: seiros-pbx-fax Requires: tcllib Requires: libtiff-utils Requires: postfix %description fax Asterisk fax support scripts %package systemtest Summary: Autotest hardware configuration for using with Asterisk PBX Group: System/Base BuildArch: noarch Obsoletes: seiros-pbx-systemtest Requires: csed %description systemtest Autotest hardware configuration for using with Asterisk PBX %description Asterisk fax support scripts %prep %setup %install install -D -m755 fax-send %buildroot%_bindir/fax-send mkdir -p %buildroot%_sbindir mkdir -p %buildroot%_sysconfdir/cron.d mkdir -p %buildroot%_datadir/mithraen-pbx-systemtest/ install -D -m755 mithraen-pbx-systemtest %buildroot%_sbindir/mithraen-pbx-systemtest install -D -m644 crontab %buildroot%_sysconfdir/cron.d/mithraen-pbx-systemtest for s in sensors/*; do install -m755 $s %buildroot%_datadir/mithraen-pbx-systemtest/ done %post systemtest if [ -f %_initdir//crond ]; then service crond reload fi if [ -c /dev/tty11 ]; then %_sbindir/mithraen-pbx-systemtest > /dev/tty11 2> /dev/null ||: fi %files fax %_bindir/fax-send %files systemtest %_sbindir/mithraen-pbx-systemtest %_sysconfdir/cron.d/mithraen-pbx-systemtest %dir %_datadir/mithraen-pbx-systemtest %_datadir/mithraen-pbx-systemtest/* %changelog * Tue Sep 08 2009 Denis Smirnov 0.2-alt3 - add obsoletes to seiros-pbx-fax * Sun Aug 30 2009 Denis Smirnov 0.2-alt2 - small fix * Sat Aug 29 2009 Denis Smirnov 0.2-alt1 - add mithraen-pbx-systemtest * Sat Aug 29 2009 Denis Smirnov 0.1-alt1 - first build for Sisyphus mithraen-pbx-0.2/sensors/000075500000000000000000000000001125133266500154475ustar00rootroot00000000000000mithraen-pbx-0.2/sensors/apic000075500000000000000000000004171125133266500163130ustar00rootroot00000000000000#!/bin/bash if grep -q XT-PIC /proc/interrupts; then echo " * XT-PIC used, is your hardware too old or APIC disabled?" | csed '/./ p red,bold' elif grep -q APIC /proc/interrupts; then if [ "$VERBOSE" == 1 ]; then echo " * APIC used" | csed '/./ p green,bold' fi fi mithraen-pbx-0.2/sensors/cpu000075500000000000000000000005111125133266500161610ustar00rootroot00000000000000#!/bin/sh CNT=`grep 'physical id' /proc/cpuinfo | sort -u | wc -l` CORES=`grep ^processor /proc/cpuinfo | sort -u | wc -l` ( echo -n " * ${CNT} x " ; grep 'model name' /proc/cpuinfo \ | sort -u \ | sed 's/[[:space:]]\+/ /g' \ | sed 's/model name : *//' \ | tr -d '\n' echo " - $CORES cores" ) \ | csed '/.*/ p green,bold' mithraen-pbx-0.2/sensors/diskspace000075500000000000000000000003271125133266500173450ustar00rootroot00000000000000#!/bin/bash T=`mktemp` df -hP \ | sed 1d \ | awk '($5+0 > 90) { printf " * %3d%% %s\n", ($5+0), $6 }' \ | sort -n > $T if [ -s "$T" ]; then echo "Used disk space:" cat $T | csed '/.*/ p red,bold' fi rm -f $T mithraen-pbx-0.2/sensors/fb000075500000000000000000000004241125133266500157640ustar00rootroot00000000000000#!/bin/bash if [ "`cat /proc/fb | wc -c`" -ne "0" ]; then echo " * Frame buffer device must be disabled when using Asterisk (check lilo.conf)" | csed '/./ p red,bold' else if [ "$VERBOSE" == 1 ]; then echo " * FrameBuffer disabled... Ok" | csed '/./ p green,bold' fi fi mithraen-pbx-0.2/sensors/ide000075500000000000000000000015111125133266500161340ustar00rootroot00000000000000#!/bin/bash echo "IDE devices:" if ! pushd /proc/ide 2> /dev/null > /dev/null; then exit 0 fi getparam() { D=$1 N=$2 rc=`grep $N /proc/ide/$D/settings | awk '{ print $2 }'` return $rc } for s in hd?; do if [ "$s" == "hd?" ]; then echo " * no IDE devices found" | csed '/./ p green,bold' exit fi D=${s##*/} T=`cat /proc/ide/$D/media` model=`cat /proc/ide/$D/model` # if [ "$T" == "cdrom" ]; then # continue # fi if getparam $s using_dma; then echo " * /dev/$D $model -- not using DMA-mode" | csed '/.*/ p red,bold' fi if getparam $s io_32bit; then echo " * /dev/$D $model -- not using 32-bit I/O" | csed '/.*/ p red,bold' fi if getparam $s unmaskirq; then echo " * /dev/$D $model -- not using unmaskirq mode" | csed '/.*/ p red,bold' fi done mithraen-pbx-0.2/sensors/interrupts-conflict000075500000000000000000000014741125133266500214210ustar00rootroot00000000000000#!/usr/bin/perl -w use strict; open( IN, "/proc/interrupts" ) || die; while () { /^\s*(\d+):.*?(XT-PIC|IO-APIC-(?:level|edge))\s+(.+?)\s*$/ || next; my ( $irq, $hw ) = ( $1, $3 ); my @hw = split( ', ', $hw ); # All USB devices can share one IRQ s/^[ue]hci_hcd:(usb\d+)$/$1/ foreach @hw; # All Sangoma devices can share one IRQ s/^wanpipe\d+$/wanpipe/ foreach @hw; my @usb = (); my @hw2 = (); foreach (@hw) { if ( $_ =~ /^usb(\d+)$/ ) { push @usb, $1; } else { push @hw2, $_; } } # Delete dupes my %hw2; $hw2{$_} = 1 foreach @hw2; @hw2 = (); push @hw2, $_ foreach sort keys %hw2; push @hw2, "usb[" . join( ',', @usb ) . "]" if @usb > 0; print " * conflict IRQ # $irq: @hw2\n" if @hw2 > 1; } close(IN); mithraen-pbx-0.2/sensors/is_lvm000075500000000000000000000002651125133266500166710ustar00rootroot00000000000000#!/bin/sh if [ "$VERBOSE" != 1 ]; then exit fi if df -hP | grep -q mapper; then echo ' * LVM used' | csed '/.*/ p green,bold' else echo ' * LVM not used' | csed '/.*/ p red' fi mithraen-pbx-0.2/sensors/zaptel000075500000000000000000000004131125133266500166720ustar00rootroot00000000000000#!/bin/bash echo "Zaptel devices:" if [ -f /proc/zaptel/1 ]; then for s in /proc/zaptel/*; do head -n1 "$s" | csed '/./ p green,bold' '/RED/ p red,bold' done else echo " * No zaptel devices found! Please, load ztdummy" | csed '/./ p red,bold' fi mithraen-pbx-0.2/specs/000075500000000000000000000000001125133266500150705ustar00rootroot00000000000000mithraen-pbx-0.2/specs/mithraen-pbx-fax.spec000064400000000000000000000003441125133266500211170ustar00rootroot00000000000000Summary: Asterisk fax support scripts License: GPL Group: System/Servers Obsoletes: seiros-pbx-fax BuildArch: noarch Requires: tcllib Requires: libtiff-utils Requires: postfix %description %summary %files %_bindir/fax-send mithraen-pbx-0.2/specs/mithraen-pbx-systemtest.spec000064400000000000000000000007511125133266500225670ustar00rootroot00000000000000Summary: Autotest hardware configuration for using with Asterisk PBX License: GPL Group: System/Base BuildArch: noarch Obsoletes: seiros-pbx-systemtest Requires: csed %post if [ -f %_initdir//crond ]; then service crond reload fi if [ -c /dev/tty11 ]; then %_sbindir/mithraen-pbx-systemtest > /dev/tty11 2> /dev/null ||: fi %files %_sbindir/mithraen-pbx-systemtest %_sysconfdir/cron.d/mithraen-pbx-systemtest %_datadir/mithraen-pbx-systemtest/ %_datadir/mithraen-pbx-systemtest/* mithraen-pbx-0.2/specs/mithraen-pbx.spec000064400000000000000000000020611125133266500203410ustar00rootroot00000000000000Name: mithraen-pbx Version: 0.2 Release: alt3 BuildArch: noarch Summary: Asterisk fax support scripts License: GPL Group: System/Servers Packager: Denis Smirnov Source: %name-%version.tar %description %summary %prep %setup %install install -D -m755 fax-send %buildroot%_bindir/fax-send mkdir -p %buildroot%_sbindir mkdir -p %buildroot%_sysconfdir/cron.d mkdir -p %buildroot%_datadir/mithraen-pbx-systemtest/ install -D -m755 mithraen-pbx-systemtest %buildroot%_sbindir/mithraen-pbx-systemtest install -D -m644 crontab %buildroot%_sysconfdir/cron.d/mithraen-pbx-systemtest for s in sensors/*; do install -m755 $s %buildroot%_datadir/mithraen-pbx-systemtest/ done %changelog * Tue Sep 08 2009 Denis Smirnov 0.2-alt3 - add obsoletes to seiros-pbx-fax * Sun Aug 30 2009 Denis Smirnov 0.2-alt2 - small fix * Sat Aug 29 2009 Denis Smirnov 0.2-alt1 - add mithraen-pbx-systemtest * Sat Aug 29 2009 Denis Smirnov 0.1-alt1 - first build for Sisyphus