Como recibir Fax en Asterisk

Imagen de RazaMetaL

Siguiendo con el envio de fax, me puse a investigar acerca de como hacerlo con asterisk y este es el resultado. Se puede implementar Hylafax + Asterisk para tener una sencilla y funcional maquina de fax virtual. Que ganamos? no tenemos que comprar un fax ni tarjetas o modulos fxs adicionales :) en fin ahorramos y de paso aprendemos algo nuevo.

Vamos a requerir de las siguientes aplicaciones:

- [url=http://www.hylafax.org]Hylafax[/url]
- [url=http://iaxmodem.sourceforge.net/]IAXModem[/url]

Las instrucciones para instalar Hylafax en Debian las pueden encontrar en este [url=http://www.ecualug.org/?q=2007/02/26/comos/como_instalar_un_servidor_de_fax_en_debian]link[/url]. Para CentOS 4.4 lo pueden descargar desde:
[url]ftp://ftp.hylafax.org/binary/linux/redhat/RPMS/i386/hylafax-4.3.2-3rhel4.i386.rpm[/url]

Para esta ultima distribucion dependiendo del caso puede pedir un par de dependencias que podemos instalar con yum:

yum install ghostscript sharutils

Y finalmente:

rpm -ivh hylafax-4.3.2-3rhel4.i386.rpm

[b]Configurar ASTERISK[/b]:
Agregamos en iax.conf la extension para nuestro fax:

[300]
username=300
type=friend
secret=300
qualify=yes
notransfer=yes
host=dynamic
context=from-internal
callerid="Fax" <300>
allow=all

Agregamos en zapata.conf :

faxdetect=incoming

En extensions.conf buscamos el contexto para las llamadas entrantes y agregamos:

exten => fax,1,Dial(IAX2/300)

En Freepbx este proceso es mucho mas sencillo, se crea una extension IAX para el fax y en la opcion de configuracion general se configura para que las llamadas de fax sean dirigidas a esa extension recien creada, en este ejemplo es 300.

[b]Configurar IAXModem[/b]
Tanto Debian y CentOS (en el repositorio de Trixbox) tienen iaxmodem disponibles en sus repositorios, es recomendable utilizar estos paquetes para obtener y gozar de beneficios de las actualizaciones de la distribucion que estemos usando :)

Descargamos IAXModem:

cd /usr/src
wget http://ufpr.dl.sourceforge.net/sourceforge/iaxmodem/iaxmodem-0.2.1.tar.gz
tar zvxf iaxmodem-0.2.1.tar.gz
cd tar zvxf iaxmodem-0.2.1

Lo instalamos:

cd lib/libiax2
./configure
make && make install
cd ../spandsp
./configure
make && make install
cd ../../
./configure
make

Copiamos el binario iaxmodem en /usr/bin:

cp iaxmodem /usr/bin

Creamos un directorio en /etc/iaxmodem en donde guaradermos la configuracion del modem IAX archivo de configuracion para el modem IAX2 en /etc/iaxmodem/ttyIAX :

device /dev/ttyIAX
port 45699
refresh 300
server localhost
peername 300
secret 300
cidname Fax
cidnumber 300
codec slinear

Debemos verificar si el modem se registra en nuestro asterisk:

# iaxmodem ttyIAX
[2007-02-27 12:56:51] Modem started
[2007-02-27 12:56:51] Setting device = '/dev/ttyIAX'
[2007-02-27 12:56:51] Setting port = 45699
[2007-02-27 12:56:51] Setting refresh = 300
[2007-02-27 12:56:51] Setting server = 'localhost'
[2007-02-27 12:56:51] Setting peername = '300'
[2007-02-27 12:56:51] Setting secret = '300'
[2007-02-27 12:56:51] Setting cidname = 'Fax'
[2007-02-27 12:56:51] Setting cidnumber = '300'
[2007-02-27 12:56:51] Setting codec = slinear
[2007-02-27 12:56:51] Error: group unspecified, using root instead
[2007-02-27 12:56:51] Error: user not found in passwd file, using root instead
[2007-02-27 12:56:51] Error: invalid mode string () ? Leaving default modes on /dev/ttyIAX
[2007-02-27 12:56:51] Opened pty, slave device: /dev/pts/1
[2007-02-27 12:56:51] Created /dev/ttyIAX symbolic link
[2007-02-27 12:56:51] Error: mode is 0, leaving default permissions
Restart 0
[2007-02-27 12:56:51] Registration completed successfully.

En asterisk:

sip*CLI> iax2 show peers like 300
Name/Username Host Mask Port Status
300/300 127.0.0.1 (D) 255.255.255.255 45699 OK (3 ms)
1 iax2 peers [1 online, 0 offline, 0 unmonitored]

En vista de que esta registrado vamos a agregarlo en /etc/inittab para que el modem este disponible todo el tiempo:

iax:2345:respawn:/usr/bin/iaxmodem ttyIAX &> /var/log/asterisk/iaxmodem-ttyIAX

Indicamos a init que lea inittab nuevamente con:

telinit q

[b]Configurar Hylafax[/b]
Hasta ahora tenemos iaxmodem registrado como extension en asterisk y hemos configurado el dialplan para que los faxes sean enviados a esta extension. Necesitamos entonces configurar hylafax para que acepte los faxes.

Lo primero es configurar hylafax como ya lo vimos en este [url=http://www.ecualug.org/?q=2007/02/26/comos/como_instalar_un_servidor_de_fax_en_debian]link[/url]:

faxsetup

Cuando nos pida un modem debemos detenernos y agregarlo a mano. En la ruta en la que descomprimimos iaxmodem hay un archivo llamado config.ttyIAX el cual copiaremos a /var/spool/hylafax/etc y luego modificaremos para que la seccion informativa de nuestro fax luzca de la siguiente manera, todo lo demas del archivo queda intacto:

cp config.ttyIAX /var/spool/hylafax/etc/
vi /var/spool/hylafax/etc/config.ttyIAX


CountryCode: 593
AreaCode: 5
FAXNumber: +593-5-262-2621
LongDistancePrefix: 0
InternationalPrefix: 00
DialStringRules: etc/dialrules
ServerTracing: 0xFFF
SessionTracing: 0xFFF
RecvFileMode: 0664
LogFileMode: 0664
DeviceMode: 0666
RingsBeforeAnswer: 1
SpeakerVolume: off
GettyArgs: "-h %l dx_%s"
LocalIdentifier: "MI EMPRESA"
TagLineFont: etc/lutRS18.pcf
TagLineFormat: "De %%l|%c|Pag %%P de %%T"
MaxRecvPages: 150

Igual que con iaxmodem, anadimos en inittab lo siguiente:

fax:2345:respawn:/usr/sbin/faxgetty ttyIAX

Y ejecutamos:

telinit q

Si marcamos a la extension 300 vamos a tener tono de fax :)

Ahora necesitamos especificar quienes recibiran los e-mails conteniendo el fax como adjunto. Para esto modificamos /var/spool/hylafax/etc/FaxDispatch para que contenga la direccion de e-mail a la que deberan llegar los faxes y el formato:

SENDTO=FaxMaster;
FILETYPE=pdf;

case "$DEVICE" in
ttyIAX) SENDTO=usuario@midominio.com;; # all faxes received on ttyS1
esac

Riniciamos hylafax y enviamos un fax a la extension 300, luego revisamos nuestro fax en el casillero de usuario@midominio.com.

Comentarios

Trata con ese comando que

Imagen de RazaMetaL

Trata con ese comando que trae trixbox, revisa que tengas instalados los paquetes ghostscript y sharutils.

------------

Antes de preguntar visita el [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

 

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

-----

Visita este [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

(adsbygoogle = window.adsbygoogle || []).push({});

allways unmonitored

Hello.

I'me having problem:

ipbx*CLI> iax2 show peers like 8000
Name/Username Host Mask Port Status
8000/8000 (Unspecified) (D) 255.255.255.255 0 Unmonitored
1 iax2 peers [0 online, 0 offline, 1 unmonitored]
ipbx*CLI>

Why this allways unmonitored?

My config:
-----
IAX.CONF
-----
[8000]
username=8000
type=friend
secret=8000
qualify=no
notransfer=yes
host=dynamic
context=from-internal
callerid="Fax" <8000>
allow=all

-----
ZAPATA.CONF
-----
;faxdetect=both
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no

-----
EXTENSIONS.CONF (for analog Digium FXO, port 4)
-----
[DID_trunk_3]
include = default
exten = _X.,1,Goto(default|1000|1)
exten = s,1,Goto(default|1000|1)
exten => fax,1,Dial(IAX2/8000)

-----
TTYIAX.CONF
-----
device /dev/ttyIAX
port 45699
refresh 300
server localhost
peername 8000
secret 8000
cidname Fax
cidnumber 8000
codec slinear

-----
IAXMODEM START RESULT
-----
[root@ipbx asterisk]# iaxmodem ttyIAX
[2007-04-14 18:14:56] Modem started
[2007-04-14 18:14:56] Setting device = '/dev/ttyIAX'
[2007-04-14 18:14:56] Setting port = 45699
[2007-04-14 18:14:56] Setting refresh = 300
[2007-04-14 18:14:56] Setting server = 'localhost'
[2007-04-14 18:14:56] Setting peername = '8000'
[2007-04-14 18:14:56] Setting secret = '8000'
[2007-04-14 18:14:56] Setting cidname = 'Fax'
[2007-04-14 18:14:56] Setting cidnumber = '8000'
[2007-04-14 18:14:56] Setting codec = slinear
[2007-04-14 18:14:56] Error: group unspecified, using root instead
[2007-04-14 18:14:56] Error: user not found in passwd file, using root instead
[2007-04-14 18:14:56] Error: invalid mode string () ? Leaving default modes on /dev/ttyIAX
[2007-04-14 18:14:56] Opened pty, slave device: /dev/pts/3
[2007-04-14 18:14:56] Removed old /dev/ttyIAX
[2007-04-14 18:14:56] Created /dev/ttyIAX symbolic link
[2007-04-14 18:14:56] Error: mode is 0, leaving default permissions
Restart 0
[2007-04-14 18:14:56] Registration completed successfully.

Also, when call 8000 from inside network I here the girl voice telling the extension is not available (same as if I call to a non existence caal).

Any help appreciated.

Regards.

Some other

Some other details:

AsteriskNOW beta 5
iaxmodem-0.2.1

I have only one FXO so I want to detect if call is voice or fax data. If voice forward to extension 1000 else to fax at 8000.

Thank you.

Regards.

COuld it be different

Imagen de JCMilleniuM

Why don't you ask the caller if he wants to send a fax or else then fwd or not

Juan Carlos Moreno A.
[url=http://www.w3b.ec]www.w3b.ec[/url]
jcmoreno@w3b.ec
Telf: (593) 9 5037551 - (593) 2 2434617
Hosting y diseño web
Quito - Ecuador

--
Ing. Juan Carlos Moreno A.

Cita: qualify=no Change on

Imagen de RazaMetaL

[quote]qualify=no[/quote]

Change on iax.conf for the following:

qualify=yes

------------

Antes de preguntar visita el [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

 

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

-----

Visita este [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

(adsbygoogle = window.adsbygoogle || []).push({});

Thank, thats it.

Thank, thats it.

But if is everything ok, shouldn't I hear a fax sound reply when calling to extension 8000 ("Si marcamos a la extension 300 vamos a tener tono de fax")? Instead I hear Asterisk girl telling "the person you are calling is unavailable, please try again" and softphone shows "call failed: not found". In other words is like the extension does not exists.

Any idea?

Rgards.

----
EDITED
----

I've made some changes at extensions.conf:
[default]
exten => 9999,1,VoiceMailMain
exten => 8500,n,Hangup
exten = 2000,1,Goto(voicemenu-custom-1|s|1)
exten => fax,1,Dial(IAX2/8000)

and take it from [DID_trunk_3]

Now, when I try to send a fax I've got this, on asterisk console:

Connected to Asterisk 1.4.2 currently running on ipbx (pid = 20474)
Verbosity is at least 3
-- Remote UNIX connection
-- Starting simple switch on 'Zap/4-1'
-- Executing [s@DID_trunk_3:1] Goto("Zap/4-1", "default|1000|1") in new stack
-- Goto (default,1000,1)
-- Executing [1000@default:1] Macro("Zap/4-1", "stdexten|1000|SIP/1000&IAX2/1000") in new stack
-- Executing [s@macro-stdexten:1] Dial("Zap/4-1", "SIP/1000&IAX2/1000|20") in new stack
-- Called 1000
[Apr 16 17:03:44] WARNING[20534]: app_dial.c:1090 dial_exec_full: Unable to create channel of type 'IAX2' (cause 3 - No route to destination)
-- SIP/1000-081b1268 is ringing
-- Nobody picked up in 20000 ms
-- Executing [s@macro-stdexten:2] Goto("Zap/4-1", "s-NOANSWER|1") in new stack
-- Goto (macro-stdexten,s-NOANSWER,1)
-- Executing [s-NOANSWER@macro-stdexten:1] VoiceMail("Zap/4-1", "1000|u") in new stack
-- Playing 'vm-theperson' (language 'en')
-- Playing 'digits/1' (language 'en')
-- Playing 'digits/0' (language 'en')
-- Playing 'digits/0' (language 'en')
-- Playing 'digits/0' (language 'en')
-- Playing 'vm-isunavail' (language 'en')
[Apr 16 17:04:09] NOTICE[20518]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
-- Redirecting Zap/4-1 to fax extension
== Spawn extension (default, fax, 0) exited non-zero on 'Zap/4-1' in macro 'stdexten'
== Spawn extension (default, fax, 0) exited non-zero on 'Zap/4-1'
-- Executing [fax@default:1] Dial("Zap/4-1", "IAX2/8000") in new stack
-- Called 8000
[Apr 16 17:04:10] WARNING[20534]: chan_zap.c:4920 zt_write: Cannot handle frames in 2 format
[Apr 16 17:04:10] WARNING[20534]: file.c:616 ast_readaudio_callback: Failed to write frame
-- Call accepted by 127.0.0.1 (format ulaw)
-- Format for call is ulaw
-- IAX2/8000-4 is ringing
-- Hungup 'IAX2/8000-4'
== Spawn extension (default, fax, 1) exited non-zero on 'Zap/4-1'
-- Hungup 'Zap/4-1'

Do you know what this means?

Thank you.

Regards.

Trata de colocar la

Imagen de RazaMetaL

Trata de colocar la prioridad del fax primero en tu extensions.conf , por otra parte pareciera algun problema de codec o permisos?


[Apr 16 17:04:10] WARNING[20534]: chan_zap.c:4920 zt_write: Cannot handle frames in 2 format
[Apr 16 17:04:10] WARNING[20534]: file.c:616 ast_readaudio_callback: Failed to write frame
-- Call accepted by 127.0.0.1 (format ulaw)
-- Format for call is ulaw
-- IAX2/8000-4 is ringing
-- Hungup 'IAX2/8000-4'
== Spawn extension (default, fax, 1) exited non-zero on 'Zap/4-1'
-- Hungup 'Zap/4-1'

Haz un tail -f /var/log/asterisk/full y mira que muestra cuando recibes fax.

------------

Antes de preguntar visita el [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

 

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

-----

Visita este [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

(adsbygoogle = window.adsbygoogle || []).push({});

sorry for your time. I've

sorry for your time. I've commented some lines with # instead of ; at iax.conf, just before [8000], also need to restart server after Hylafax compilation/installation. Now I have 2 more fax related processes runing.
Now I think it's everythin ok. I've already have faxes on my email.

Just another question.
How can I make my IPBX detect if fax first and then redirect to 1000 if not a fax? At this moment, when I send a fax, IPBX reply and transfer call to 1000, then if 1000 not reply, transfer to 8000/fax.

My extensions.conf:
[DID_trunk_3]
include = default
exten => fax,1,Dial(IAX2/8000)
exten = _X.,1,Goto(default|1000|1)
exten = s,1,Goto(default|1000|1)

Asterisk console while receiving fax:
[Apr 16 17:58:35] NOTICE[3144]: chan_iax2.c:7078 socket_process: Peer '8000' is now REACHABLE! Time: 3
[Apr 16 17:58:48] NOTICE[3136]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 17:59:39] NOTICE[3143]: chan_iax2.c:7872 __iax2_poke_noanswer: Peer '8000' is now UNREACHABLE! Time: 3
[Apr 16 17:59:43] NOTICE[3142]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 17:59:49] NOTICE[3137]: chan_iax2.c:7078 socket_process: Peer '8000' is now REACHABLE! Time: 1
-- Starting simple switch on 'Zap/4-1'
-- Executing [s@DID_trunk_3:1] Goto("Zap/4-1", "default|1000|1") in new stack
-- Goto (default,1000,1)
-- Executing [1000@default:1] Macro("Zap/4-1", "stdexten|1000|SIP/1000&IAX2/1000") in new stack
-- Executing [s@macro-stdexten:1] Dial("Zap/4-1", "SIP/1000&IAX2/1000|20") in new stack
-- Called 1000
[Apr 16 17:59:58] WARNING[3446]: app_dial.c:1090 dial_exec_full: Unable to create channel of type 'IAX2' (cause 3 - No route to destination)
-- SIP/1000-08215840 is ringing
-- Nobody picked up in 20000 ms
-- Executing [s@macro-stdexten:2] Goto("Zap/4-1", "s-NOANSWER|1") in new stack
-- Goto (macro-stdexten,s-NOANSWER,1)
-- Executing [s-NOANSWER@macro-stdexten:1] VoiceMail("Zap/4-1", "1000|u") in new stack
-- Playing 'vm-theperson' (language 'en')
-- Playing 'digits/1' (language 'en')
-- Redirecting Zap/4-1 to fax extension
== Spawn extension (default, fax, 0) exited non-zero on 'Zap/4-1' in macro 'stdexten'
== Spawn extension (default, fax, 0) exited non-zero on 'Zap/4-1'
-- Executing [fax@default:1] Dial("Zap/4-1", "IAX2/8000") in new stack
-- Called 8000
-- Call accepted by 127.0.0.1 (format ulaw)
-- Format for call is ulaw
-- IAX2/8000-4 is ringing
-- IAX2/8000-4 answered Zap/4-1
[Apr 16 18:00:38] NOTICE[3138]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
-- Hungup 'IAX2/8000-4'
== Spawn extension (default, fax, 1) exited non-zero on 'Zap/4-1'
-- Hungup 'Zap/4-1'
[Apr 16 18:00:53] NOTICE[3144]: chan_iax2.c:7872 __iax2_poke_noanswer: Peer '8000' is now UNREACHABLE! Time: 1
[Apr 16 18:01:03] NOTICE[3136]: chan_iax2.c:7078 socket_process: Peer '8000' is now REACHABLE! Time: 3
[Apr 16 18:01:33] NOTICE[3139]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 18:02:07] NOTICE[3144]: chan_iax2.c:7872 __iax2_poke_noanswer: Peer '8000' is now UNREACHABLE! Time: 3
[Apr 16 18:02:17] NOTICE[3136]: chan_iax2.c:7078 socket_process: Peer '8000' is now REACHABLE! Time: 1
[Apr 16 18:02:28] NOTICE[3139]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 18:03:21] NOTICE[3144]: chan_iax2.c:7872 __iax2_poke_noanswer: Peer '8000' is now UNREACHABLE! Time: 1
[Apr 16 18:03:23] NOTICE[3145]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 18:03:31] NOTICE[3138]: chan_iax2.c:7078 socket_process: Peer '8000' is now REACHABLE! Time: 3
[Apr 16 18:04:18] NOTICE[3141]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 18:04:35] NOTICE[3137]: chan_iax2.c:7872 __iax2_poke_noanswer: Peer '8000' is now UNREACHABLE! Time: 3
[Apr 16 18:04:45] NOTICE[3138]: chan_iax2.c:7078 socket_process: Peer '8000' is now REACHABLE! Time: 1
[Apr 16 18:05:13] NOTICE[3141]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 18:05:49] NOTICE[3137]: chan_iax2.c:7872 __iax2_poke_noanswer: Peer '8000' is now UNREACHABLE! Time: 1
[Apr 16 18:05:59] NOTICE[3138]: chan_iax2.c:7078 socket_process: Peer '8000' is now REACHABLE! Time: 3
[Apr 16 18:06:08] NOTICE[3141]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 18:07:03] NOTICE[3137]: chan_iax2.c:5635 update_registry: Restricting registration for peer '8000' to 60 seconds (requested 300)
[Apr 16 18:07:03] NOTICE[3138]: chan_iax2.c:7872 __iax2_poke_noanswer: Peer '8000' is now UNREACHABLE! Time: 3
[Apr 16 18:07:13] NOTICE[3143]: chan_iax2.c:7078 socket_process: Peer '8000' is now REACHABLE! Time: 1
ipbx*CLI>

By the way, what this anoying messages means (now REACHABLE/UNREACHABLE)? Should I be concerned with this?

Regards.

Páginas