我正在设置基于 Asterisk 1.8 的 PBX,作为要求的一部分,我需要为发送和接收传真做好准备。“总体”目标是在每台 Windows XP(或更高版本)最终用户计算机上安装传真打印机,让用户打印到该打印机,提示输入传真号码,并在发送完成后通过电子邮件回复该用户。我还希望能够接收传真(将其发送到通用电子邮件帐户)。
sip.conf:
[general]
t38pt_udptl=yes
context=from_sip
allowoverlap=no
realm=zzzz.com
udpbindaddr=0.0.0.0
tcpenable=no
tcpbindaddr=0.0.0.0
srvlookup=yes
recordhistory=yes
faxdetect=yes
localnet=192.168.0.0/255.255.0.0
externhost=place.no-ip.com
externrefresh=180
nat=yes
directmedia=no
canreinvite=no
directrtpsetup=no
[callcentric_fax_out]
type=peer
host=callcentric.com
secret=secret
defaultuser=user_num
fromuser=user_num
fromdomain=callcentric.com
nat=yes
canreinvite=no
[callcentric]
type=peer
host=callcentric.com
secret=secret
defaultuser=user_num
fromuser=user_num
fromdomain=callcentric.com
nat=yes
canreinvite=no
callbackextension=s
context=from_cc
insecure=port,invite
;other sip devices below
扩展.conf:
[general]
[globals]
[from_sip]
exten => s,1,Playback(cannot-complete-temp-error)
exten => s,n,Hangup()
[from_cc]
exten => s,1,Answer()
exten => s,n,Ringing()
exten => s,n,Wait(3)
exten => s,n,Authenticate(31337)
exten => s,n,DISA(no-password,from_office)
exten => fax,1,Goto(fax-rx,s,1)
[fax-rx]
exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n,Set(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID}.tif)
exten => s,n,ReceiveFAX(${FAXFILE})
exten => h,1,System(/usr/bin/mailfax.sh ${FAXFILE} "${CALLERID(name)}" "${CALLERID(num)}" [email protected] [email protected] MailFax ${FAXSTATUS})
[hylafax-out]
exten => _1XXXXXXXXXX,1,Gosub(call_via_callcentric_fax_out,${EXTEN},1)
exten => _XXXXXXX,1,Gosub(call_via_callcentric_fax_out,${EXTEN},1)
[call_via_callcentric]
exten => _1XXXXXXXXXX,1,Dial(SIP/${FILTER(0-9,${EXTEN})}@callcentric,30,KTr)
exten => _XXXXXXXXXX,1,Dial(SIP/1${FILTER(0-9,${EXTEN})}@callcentrice,30,KTr)
exten => _XXXXXXX,1,Dial(SIP/1516${FILTER(0-9,${EXTEN})}@callcentric,30,KTr)
[call_via_callcentric_fax_out]
exten => _1XXXXXXXXXX,1,Dial(SIP/${FILTER(0-9,${EXTEN})}@callcentric_fax_out,30,KTr)
exten => _XXXXXXXXXX,1,Dial(SIP/1${FILTER(0-9,${EXTEN})}@callcentrice_fax_out,30,KTr)
exten => _XXXXXXX,1,Dial(SIP/1516${FILTER(0-9,${EXTEN})}@callcentric_fax_out,30,KTr)
[from_office]
exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
exten => 500,n,Dial(IAX2/[email protected]/s@default,TK) ; Call the Asterisk demo
exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site
使用此拨号方案和 SIP 设置,我可以完美地接收传真。现在我想使用 Hylafax 和 IAXModem 发送传真,这些配置都是正确的。使用的传入上下文是 [hylafax-out]。最初,我只是使用 切换到我的正常呼叫上下文exten => _1XXXXXXXXXX,1,Gosub(call_via_callcentric,${EXTEN},1)
。使用 indeed 监控 Asterisk 服务器asterisk -rvvvvvv
显示 hylafax 能够通过 callcentric 拨打电话,但就在此时,灾难发生了。由于 sip.conf 中的 faxdetect=yes,Asterisk 检测到接收机器的传真音并跳转到exten => fax,1,Goto(fax-rx,s,1)
。也就是说,它识别出连接到 hylafax 通道的通道设置是 [from_cc] 上下文的一部分。
为了解决这个问题,我在 sip.conf (callcentric_fax_out) 中复制了我的 Callcentric 信息,但没有给它一个回调扩展。我修改了我的 hylafax-out 上下文以使用这个新的 sip 对等体(它只是旧对等体的克隆,减去上下文)。这很完美 - 我可以通过这个新的对等体连接发送传真,虽然 asterisk 会检测到传真 CNG 噪音,但它没有地方重定向呼叫,因此不会干扰。然而,正是在这个设置中我注意到了一个问题。
在通过对等方进行呼叫(发送传真)期间callcentric_fax_out
,似乎对callcentric
等方拒绝了来电。查看 sip 调试,我得到以下信息:
<--- SIP read from UDP:204.11.192.35:5060 --->
CANCEL sip:[email protected]:5060 SIP/2.0
v: SIP/2.0/UDP 204.11.192.35:5060;branch=z9hG4bK-9bf9ce47c01ef721aff04119c7f831ba
f: "WIRELESS" <sip:[email protected]>;tag=3501265591-800738
t: <sip:[email protected]>
i: [email protected]
CSeq: 1 CANCEL
Max-Forwards: 15
l: 0
<------------->
--- (8 headers 0 lines) ---
<--- Transmitting (NAT) to 204.11.192.35:5060 --->
SIP/2.0 481 Call leg/transaction does not exist
Via: SIP/2.0/UDP 204.11.192.35:5060;branch=z9hG4bK-9bf9ce47c01ef721aff04119c7f831ba;received=204.11.192.35;rport=5060
From: "WIRELESS" <sip:[email protected]>;tag=3501265591-800738
To: <sip:[email protected]>;tag=as6091b90b
Call-ID: [email protected]
CSeq: 1 CANCEL
Server: Asterisk PBX 1.8.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0
我的假设是,由于这些对等点共享一个 IP,Asterisk 会感到困惑。
如果有人能对我的下一步行动提出建议,我将不胜感激。再次重申,我的最终目标只是一个可以正常工作的 Windows 打印机到传真网关,并具有入站传真检测功能。如果您能提供更简单的解决方案,我将非常乐意听取您的意见。