Was this page helpful?

SpanDSP as a FAX machine

    SpanDSP - 這是一個 DSP(Digital Signal Processing) 訊號處理的函式庫套件。Asterisk 的傳真模組 app_fax 需要用到這個套件。

    系統環境

    • PIAF 1.7.5.5: Asterisk 1.6.2 + FreePBX
    • OpenVox A400P

    安裝 SpanDSP

    下載位址:http://www.soft-switch.org/downloads...shots/spandsp/

    cd /usr/src
    tar xzf spandsp-20110703.tar.gz
    cd spandsp-0.0.6
    ./configure
    make clean
    make
    make install 
    

    檢查安裝

    #whereis libspandsp.so
    libspandsp: /usr/local/lib/libspandsp.la /usr/local/lib/libspandsp.a /usr/local/lib/libspandsp.so 
    

    安裝 app_fax 模組

    由於 Asterisk 1.6 已經內建有此模組,但 PIAF 預設並未安裝,所以需要重新編譯 Asterisk;如果是 Asterisk 1.4,請到此下載 http://sourceforge.net/projects/agx-ast-addons/

    amportal stop
    cd /usr/src/asterisk
    ./configure
    make menuselect
    

    選擇 app_fax 項目

    Applications -> app_fax ;確定此項是[*],而不是 [XXX]

    Save & Exit

    make clean
    make
    make install 
    

    Notes:

    如果要保留所有原有的設定檔,請不要執行 make config。

    app_fax 安裝完成,驗證方法:

    #amportal start
    #asterisk -rx "module show like app_fax"
    Module                         Description                              Use Count
    app_fax.so                     Simple FAX Application                   0
    1 modules loaded
    
    #asterisk -rx "core show application sendfax"
    #asterisk -rx "core show application receivefax"
    

    傳真測試

    接收傳真

    FreePBX > Tools > Config Edit > extensions_custom.conf

    [my-fax-in]
    exten => s,1,Answer
     same => n,Wait(2)
     same => n,Set(TIFF=/var/spool/asterisk/fax/fax_${STRFTIME(,,%Y%m%d-%H%M)}_${RAND(1)}.tiff)
     same => n,ReceiveFAX(${TIFF})
     same => n,Hangup
    

    FreePBX > Tools > Custom Destinations > Add

    Custom Destination = my-fax-in,s,1
    Description = FAX-IN

    FreePBX > Setup > Inbound Route > Add

    Description = FXO4
    DID Number = <請先設定 Zap Channel DIDs>
    Set Destination = Custom Destination: FAX-IN

    發送傳真

    編輯 extensions_custom.conf

    [my-fax-out]
    exten => s,1,NoOp(**** SENDING FAX ****)
    exten => s,n,Wait(1)
    exten => s,n,Set(FAXCOUNT=1)
    exten => s,n,Set(FAXFILE=fax_out_demo.tiff)
    
    exten => s,n,NoOp(**** SETTING FAXOPT ****)
    exten => s,n,Set(FAXOPT(ecm)=yes)
    exten => s,n,Set(FAXOPT(localstationid)=035981786)
    exten => s,n,Set(FAXOPT(maxrate)=14400)
    exten => s,n,Set(FAXOPT(minrate)=2400)
    
    exten => s,n,NoOp(**** SENDING FAX : ${FAXFILE} ****)
    exten => s,n,SendFAX(/tmp/fax-out/${FAXFILE},d)
    
    exten => s,n,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
    exten => s,n,NoOp(FAXOPT(filename) : ${FAXOPT(filename)})
    exten => s,n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})
    exten => s,n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})
    exten => s,n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})
    exten => s,n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})
    exten => s,n,NoOp(FAXOPT(pages) : ${FAXOPT(pages)})
    exten => s,n,NoOp(FAXOPT(rate) : ${FAXOPT(rate)})
    exten => s,n,NoOp(FAXOPT(remotestationid) : ${FAXOPT(remotestationid)})
    exten => s,n,NoOp(FAXOPT(resolution) : ${FAXOPT(resolution)})
    exten => s,n,NoOp(FAXOPT(status) : ${FAXOPT(status)})
    exten => s,n,NoOp(FAXOPT(statusstr) : ${FAXOPT(statusstr)})
    exten => s,n,NoOp(FAXOPT(error) : ${FAXOPT(error)})
    

    call file

    Channel: DAHDI/4/0422715575
    MaxRetries: 0
    RetryTime: 60
    WaitTime: 60
    Archive: yes
    Context: my-fax-out
    Extension: s
    Priority: 1
    Set: FAXFILE=/var/lib/asterisk/fax-outgoing/output.tif
    Set: FAXHEADER=This fax is from Asterisk
    Set: TIMESTAMP=25/01/11 : 16:40:01
    Set: DESTINATION=04888999
    Set: LOCALID=031234567
    Set: [email protected]
    
    Was this page helpful?
    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core