Home Forum Developers General discussions Attrafax in Switchfin

JRPassphrase Registration Control

In order to register on this site, you must first submit the passphrase below.

TODO list for each hardware target can be found as sticky topic in the corresponding forum


admin
useravatar
User Info

Attrafax in Switchfin

Hi Guys,

It was a few weeks since we have been working on Attrafax http://www.zoiper.com/foip/ as FAX solution for Switchfin.

Why we selected Attrafax?
Well up to our knowledge we have two options SpanDSP http://www.soft-switch.org and Attrafax.
SpanDSP in my personal opinion is more advanced and optimized code from algorithmic view
but as a result the code requires more time to be understand and modified.
Attrafax from the other hand is very clean code. In addition it includes T38 gateway support so we decided to give it a try.
Here I would like to say that we have not done comparison between those two packages in any way or shape and what I share
is just our fillings having 1, 2 weeks touch of those FAX solutions.

The first thing we saw when we put Attrafax was that it is not working on Blackfin. smile
Well we needed few days to realize that Blackfin is crunching the floating point algos to slowly
and it didn't manage to process the 20ms frame for less then 20 ms (~60ms actually). 

It was clear that we need to rewrite the modem part of the code in fixed point.
Initially we have optimized V21 receiver and we got the FAX packets DIS, DCS coming properly.
So we decided to give it  try with the rest of the code.
So this where we spend those few weeks. 

Now we have the critical parts of V21, V17, V29, V27 in fixed point arithmetic.
Single frame is processed for around 9ms so eventually we can fit two FAX channels. There is still room for further optimizations but without big changes in the code I don't think we can achieve more than 4 FAX channels. Fortunately it is not needed by  our application.

We have successfully tested  FAX machine --->ATA--(sip)-->BR4 Appliance -> tiff file

Jason just told me that he had success with T38 stack and Zoiper client.

So things starting to look good smile

Stay tuned.
Dimitar



Edited By:  admin
Aug-17-10 00:15:46

Administrator has disabled public posting
Albi90
useravatar
User Info

Re: Attrafax in Switchfin

Hi Guys

The GUI 4.0 has been updated to support fax2email via attrafax, let us know how you go!!!

Thanks
Jason


Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Guys,

It is time to share some test results with the Fixed point version of Attrafax we got on our platform


In order to formalize the tests let's follow the original notation of attrafax-0.9/doc/t38-tests
with some Switchfin interpretation.


So let define our setup like this **********************************************************************************


fax <-> dahdi <-> IP02/IP08 <-> sip <-> Zoiper


user 6000 -> DAHDI/1 and fax connected to it, this is reffered to PSTN below
user 6001 -> sip account for Zoiper soft phone

Required configuration: **********************************************************************************************


zapata.conf

faxdetect = both

sip.conf - In both the global section and the device sections for the
t38-capable devices add

t38pt_udptl = yes

Dialplan: ***************************************************************************************************************


fax = 6000
zoiper = 6001

[default]
; tdm part =======================
; fax gw
exten => ${fax},1,Dial(DAHDI/1)

; standalone app
exten => 6701,1,RxFax_T30(/tmp/t30rx,6701)

; sip part ========================
; fax gw
exten => {zoiper},1,Dial({zoiper})

; standalone app
exten => 6702,1,RxFax_T38(/tmp/t38rx,6703)

Tests: ******************************************************************************************************************


1) Testing the gateway. The test is done in both directions.

SIP-receiving, PSTN-transmitting gateway

            * test G01: Send one page from fax to zoiper (extension 6001) and see if it's received ok.
            * test G02: Send 10 pages from fax to zoiper (extension 6001) and see if it's received ok.

    PSTN-receiving, SIP-transmitting gateway

            * test G11: Send one page from zoiper to fax (extension 6000) and see if it's received ok.
            * test G12: Send 10 pages from zoiper to fax (extension 6000) and see if it's received ok.

2) Testing the T30 (PSTN) applications:

Receiving a fax from the PSTN

            * test G21: Send one page from fax to file (extensions 6701), see the received file.
              test G22: Send 10 pages from fax to file (extensions 6701), see the received files.

Sending a fax to the PSTN:

            * test G23: sending a tiff file to the fax. We do this test using call file like this

Channel: DAHDI/1
MaxRetries: 0
RetryTime: 10
WaitTime: 30
Application: TXFAX_T30
Data: /tmp/onepage.tiff|123456


3) Testing the T38 (SIP) applications:


