HylaFAX The world's
most advanced open source fax server
|
|
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
Re: [hylafax-users] Modifying the Hylafax source code to interact with MySQL
I have done it with simple Bash scripts, and small modifications faxrcvd.
I do not want to publish all code, it is too specific. But it can be useful.
Here 2 parts of the code (interaction with Database):
########### part 1 - find phone in phonebook database
GETSORTRULE="SELECT idrule, idfirm, idgroup, idphone, sort_folder FROM
sortrules WHERE sort_phone='$FAXNO'";
result=$(mysql -h"$MYSQL_HOST" -u "$MYSQL_USR" -p"$MYSQL_PWD" -nB -D
"$MYSQL_DB" -e "$GETSORTRULE");
idrule=`echo $result | awk '{print($6);}'`;
idfirm=`echo $result | awk '{print($7);}'`; // firm id
idgroup=`echo $result | awk '{print($8);}'`; // group id, I have number of
client groups
idphone=`echo $result | awk '{print($9);}'`; // if found phone number record
here internal primary key
sortfolder=`echo $result | awk '{print($10);}'`; // faxrcvd save it in
<sortfolder> folder if need
############################
# insert into fax log
INSSQL="INSERT INTO inboxlog(idfirm, idgroup, idphone, fax_from, URL, TIME,
errmsg, pagecount) VALUES($idfirm, $idgroup, $idphone, '$FAXNO','$FILENAME',
'$NOW', '$ERRMSG',$PAGECOUNT )";
#echo $INSSQL
result=$(mysql -h"$MYSQL_HOST" -u "$MYSQL_USR" -p"$MYSQL_PWD" -nB -D
"$MYSQL_DB" -e "$INSSQL");
Regards,
Alexander Slepoy
-----Original Message-----
From: hylafax-users-bounce@xxxxxxxxxxx
[mailto:hylafax-users-bounce@xxxxxxxxxxx] On Behalf Of Godfrey Lawrence
Sent: Monday, March 08, 2004 1:45 PM
To: hylafax-users@xxxxxxxxxxx
Cc: godfrey_lawrence@xxxxxxxxx
Subject: [hylafax-users] Modifying the Hylafax source code to interact with
MySQL
Hello world,
Greetings!
I have created a table called logtable in MySQL.
When the fax is received apart from updating xferfaxlog file the following
modified code is expected to update the MySQL logtable.
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster.
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxxxxx*