Brett Sutton
Asterisk IT Staff
Sr. Member
    
Offline
Posts: 411

|
 |
« Reply #1 on: February 03, 2010, 09:47:50 PM » |
|
If you want to bill for faxes sent/received have a look at the 'audit.log' file that Noojee Fax creates.
It exists for precisely this purpose.
We also have a commercial addon that can write the audit information to a database and includes some extra information which is often required when writting a fax billing application.
What follows is some of the doco from the JDBC billing module (commercial plugin for Noojee Fax)
JDBC Billing (JdbcAuditHandler)
The JDBC Billing module provides improved billing information over and above the standard CDR logs that Noojee Fax outputs. The Billing module is designed to output the billing information directly to a database to improve access to the data.
Each time a fax transmission is attempted the following information is written to the database be calling a pre-defined stored procedure.
For each fax sent the following information is recorded:
* email address of submitter * destination phone number * number of pages * email subject line * success or failure * transmission start time * transmission duration * call start time * call duration * caller id * unique fax id * account code (specified in NoojeeFax.xml <Template> or from jdbc routing plugin (license fee applies))
The transmission duration refers to the time from when the system attempts to initiate the call until the call is terminated. The call duration refers to the time from when the remote station answers until the call is terminated.
For each fax received the following information is recorded:
* DID number * delivery email address (semi colon delimited list) * number of pages * remote station id * caller id * unique fax id * date and time received
Sample NoojeeFax configuration:
<TxFax> <MaxRetries>1</MaxRetries> <Priority>1</Priority> <RetryTime>40</RetryTime> <WaitTime>60</WaitTime> <Timeout>60</Timeout> <Debug>true</Debug>
<Handlers> <Handler> <Name>some other handler</Name> <Arguments></Arguments> </Handler> <Handler> <Name>au.com.noojee.noojeefax.handler.JdbcAuditHandler</Name> <Arguments>com.mysql.jdbc.Driver,jdbc:mysql://database_server/billing_db,user,password,tx,call faxSent</Arguments> </Handler> <Handler> <Name>some other handler</Name> <Arguments></Arguments> </Handler> </Handlers> </TxFax>
<RxFax> <Handlers> <Handler> <Name>some other handler</Name> <Arguments></Arguments> </Handler> <Handler> <Name>au.com.noojee.noojeefax.handler.JdbcAuditingHandler</Name> <Arguments>com.mysql.jdbc.Driver,jdbc:mysql://database_server/billing_db,user,password,rx,call faxReceived</Arguments> </Handler> </Handlers> </RxFax>
Arguments to the JdbcAudithandler are in the following format:
class,url,user,password,mode,stored_proc_command
where:
* class - the name of the JDBC driver class * url - the JDBC URL * user - the database account user name * password - the database account password * mode - is either tx or rx * stored_proc_command - the database command to invoke a stored proc that updates the billing tables * Note that the relevant JDBC drivers for the billing database must be in the NoojeeFax class path and must be added to the NoojeeFax.jar manifest.
IMPORTANT NOTE: The Audit handler must be configured in the list of handlers after any routing handler. It's most likely best to ensure it is the last handler in the list. The reason for this is that the handlers are chained and as each handler processes the fax it provides data for subsequent handlers. The audit handler for inbound faxes requires that the fax is routed via email to the recipients before the audit handler is invoked so that the list of email recipients is available.
Sample script to prepare database for audit entries:
create table FaxTransmitLog (Submitter char(40), FaxNumber char(25), PageCount int, Subject char(120), Success tinyint, TransmitStartTime datetime, TransmitDuration int, CallStartTime datetime, CallDuration int, CallerID char(25), FaxId bigint, AccountCode char(140));
delimiter $$ create procedure faxSent(Submitter char(40), FaxNumber char(25), PageCount int, Subject char(120), Success tinyint, TransmitStartTime datetime, TransmitDuration int, CallStartTime datetime, CallDuration int, CallerID char(25), FaxId bigint, AccountCode char(140)) BEGIN insert into FaxTransmitLog (Submitter, FaxNumber, PageCount, Subject, Success, TransmitStartTime, TransmitDuration, CallStartTime, CallDuration, CallerID, FaxId, AccountCode) values (Submitter, FaxNumber, PageCount, Subject, Success, TransmitStartTime, TransmitDuration, CallStartTime, CallDuration, CallerID, FaxId, AccountCode); END $$
delimiter ; create table FaxReceivedLog (DID char(25), Recipients varchar(512), PageCount int, RemoteStationId char(80), CallerId char(25), FaxId bigint, ReceivedTime datetime);
delimiter $$ create procedure faxReceived(DID char(25), Recipients varchar(512), PageCount int, RemoteStationId char(80), CallerId char(25), FaxId bigint, ReceivedTime datetime) BEGIN insert into FaxReceivedLog (DID, Recipients, PageCount, RemoteStationId, CallerId, FaxId, ReceivedTime) values (DID, Recipients, PageCount, RemoteStationId, CallerId, FaxId, ReceivedTime); END $$
|