Re: Send fax in current active channel

Lee Howard <[email protected]> Mon, 25 Oct 2010 20:45:23 -0700
Newsgroups gmane.comp.telephony.fax.hylafax.devel
Message-ID <[email protected]>
Haamed Kouhfallah wrote:
> Now: i use java to make hylafax JOB to send faxes, i have agi program 
> and give user fax number and then fax doc with another line to given 
> number.
> but
> I want : to say the user "satart to fax mashine !" and i can make a 
> job that able to sent fax in current active channel.
>
> how can i do it?

Since you're posting to the -devel mailing list and are apparently 
competent-enough to have developed an AGI program and use a java client 
I will assume that I can just spell it out here and let you do the 
work.  It's a tricky configuration, and it requires HylaFAX+ 5.2.8 or 
newer and IAXmodem 1.2.0.

In your HylaFAX modem config files for iaxmodems 
(/var/spool/hylafax/etc/config.<iaxmodems>) add the following:

DynamicConfig: etc/dynamicconfig

In your HylaFAX faxq config file (/var/spool/hylafax/etc/config) add:

JobControlCmd: etc/jobcontrol
AllowIgnoreModemBusy:   yes

Then create /var/spool/hylafax/etc/dynamicconfig with this shell code:

------------------------------
#!/bin/sh

#
# A 5-digit DID indicates that we are to not answer this call as an
# incoming fax, but rather to answer this call and send a fax to the 
caller.
# The DID number specifies an image file to send from /var/faximages.
#

DID=$5
DIDLEN=`printf $DID | wc -c`

if [ "$DID" = "5" ]; then

   MODEM=`echo $1 | sed 's/^\/dev\///g'`

   sendfax -n -w -t 1 -T 1 -i answersend -O ignoremodembusy:yes -h 
$MODEM\@ -d $DID /var/faximages/$DID.tif > /dev/null 2>&1
   echo "RejectCall: true"

fi

exit 0
------------------------------

The sendfax command in this script submits a fax job to the HylaFAX 
server with a special "answersend" tag.  The job is made specifically 
for the ringing modem and tells the HylaFAX server to ignore the fact 
that the modem is already declared busy due to the incoming call (this 
is a new feature in HylaFAX+ 5.2.8).  The -d option in this case will 
essentially be meaningless.

Create /var/spool/hylafax/etc/jobcontrol with this shell code:

------------------------------
#!/bin/sh
. etc/setup.cache
. bin/common-functions
QFILE=sendq/q$1
parseQfile
if [ "$jobtag" = "answersend" ] && [ "$ignoremodembusy" = "1" ]; then
   echo "ModemDialCmd: \"ATH1\\nATD\""
   echo "ModemSoftResetCmd: AT"
fi
exit 0
------------------------------

This script basically checks the job request to see if it was tagged 
with "answersend" and further checks that it was submitted with 
"ignoremodembusy".  This indicates that it is a job to be patched 
through to the incoming call.  The ModemDialCmd is altered, therefore, 
so that it will simply take the line off-hook and then not dial anything 
but instructs the modem to start playing CNG (fax beep) tones.  The 
ModemSoftResetCmd is also altered to prevent the modem from actually 
being "reset" which would otherwise cause the call to be rejected by the 
iaxmodem.

So that's it... it's a bit tricky, yes.  But you *did* post to the 
-devel mailing list ;-)

Thanks,

Lee.



____________________ HylaFAX(tm) Developers Mailing List ____________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe [email protected] < /dev/null