我在CentOS 6.4 x64上配置了Asterisk 11.7.0,配置如下sip.conf
:
[general]
register =>mynumber:mypass@xxx.xxx.xxx.xxx
registertimeout=20
context=incoming
allowoverlap=no
bindport=5060
bindaddr=192.168.0.3
srvlookup=no
subscribecontext=from-sip
; The SIP provider
[VoIPProvider]
canreinvite=no
username=mynumber
fromuser=mynumber
secret=mypass
context=incoming
type=friend
fromdomain=xxx.xxx.xxx.xxx
host=xxx.xxx.xxx.xxx
dtmfmode=rfc2833
disallow=all
allow=alaw
allow=ulaw
nat=yes
insecure=very
; ext 100
[100]
type=friend
host=dynamic
secret=MyPass123
context=internal
mailbox=100@default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 200
[200]
type=friend
host=dynamic
secret=MyPass123
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
关注extensions.conf
:
[incoming]
; Ring on extension 100, 200 and the mobile phone.
exten => s,1,Answer()
exten => s,n,Dial(SIP/100&SIP/200&SIP/VoIPProvider/*320423456789,150,r,t,)
; Pass unanswered call to a mobile phone
exten => s,n,Dial(SIP/VoIPProvider/*320423456789,150,r)
; Still not answered? Pass unanswered calls to voicemail
exten => s,n,Voicemail(100,u)
exten => s,n,Hangup
[outgoing]
exten => _XXXXXXXXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
[internal]
exten => _XXX,1,Dial(SIP/${EXTEN})
; Calls to ext 100
exten => 100,1,Dial(SIP/100,20)
exten => 100,n,VoiceMail(100,u)
exten => 100,n,Hangup
; Calls to ext 200
exten => 200,1,Dial(SIP/100,20)
exten => 200,n,Hangup
每当我从手机拨打我的号码时,我都会收到拒绝信号。当我检查wireshark日志时,我看到三个SIP数据包:
MySipProvider - >我:邀请啜饮:s@192.168.0.3:5060 我 - > MySipProvider:401未经授权 MySipProvider - >我:ACK sip:s@192.168.0.3:5060
那就是全部。可能会发生什么?谢谢。
答案 0 :(得分:1)
看起来您的Asterisk服务器正在请求来自您的提供商的来电进行身份验证。我猜测为什么是因为sip.conf中“VoIPProvider”条目的“主机”值与呼叫来自的IP地址相匹配。您可以通过暂时注释掉“主机”值并查看来电是否有效来检查这是否是问题。如果是这样,您将需要对“VoIPProvider”条目进行调整,使其仅与传出呼叫匹配,而不是传入和传出(您过去通过设置“类型”来执行此操作,但我不是在路上更新现在已经完成了。)
答案 1 :(得分:1)
解决传出问题,内部和外部的用户上下文不包含在其中,请在extension.conf中的上下文内添加以下行
[内部] include =传出
以便您的用户可以在SIP中继拨号。 :)
答案 2 :(得分:0)
使用寄存器字符串: register => urusername:urpassword @名称IP地址/的providerName
就像你的情况一样:
register => mynumber的:mypassword@X.X.X.X/VoIPProvider
给它一个去ithink这将解决问题:)