Difference between revisions of "Fax is not received"

From Kolmisoft Wiki
Jump to navigationJump to search
(New page: After trying to use Fax2Email functionality in Asterisk CLI you see: * Check permissions on /var/spool/asterisk/faxes)
 
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
= mor_fax2email: ERROR! Not connected to database =
After trying to use Fax2Email functionality in Asterisk CLI you see:
After trying to use Fax2Email functionality in Asterisk CLI you see:
mor_fax2email: MOR Fax2Email v0.1.3 AGI script started.
mor_fax2email: Failed to connect database server. Check debug for more info.
mor_fax2email: ERROR! Not connected to database.
Solution:
In '''/var/lib/asterisk/agi-bin/mor.conf''' correct DB connection settings.


* Check permissions on /var/spool/asterisk/faxes
* Check permissions on /var/spool/asterisk/faxes
* Make sure UDTP range 4000-4999 is open on the firewall.
<br><br>
----
== __ast_pbx_run: Channel 'Local/999@mor_local-1217,2' sent into invalid extension 'fax' in context 'mor_fax2email', but no invalid handler ==
Make sure /etc/asterisk/extensions_mor.conf has such line:
[mor_fax2email]
exten => _X.,1,Answer
exten => _X.,2,StopPlaytones
exten => _X.,3,Playback(beep)
exten => _X.,4,Set(FAXFILE=${CDR(UNIQUEID)})
exten => _X.,5,RxFax(/var/spool/asterisk/faxes/${FAXFILE}.tif)
'''exten => fax,1,Goto(mor_fax2email,111,1)'''
exten => h,1,DeadAGI(mor_fax2email)
exten => h,2,Hangup
If not - add such line (marked in bold) and reload Asterisk.
<br><br>
= ERROR! TIF file does not exist! =
If you get a similar output in Asterisk CLI:
mor_fax2email:
mor_fax2email: MOR Fax2Email AGI script started.
mor_fax2email: Successfully connected to database.
mor_fax2email: from sender: , fax file: 1311285609.5, faxsender: 311043455xx, fax_id :14, pdf file: /var/spool/asterisk/faxes/1311285609.5.pdf, tif file: /var/spool/asterisk/faxes/1311285609.5.tif
[2011-07-22 00:01:52] NOTICE[3316]: app_mor_debug.c:168 process_call_details: RTPAUDIOQOS: ssrc=655552979;themssrc=428650528;lp=0;rxjitter=0.006493;rxcount=4511;txjitter=0.002304;txcount=541;rlp=0;rtt=0.020000
[2011-07-22 00:01:52] NOTICE[3316]: app_mor_debug.c:186 process_call_details: PDD:
[2011-07-22 00:01:52] NOTICE[3316]: app_mor.c:2407 mor_acct_stop: Reseller's balance will be deducted by: 0.000000, and frozen balance by: 0.000000.
mor_fax2email: '''ERROR! TIF file does not exist!'''
-- AGI Script mor_fax2email completed, returning 0
-- Executing [h@mor_fax2email:2] Hangup("Local/910007@mor_local-1f39,2", "") in new stack
== Spawn extension (mor_fax2email, h, 2) exited non-zero on 'Local/91000x@mor_local-1f39,2'
the problem can be anywhere if you get this error. Please see this page: [[Fax_over_VoIP|FAX over VoIP]]
<br><br>
= Make sure T38 was not enabled =
If you face a problem with FAX not being received, two ways to detect this problem:
* Fax call takes about 30 seconds, and faxes not trains (if the codec is G729, call takes a little bit more than 40seconds and fails)
* Make a SIP debug, and you will see like this:
v=0.
o=CiscoSystemsSIP-GW-UserAgent 7568 7687 IN IP4 195.62.x.x.
s=SIP Call.
c=IN IP4 ip.add.re.ss.
t=0 0.
m=image 52972 udptl t38.
c=IN IP4 ip.add.re.ss.
a=T38FaxVersion:0.
a=T38MaxBitRate:14400.
a=T38FaxFillBitRemoval:0.
a=T38FaxTranscodingMMR:0.
a=T38FaxTranscodingJBIG:0.
a=T38FaxRateManagement:transferredTCF.
a=T38FaxMaxBuffer:200.
a=T38FaxMaxDatagram:72.
a=T38FaxUdpEC:t38UDPRedundancy.
Solution, check in sip.conf:
t38pt_udptl = no (be sure, it's NOT yes)
= FAX is not received on ZAP channel =
When ZAP channel is used, FAX device should be assigned to Asterisk server which has ZAP/DAHDI cards installed. Please make sure that correct Asterisk server is specified in "Server" drop-down list on FAX device settings.
It can be an issue when you have more than one Asterisk server only.
<br><br>
= Timing module is not loaded =
If Timing module is not working or if not loaded at all, FAX will fail and you will see ERROR like:
ERROR[14592]: res_fax_spandsp.c:464 spandsp_fax_new: Channel 'Local/1054@mor_local-00012b63;2' FAX session '253' failed to create timing source.
ERROR[14592]: res_fax.c:893 fax_session_new: FAX session failed to initialize.
ERROR[14592]: res_fax.c:1183 generic_fax_exec: Can't create a FAX session, FAX attempt failed.
* Check Timing module first:
sip*CLI> timing test 50
Attempting to test a timer with 50 ticks per second.
Failed to open timing fd
'''Command 'timing test 50' failed.'''
sip*CLI>
If you see that Timing failed like in an example above, than it seems your Timing module is not working or is missing at all. To check Timing module do like this in Asterisk CLI:
asterisk1*CLI> module show like res_timing
Module                        Description                              Use Count
'''0 modules loaded'''
This means that you have no Timing modules loaded at all. To load Timing module, check if there are any possible Timing modules:
[root@VM ]$ cd /usr/lib/asterisk/modules/
[root@VM ]$ ll | grep res_timing
-rwxr-xr-x 1 root root  179896 Oct  2  2014 res_timing_pthread.so
-rwxr-xr-x 1 root root  165310 Oct  2  2014 res_timing_timerfd.so
[root@VM ]$
In example there are two Timing modules available/compiled. We load timerfd module:
VM*CLI> module load res_timing_timerfd.so
Loaded res_timing_timerfd.so
Loaded res_timing_timerfd.so => (timerfd Timing Interface)
VM*CLI>
If only pthread module is available, then we do:
VM*CLI> module load res_timing_pthread.so
Loaded res_timing_pthread.so
Loaded res_timing_pthread.so => (pthread Timing Interface)
VM*CLI>
After module is loaded, Timing should work already. To check it, Timing test should show something like:
VM*CLI> timing test 50
Attempting to test a timer with 50 ticks per second.
Using the 'timerfd' timing module for this test.
It has been 1000 milliseconds, and we got 50 timer ticks
VM*CLI>
The error should be now resolved and not happen again.
*Make sure Timing module will be loaded after Asterisk/Server restart.
Check the /etc/asterisk/modules.conf file. If you see something like:
noload => res_timing_pthread.so
Comment it or remove. This will prevent from NOLOADING the module once Asterisk starts again.
= FAX over T.38 is not received =
Try to set following parameters in /etc/asterisk/sip.conf
...
t38pt_udptl=yes,redundancy,maxdatagram=400
...
in /etc/asterisk/udptl.conf
udptlstart=4000
udptlend=5999
;T38FaxMaxDatagram = 400    #comment this out
use_even_ports=no    #add this
<br><br>
== Make sure ports are not closed on the firewall ==
T38 default ports are 4000-5999. Make sure they are open in the firewall.
<br><br>
= See also =
* [[I have a problem with Fax]]
* [[Fax over VoIP]]

Latest revision as of 06:30, 11 February 2023

mor_fax2email: ERROR! Not connected to database

After trying to use Fax2Email functionality in Asterisk CLI you see:

mor_fax2email: MOR Fax2Email v0.1.3 AGI script started.
mor_fax2email: Failed to connect database server. Check debug for more info.
mor_fax2email: ERROR! Not connected to database.

Solution:

In /var/lib/asterisk/agi-bin/mor.conf correct DB connection settings.

  • Check permissions on /var/spool/asterisk/faxes
  • Make sure UDTP range 4000-4999 is open on the firewall.




__ast_pbx_run: Channel 'Local/999@mor_local-1217,2' sent into invalid extension 'fax' in context 'mor_fax2email', but no invalid handler

Make sure /etc/asterisk/extensions_mor.conf has such line:

[mor_fax2email]
exten => _X.,1,Answer
exten => _X.,2,StopPlaytones
exten => _X.,3,Playback(beep)
exten => _X.,4,Set(FAXFILE=${CDR(UNIQUEID)})
exten => _X.,5,RxFax(/var/spool/asterisk/faxes/${FAXFILE}.tif)
exten => fax,1,Goto(mor_fax2email,111,1)
exten => h,1,DeadAGI(mor_fax2email)
exten => h,2,Hangup

If not - add such line (marked in bold) and reload Asterisk.

ERROR! TIF file does not exist!

If you get a similar output in Asterisk CLI:

mor_fax2email:
mor_fax2email: MOR Fax2Email AGI script started.
mor_fax2email: Successfully connected to database.
mor_fax2email: from sender: , fax file: 1311285609.5, faxsender: 311043455xx, fax_id :14, pdf file: /var/spool/asterisk/faxes/1311285609.5.pdf, tif file: /var/spool/asterisk/faxes/1311285609.5.tif
[2011-07-22 00:01:52] NOTICE[3316]: app_mor_debug.c:168 process_call_details: RTPAUDIOQOS: ssrc=655552979;themssrc=428650528;lp=0;rxjitter=0.006493;rxcount=4511;txjitter=0.002304;txcount=541;rlp=0;rtt=0.020000
[2011-07-22 00:01:52] NOTICE[3316]: app_mor_debug.c:186 process_call_details: PDD:
[2011-07-22 00:01:52] NOTICE[3316]: app_mor.c:2407 mor_acct_stop: Reseller's balance will be deducted by: 0.000000, and frozen balance by: 0.000000.
mor_fax2email: ERROR! TIF file does not exist!
-- AGI Script mor_fax2email completed, returning 0
-- Executing [h@mor_fax2email:2] Hangup("Local/910007@mor_local-1f39,2", "") in new stack
== Spawn extension (mor_fax2email, h, 2) exited non-zero on 'Local/91000x@mor_local-1f39,2'

the problem can be anywhere if you get this error. Please see this page: FAX over VoIP




Make sure T38 was not enabled

If you face a problem with FAX not being received, two ways to detect this problem:

  • Fax call takes about 30 seconds, and faxes not trains (if the codec is G729, call takes a little bit more than 40seconds and fails)
  • Make a SIP debug, and you will see like this:
v=0.
o=CiscoSystemsSIP-GW-UserAgent 7568 7687 IN IP4 195.62.x.x.
s=SIP Call.
c=IN IP4 ip.add.re.ss.
t=0 0.
m=image 52972 udptl t38.
c=IN IP4 ip.add.re.ss.
a=T38FaxVersion:0.
a=T38MaxBitRate:14400.
a=T38FaxFillBitRemoval:0.
a=T38FaxTranscodingMMR:0.
a=T38FaxTranscodingJBIG:0.
a=T38FaxRateManagement:transferredTCF.
a=T38FaxMaxBuffer:200.
a=T38FaxMaxDatagram:72.
a=T38FaxUdpEC:t38UDPRedundancy.


Solution, check in sip.conf:

t38pt_udptl = no (be sure, it's NOT yes)


FAX is not received on ZAP channel

When ZAP channel is used, FAX device should be assigned to Asterisk server which has ZAP/DAHDI cards installed. Please make sure that correct Asterisk server is specified in "Server" drop-down list on FAX device settings.

It can be an issue when you have more than one Asterisk server only.




Timing module is not loaded

If Timing module is not working or if not loaded at all, FAX will fail and you will see ERROR like:

ERROR[14592]: res_fax_spandsp.c:464 spandsp_fax_new: Channel 'Local/1054@mor_local-00012b63;2' FAX session '253' failed to create timing source.
ERROR[14592]: res_fax.c:893 fax_session_new: FAX session failed to initialize.
ERROR[14592]: res_fax.c:1183 generic_fax_exec: Can't create a FAX session, FAX attempt failed.
  • Check Timing module first:
sip*CLI> timing test 50
Attempting to test a timer with 50 ticks per second.
Failed to open timing fd
Command 'timing test 50' failed.
sip*CLI> 

If you see that Timing failed like in an example above, than it seems your Timing module is not working or is missing at all. To check Timing module do like this in Asterisk CLI:

asterisk1*CLI> module show like res_timing
Module                         Description                              Use Count 
0 modules loaded

This means that you have no Timing modules loaded at all. To load Timing module, check if there are any possible Timing modules:

[root@VM ]$ cd /usr/lib/asterisk/modules/
[root@VM ]$ ll | grep res_timing
-rwxr-xr-x 1 root root  179896 Oct  2  2014 res_timing_pthread.so
-rwxr-xr-x 1 root root  165310 Oct  2  2014 res_timing_timerfd.so
[root@VM ]$ 

In example there are two Timing modules available/compiled. We load timerfd module:

VM*CLI> module load res_timing_timerfd.so
Loaded res_timing_timerfd.so
Loaded res_timing_timerfd.so => (timerfd Timing Interface)
VM*CLI>

If only pthread module is available, then we do:

VM*CLI> module load res_timing_pthread.so 
Loaded res_timing_pthread.so
Loaded res_timing_pthread.so => (pthread Timing Interface)
VM*CLI> 

After module is loaded, Timing should work already. To check it, Timing test should show something like:

VM*CLI> timing test 50
Attempting to test a timer with 50 ticks per second.
Using the 'timerfd' timing module for this test.
It has been 1000 milliseconds, and we got 50 timer ticks
VM*CLI> 

The error should be now resolved and not happen again.

  • Make sure Timing module will be loaded after Asterisk/Server restart.

Check the /etc/asterisk/modules.conf file. If you see something like:

noload => res_timing_pthread.so

Comment it or remove. This will prevent from NOLOADING the module once Asterisk starts again.


FAX over T.38 is not received

Try to set following parameters in /etc/asterisk/sip.conf

...
t38pt_udptl=yes,redundancy,maxdatagram=400
...

in /etc/asterisk/udptl.conf

udptlstart=4000
udptlend=5999
;T38FaxMaxDatagram = 400    #comment this out
use_even_ports=no    #add this



Make sure ports are not closed on the firewall

T38 default ports are 4000-5999. Make sure they are open in the firewall.



See also