这段时间一直在研究asterisk,是基于《Asterisk™ The Future of Telephony》这本书展开的,涉及asterisk的安装,调试,SIP,IAX,以及一些基本的配置等,这里对测试的脚本进行留存
因为我们用的asterisk大部分都装了 freepbx等,配置文件看起来超复杂,找不到重点,这里的保留最原始的。。
配置SIP分机用的,这个文件其实可以超简单的。。
sip.conf
[general]
register => tontone:123456@192.168.0.105/asaka
[asaka]
type=friend
host=192.168.0.105
context=asaka_incoming
secert=123456
[1000]
type=friend
host=dynamic
context=from-internal
[2000]
type=friend
host=dynamic
context=from-internal
;requirecalltoken=no
配置IAX用的。。
iax.conf
[general]
autokill=yes
register => asaka:123456@192.168.0.105
[tontone]
type=friend
secret=123456
host=dynamic
context=incoming_tontone
trunk=yes
;requirecalltoken=no
[zoiper]
type=friend
host=dynamic
context=from-internal
配置dahdi
chan_dahdi.conf
;# Flash Operator Panel will parse this file for dahdi trunk buttons
;# AMPLABEL will be used for the display labels on the buttons
;# %c Dahdi Channel number
;# %n Line number
;# %N Line number, but restart counter
;# Example:
;# ;AMPLABEL:Channel %c – Button %n
;# For Dahdi/* buttons use the following
;# (where x=number of buttons to dislpay)
;# ;AMPWILDCARDLABEL(x):MyLabel
[channels]
language=en
; include dahdi extensions defined in FreePBX
#include chan_dahdi_additional.conf
#include dahdi-channels.conf
; XTDM20B Port #1,2 plugged into PSTN
;AMPLABEL:Channel %c – Button %n
;context=from-pstn
;signalling=fxs_ks
;faxdetect=incoming
;usecallerid=yes
;echocancel=yes
;echocancelwhenbridged=no
;echotraining=800
;group=0
;channel=1-2
usecallerid=yes
hidecallerid=no
callwaiting=no
threewaycalling=yes
transfer=yes
echocancel=yes
echotraining=yes
immediate=no
callerid=4001
; define channels
context=from-internal ; Uses the [internal] chntext in extensions.conf
signalling=fxo_ks ; Uses FXO signalling for an FXS channel
channel => 1 ; Telephone attached to port 1
context=from-pstn ; Incoming calls go to [incoming] in extensions.conf
signalling=fxs_ks ; Use FXS signalling for an FXO channel
channel => 2 ; PSTN attached to port 2
dahdi-channels.conf
; Autogenerated by /usr/sbin/dahdi_genconf on Tue Jun 22 16:59:35 2010 — do not hand edit
; Dahdi Channels Configurations (chan_dahdi.conf)
;
; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended
; to be #include-d by /etc/asterisk/chan_dahdi.conf that will include the global settings
;
; Span 1: WCTDM/4 “Wildcard S400P Prototype Board 5” (MASTER)
;;; line=”1 WCTDM/4/0″
signalling=fxo_ls
callerid=”Channel 1″ <4001>
mailbox=4001
group=5
context=from-internal
channel => 1
callerid=
mailbox=
group=
context=default
;;; line=”2 WCTDM/4/1″
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 2
callerid=
group=
context=default
配置拔号方案
extensions.conf
[globals]
OUTBOUNDTRUNK=DAHDI/2
TELE=DAHDI/1
ZOIPER=IAX2/zoiper
[general]
autofallthrough=yes
[default]
exten => s,1,Verbose(1|Unrouted call handler)
exten => s,n,Answer()
exten => s,n,Wait(1)
exten => s,n,Playback(tt-weasels)
;exten => s,n,Dial(sip/1000,20)
;exten => s,n,Record(/var/spool/asterisk/monitor/asterisk-${EXTEN}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}:wav)
exten => s,n,Hangup()
[incoming_tontone]
include => from-internal
exten => _105XXX.,1,Verbose(1|exten is 105XXX)
exten => _105XXX.,n,NoOp()
exten => _105XXX.,n,Dial(IAX2/tontone/${EXTEN:3},20)
exten => _105XXX.,n,Playback(the-party-you-are-calling&is-curntly-unavail)
exten => _105XXX.,n,Hangup()
[asaka_incoming]
exten => _135XXX.,1,Verbose(1|exten is 1055XXXX)
exten => _135XXX.,n,NoOp()
exten => _135XXX.,n,Dial(SIP/asaka/${EXTEN:3},20)
exten => _135XXX.,n,Playback(the-party-you-are-calling&is-curntly-unavail)
exten => _135XXX.,n,Hangup()
include => incoming_tontone
include => internal
include => call-out
[from-internal]
include => internal
include => incoming_tontone
include => asaka_incoming
include => call-out
include => test-waitexten
[internal]
exten => _XXXX,1,Verbose(1|Unrouted call handler)
exten => _XXXX,n,Answer()
exten => _XXXX,n,Wait(1.2)
exten => _XXXX,n,Dial(SIP/${EXTEN},20)
;exten => _XXXX,n,VoiceMail(2000@default,u)
exten => _XXXX,n,hangup()
exten => 8,1,Directory(default,incoming,f)
exten => 9,1,Directory(default,incoming)
exten => 456,1,Set(DB(test/count)=1)
exten => 456,n,Set(COUNT=${DB(test/count)})
exten => 456,n,SayNumber(${COUNT})
exten => 500,1,Macro(voicemail,SIP/2000)
exten => 600,1,MeetMeCount(600,CONFCOUNT)
exten => 600,n,GotoIf($[${CONFCOUNT} <= 10]?meetme:conf_full,1)
exten => 600,n(meetme),MeetMe(600,i,54321)
exten => conf_full,1,Playback(conf-full)
exten => 601,1,Playback(conf-thereare)
exten => 601,n,MeetMeCount(600)
exten => 601,n,Playback(conf-peopleinconf)
exten => 777,1,Macro(mysql,15921256331)
[test-waitexten]
exten => 123,1,Answer()
exten => 123,n,Background(enter-ext-of-person)
exten => 123,n,WaitExten()
exten => 2,1,playback(digits/2)
exten => 2,n,Goto(123,1)
exten => 3,1,playback(digits/3)
exten => 3,n,Goto(123,1)
exten => i,1,playback(pbx-invalid)
exten => i,n,Goto(123,1)
exten => t,1,playback(vm-goodbye)
exten => t,n,hangup()
[macro-voicemail-a]
exten => s,1,Dial(${ARG1},10)
exten => s,n,GotoIf($[“${DIALSTATUS}” = “BUSY”]?busy:unavail)
exten => s,n(unavail),Voicemail(${MCARO_EXTEN}@default,u)
exten => s,n,Hangup()
exten => s,n(busy),VoiceMail(${MCARO_EXTEN}@default,b)
exten => s,n,Hangup()
[macro-voicemail]
exten => s,1,Dial(${ARG1},20)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN},u)
exten => s-NOANSWER,n,Goto(incoming,s,1)
exten => s-BUSY,1,Voicemail(${MACRO_EXTEN},b)
exten => s-BUSY,n,Goto(incoming,s,1)
exten => _s-.,1,Goto(s-NOANSWER,1)
[macro-mysql]
exten => s,1,Set(NUM_tmp=${ARG1})
exten => s,n,GotoIf($[${NUM_tmp:0:1}=1]?judge)
exten => s,n,Set(DIAL_NUMBER=${NUM_tmp})
exten => s,n,Goto(continue)
exten => s,n(judge),Set(ExtenPre=${Num_tmp:0:7})
exten => s,n,MYSQL(Connect connid localhost freepbx fpbx test)
exten => s,n,MYSQL(Query resultid ${connid} select id from astest where phone=${ExtenPre})
exten => s,n,MYSQL(Fetch fechid ${resultid} id)
exten => s,n,Noop(${fechid})
exten => s,n,Set(DIAL_NUMBER=${IF($[${fechid}=0]?0${NUM_tmp}:${NUM_tmp}))
exten => s,n,MYSQL(Clear ${resultid})
exten => s,n,MYSQL(Disconnect ${connid})
[call-out]
exten => _XXX.,1,answer()
exten => _XXX.,n,wait(1)
exten => _XXX.,n,Monitor(wav,asterisk-monitor-${EXTEN}-%d})
exten => _XXX.,n,Dial(${OUTBOUNDTRUNK}/${EXTEN})
exten => _XXX.,n,Hangup()
[from-pstn]
;exten => s,1,Zapateller(nocallerid)
;exten => s,n,Playback(enter-ext-of-person)
exten => s,1,answer()
exten => s,n,wait(1.5)
;exten => s,n,Monitor(wav,asterisk-monitor-${EXTEN}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten => s,n,GotoIfTime(8:00-22:00,*,*,*?dial-tele,s,1)
;exten => s,n,Goto(from-internal,1000,1)
exten => s,n,Voicemail(2000,u)
exten => s,n,Hangup()
[dial-tele]
exten => s,1,Monitor(wav,asterisk-monitor-${EXTEN}-%d})
exten => s,n,Dial(${TELE},20,Tt)
;exten => s,n,Dial(${ZOIPER},20)
;exten => s,n,Verbose(1|test tele ${DIALSTATUS})
;exten => s,n,GotoIf($[“${DIALSTATUS}”=”CANCEL”]?cancel:)
exten => s,n(cancel),Hangup()
配置voicemail
voicemail.conf
[general]
#include vm_general.inc
#include vm_email.inc
[default]
2000 => 1234,Aaron,evane1890@gmail.com,chen_jiang_tao@hotmail.com
500 => 1234,Aaron2,evane1890@gmail.com,chen_jiang_tao@hotmail.com
配置会议
meetme.conf
[rooms]
#include meetme_additional.conf
conf => 600
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/100513.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...