Barra de espaço
Barra de espaço

This tutorial describes a detailed procedure showing how to perform the configuration to receive fax and forward it by e-mail on an Asterisk server.

YOUTUBE

In our channel you can view the video of this tutorial.



Run the following command to perform the installation of SendEmail program which is responsible for sending the fax received by email:

# apt-get install sendemail libio-socket-ssl-perl libnet-ssleay-perl


Try sending a test e-mail through GMail using the following command:

# /usr/bin/sendemail -s smtp.gmail.com -f This email address is being protected from spambots. You need JavaScript enabled to view it. -t This email address is being protected from spambots. You need JavaScript enabled to view it. -u 'Maldito Kakaroto' -m 'Destruirei o planeta terra e todos aqueles q vc ama' -xu vegetaUser -xp VegetaPassword -o tls=yes  -v

(Change the e-mail, user and password to reflect your account)

If your test was successful, skip to the next step.

If your test presents the following error:

"invalid SSL_version specified at /usr/share/perl5/IO/Socket/SSL.pm line 332" 

Edit the file "sendemail" as shown.

# vi /usr/bin/sendemail

Locate the line below: 

 if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'SSLv3 TLSv1')) {


Edit and remove TLSv1

Here is the line after the change:

if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'SSLv3')) {


Try to send the test message again.

# /usr/bin/sendemail -s smtp.gmail.com -f This email address is being protected from spambots. You need JavaScript enabled to view it. -t This email address is being protected from spambots. You need JavaScript enabled to view it. -u 'Maldito Kakaroto' -m 'Destruirei o planeta terra e todos aqueles q vc ama' -xu vegetaUser -xp VegetaPassword -o tls=yes -v

(Change the e-mail, user and password to reflect your account)



INSTALLATION

Delete the current contents of the file "sip.conf"
# echo > /etc/asterisk/sip.conf

Edit the file "sip.conf"
# vi /etc/asterisk/sip.conf

Here is a functional configuration file.

[general]
allowguest=no
srvlookup=no
udpbindaddr=0.0.0.0
tcpenable=no
canreinvite = no
dtmfmode=auto
t38pt_udptl = yes   ;PARTE IMPORTANTE 

[ramal-voip](!)
type=friend
context=INTERNO
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g729 

[100](ramal-voip)
secret=senha100
callerid="Vegeta" <100> 

[200](ramal-voip)
secret=senha200
callerid="Kakaroto" <200>


We created 2 extensions 100 & 200.

Delete the current contents of the file "extensions.conf".
# echo > /etc/asterisk/extensions.conf

Edit the file "extensions.conf".
# vi /etc/asterisk/extensions.conf

Here is a functional configuration file.

[general] 

[INTERNO]
;
; RAMAL 100 (FOR TEST ONLY)
;
exten => 100,1,Dial(SIP/100)
;
; RAMAL 200 (FOR TEST ONLY)
;
exten => 200,1,Dial(SIP/200) 

;
; RECEBIMENTO DE FAX
;
exten => 999,1,Verbose(3,Incoming fax)
same => n,Set(FAXDEST=/tmp)
same => n,Set(tempfax=${STRFTIME(,,%C%y%m%d%H%M)})
same => n,ReceiveFax(${FAXDEST}/${tempfax}.tif,d)
same => n,Verbose(3,- Fax receipt completed with status: ${FAXSTATUS})
same => n,System(/usr/bin/sendemail  -s smtp.gmail.com  -f This email address is being protected from spambots. You need JavaScript enabled to view it. -t This email address is being protected from spambots. You need JavaScript enabled to view it. -u 'Novo FAX'  -m 'Fax de ${EXTEN}' -xu vegetaUser -xp vegetaPassword -o tls=yes -v -a ${FAXDEST}/${tempfax}.tif)


In addition to 2 configured SIP extensions, we added a third extension 999 that should receive the fax on the /tmp directory and sent it as attachment to the e-mail acount This email address is being protected from spambots. You need JavaScript enabled to view it..

Restart Asterisk service through the following command.
# /etc/init.d/asterisk restart


TEST

After correctly configure your Asterisk to receive Fax, try to send a fax from a conventional device to your Asterisk.

It might be interesting to run Asterisk in debug mode to check what is going on.

# asterisk -vvvvvr

You should see something like the log below.

== Using SIP RTP CoS mark 5
    -- Executing [999@LocalSets:1] Verbose("SIP/trunkteste-000000a2", "3,Incoming fax") in new stack
    -- Incoming fax
    -- Executing [999@LocalSets:2] Set("SIP/trunkteste-000000a2", "FAXDEST=/tmp") in new stack
    -- Executing [999@LocalSets:3] Set("SIP/trunkteste-000000a2", "tempfax=201502021432") in new stack
    -- Executing [999@LocalSets:4] ReceiveFAX("SIP/trunkteste-000000a2", "/tmp/201502021432.tif,d") in new stack
    -- Channel 'SIP/trunkteste-000000a2' receiving FAX '/tmp/201502021432.tif'
  == Using UDPTL CoS mark 5
    -- Executing [999@LocalSets:5] Verbose("SIP/trunkteste-000000a2", "3,- Fax receipt completed with status: SUCCESS") in new stack
    -- - Fax receipt completed with status: SUCCESS
    -- Executing [999@LocalSets:6] Verbose("SIP/trunkteste-000000a2", "3,- Fax receipt completed with status: SUCCESS") in new stack
    -- - Fax receipt completed with status: SUCCESS
    -- Executing [999@LocalSets:7] System("SIP/trunkteste-000000a2", "/usr/bin/sendemail  -s smtp.gmail.com  -f This email address is being protected from spambots. You need JavaScript enabled to view it. -t This email address is being protected from spambots. You need JavaScript enabled to view it. -u 'Novo FAX'  -m 'Fax de 999' -xu vegetaUser -xp vegetaPassword  -o tls=yes -v -a /tmp/201502021432.tif") in new stack 


CONCLUSION

This tutorial presented a way to receive fax on your asterisk server.