Receiving a fax from Zoiper

            * test G31: Send one page from Zoiper to extensions 6702, see the received file.
            * test G32: Send 10 pages from Zoiper to extensions 6702, see the received files.


Sending over SIP, normal apps:

            * Test G35: sending a tiff file to Zoiper. We do this test using call file like this

Channel: SIP/6001
MaxRetries: 0
RetryTime: 10
WaitTime: 30
Application: TXFAX_T38
Data: /tmp/onepage.tiff|123456

Test Results: ****************************************************************************************************


Currently the tests we know fixed point Attrafax passes are: G21, G22, G23, G31, G32, G11.
Still there are few tests which we are about to try. 
Please let us know in if you have tried some of the remaining G01, G02, G12, G35.


Once again thank you Zoiper guys for sharing Attrafax!

Best Regards
Dimitar


Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Guys,

Goertzel in Attrafax was rewriten in fixed point and probably this is the last thing which worths optimization for now. 

The fixed point Attrafax patch with this addition and some clean up is in SVN now.
To test Goertzel fax2 should send fax to fax1.

     fax1 <-> dahdi <-> IP02/IP08 <-> sip <-> T38 ATA <-> fax2

Please share your test results in case you have two fax machines IP02/IP08 and one of the supported ATA:

Mediatrix 1102
Cisco Linksys Sipura SPA2100 with firmware 3.3.6
Cisco Linksys Sipura SPA2102 with firmware 3.3.6
Cisco Linksys Sipura SPA3102 with firmware 3.3.6
Cisco Linksys Sipura SPA3102 with firmware 5.1.7
Cisco Linksys Sipura SPA9000 with firmware 3.3.6
Audio Codes MP-112 FXS
Allied Telesyn AT-RG613-TX
Cisco 827
Cisco 5350
AddPac 200
Grandstream HT386

Cheers
Dimitar


Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Guys,

Attrafax patch has been expanded with fixed point overflow checks in few critical points of the fax modem code.
The option is enabled by default.
In case you notice Overflow message during the fax operation please copy your complete Attrafax log here so we analyze.

You can disable this check by removing DEBUG from attrafax-0.9/include/internal/common/complex.h and this way gain some performance.

Cheers
Dimitar


Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Guys,

Jason and I did series of tests of Switchfin.
Attrafax/Switchfin now passes all of the FAX tests as defined above.

If you observe Overflow condition or some issue using this FAX solution please
let us know.

Cheers
Dimitar


Administrator has disabled public posting
ndsf
useravatar
User Info

Re: Attrafax in Switchfin

I have have completed test G21 but encountered the problem shown below trying to reproduce test G23 (send fax to PSTN) [since G21 is OK, I am now trying a hard-wired G23 example]. The configuration is as follows:

exten => 888,1,Macro(faxtransmit)

[macro-faxtransmit]
exten => s,1,Set(FAX_FORMAT="tiff")
exten => s,2,Set(FAXFILE=myfax.tiff)
exten => s,3,Txfax_T30(${FAXFILE},2108011010)

The output that appears on the CLI is this:
IP04*CLI>
    -- Starting simple switch on 'DAHDI/1-1'
    -- Executing [888@DLPN_DialPlan1:1] Macro("DAHDI/1-1", "faxtransmit") in new stack
    -- Executing [s@macro-faxtransmit:1] Set("DAHDI/1-1", "FAX_FORMAT="tiff"") in new stack
    -- Executing [s@macro-faxtransmit:2] Set("DAHDI/1-1", "FAXFILE=myfax.tiff") in new stack
    -- Executing [s@macro-faxtransmit:3] TXFAX_T30("DAHDI/1-1", "/myfax.tiff|2108011010") in new stack
t30tx/0xe79b04/0:       t30tx_init called...
t4/0xe79bc0/0:  malloc-ing page buffer, len=65536
t4/0xe79bc0/0:  page 0: 216 1165
t30tx/0xe79b04/0:       init_rxpreamble
t30tx/0xe79b04/0:       t30tx_init done...
TXFAX_T30: successfuly initialised

Everything seems fine, but the trouble is that the call is never made.
Any ideas what could be wrong?

Nikos


Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Nikos,

Do you use unchanged Switchfin or you are taking only Attrafax patch?
It looks like your asterisk is not properly patched.

Your remote fax is connected directly to the PSTN, right?

We have never tested with FX02. Did you try if the FXO port can pass thru
the fax signal? This you can test with unchanged Asterisk and without Attrafax.   
Or probably you can give it a try using IP02.

