Page 1 of 1

perl scripts and asterisk

PostPosted: Tue Sep 21, 2010 12:41 pm
by butchick
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

Re: perl scripts and asterisk

PostPosted: Thu Sep 23, 2010 6:18 am
by riovista
Take a look at this:

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

It's a simple agi script that doesn't require perl.

Re: perl scripts and asterisk

PostPosted: Thu Sep 23, 2010 2:22 pm
by butchick
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`");