asterisk入门资料

合集下载

《Asterisk 使用资料》

《Asterisk 使用资料》

Asterisk目录及配置文件/etc/asterisk/Asterisk主目录,包含其它关于Asterisk的配置文件;*zaptel.conf这个配置文件放在/etc,因为其它软件也可以使用Zaptel这个硬件及其驱动,所以不是放在/etc/asterisk里./usr/lib/asterisk/modules/这个目录包含所有可以加载Asterisk模块(应用程序\编辑器\格式和有用通道),在Asterisk启运时会加载这些模块(可以编辑modules.conf)./var/lib/asterisk/比较重要的是astdb文件与agi-bin目录;astdb包含Asterisk当地数据库信息.sounds/所有声音提示的文件在里面,包括Asterisk原代码中的sounds.txt文件mohmp3/如果配置了音乐保持,应用程序会在这个目录下查找mp3(用CBR从文件中去除身份标签).keys/使用公钥和私钥系统认证与一个由RSA数字签名形成的一对等连接.公钥和私钥的扩展名分别为.pub和.keyfirmware/这个目录含了很多Asterisk相兼容的设备固件,它只有iax/这个子目录,其中有Digium的IAXy的二进制固件镜像.images/只有在较多的支持并且利用图解式的图像设备被发布,这个目录将会与相应的目录有更大的关联./var/lib/asterisk/agi-bin agi-bin包含所有脚本,可以通过许多已经建立的AGI应用程序与Asterisk连接./var/spool/asteriskoutgoing/gcall/tmp/voicemail/================配置文件================/etc/asterisk/asterisk.conf主要配置文件,/etc/zaptel.conf硬件接口的基本层.修改这个配置文件要用modprobe装载Linux Kernel使用模块./etc/asterisk/zapata.conf为硬件配置Asterisk的接口./etc/asterisk/extensions.conf拨号方案./etc/asterisk/sip.conf SIP协议配置文件/etc/asterisk/iax.conf呼入和呼出IAX通道/etc/asterisk/extensions.conf拨号方案配置文件/etc/asterisk/moduprobe.conf加载模块配置文件Asterisk developer\'s documentation 翻译计划by serva今天,Asterisk已经成为一个VOIP业界使用最广泛的一个集成电信级别P BX的工具,IPPBX如今已经成为VOIP商家争夺的一块重要市场,在我们越来越熟悉使用Asterisk的同时,我们希望能够越来越深入的了解asterisk,特别是对于开发人员,如果有自己特定的需求,在复杂的asterisk文件夹和asteri sk的源代码文件中迷失了方向,不知所措。

标准ERP配置Asterisk服务器使用指南说明书

标准ERP配置Asterisk服务器使用指南说明书