I don't expect issues with G23 and Switchfin as G23 is confirmed to be working in few scenarios. Still some issues are possible so your further testing is very welcome!

Best Regards
Dimitar


Administrator has disabled public posting
ndsf
useravatar
User Info

Re: Attrafax in Switchfin

It is the switchfin image I downloaded from switchvoice, but on hardware that it was not compiled for ... Anyway, things are looking up since I have managed to get the fax sent by using a monolithic call file:

Channel: DAHDI/g1/2108011010
Application: Txfax_t30
Data: hello.tiff|2108011010

Hopefully, I will soon be able to configure the FX02 to deliver the full fax service (promise to post is here as well).
What I have now noticed is that in some occasions, after reflashing and installing the switchfin image, the device hangs and the last few messages that appear are:

Checking for upload image to program
We have already unpacked default configuration ...
eth0: link up, 100Mbps, full duplex, lpa 0x45E1
Checking if the reset button is pressed

Any ideas on what these mean would be welcome

Nikos


Administrator has disabled public posting
ndsf
useravatar
User Info

Re: Attrafax in Switchfin

Dear Dimitar,

I am glad we have confirmed that the attrafax included by default in the Switchvoice uImage-ip02-ip08-v383.img is fixed point and hence suitable for the BF532 processor based hardware.

I managed to have the FAX Rx/Tx chain working and I have tried to summarise all the procedure sofar, so that maybe someone else can save some time setting it up.

;----- GET DOCUMENT FROM FAX MACHINE (PRODUCES infax_2D_page_0001.g3)------
[DEBUG_7777]
exten = 7777,1,NoOp($$$$$$$ SCAN DOCUMENT FROM FAX MACHINE $$$$$$$$$$$$)
exten = 7777,n,Answer()
exten = 7777,n,Set(FAX_FORCE_V29=1)
exten = 7777,n(t30),Rxfax_t30(/infax, 7777)
exten = h,1,Goto(debug_file,s,1)

