Skip to content

Instantly share code, notes, and snippets.

@bao3 bao3/sip.conf
Last active Feb 17, 2016

Embed
What would you like to do?
root@v2:~# cat /etc/asterisk/sip.conf
;=================================
; SIP Configuration for Asterisk
;
[general]
context=sip ;默认使用extension.conf中的sip字段
videosupport=yes ;打开视频支持,有些客户端(手机)支持视频
textsupport = yes ;短信支持
ccept_outofcall_message = yes
outofcall_message_context = messages
allowguest=yes
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=ulaw
allow=gsm
allow=alaw
allow=h263
allow=h263p
allow=h264
alwaysauthreject=yes ;上面是支持的编码,这里则是自动匹配打开
canreinvite=no ;客户端互通,也就是对讲机模式,实体的VoIP手机搭配这个非常赞
nat=yes ; 我建议你无论何时都打开这个选项,除非你遇到问题,如果不开,两部内线电话连接WIFI后能接通但没声音
session-timers=refuse
externhost=voip.bao3.org ;这里是你的域名,也就是账户连接的的服务器
externrefresh=15
;localnet=192.168.1.0/255.255.255.0 ;这条我注释掉,因为我是VPS,如果你在路由器后面就要打开并修改
registerattempts=30
registertimeout=30
qualify=yes
maxexpiry=3600
minexpiry=600
defaultexpiry=1200
; Register to sip providers
register => 1307771983:OyM05MrO@n1.woxin.com.cn:5060 ; 这个选项是连接到联通的wo-call上,作为手机的外部号码,如果你只是需要内部免费通话,那么这一项是不需要的
;你也可以绑定其他的运营商的VoIP(SIP)电话号码,通常就是DID号码
;sip providers
;这里是定义运营商手机号码的
[voipms]
context=sip
canreinvite=no
host=n1.woxin.com.cn
secret=OyM05MrO ;密码
type=peer
username=13777771983 ;联通手机号码
fromuser=13777771983 ;联通手机号码
trustrpid=yes
sendrpid=yes
insecure=invite
nat=yes
; My SIP phones in the house/office are listed below
;
;All users
[8000] ;这里定义电话分机ID
type=peer
username=8000 ; 这里是远程连接用的用户名
secret=8000 ;用户密码
host=dynamic
port=5060
context=phone ;当8000这个号码注册时,同时套用extension.conf中的[phone]字段的规则
canreinvite=yes
dtmfmode=rfc2833
dial=SIP/8000
callerid=8000
[8001] ; 尽量让电话分机号码和用户名保持一致,少很多麻烦
type=peer
username=8001 ;和上面一样
secret=8001 ;密码
host=dynamic
port=5060
context=phone
canreinvite=yes ;打开对讲机模式,运行客户端互通,因为我的手机支持对讲机
dtmfmode=rfc2833
;=======end of sip.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.