CONFIGURING AN ASTERISK SERVERFrom Standard ERP's T elephony module, it is possible to fully configure an Asterisk server, whether it is installed locally on the same server as Standard ERP (only applicable on a Linux-based server) or on a separate remote server.It is also possible to integrate Standard ERP with an existing Asterisk server without managing its configuration directly from Standard ERP. Below are the steps required for a full integration, and will not explain what steps are required for local, remote, and existing servers.PBX ConnectionThe basic setting for integrating your Standard ERP system with an Asterisk server is a PBX Connection. A PBX Connection represents a connection to a unique actual VoIP Server.T o start with, you should create a new PBX Connection from the T elephony module in the PBX Connection register.A PBX Connection is defined primarily by:Code: The PBX unique identifier.Comment: A descriptive text.Type: The type of VoIP server to connect to; this can be chosen from a variety of Asterisk versions, TrixBox, Digium Switchvox, VPBX and 3CX Phone System 12 etc.Hostname: The hostname for the server being used.Host IP address: The IP address for the server being used.Port: The port through which the Asterisk's Management Interface (AMI) can be reached (5038 by default for Asterisk)Username: Username to connect to the AMI.Password:Password to connect to the AMI.Closed: A PBX Connection can be closed when it is no longer in use or valid.In the case of a locally or remotely installed Asterisk server, the T ype should be Asterisk 1.8 (AMI). The username and password can be freely set as they will be configured in the server for you.In case you are connecting to an existing server, the port, username, and password should match the content of your server's manager.conf file. Here is an example of manager configuration usable with Standard ERP:[general]enabled=yesport=5038bindaddr=0.0.0.0allowmultiplelogin=yesdisplayconnects=yestimestampevents=yes[myadmin]secret=passwordxyzdeny=0.0.0.0/0.0.0.0permit=1.2.3.4read=system,call,originatewrite=system,call,originateIn this case Port would be 5038, username myadmin and password passwordxyz. You should replace 1.2.3.4 by the IP address of your Standard ERP server.A PBX Connection has other fields organised in four tabs, and which are used when managing a local or remote server entirely from Standard ERP. Administrators using an existing server fully managed by some external means should skip over to the Contact records section.Dialling SettingsUnder this tab, you can configure the various telephony prefixes in use in your system.International Dial Prefix: T o dial out of your country.Country Code: T o dial in your country.Default Area Code: T o dial in your local area.External Line Prefix: T o dial out of your organisation.Skip Digit for International Calls:As its name indicates, you may also define digits to skip when dialling internationally.These parameters are used to place and receive calls, and to identify contacts based on their caller ID, including when using IAX (see below).RulesThis T ab allows to define a number of rules from various types:Ignore SIP Channel:In case of an existing server, this will ignore possible intermediary SIP channels to handle calls and instead only care about the end points. The Identifier is the name of the intermediary SIP channel to ignore.No Act For Calls Between Extensions Shorter Than: Disables the automatic Activity creation for internal calls (detected by the short length of internal extensions). This is only applicable for PBX Connections of the T ype Digium SwitchVox. The Identifier is the maximum length.Track number: Not used.Unique callers only: With this option, only one call will be displayed in Communicator even if there is more than one call from or to the number configured in Identifier.Remote AdministrationFrom this tab, you can define the following:Remote User: Linux user that will be used to copy the Asterisk configuration files to a remote serverRemote Configuration Directory: The path where to copy said configuration files. As such, it is important that the directory is writable by the Linux user and that your Standard ERP server has been set up to be able to connect directly to the remote Asterisk server without needing to enter a password (namely set up a Public Key Authentication between both servers).AsteriskFrom this final tab, you can enable the connection of your Asterisk server to other Asterisk server using IAX (Inter-Asterisk eXchange).Enable Inter-Asterisk eXchange(IAX):By ticking this option, you will allow all other PBX Connections configured in Standard ERP and set to use IAX to connect to this particular server as well as allow this server to connect to all other servers enabled for IAX and configured in Standard ERP.IAX Password: The password used by this server to connect to other IAX servers.Sending configuration to the serverThis section only applies to the local and remote servers situations.After completing the above configuration of a PBX Connection, you can already send the configuration to an Asterisk server.If you are running a local server, you can dump the configuration files by using the Local Asterisk Server settings from the T elephony module.First, you will need to install the Asterisk server by selecting Setup Asterisk Server in the Operation Menu. This will give you a warning pop-up reading “Starting download and installation of Asterisk server”. Click OK. This will download the binaries for the Asterisk Server from the HansaWorld servers and install them on your local server. The server will then be started. You should never have to use Setup Asterisk Server again after this.If you close the Local Asterisk Inspect window and reopen it, you will see the path where your server is installed.From the Operation Menu, you can also select “Update Asterisk Server Configuration” (which will dump the current configuration on the Asterisk server configuration directory and restart the Asterisk server so that the configuration is applied), Start Asterisk Server, and Stop Asterisk Server (which should both only rarely be used, for instance for external maintenance purposes).If you are running a remote server which is fully configured using Standard ERP, you should instead head to the Asterisk SIP Configuration Files maintenance in the Routines of the T elephony module.Use Paste Special in the PBX Connection to select the server you want to update, and tick Send Files to Server before running. If you do not tick this option, then the files will only be generated locally on your Standard ERP server.Note that this will only work if you have properly setup your PBX Connection and the Linux environment of your Asterisk server (see above).You can also select from the following other Maintenance Routines:!Asterisk SIP trunks.!Asterisk Users.These routines will generate respectively only the configuration files for the SIP trunks of a PBX Connection, or for its users, instead of regenerating all the files.Note that the files are only sent to the server but not applied. An administrator needs to connect manually to the Asterisk server and reload them. For instance by issuing a 'core reload' command from Asterisk's command line interface.Asterisk usersThe next step in setting up your Asterisk server is to create a number of users.This section is applicable for local and remote servers.From the T elephony module, you can create new Asterisk Users for your employees or partners.For each user, you can define:PBX Connections: One or more servers on which the user will be created and allowed to connect to. Leave blank to create the user on all PBX Connections configured.Name: A descriptive name.Username: Will be used to configure their SIP client.Password:Will be used to configure their SIP client.Group: No longer used.Caller ID number: The display number that might be shown to the party this user is calling. Note that this can easily be overridden by the configuration of a SIP client or SIP trunk. Especially when dialling out to international telephone numbers, Caller ID numbers are likely to get lost.Caller ID name: The display name that might be shown to the party this user is calling. Note that this can easilybe overridden by the configuration of a SIP client or SIP trunk.Especially when dialling out to a mobile or landline telephone number, plain text display names will be lost.Closed: A closed user will simply not be configured on the server and as such, it will not be possible to connect to the server using that user.No Queue Fallback: If an Asterisk User is marked as not being part of Queue Fallback, then that user will not be called when a queue is not staffed but is receiving a phone call.Note that after creating one (or more) Asterisk users, it is necessary to send the configuration to the server, as described above.Contact recordsThis section is applicable for all types of servers: local, remote, and existing.As of now, Asterisk users and Standard ERP users (Persons), and their contact cards are not connected and as such, Contact cards for your users will need to be filled in manually with their SIP contact details.In the SIP field of the contact record pertaining to your Asterisk user should be filled in as username@host name. Where username comes from the Asterisk User record, and hostname from the PBX Connection record.SIP TrunksThis section is applicable for local and remote servers.At this point of the configuration, you can place calls between users of your Asterisk server. T o reach out to the outside world, you will need a SIP trunk or VoIP trunk. Each country usually has several providers that can help you get started. As Asterisk is a commonly used VoIP server platform, it is easy to get help from your provider in general.A simple Internet search should allow you to find a number of SIP providers for your country.Using the information provided by your subscriber, you will be able to fill in the SIP Trunk record necessary for you to place calls to the rest of the world. A SIP provider will usually be able to sell you the usage of one, or more phone numbers that your contacts will be able to call to reach you. In some cases, your SIP provider might also allow you to place outgoing calls. Make sure to carefully select the SIP provider that is able to provide you with the capabilities you need to run your business smoothly.Setting up a SIP trunk comes with a wide array of technical possibilities, a number of which are supported inStandard ERP. We will detail some of those here but it is not possible to list all the possible technical configurations one can encounter.Code: Select a unique code for your SIP trunk.PBX Connection: Paste Special the PBX connection on which you want this SIP trunk to be terminated.Host: Fill in the host name or IP address provided by your SIP provider here. It might be that host and domain have the same value.Domain: Fill in the domain name provided by your SIP provider here. It might be that host and domain have the same value.Username: Fill in the username provided by your SIP provider here.Password: Fill in the information provided by your SIP provider here.Skip Digit for International Calls: This parameters operates similarly to that set in the PBX Connection but will apply to calls using the SIP trunk.Country Code:This parameters operates similarly to that set in PBX Connection but will apply to calls using the SIP trunk.Caller ID: The caller ID of your SIP trunk provider (optional).Allow anonymous calls: Lets the system accept anonymous calls coming from your providers.Allowed IPs: Only incoming calls coming from these IP addresses will be allowed. Please check with your SIP provider to only open the minimum number of addresses. (optional but important security point).Inbound phone numbers: A SIP provider may very well provide you several telephone numbers using the same SIP trunks. In certain cases, you will be given unique identifiers for each one of them. They should be filled in here. It might be that the usernames and passwords are the same as above.Trunk type:Set to Outbound calls only if you intend to input a separate configuration for Inbound Phone Numbers in the matrix as described just above. Set to In- and outbound calls if you do not have a separate configuration for Inbound Phone Numbers.IAX: Select this if your SIP trunk provider is providing you services using an Asterisk IAX trunk.Queues and MenusThis section is applicable for local and remote servers.Most of us are familiar with the telephony lines operated by large companies. A welcome Menu plays when you call into the support line of a company, after pushing a few digits on your phone and listening to a few more voice Menu messages, you are placed in a Queue. Thanks to Standard ERP's integration with Asterisk, your company can easily benefit from such technology.In Standard ERP's terminology, a Menu is used to select between different queues or menus; and a Queue is used to put in relation agents answering calls and external callers. Queues and Menus share a number of settings (Phone Numbers, Opening Times) and capabilities (Playing a sound upon arrival, when closed, etc.).Instructions for users to use queues can be found earlier in the document.A Queue contains the following information:Code: A unique identifier in Standard ERPQueue ID: A unique identifier in Asterisk which will be used by your employees to connect to the queue and start answering calls.SIP Trunk: The SIP trunk from where the calls will be arriving.Description: A free-text comment.Phone Number: (Optional) in the case where you want a direct number for callers to reach the queue without going through a Menu. Note: you can play a greetings message even in the case where callers go straight toa queue. You do not need a Menu to play a welcome message.Fallback number: An optional number to call in the case i) no agent is available in the queue AND ii) no one is logged in to the Asterisk server or everyone who is logged in is marked with “No Queue Fallback”.Open from/until: it is possible to define two sets of opening hours (to include the possibility of a lunch break for instance). In case only one set of opening hours is needed, use the first pair of “Open from”/”Open until”fields and leave the second pair blank.A Menu contains the following information:Code: A unique identifier.SIP Trunk: T he SIP trunk from where the calls will be arriving.Description: A free-text comment.Phone Number: The phone number for your contacts to dial in order to access the Menu. Optional in case the Menu is accessed via another Menu.Open from/until:It is possible to define two sets of opening hours (to include the possibility of a lunch break for instance). In case only one set of opening hours is needed, use the first pair of “Open from”/”Open until”fields and leave the second pair blank.Repeat every (s): The number of seconds between repeats of the message explaining to the caller his or her possible choices.A matrix finally allows you to configure the different Menus and Queues reachable from this Menu:Number: The digit to press for the user to enter the selected Queue or Menu. Note that in the case pressing the digit leads to entering a Queue, the digit need not be the same as the Queue ID defined in the Queue.Queue: Paste Special to an existing Queue (note, if you select this, you should not select a Menu as well).Menu: Paste Special to an existing Menu (note, if you select this, you should not select a Queue as well).Comment: A free-text comment as a reminder of what the selected Queue or Menu might be.Using Menus, you can cascade multiple levels of Menus. However, once a caller has joined a Queue, he or she will not be able to go back to another Queue or Menu.The last remaining part of the configuration is now to assign sound files to be played to guide your callers through your Menus and Queues.Whereas all the previous configuration was done in Registers of the T elephony module, sounds will be configured from the Settings of the T elephony module. More precisely, from the PBX Sounds setting.First, create a new PBX Sound. Then in Event, use Paste Special to select the type of Event that will trigger the sound file to play. The Event you select will affect whether you are selecting a Queue or a Menu in the following field. Available Events are:Initial Queue Message: Played as an initial greeting when a caller reaches a Queue.Line Busy: Played after 30 seconds of a caller waiting in a Queue.Menu Closed: Played whenever a caller arrives to a Menu outside of the defined opening hoursMenu Message: Played as an initial greeting when a caller enters a Menu (should also describes the options available from the Menu and the digits associated with each function).Music on Hold:Music to play while the caller is waiting in a Queue.Queue Closed: Played whenever a caller arrives to a Queue outside of the defined opening hours.Once an Event is selected, use Paste Special to select the Queue/Menu where the sound file should be used. Only one Queue or Menu can be selected. After Saving the Record, you can now attach a file to the Record following the usual way of dragging and dropping the file over the paperclip icon or into the Document Manager window which you can open by double-clicking the paperclip icon.Note: the attached sound file must be a mono.wav file, sampled at 8kHz.Remember to send the configuration to the server once done. The sound files will be copied during that stage a s well.。