;----- CONVERT infax_2D_page_0001.g3 to infax.tiff ------------
[debug_file]
exten = s,1,System(/bin/fax2tiff -3 -2 -o /infax.tiff /infax*.g3)
exten = s,n,System(rm /*.g3)
exten = s,n,Set(TX_ARGS="Data: infax.tiff|")
exten = s,n,Set(FAX_NUMBER=1234567890)
;----- SEND infax.tiff to NUMBER 1234567890 --------------------------------
exten = s,n,System(echo Channel: DAHDI/g1/1234567890 >> ./printofax.call)
exten = s,n,System(echo MaxRetries: 2 >> ./printofax.call)
exten = s,n,System(echo RetryTime: 20 >> ./printofax.call)
exten = s,n,System(echo WaitTime: 10 >> ./printofax.call)
exten = s,n,System(echo Application: Txfax_t30 >> ./printofax.call)
exten = s,n,System(echo "${TX_ARGS}${FAX_NUMBER}" >> ./foo.call)
exten = s,n,System(echo " " >> ./foo.call)
exten = s,n,System(cat ./printofax.call ./foo.call > faxsend.call)
exten = s,n,System(mv faxsend.call /var/spool/asterisk/outgoing/)
exten = s,n,Goto(default,s,1)


However this configuration is not perfect.
Although infax_2D_0001.g3 and the corresponding infax.tiff are very fine 1728x2326 1-bit/pixel documents (Rxfax_t30 works fine), when I use Txfax_t30 to send to a remote fax (e.g. DAHDI/g1/1234567890) or print locally (e.g. local/6710@local) the printed document is a corrupted version of the original. I tried to set rxgain/txgain in chan_dahdi.conf using a 1004Hz sinewave (one machine called another and stored the resulting samples using SNDREC), but still the documents printed are strangely corrupted
(possibly synchronisation is lost every 100 pixels ???? Is one of the applications trying to smooth or interpolate the image????)

To print to a local fax I used:

Channel: local/6010@local
MaxRetries: 2
RetryTime: 30
WaitTime: 60
Application: Txfax_t30
Data: /infax.tiff|local/6010@local

is this correct, or Txfax_t30 when running corrupts the file to be transmitted and I need a patch. See the attached to understand the corruption taking place (makes small print text, impossible to read)
Here is a sample of the pr[img width=100px height=100px][/img]oblem. On the left there is the original (the handwritten word "FAX"). On the right there is the received image.
http://picasaweb.google.gr/102172595061 … 1467050146

(This is the original image converted to jpeg, because picassa would not let me uploaf the original tiff. Here the picture depth is 8 bits, but the effect is clearly visible)

I am a bit stuck for ideas, so again Any help would be appreciated!

Nikos


Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Nikos,

How are your experiments around Switchfin fax going?

Best Regards
Dimitar


Administrator has disabled public posting
ndsf
useravatar
User Info

Re: Attrafax in Switchfin

I haven't updtaed the status yet, becaus I was waiting to stabilise my system. Anyway, I have now replaced Attrafax with appfax and the faxes seem to be going through nicely now via any POTS channel.
I have also set the SET_FORCE_V29 flag in the extensions.conf file
The (working) configuration is now:

Channel: DAHDI/g1/1234567890
MaxRetries: 100
RetryTime: 20
WaitTime: 60
Application: txfax
Data: /file.tiff|DAHDI/g1/1234567890

inside extensions.conf
exten = s,n,Set(FAX_FORCE_V29=1)

The problem I am faced with now is the following:
I generate inside the IP02 fax messages as tif files and send them.
These "home made" tif files seem to be going through nicely when the call is local, but have an increased probability of failure when the call is international. So far I have not seen the same problem with the tiff files aquired by the IP02 or when the call is local. The only difference that I can find is that my tiffs have fewer tags set. In the past, setting some of these tags caused problems. I am now investigating if any of them are really necessary.
As usual, any ideas will be welcome!

Nikos



Edited By:  ndsf
Nov-13-10 20:06:54

Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Nikos,

By appfax do you mean the spandsp interface we also have in Switchfin?

Best Regards
Dimitar


Administrator has disabled public posting
ndsf
useravatar
User Info

Re: Attrafax in Switchfin

Yes, this is the one


Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Nikos,

We have observed in the past that Attrafax is more stable then Spandsp on IP0x hardware. In addition we have T38 FAX stack and Gateway for Atrafax built in.

Please don't expect T30 FAX to go well for international calls.

Best Regards
Dimitar


Administrator has disabled public posting
ndsf
useravatar
User Info

Re: Attrafax in Switchfin

Well, I was planning anyway to go back and try to compile Attrafax (I haven't managed this yet - I am using pre-compiled distributions). However I am currently engaged in another panic: my IP02 does not seem to recognise its network interface. When this happens, I connet to it via the serial port and when I run the ifconfig command, I just see the local loopback and the eth0 interface has dissapeared!
So far I have managed to revive it a few times. Steps:
1) I connect via serial port
2) Flash erase
3) Set up a firmware update (the recovery procedure)
4) Rebooting the IP02 several times until it recognises its NI
However this procedure seems random. How can I find out what is really happening?

Best regards,
Nikos



Edited By:  ndsf
Nov-16-10 19:16:38

Administrator has disabled public posting
admin
useravatar
User Info

Re: Attrafax in Switchfin

Hi Nikos,

In separate topic please post your dmesg.
Is your ethernet interface working stable from u-boot?
Can you bring the eth0 up using ifconfig command?

Best Regards
Dimitar


Administrator has disabled public posting
ndsf
useravatar
User Info

Re: Attrafax in Switchfin

No the ethernet interface is still non-functional from u-boot.
It seems to recover after a random number of flash erases and reboots.
Please see separate post in the IP0x forum:
Home --> Forum --> Developers --> IP0x --> IP02 lost ethernet port


Administrator has disabled public posting
bradley
useravatar
User Info

Re: Attrafax in Switchfin

Hallo

I have tried twice, and failed, to build a stable IP0x image with both attrafax and G729 in it. When I load this image on an IP04, the box goes into a reboot cycle but doesn't provide any helpful information in the serial console, or dmesg.

Has anyone managed to do this? What should I look out for and how do I troubleshoot the reboot cycle?

Thanks

Bradley


Administrator has disabled public posting
Albi90
useravatar
User Info

Re: Attrafax in Switchfin

Hi bradley

I have noticed allot of instability with Attrafax and Asterisk 1.4.40, The rebooting cycle of the IP04 is most likely ProcWatch detecting asterisk has crashed and rebooting to fix the issue.

You can disable procwatch by running "/etc/init.d/asteriskwatch stop" you will have to be fast as procwatch checks every 27sec.

You can also try reverting to the older asterisk build or building the image without Attrafax.

Thanks
Jason


Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 2587  Total Topics: 299  Total Polls: 1  Total Posts: 1727  Dormant
User Info:   Newest User :  user2553   Members Online: 0   Guests Online: 222
Online  There are no members online
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked