Hylafax Developers Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-devel] A somewhat specialized dialback patch



The enclosed little patch modifies the Hylafax daemon so that when a
call is not answered correctly, a configurable command can be
executed.  I wrote this because I wanted to leave my modem always
ready to receive faxes, but I also needed a way to force my machine to
dial my ISP.  After making the patch, I can call my fax number and
hang up when the fax tone comes through.  A few minutes later,
courtesy of the "failed answer" command, my machine comes online and
sends me a note (which as a side effect tells me the IP address it is
using).  This allows me to easily access my home machine from work,
even though I only have a dialup account.

I have endeavored to follow the existing style in choosing my variable
and string names; however, you may wish to change the configuration
string "failedanswercmd" to something shorter.

Incidentally, the script I use to force the dialup (via diald) is
simply:

#!/bin/sh
#
# Force my PPP connection to come up, and notify me that it's live.
#
# Usage:
#
USAGE='Usage: forceup [-q]'
#
MACHINE=mymachine@mywork
USER=me
SLEEPTIME=600

quiet=false
while [ $# -gt 0 ]
do
    case "$1" in
	-q)
	    quiet=true
	    ;;
	--)
	    shift
	    break
	    ;;
	-*)
	    echo "$USAGE" 1>&2
	    exit 2
	    ;;
	*)
	    echo "$USAGE" 1>&2
	    exit 2
	    ;;
    esac
    shift
done

if $quiet
then
    exec </dev/null >/dev/null 2>&1
fi

ping -c 60 $MACHINE
echo Connection forced up | mail -s Up $USER@$MACHINE
ssh -n $MACHINE sleep 600


-- 
    Geoff Kuenning   geoff@cs.hmc.edu   http://www.cs.hmc.edu/~geoff/

There are some Perl programs that look like nothing so much as line noise.
		-- Margaret Fleck

Index: faxGettyApp.h

--- faxGettyApp.h.orig	Sun Jun 13 00:41:06 1999
+++ faxGettyApp.h	Mon May 29 17:44:09 2000
@@ -83,6 +83,7 @@
     u_short	answerRotorSize;	// rotor table size
     AnswerType	answerRotary[3];	// rotary selection of answer types
     fxStr	faxRcvdCmd;		// fax received command
+    fxStr	failedAnswerCmd;	// failed answer command
     u_int	modemPriority;		// modem priority passed to faxq
 
     static faxGettyApp* _instance;


Index: faxGettyApp.c++

--- faxGettyApp.c++.orig	Sun Jun 13 00:41:05 1999
+++ faxGettyApp.c++	Mon May 29 18:09:23 2000
@@ -470,6 +470,15 @@
 	break;
     case ClassModem::CALLTYPE_ERROR:
 	traceServer("ANSWER: %s", (const char*) emsg);
+	if (failedAnswerCmd != "") {
+	    fxStr cmd(failedAnswerCmd
+		| quote | getModemDeviceID() | enquote
+		| quote |   getModemDevice() | enquote
+		| quote |               emsg | enquote
+	    );
+	    traceServer("FAILED ANSWER: %s", (const char*) cmd);
+	    runCmd(cmd, true);
+	}
 	break;
     }
     return (callHandled);
@@ -827,6 +836,7 @@
 { "vgettyargs",		&faxGettyApp::vgettyArgs },
 { "egettyargs",		&faxGettyApp::egettyArgs },
 { "faxrcvdcmd",		&faxGettyApp::faxRcvdCmd,	FAX_FAXRCVDCMD },
+{ "failedanswercmd",	&faxGettyApp::failedAnswerCmd },
 };
 const faxGettyApp::numbertag faxGettyApp::numbers[] = {
 { "answerbias",		&faxGettyApp::answerBias,	(u_int) -1 },


____________________ HylaFAX(tm) Developers Mailing List ____________________
 To unsub: mail -s unsubscribe hylafax-devel-request@hylafax.org < /dev/null



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services