Asterisk 入门一 --- Asterisk 1.6.2.6 安装

Asterisk 入门一 --- Asterisk 1.6.2.6 安装

Asterisk 入门一 --- Asterisk 1.6.2.6 安装2010-04-28 16:27其实asterisk安装灰常简单只要跟着安装包中的readme 文档一步一步走就可以了:1.安装测试环境虚拟机:Sun VirtualBox 3.1X操作系统:CentOS 52.Astrisk各稳定版本以及附加工具/downloads改页面有很多下载选项大概的介绍一下1.AsteriskAsterisk 源码压缩包,这就是我们要用的2.AsteriskNOWAsteriskNOW 是一个光盘镜像包含了linux 系统,一旦安装完成就有一套简单的PBX 系统了3.Asterisk Add-OnsAsterisk Add-Ons 是Asterisk 和Asterisk 一些相关的驱动和组件等。

3.下载安装# wget/pub/telephony/asterisk/releases/asteris k-1.6.2.6.tar.gz#tar -zxvf asterisk-1.6.2.6.tar.gz# cd asterisk-1.6.2.6运行配置脚本检测依赖关系并设置安装目录# ./configure --prefix=/usr/local/asterisk看到硕大的星号了嘛哈哈配置成功.$$$$$$$$$$$$$$$=...$7$7.. .7$$7:..$$:. ,$7.7.$7. 7$$$$ .$$77..$$. $$$$$ .$$$7..7$ .?. $$$$$ .?. 7$$$.$.$. .$$$7. $$$$7 .7$$$. .$$$..777. .$$$$$$77$$$77$$$$$7. $$$,$$$~ .7$$$$$$$$$$$$$7. .$$$..$$7 .7$$$$$$$7: ?$$$.$$$ ?7$$$$$$$$$$I .$$$7$$$ .7$$$$$$$$$$$$$$$$ :$$$.$$$ $$$$$$7$$$$$$$$$$$$ .$$$.$$$ $$$ 7$$$7 .$$$ .$$$.$$$$ $$$$7 .$$$.7$$$7 7$$$$ 7$$$$$$$$ $$$$$$$7. $$ (TM)$$$$$$$. .7$$$$$$ $$$$$$$$$$$$$$7$$$$$$$$$.$$$$$$ $$$$$$$$$$$$$$$$.该步骤可选,该步骤用于选择一些模块#make menuselect编译安装#make#make install安装一些简单的配置文件#make samples好了现在都安装结束了--------------------------------------------------------------------------------------------启动守护进程# safe_asterisk进入CLI#asteriks -r更多的命令可以使用 #man asterisk查看按q退出Asterisk 入门二 --- Asterisk 配置以及控制台命令2010-04-28 16:52接下来我们开始学习asterisk先提供个学习的教材和网址大部分的问题可以在/中找到解答其次提供一本 Asterisk 入门教程叫Asterisk,电话未来之路第二书签版.pdf自个摆渡下吧-------------------------------------------------------------------------------------Asterisk 几个相关目录配置文件/usr/local/asterisk/etc/asterisk可执行文件目录 /usr/local/asterisk/sbin先启动asterisk守护进程#safe_asterisk进入控制台#asterisk -rAsterisk 1.6.2.6, Copyright (C) 1999 - 2010 Digium, Inc. and others.Created by Mark Spencer <markster@>Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General PublicLicense version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details.=========================================================================Connected to Asterisk 1.6.2.6 currently running on localhost (pid = 18023)Verbosity is at least 3localhost*CLI>看看有啥命令>core show help或者具体的命令帮助>core show help <command>Asterisk app命令中文翻译2008-11-06 15:15常规指令Authenticate:鉴别用户VMAuthenticate:根据“voicemail.conf”鉴别用户Curl:接受外接URLs的修复。

