perl scripts and asterisk

Community-based Support for users of Free Fax For Asterisk

perl scripts and asterisk

Postby butchick » Tue Sep 21, 2010 12:41 pm

Anybody has idea on how to run a perl scripts that get callerid from the incoming fax for asterisk dialplan and include calledid in the subject.
Here is my perl scripts:

#!/usr/bin/perl -w
#use strict;
use MIME::Lite;
use Asterisk::AGI;

my $agi = new Asterisk::AGI;
my %input = $agi->ReadParse();
my $num = $input{'CALLERID(num)'};


system("tiff2ps -a /var/spool/asterisk/fax/fax.tif | ps2pdf13 -sPAPERSIZE=letter - > /var/spool/asterisk/fax/fax.pdf");

$msg = MIME::Lite->new(
From => 'fax@domain.com',
To => 'user@domain.com',
# Cc => 'user@domain.com',
Subject => 'Fax recieve`',
Type => 'multipart/mixed');

$msg->attach( Type =>'application/pdf',
Path =>"/var/spool/asterisk/fax/fax.pdf",
Filename =>"fax.pdf");

$msg->attach( Type =>'TEXT',
Data =>'Hi you have a new fax recieve from `$num`');


## Attach etc...

$msg->send();
$msg->send('smtp', 'smtp.domain.com');

Thanks in advance
butchick
Newsterisk
 
Posts: 2
Joined: Mon Dec 15, 2008 10:31 am

Re: perl scripts and asterisk

Postby riovista » Thu Sep 23, 2010 6:18 am

Take a look at this:

http://code.google.com/p/efax4asterisk/

It's a simple agi script that doesn't require perl.
riovista
Newsterisk
 
Posts: 8
Joined: Mon Aug 02, 2010 12:35 pm

Re: perl scripts and asterisk

Postby butchick » Thu Sep 23, 2010 2:22 pm

Thanks for the help its working now only below two line to be fill.

my $num = $input{'callerid'};

Data =>"Hi you have a new fax recieve from `$num`");
butchick
Newsterisk
 
Posts: 2
Joined: Mon Dec 15, 2008 10:31 am


Return to Fax For Asterisk

Who is online

Users browsing this forum: No registered users and 1 guest