There was some discussion on this subject just a few days ago.  I'll repost
here (because it was in a thread with completely different title).  This
will work over SIP if you use u-Law or a-Law codecs and good quality link
(low latency, etc).  Don't try it with any highly compressed codec, it won't
work.

I use the following in my dialplan.... asterisk 1.8 will automatically
detect fax tone and branch to "fax", for asterisk 1.4 you need to use
NVdetect/NVbackgrounddetect to catch the tone.

exten = fax,1,Gosub(fax-rx,s,1)
exten = fax,n,Hangup()

[fax-rx]
exten = s,1,NoOp(Receive FAX)
exten =
s,n,Set(emailaddr=${IF(${DB_EXISTS(actionlist/fax${CALLERID(dnid)})}?${DB_RESULT}:${DB(actionlist/fax)})})
exten =
s,n,Set(FAXFILE=/tmp/fax~${CALLERID(NUM)}~${emailaddr}~${FILTER(0123456789,${UNIQUEID})})
exten = s,n,Set(LOCALHEADERINFO=My Name)
exten = s,n,Set(LOCALSTATIONID=My Name)
exten = s,n,ReceiveFAX(${FAXFILE}.tiff)  ;Asterisk 1.8
;exten = s,n,RxFAX(${FAXFILE}.tiff)  ;Asterisk 1.4
exten = s,n,Log(NOTICE,New FAX: ${FAXPAGES} page(s) from ${CALLERID(NUM)}
(${REMOTESTATIONID}) to ${CALLERID(dnid)})
exten = s,n,Hangup()
exten = s,n,Return()

This places a .tiff file into the /tmp directory.  The filename includes the
email address that the fax should be forwarded to -- the email address comes
from the astdb "actionlist/fax" or "actionlist/faxXXX" where XXX is
destination extension. I then have an application running in background
looking for new tiff files, converting them to pdf and emailing.  I do this
outside of the asterisk dialplan as I found it more reliable....

#!/bin/bash
#

background () {
  echo $$ > /tmp/check_fax.pid
  while true;
    do
    for f in /tmp/*.tiff
    do
      if [ -f $f ]
      then
        fuser -s $f
        if [ $? -ne 0 ]
        then
          tiff2pdf -o "${f%\.*}".pdf "$f"
          mv -f "$f" /mnt/kd/fax
        fi
      fi
    done

    for f in /tmp/*.pdf
    do
      if [ -f $f ]
      then
        cidemail="${f%~*}"
        cidemail="${cidemail#*~}"
        email="${cidemail#*~}"
        cid="${cidemail%~*}"
        shortf="${f##*~}"
        mv -f "$f" "/tmp/fax-$shortf"
        echo "Subject: New FAX from $cid
From: AsteriskPBX
To: $email" | \
mime-pack "New FAX received from $cid" "/tmp/fax-$shortf" "application/pdf"
| \
sendmail -t
        rm -f "/tmp/fax-$shortf"
      fi
    done

    sleep 30
  done
  rm -f /tmp/check_fax.pid
}

background&




To allow easy changes, I pull the email address from the asterisk database
rather than hard code it into the dialplan... using the Astlinux user
interface "Actionlist" tab to set it. Use action key "fax" and enter the
email address into the data field.  You can also use action key "faxXXX"
where XXX is a destination number --  I use this so that I can send a fax to
a different email address based on the extension I am sending the fax too,
but it probably only work for faxes originating at another internal
extension rather than coming in from a DID trunk.

Once the email address is pulled from the database it becomes part of the
.tiff file name that is placed in the /tmp directory. Then the bash script
that I have running in the background parses it out, converts the tiff to
pdf, moves the tiff to the kd (for backup/archive), mails the pdf and then
deletes the pdf.  The bash script is executed on every Astlinux boot by
placing

/mnt/kd/bin/check_fax

inside the rc.local file (see Edit tab on the user interface) -- this
assumes you put the script in /mnt/kd/bin/check_fax... and set the file
attributes to make it executable (chmod +x)


Good luck
David

On Fri, Sep 30, 2011 at 1:13 PM, Nedi <n...@gmx.ch> wrote:

> Hi,
> can anyone explain me how to make settings to send and recieve fax through
> SIP
> I have astlinux with Asterisk 1.8
> Regards
> Nedi
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Astlinux-users mailing list
> Astlinux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
>
> Donations to support AstLinux are graciously accepted via PayPal to
> pay...@krisk.org.
>
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Astlinux-users mailing list
Astlinux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.

Reply via email to