asterisk模块编写

asterisk模块编写
让我们继续进行同时包含使用 Asteisk 日志模块接口,用于显示 Asterisk 日志信息,显
示日志信息也是本模块所要做的事情。 #include "asterisk/logger.h"
现在包含每个 Asterisk 模块必须的使用的两个函数,load_module()和 unload_module().
通过 CLI 命令可以自己卸载、加载你的模块,可以观测到日志信息。 *CLI> module unload res_helloworld.so
[Jun 19 10:50:57] NOTICE[26612]: res_helloworld.c:35 unload_module: Goodbye World! *CLI> module load res_helloworld.so
Asterisk1.6 的,为 Asterisk1.4 编写模块几乎一样。创建的文件名为 res_helloworld.c,存放在
Asterisk 的源代码树/res 目录下。
首先每个 Asterisk 模块都包含主要的 Asterisk 头文件,asterisk.h #include "asterisk.h“
ast_cdr_register("HelloWorld", "Hello World CDR Handler", cdr_helloworld); 在 unload_module() 中,需要对刚刚添加的应用注销。
ast_cdr_unregister("HelloWorld");
编译安装后,运行 Asterisk ,可以去确认你的新 CDR 应用是否被注册到了 Asterisk
这个功能。 复制代码 static char *handle_cli_echo(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) {

Asterisk-相关知识与应用

Asterisk-相关知识与应用

DialPlan (拨号方案)
dial : 它是Asterisk 很有价值的一功能,当来电者使用不同的通信方式时,它可以进行转换并进 行呼叫连接,如SIP电话到PSTN呼叫
Contexts : 拨号方案(DialPlan)进入部分我我们称为Contexts,每个Contexts 有一些extensions(扩展)构成,来实现一系列相关服务。
举一个例子如下: [default]
在extensions.conf 配制文件中, [default]上下文是拨号方案默认的进入部分
DialPlan (拨号方案)
goto 功能是发送呼叫到拨号方案中的其它context部分.
语法: goto(context,extension,priority)
[default] exten => 123,1,Answer() exten => 123,n,Background(main-menu) exten => 1,1,Playback(digits/1)
支持一条线路,只需要增32KB 的带宽,但是需要网络 质量良好。 Asterisk可支持成千的客户端(需要板卡与带宽支持)
asterisk 安装与启动
1从官方网站下载 asterisk-1.2.26.tar包,拷备到LINUX 下的用户目录. 2 用tar xzvf asterisk-1.2.26.tar 解压到当目录. 3 进入 asterisk 目录 执行如下命令
/usr/lib/asterisk/modules/ 这个目录包含所有可以加载Asterisk模块(应用程序\ 编辑器\格式和有用 通道),在Asterisk启运时会加载这些模块(可以编辑 modules.conf).
/var/lib/asterisk 比较重要的是astdb文件与agi-bin目录;astdb包含Asterisk当地数 据库信息. sounds/ 所有声音提示的文件在里面 mohmp3/ 如果配置了音乐保持,应用程序会在这个目录下查找mp3 keys/ 使用公钥和私钥系统认证与一个由RSA数字签名形成的一对等 连接.公钥和私钥的扩展名分别为.pub和.key

asterisk_phpagi简单开发第四版

asterisk_phpagi简单开发第四版

asterisk_phpagi简单开发第四版asteriskphpagi开发入门不知不觉过了一个多月了哈,由于呼叫中心的项目进度比较缓慢,俺也就不急了,所以边做边玩,这一版俺讲讲agi处理等待中的来电,当然这一个多月俺也把那个test.php 文件也做了一个比较大的改动。

具体请看下文。

本人水平有限,难免会有写的不周到或错误的地方,欢迎指正。

首先鼠标规则基本没颤抖,前面几版都存有表明,我就不再重复了先看一看这个test.php脚本吧#!/usr/bin/phpcq//说明上面这个是php脚步的写法,/usr/bin/php是你的php安装目录(这段话是我写的说明,请勿放在test.php里)set_time_limit(60);ob_implicit_flush(false);include(\提及phpagiUSB$num=$argv[1];//这个就是带过来的通道变量${exten}的值,获取来电者按了哪一个键或者拨了哪个分机$flag=$argv[2];//则表示就是分组还是轻易挥分机号$caller=$argv[3];//发短信号码$number=$num;//默认认为来电者直接拨分机号$group=0;//默认分组是0,表示直接拨分机号的//表示是按了一个键,表示分组if($flag){$group=$num;//分组号$number=0;}$url=\.\r;$string=file_get_contents($url);//这个字符串是mv中间件返回的$res=explode('|',$string);/*表明,我改动了这一部分$res[0]:规则状位(0:挂机或返回上一级、1:等待、2:可以接通)$res[1]:振铃状态(0:普通方式、1:同时振铃)$res[2]:可以dial的分机(如果$res[0]为2并且$res[1]为0,这里就是一个分机号;如果$res[0]为2并且$res[1]为1,这里就是多个分机号(sip/8260&sip/8263....),表示同时振铃)*//*调用远程USB回去出访数据库,然后在USB里展开了繁杂(嘻嘻)的运算,因为必须考量每个分机可能将设置了呼叫转移啊,并且必须必须满足用户一定的条件才可以引爆呼叫转移,除了轮询查阅每一个分机与否打开了应答维持,反正就是好几个递回,源码比较复杂,搞出的我快精神崩盘了,哈哈,最终还是写下出了。

Asterisk权威指南中文版-第02章Asterisk体系结构

Asterisk权威指南中文版-第02章Asterisk体系结构

第二章 Asterisk体系结构目录2.1 Modules (2)2.1.1 Dialplan Applications (3)2.1.2 Bridging Modules (6)2.1.3 Call Detail Recording Modules (6)2.1.4 Channel event logging modules (7)2.1.5 Channel Drivers (7)2.1.6 Codec Translators (8)2.1.7 Format Interpreters (9)2.1.8 Dialplan Functions (10)2.1.9 PBX Modules (12)2.1.10 Resource Modules (12)2.1.11 Addon Modules (14)2.1.12 Test Modules (15)2.2 文件结构 (15)2.2.1 Configuration files (15)2.2.2 Modules (15)2.2.3 The Resource Library (15)2.2.4 The Spool (16)2.2.5 Logging (16)2.3 The Dialplan (16)2.4 硬件 (16)2.5 Asterisk版本 (17)2.5.1 以前的版本号机制 (17)2.5.2 新的版本机制 (18)2.6 结论 (18)Asterisk完全不同于其他的,更加传统的PXB系统。

在Asterisk中,dialplan基本上采用完全一样的方法处理所有呼入channel。

在传统PBX中,“内线”和“外线”在逻辑上是分开的。

举例来说,你不能把一个外部网关联接到PBX的内线分机端口上,用户也无法在不按下外线数字的情况下拨打外线(例如,很多的IP PBX拨打外线要加拨“0”)。

与此相反,在Asterisk中并没有严格的“内线”和“外线”的概念。

Asterisk 系统及其应用分析

Asterisk 系统及其应用分析

Asterisk 系统及其应用分析
汤秀娟
北京邮电大学计算机科学与技术学院 北京(100876)
E_mail: tangxiujuan1983@
摘 要:Asterisk是由Digium公司开发的开放源码的软件PBX,它不仅支持传统的电话业务 也支持电话会议,语音信箱,收发传真等新型的业务,并且它的通用性强,可扩展性能好, 硬件成本低,因此吸引了大量的用户和开发者,有广阔的应用前景。本文系统地介绍了 Asterisk的特点,它的内部系统结构,以及系统可动态加载的API模块的功能,并且介绍了拨 号方案的语法,给出了一个拨号方案的简单例子;此外,还对Asterisk系统的初始化流程, 呼叫流程,呼入呼出场景,以及处理呼叫时的控制流程进行了详细的分析;最后,介绍了一 种基于Asterisk的VOIP解决方案。 关键词:Asterisk, VOIP, PBX 中图分类号:TP311.52 TN916.1
Asterisk向外拨号时的场景: ⑴ Dial 创建一个 outbound PBX 通道,并且要求对应的通道驱动创建一个呼叫; ⑵ 当电话被接通,asterisk 桥接媒体流,使得第一个通道的呼叫者能够与第二路通道的
被呼叫者进行通话; 有些情况下,呼入和呼出的通道使用相同的技术方案和兼容的编解码技术,这时候就会
(3) 网络系统配置更为简单,可将现有的资源,如图形用户接口(或 IM 短信)服务于 当前的需求。
(4) 通用性强,维护简单,基于 Asterisk 的软件系统易于管理和维护。 (5) 可扩展性能好,操作十分简单,而且节约时间和费用。当需要在己有的 PBX 上扩 充多个子电话时,传统的 PBX 设备不大支持这种扩充,必须换掉内部模块,这是一笔不小 的开支。但是使用 Asterisk 来充当 PBX 的内部核心软件模块,可随时更新,由软件可替代 整体的硬件更新,既节省经费又节省时间。 (6) 使用 Asterisk 来充当 IP-PBX 还有一个非常吸引人的优点是,它可以利用其 VOIP 功能用市话价格拨打长途电话,极大节省了长途通信的费用。 除了能看到的优点,在深层次的意义上 IP-PBX 系统导致了新的真正集成化的数据、语 音应用的大量出现,甚至是当前的 IPTV,从而引起了人们日常工作模式的进步以及效率的提 高。
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Asterisk入门资料目录1. 概述 (3)2. 什么是asterisk?开源电话平 (3)3. 为什么使用Asterisk? (3)4. 专利技术有什么错? (3)5. 我们要Asterisk做什么? (4)6. Asterisk支持什么技术? (4)7. 比较好的Asterisk参考书? (4)8. 相关: (4)9. 组件: (4)10. 有用的网页: (5)11. 重要链接: (5)12. 重要信息: (5)13. 外部交换借口/通道接口 (6)14. 拨号计划: (6)14.1. 上下文(context) : (6)14.2. 分机以如下格式定义: (7)14.3. Applications: (7)14.4. 特别分机: (8)14.5. 这个拨号计划会: (8)14.6. 为拨号计划添加逻辑: (8)15. 载入Ubuntu: (9)16. 求助: (9)17. 本章的任务: (10)18. 备注: (20)1.概述subscriber:加入某个group,从而遵从某一个call restricionsubscriber group:可以使用1种call restriction。

call restriction:将numbering plan中各项取出,各自组成成不同的呼叫限制方案numbering plan:通用,是一个整体的计划,里面包括长途,本地,等各种形式的方案————————————————————-以上,用于拨入号码的预处理,实际上是一种过滤,下面才是真正的呼叫处理。

————————————————————–route:一种策略,根据号码匹配的模式,选择走哪个trunk。

trunk:实际上做通一个链路,供route选择。

analog的,一个POTS就是一条analog trunkanalog的数量由设备定,ip trunk没有限制数量,并且一个ip trunk连到对方IPPBX后,对方的subscriber 数量是不确定的,由那个IP PBX决定。

Asterisk,开始吧————————————————————–2.什么是asterisk?开源电话平Asterisk 通过了电话的开源平台。

基本上就是一个软件的PBX。

最初是Digium 公司的Mark Spencer 编写的,这个公司就是他创立的,专门生产并销售Asterisk使用的硬件。

Asterisk 简直就是一场电话的革命。

3.为什么使用Asterisk?现在电信行业的混乱,因为各种专利技术应用在各种层次的网络上,导致很大的混乱。

Asterisk 就是答案——给电信行业普遍的混乱环境带来秩序的革命。

4.专利技术有什么错?没错,如果专利技术独立工作的话。

就像你有剃须刀和剃须膏没错一样!但是让各种技术互相操作,专利技术就会除了要价过高、客户不满,以及缓慢的开发速度等问题之外的刻板和局限。

5.我们要Asterisk做什么?根据情况而定。

在一个小实验室,一个pc(x86),500MHz 的奔三,合适的内存,合适的电源,还有Linux (其他os也可以支持)。

此外还有Digium 板卡插在系统中,以便连接本地PSTN。

6.Asterisk支持什么技术?与 VoIP, PSTN, ISDN, AIX, SIP 有关的任何东西。

7.比较好的Asterisk参考书?<电话未来之路>(http://www.asterisk-docs.o…找到,编译,安装,在第3,4章中,包含了到哪里去找那些文件之类的信息。

还有编译时的需要注意的选项,需要配置的模块,和在运行时载入的模块。

8.相关:gcc, glibc-kernheaders, cpp, binutils, glibc-headers, glibc-devel此外, 安装bison 和open ssl大多数标准的distro都自带推荐distro:基于RedHat和RH的distro (版本没指定)9.组件:AsteriskZaptellibpriAsterisk:Asterisk 程序文件,还有配置,监控的工具Zaptel: Zapata 项目中硬件的核心模块和驱动,如果要与PSTN或者其他网络接口,需要它。

libpri: 与Primary Rate Interface ISDN的接口库。

还有,如果基准时间参考,需要安装ztdummy 模块(第3章中解释)10.有用的网页:PSTN: /wi…G.729: /wi…G.711: /CI…Digium: /wi…Asterisk: /wi…Free World Dial-up: /wi…Asterisk Architecture: http://www.asteriskdocs.or…11.重要链接:Putty:http://www.chiark.greenend…Asterisk 通道:/w…12.重要信息:Asterisk machine on the LAN: 90.0.0.3Asterisk的目录结构:(更确切的说,是Asterisk使用的目录)/etc包含了zaptel.conf文件(只有一个)/usr/lib/asterisk/modules所有的asterisk可载入的模块都在这里,一般来说,所以的模块都是启动的时候载入的注意:要更改启动时载入的模块,或者是模块载入的方式,你可以修改/etc/asterisk/modules.conf文件/etc/asterisk包含了所有的asterisk配置文件/var/lib/asteriskagi-bin: agi 脚本固件:兼容设备固件映像:在这个目录下寻找映像(如果通道支持)关键字:这个文件中有基于RSA一类的认证关键字mohmp3:当配置了持有音乐的时候,这个目录是放置mp3的(注意,mp3应该使用恒比特率编码,并且没有id标签。

)sounds:所有的语音提示/var/spool/asteriskqcall:撤销了——包含了特殊呼叫方法的呼叫信息文件——不是打电话的好方法,因为这种方式太硬性了——不再使用。

使用outgoing替代。

Outgoing:现在打电话的法国闹事——呼叫信息目录普遍使用。

Tmp:中间/临时数据Voicemail:语音和问候语。

通过修改/etc/asterisk/voicemail.conf文件可以修改。

/var/run处理系统中运行进程的id(包括asterisk)/var/log/asteriskAsterisk在这里生产日志,通过/etc/asterisk/logger.conf来配置。

/var/log/asterisk/cdr-csv用来存储呼叫详细记录,逗号分割,例如csv(地址簿格式)重要:很多时间会使用cdr,ast附件包的代码可以在mysql数据库中存储cdr,用于记录呼叫详细记录13.外部交换借口/通道接口FXO :Digium Dev-Lite kit上的红口:Foriegn eXchange Office:这个通道(接口)的动作角色是fxo,利用fxs协议——就是说这个模块需要插入到pstn。

FXS(Digium卡的绿口):Foriegn eXchange Station,它表现得像fxs,读的是fxo协议——所以要插入终端设备——注意,这里插pstn,会烧坏!配置Foriegn eXchange Station文件:让你对常见的通道接口进行管理/comm 通道硬件,决定如何在连接的设备之间进行握手。

注意:使用zapata.conf文件完成非常重要的通道配置——激活或者失效类似回形针、回声处理之类的功能。

详细程度到pstn添加到那个端口,信令控制等——如果这里配置不正确,甭指望系统能工作正常。

14.拨号计划:在extensions.conf中指定。

Dialplan:拨号计划:在 /etc/asterisk 文件中拨号计划语法由以下组成部分:14.1.上下文(context) :写在[]里面, 定义上下文来创建独立的空间注意:最重要的一个上下文的应用就是提供安全性:要获得更多信息,看安装文件中SECURITY 文件。

例如:[incoming]statement 1—statement 2—[next-context]注意:当下一个定义的上下文开始的时候,现在这个上下文就结束了。

分机:非常简单。

与普通的PBX一样。

分机号的意思是你在连接到系统之后拨打的号码以获得某个终端/服务-不仅是asterisk14.2.分机以如下格式定义:exten =>分机的组成部分:exten => name, priority, application()例如exten => 123, 1, Answer() 的意思是当另一端拨打123,调用asterisk/apps /Answer(),优先级别为1。

优先级别通常从1开始。

数字越小,级别越高。

例如,级别1就比级别2要高。

(现在,有一些称为非数字化的级别——非常好,继续读!)一个很好的例子:exten => 123, 1, Answer()exten => 123, 2, Hangup()会发生什么情况,无论什么人拨打123,系统都会首先执行answer(),然后当answer结束的时候,过渡到hungup()。

你看,都是执行的顺序和优先级。

还有一些特殊的分机,例如s,比如我们前面的例子中123的位置,后面再解释记住:所有的优先级别都是从1开始,其他的必须遵循这个顺序。

Ast不会处理其他的,会认为是出错。

分机可是任何,不仅是数字,例如名字。

优先级:我想在前面讨论分机的时候已经讨论了优先级别。

非数字的优先级:我们会在Answer() …Hangup() 后使用n来代替实际的优先级别数字。

exten => 123, 1, Answer()exten => 123, n, Hangup()Asterisk会自动给优先级别+1, 所以你就不用每次记着并输入这个数字了Also, in Asterisk v2, we’ve got a way to put labels tp priorities:exten => 123, 1, Answer()exten => 123, n(Hangup), Hangup()14.3.Applications:应用程序:应用程序是真正执行你的拨号计划的程序。

拨号计划定义了顺序——应用程序就按照它去做。

工作内容可以是任何东西,从播放声音到接受当前通道上的按键输入。

(/w…了解asterisk通道,虽然听起来很好笑,但是我是对通道很迷惑)简而言之,应用程序是真正干活的,当有人拨打123的时候,参考以上示例。

相关文档
最新文档