对asterisk的一些研究

对asterisk的一些研究

这段时间一直在研究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账号...

(0)


相关推荐

  • 微信模拟位置想在哪就在哪(GPS欺骗)

    微信模拟位置想在哪就在哪(GPS欺骗)微信模拟位置是通过位置欺骗,让微信误以为我们就在当前的位置进行周边好友的搜索与添加。这是一个很老的功能,为什么说很老呢?因为这是在android4.1的时候流行的一个功能,android在4.4推出后这个功能基本不能使用了!即使很老但是最近也碰到了这样的需求,不过针对特殊的群体,手机定制而来,就没有限制了!首先我们要知道怎么用:首先:我们从设置里找到开发者选项(开发者都知道):在这里就是,开发人

  • 暴力破解工具-hydra使用「建议收藏」

    一、hydra简介:ydra(九头蛇),分布式任务处理系统,由社交标签服务提供商AddThis六年前开发,现在已得到Apache的开源许可,就像Hadoop一样,只是还没有Hadoop那样的知名度和声势。Hydra的创造者称,该“多头”平台非常擅长处理一些大的数据任务——对非常大的数据集进行实时处理。hydra是一款世界顶级密码暴力破解工具,支持几乎所有的协议的在线破解,功能强大,其密码…

  • Java集合之WeakHashMap[通俗易懂]

    Java集合之WeakHashMap[通俗易懂]WeakHashMap继承于AbstractMap,同时实现了Map接口。和HashMap一样,WeakHashMap也是一个散列表,存储的内容也是键值对key-value映射,并且键和值都可以是null。WeakHashMap的键都是弱键,给定一个键,其映射的存在并不阻止垃圾回收器对该键的丢弃,使该键成为可终止,然后被回收。弱键的原理就是Entry继承了WeakReference接口,当G

  • openwrt安装aliddns使用阿里云ddns[通俗易懂]

    openwrt安装aliddns使用阿里云ddns[通俗易懂]openwrt安装aliddns使用阿里云ddns一些小伙伴安装了openwrt之后发现没法使用阿里云的ddns解析这里告诉你怎么添加aliddns插件需要会一些linux基础命令和ssh分四步安装依赖下载插件上传插件安装插件安装ddns-scripts、luci-app-ddns、openssl-util、wget依赖包使用luciweb界面里面的软件包管理,或者ssh使用opkg安装都一样有的openwrt自带的源地址可能下载很慢或根本无法下载,得换源下载alid

  • c++如何获取系统当前时间(超级详细)

    c++如何获取系统当前时间(超级详细)voidgettime(){time_trawtime;structtm*ptminfo;time(&rawtime);ptminfo=localtime(&rawtime);printf(“current:%02d-%02d-%02d%02d:%02d:%02…

    2022年10月19日
  • pycharmimport时找不到指定文件_pycharm系统找不到指定文件

    pycharmimport时找不到指定文件_pycharm系统找不到指定文件1、现象系统提示找不到指定的文件:Errorrunning’hello’:Cannotrunprogram"B:\pystudy\venv\Scripts\python.exe"(indirectory"\python-study"):CreateProcesserror=2,系统找不到指定的文件。2、原因原来的工程目录(B盘)下,保存了python的编…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号