asterisk 能打电话的配置

时间:2024-10-28 19:06:03

若使用的是chan_sip.so模块,则在sip.conf里添加:

[10]
type=friend
;context=phones
context=public
host=dynamic
secret=12345678

[11]
type=friend
;context=phones
context=public
host=dynamic
secret=12345678

若使用的是chan_sip.so模块,则在extensions.conf里添加:

; hzh add,其中,只有10和11是用户名,其余的不用改变
exten => 10,1,Log(NOTICE,"10/hzh ACCOUNT")
exten => 10,n,Dial(SIP/10,120,Tt)
exten => 11,1,Log(NOTICE,"11/hzh ACCOUNT")
exten => 11,n,Dial(SIP/11,120,Tt)

===================

若使用的是chan_pjsip.so模块,则在pjsip.conf里添加:

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0 []
type = endpoint
transport = simpletrans
context = public
disallow =
allow = all
aors =
auth = auth10 []
type = aor
max_contacts =
contact = sip:@192.168.23.100: [auth10]
type=auth
auth_type=userpass
password=
username= []
type = endpoint
transport = simpletrans
context = public
disallow =
allow = all
aors =
auth = auth11 []
type = aor
max_contacts =
contact = sip:@192.168.23.100: [auth11]
type=auth
auth_type=userpass
password=
username= []
type = endpoint
transport = simpletrans
context = public
disallow =
allow = all
aors =
auth = auth12 []
type = aor
max_contacts =
contact = sip:@192.168.23.100: [auth12]
type=auth
auth_type=userpass
password=
username=

若使用的是chan_pjsip.so模块,则在extensions.conf里添加(可以添加在demo里):

; hzh add,其中,只有10和11是用户名,其余的不用改变
exten => ,,Log(NOTICE,"10/hzh ACCOUNT")
;exten => ,n,Dial(SIP/,,Tt)
exten => ,n,Dial(PJSIP/${EXTEN})
exten => ,,Log(NOTICE,"11/hzh ACCOUNT")
;exten => ,n,Dial(SIP/,,Tt)
exten => ,n,Dial(PJSIP/${EXTEN})
exten => ,,Log(NOTICE,"12/hzh ACCOUNT")
;exten => ,n,Dial(SIP/,,Tt)
exten => ,n,Dial(PJSIP/${EXTEN})

; 将exten 10 的状态与 PJSIP/10的用户联系起来,之间等同
exten => ,hint,PJSIP/
exten => ,hint,PJSIP/
exten => ,hint,PJSIP/