用Sipp 对Asterisk 进行性能测试的工作笔记
用Sipp 对Asterisk 进行性能测试的工作笔记
用Sipp 对Asterisk 进行性能测试的工作笔记公司需要, 对Asterisk 进行一定的性能测试.测试目标:1. IVR 支持多少路2. 一对一通话, 支持多少路3. 不同编解码的性能影响.4. 通话中,录音, 支持多少路.测试工具: sipp /辅助工具: XliteSIP rfc:/rfc/rfc3261.txtRTP for AV /rfc/rfc3551.txt环境:CPU: xeon 51101.6G*2 , 1 G MEM 物理机Asterisk1.4.7Asterisk 基本操作:启动: safe_asterisk, 或者asterisk -vvvc如果是后台启动, 连接监控: astersisk -r关闭: 在控制栏输入stop nowAsterisk 配置:关注两个配置文件(/etc/asterisk):sip.conf // sip 分机号设置extensions.conf // dail plan 设置, 控制呼入后是什么动作sip.conf 添加2000 个分机号, 以便模拟1000 人呼叫(呼叫,应答)[1000]type=friendhost=dynamiccontext=incoming //和extensions.conf 中对应canreinvite=no //如果设置为yes, 双方通话信息会直接进行, 而不通过asterisk. 设置成no,表示所有交互都通过Asterisk.[1001]type=friendhost=dynamiccontext=incomingcanreinvite=noextensions.conf 这里列举了多种呼叫计划, 包括IVR, 拨号通话, 通话录音等.[incoming];play hello world foreverexten => _XXXX,1,answer()exten => _XXXX,2,playback(hello-world)exten => _XXXX,3,goto(OneToOne,_XXXX,1);[typetest];exten => 1111,1,Wait(2);exten => 1111,2,Record(/tmp/asterisk-recording:gsm);exten => 1111,3,Hangup;exten => 1112,1,Wait(2);exten => 1112,n,Playback(/tmp/asterisk-recording);exten => 1112,n,Hangup;[typetest2];exten => _XXXX,1,answer();exten => _XXXX,2,dial(sip/${EXTEN},10,r);[typetest3];exten => 999,1,answer();exten => 999,2,dial(sip/${EXTEN},10,r);exten => 999,1,Meetme(1234,i,123456);[OneToOne];exten => _XXXX,1,answer();exten => _XXXX,2,mixmonitor(test${EXTEN}.wav|av(0)V(0));exten => _XXXX,3,dial(sip/${EXTEN},10,r);exten => _XXXX,4,Hangup;exten => _XXXX,3,Record(/tmp/asterisk-recording${EXTEN}:gsm);exten => _XXXX,1,answer();exten => _XXXX,2,playback(hello-world);exten => _XXXX,3,goto(IVR,_XXXX,2)Sipp 基本操作:sipp 涉及三个文档(以呼入后,就不停播放IVR 语音):*.bat 批处理命令,方便调用, 其中 -m 参数表示sipp -sf a16.xml -inf a16.csv -p 5062 -m 200 -i 172.16.3.199 10.0.1.4:5060 -trace_err*.xml // 具体的操作, 核心部分, 下篇具体介绍xml 文件*.csv // xml 里面引用的参数, 以便发起不同呼叫SEQUENTIAL2001;1002;2003;1003;2200;1200;xml 文件 . 本文草本出自狼山客人, 保留其相关注释.<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE scenario SYSTEM "sipp.dtd"><!-- This program is free software; you can redistribute itand/or --><!-- modify it under the terms of the GNU General Public License as --> <!-- published by the Free Software Foundation; either version 2 of the --><!-- License, or (at your option) any laterversion. --><!-- --><!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warrantyof --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe --><!-- GNU General Public License for moredetails. --><!--<!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write tothe --><!-- Free Software Foundation,Inc., --><!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307USA --><!-- --><!-- Sipp default 'uac'scenario. --><!-- --><scenario name="Basic Sipstone UAC"><!--狼山客人:下面这一块表示SIPp发送一个INVITE数据包到SIPserver(Wavesplitter的MSP-16)--><send><![CDATA[INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport][local_ip]:[local_port];branch=[branch];rportFrom: [field0]<sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>Call-ID: [call_id]Cseq: 1 INVITEContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Type: application/sdpContent-Length: [len]v=0o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]s=-t=0 0c=IN IP[media_ip_type] [media_ip]m=audio [media_port] RTP/AVP 0a=rtpmap:0 G726/8000]]></send><!--狼山客人:下面这一块表示SIPp在等待SIP server返回一个100的数据包--><recv response="100"> optional="true"</recv><!--狼山客人:下面这一块表示SIPp在等待SIP server返回一个200的数据包,如果收到,说明ViVoice公司的VENUS NW800视频电话已经接听了,用户已经提起话筒--><recv response="200"></recv><!--狼山客人:下面这一块表示SIPp开始通话--><!-- Packet lost can be simulated in any send/recv messageby --><!-- by adding the 'lost = "10"'. Value can be [1-100]percent. --><send><![CDATA[ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp<sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: sut <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id]CSeq: 1 ACKContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Length: 0]]></send><!--狼山客人:下面这一块表示SIPp开始发送语音RTP stream,在VENUS NW800视频电话上可以听到不知道哪国的老外的声音--><!-- Play a pre-recorded PCAP file (RTP stream) --><nop><action><exec play_pcap_audio="pcap/g711a.pcap"/></action></nop><!--狼山客人:暂停10秒钟(10000),一小时, 3600000,等待播放语音完毕--><pause milliseconds="300000"/><!--狼山客人:下面这一块发送BYE信号,这是挂断电话信号--><send retrans="500"><![CDATA[BYE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport] [local_ip]:[local_port]From:sipp <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: sip <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id]Cseq: 2 BYEContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Length: 0]]></send><!--狼山客人:下面这一块表示挂断完毕--><recv response="200"></recv></scenario>里面的业务逻辑需要自己确认, 最好的方法是通过抓包(比如ethereal), 分析其工作流. 不同情况下, 返回的信息有所不同, 需要相应调整.上面是个呼入后,播放IVR 的案例, 比较简单.下面是register 的例子(要测试通话, 就要先注册分机号)<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE scenario SYSTEM "sipp.dtd"><!-- This program is free software; you can redistribute itand/or --><!-- modify it under the terms of the GNU General Public License as --> <!-- published by the Free Software Foundation; either version 2 of the --><!-- License, or (at your option) any laterversion. --><!-- --><!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warrantyof --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe --><!-- GNU General Public License for moredetails. --><!-- --><!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write tothe --><!-- Free Software Foundation,Inc., --><!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307USA --><!-- --><!-- Sipp default 'branchc'scenario. --><!-- --><scenario name="Basic Sipstone UAC"><send retrans="500"><![CDATA[REGISTER sip:[field0]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport][local_ip]:[local_port];branch=[branch];rportFrom: [field0]<sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]To: [field0] <sip:[field0]@[remote_ip]:[remote_port]>Call-ID: [call_id]CSeq: [cseq] REGISTERVia: SIP/2.0/[transport][local_ip]:[local_port];branch=z9hG4bK-d87543-717507386-1--d87543-;rp ortContact: <sip:[field0]@[local_ip]:[local_port]>Expires: 1200Max-Forwards: 70User-Agent: eyeBeam release 3004t stamp 16741Allow:INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFOContent-Length: 0]]></send><recv response="100"> optional="true"</recv><recv response="200" crlf="true"></recv></recv></scenario>Register 后, 先把被叫号码启动, 进入守护状态, 等到有电话呼叫(INVITE) 后, 震铃接通, 并发送数据. 产生通话效果.<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE scenario SYSTEM "sipp.dtd"><!-- This program is free software; you can redistribute itand/or --><!-- modify it under the terms of the GNU General Public License as --> <!-- published by the Free Software Foundation; either version 2 of the --><!-- License, or (at your option) any laterversion. --><!-- --><!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warrantyof --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe --><!-- GNU General Public License for moredetails. --><!-- --><!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write tothe --><!-- Free Software Foundation,Inc., --><!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307USA --><!-- --><!-- Sipp default 'branchs'scenario. --><!-- --><scenario name="branch_server"><!-- Set variable 3 if the ua is of the form ua2... --><recv request="INVITE" crlf="true"></recv><!-- send 180 then trying if variable 3 is set --><send next="1"><![CDATA[SIP/2.0 180 Ringing[last_From:][last_To:];tag=[call_number][last_Call-ID:][last_CSeq:][last_Via:]Contact: <sip:[field0]@[local_ip]:[local_port]>Content-Length: 0]]></send><label id="1"/><send retrans="500"><![CDATA[SIP/2.0 200 OK[last_From:][last_To:];tag=800000[call_number][last_Call-ID:][last_CSeq:][last_Via:]Contact: <sip:[field0]@[local_ip]:[local_port]>Allow:INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFOContent-Type: application/sdpContent-Length: 136v=0o=- 2372001 2372043 IN IP4 [local_ip]s=eyeBeamc=IN IP4 [local_ip]t=0 0c=IN IP4 [media_ip]m=audio [media_port] RTP/AVP 0a=fmtp:101 0-15a=rtpmap:100 speex/16000a=rtpmap:101 telephone-event/8000a=sendrecv]]></send><recv request="ACK"rtd="true"crlf="true"></recv><label id="2"/><nop><action><exec play_pcap_audio="pcap/g711a.pcap"/></action></nop><pause milliseconds="7000" next="2" /><!-- Keep the call open for a while in case the 200 is lost to be --> <!-- able to retransmit it if we receive the BYEagain. --><!-- definition of the response time repartition table (unit isms) --><!-- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> --><!-- definition of the call length repartition table (unit isms) --><!-- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> --><ResponseTimeRepartition value="20, 40, 60, 80, 100, 200, 400, 800"/> <CallLengthRepartition value="20, 100, 200, 1000, 2000, 10000, 20000"/></scenario>被叫准备好以后, 主叫开始呼叫<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE scenario SYSTEM "sipp.dtd"><!-- This program is free software; you can redistribute itand/or --><!-- modify it under the terms of the GNU General Public License as --> <!-- published by the Free Software Foundation; either version 2 of the --><!-- License, or (at your option) any laterversion. --><!-- --><!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warrantyof --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe --><!-- GNU General Public License for moredetails. --><!-- --><!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write tothe --><!-- Free Software Foundation,Inc., --><!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307USA --><!----><!-- Sipp 'uac' scenario with pcap (rtp)play --><!-- --><scenario name="UAC with media"><!-- In client mode (sipp placing calls), the Call-ID MUSTbe --><!-- generated by sipp. To do so, use [call_id]keyword. --><send retrans="500"><![CDATA[INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport][local_ip]:[local_port];branch=[branch];rportFrom: [field0]<sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>Call-ID: [call_id]Cseq: 1 INVITEContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Type: application/sdpContent-Length: [len]v=0o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]s=-c=IN IP[local_ip_type] [local_ip]t=0 0m=audio [auto_media_port] RTP/AVP 8a=rtpmap:8 PCMA/8000a=rtpmap:101 telephone-event/8000a=fmtp:101 0-11,16]]></send><recv response="100" optional="true"></recv><!--<recv response="180" optional="true"></recv>--><!-- By adding rrs="true" (Record Route Sets), the routesets --><!-- are saved and used for following messages sent. Useful totest --><!-- against stateful SIPproxies/B2BUAs. --><recv response="200" rtd="true" crlf="true"></recv><!-- Packet lost can be simulated in any send/recv messageby --><!-- by adding the 'lost = "10"'. Value can be [1-100]percent. --><send><![CDATA[ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp<sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: sut <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id]CSeq: 1 ACKContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Length: 0]]></send><!-- Play a pre-recorded PCAP file (RTPstream) --><label id="1"/><nop><action><exec play_pcap_audio="pcap/g711a.pcap"/></action></nop><pause milliseconds="7000" next="1" /><!-- Play an out of band DTMF'1' --><nop><action><exec play_pcap_audio="pcap/dtmf_2833_1.pcap"/></action></nop><pause milliseconds="1000"/><!-- The 'crlf' option inserts a blank line in the statistics report. --><send retrans="500"><![CDATA[BYE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport] [local_ip]:[local_port]From:sipp <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: sip <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id]Cseq: 2 BYEContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Length: 0]]></send><recv response="200" crlf="true"></recv><!-- definition of the response time repartition table (unit isms) --><!-- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> --><!-- definition of the call length repartition table (unit isms) --><!-- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> --><ResponseTimeRepartition value="20, 40, 60, 80, 100, 200, 400, 800"/> <CallLengthRepartition value="20, 100, 200, 1000, 2000, 10000, 20000"/></scenario>编码对性能影响:v=0o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]s=-c=IN IP[local_ip_type] [local_ip]t=0 0m=audio [auto_media_port] RTP/AVP 8a=rtpmap:8 PCMA/8000 //语音发送, 修改PCMA 为G726 等, 不过这个需要asterisk server 支持a=rtpmap:101 telephone-event/8000a=fmtp:101 0-11,16通话录音性能:extensions.conf 中选择通话中录音的方式就可以了. 录音文件保存在:/var/spool/asterisk/monitor测试结果:IVR: 500 路一对一通话: 500 路录音: 300 路编解码转换对性能影响较大, 具体和编码方式相关.。
Asterisk安装和测试
Asterisk安装(红色字体部分为需要键入或修改的部分)下载准备系统环境:Linux CentOS 5.0,安装开发工具以及开发库。
Asterisk 源代码包asterisk-1.6.1.20.tar.gz,版本:1.6.1.20。
SIP软电话使用eyebeam 版本:1.5.8。
1.切换用户(需要输入管理员密码),执行su root2.进入源码包存放文件夹[root@asterisk-test1 ~]#cd /usr/local/src3.下载[root@asterisk-test1 ~]#wget/pub/telephony/asterisk/releases/asterisk1.6.1.20.tar.gz编译安装Asterisk1.解压源代码包[root@asterisk-test1 ~]# tar -zxvf asterisk-1.6.1.20.tar.gz2.进入包目录[root@asterisk-test1 ~]# cd asterisk-1.6.1.203.环境检测和预配置[root@asterisk-test1 asterisk-1.4.5]# ./configure(其实这样直接进行configure并非十分规范。
应当先使用“./configure –help”命令来查看一些可用的选项和参数,然后根据实际情况才进行定制操作。
)当环境预检测和预配置工作做完时,最后会显示以上反馈信息。
并且建立好Makefile。
注意:系统如果缺少安装必须的包,此步骤可能会出现configure: error错误,解决方案见后文可能遇到的问题configure: creating ./config.statusconfig.status: creating build_tools/menuselect-depsconfig.status: creating makeoptsconfig.status: creating channels/h323/Makefileconfig.status: creating include/asterisk/autoconfig.h.$$$$$$$$$$$$$$$=...$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$$$$$$$$$.$$$$$$$$$$$$$$$$$$$$$$.configure: Package configured for:configure: OS type : linux-gnuconfigure: Host CPU : i6864.清除陈旧的已编译文件[root@asterisk-test1 asterisk-1.4.5]# make clean5.重新编译Asterisk程序[root@asterisk-test1 asterisk-1.4.5]# make编译完成后会显示以下反馈提示信息,提示用户进行下一步可选的操作。
SIP网关压力测试工具SIPp的安装及使用详解收藏
SIP网关压力测试工具SIPp的安装及使用详解收藏上一篇介绍了安装Trixbox的过程。
经过简单的测试,pc2pc、pc2phone的通话功能正常。
要把网络电话业务作为商用,就必须要保证系统的稳定和一定的承载能力,所以接下来需要做的是对Asterisk的压力测试,以了解Asterisk在我们的硬件基础上的承载能力。
google一番,发现有一共叫SIPp的软件,专门用于对SIP网关的压力测试,包括注册、通话、多方meeting等并发的压力测试。
以下是从网上搜集并结合我的实际安装过程整理的资料。
SIPp是一个在Linux下运行的软件,为了便于操作,可将其通过Cygwin模拟运行在win32平台下。
第一步,先要安装的是Cygwin,下载地址:/setup.exe 。
该安装文件是在运行过程中再下载相关安装包进行安装的。
第二步,安装。
摘录网友的安装经验:“这方面的文很多,这里只大概谈一下需要注意的地方:1、下载时前面都是下一步就OK,按默认就好。
到选择镜像站点的时候建议选择前面一点的,希望大家不要浪费时间去试验;2、到选择安装方式——Select Packages页面时,一定要注意每个包后面的状态:Keep,意思就是说保持目前已经安装的版本不动。
不会替换目前已有的版本,下次安装包的时候尽量使用此选项,因为它不会把你已经有的包重新安装一次;Curr,意思就是说把最新的版本统统下载下来安装其它2个没试过。
而且应该注意一下名为Category的一列,该列后面写的是安装的方式,有安装、卸载、重新安装等,不用说,第一次当然是安装。
好了,剩下的就是等待了,相信我,这是相当漫长地。
Cygwin就安装完毕,大家一定要记住安装的路径。
”第二步,安装cygwin的IPv6补丁。
地址:http://win6.jp/Cygwin/index.html1、将其解压出来的3个文件夹:/bin,/lib,/usr复制到刚刚Cygwin的安装目录下即:../Cygwin/这里,以替换已有的文件夹。
sipp使用秘笈v1.2
Sipp测试工具使用文档1. Sipp软件简介sipp是对sip协议进行性能测试的一款软件系统。
sipp能够对远程系统发起一个或者多个呼叫。
Sipp提供呼叫发起端(uac)和呼叫接收端(uas)的功能,通过呼叫完成对中间设备(TG等)的性能测试。
sipp会根据xxx.xml场景描述文件来进行sip呼叫的建立、处理和释放。
2. 使用前的准备(这里假设读者已经安装好了的sipp)考虑到测试时操作的方便性,因此写了几个批处理文件,封装内部细节,只须指定服务器的IP与端口即可进行测试。
(约定uac指定端口,uas占用5090端口,使用前请确定端口没占用)呼叫前请注意是否配置好了所需文件,如果您是第一次使用请首先参考第4节和第5节相关内容修改2.1 系统相关修改1) 关闭系统防火墙,杀毒软件,下载程序以及其他跟网络相关的应用程序以防干扰测试。
2) 添加ip 。
有时候设备ip段和本机ip段不一样(本机ip段可能用于公网)那么只需要添加一个ip即可。
添加方法:网上邻居->右键属性->本地连接->右键属性->选择Tcp/ip选择属性点击高级在ip地址那个框内,选择添加即可。
3. 使用方法考虑到测试时操作的方便性,因此写了几个批处理文件,封装内部细节,只须指定服务器的IP与端口即可进行测试。
(约定uac占用5061端口,uas占用5090端口,使用前请确定这两个端口没占用)3.1 注册test.bat直接在sip的安装目录下点击test.bat3.2 启动uas在弹出的对话框中输入uas(注明:uas是呼叫接收端,无需输入任何参数)3.3 启动uacUac.bat hostip hostport 每秒呼叫个数总呼叫个数例如:uac 172.16.55.201 5060 10 1000上面表示呼叫目标(配置中使用的TG)目标IP,172.16.55.201,对端端口5060,每秒发起呼叫10,总呼叫数目为1000(注:uac后面的参数次序不能有错,必须按照此顺序进行)3.4 程序启动后的常用操作‘+’呼叫速率加1‘-‘呼叫速率减1‘*’呼叫速率加10‘/’呼叫速率减10暂停呼叫:按键盘上的p键来暂停呼叫,再次按p键则重新开始。
asterisk使用SIP相互对接
asterisk使⽤SIP相互对接当⽤户数量上去,单凭⼀台asterisk是很能⽀持庞⼤的⽤户群体,所以要根据⽤户量来部署多台asterisk来应付实际情况的需求.但部署多台asterisk所带来的⼀个问题就是A服务器的⽤户如果Call B服务器的⽤户呢?其实asterisk的设计者早已帮我们解决问题,以下是通过SIP把两台asterisk对接起来(不过官⽅推荐asterisk的对接⽤AIX).分别在192.168.1.21 和192.168.1.22两台服务器上装上asterisk,然后配置各⾃的⽤户,TRUNK和转发规则。
配置192.168.1.21打开/etc/asterisk/sip.conf在[general]组下添加注册到22的命令register=>AST22:123456@192.168.1.22然后在⽂件尾添加相关组信息[AST21]type=friendsecret=123456host=dynamicusername=AST21disallow=allallow=ulaw;alawcontext=FROMSIP[22TRUNK]type=friendusername=AST22secret=123456host=192.168.1.22dtmfmode=rfc2833context=FROMSIPfromuser=AST22insecure=very打开/etc/asterisk/extensions.conf 添加下⾯内容[FROMSIP]Exten => _90.,1,dila(sip/91${exten:2}@22TRUNK,40,m(default))拔打90开头的号码,把91代替90后转发192.168.1.22,拔打等待40秒,等待的时候播放default这个采铃。
Exten => _91.,1,dial(sip/${exten:2},40,m(default))当接收到91开头的号码,把91后⾯的号码进⾏内部呼叫。
asterisk常用调试监测命令
asterisk常用调试监测命令asterisk是开源的VOIP系统。
是目前最流行的VOIP开源软件。
在使用过程中可以使用下述的命令,对系统进行监控调试。
下文来自网络,非本人原创1. 运行调试常用命令./asterisk & 在后台启动asterisk./asterisk –vvvc 启动asterisk并尽量多的在控制台显示调试信息./asterisk –r 连接asterisk控制台set verbose 9999 设置打印详细信息2.asterisk控制台下常用命令sip reload 重新加载sip配置信息sip set debug on 设置显示更多的sip信息sip set debug off关闭显示更多的sip信息sip show channels 显示所有活动的SIP通道sip show peers 显示所有已定义的SIP peerdialplan show 显示拨号方案dialplan reload重新加载拨打方案stop gracefully 优雅地停止asteriskstop now 立即停止运行asteriskmodule show 显示所有已加载模块module load cdr_radius.so 加载模块cdr_radius.somodule reload cdr_radius.so 重新加载模块cdr_radius.somodule unload cdr_radius.so 卸载模块cdr_radius.socore show applications 显示所有的应用,比如Dial, Radius, Hangup, Answer等core show channels 显示所有的通话频道core show codecs 显示所有支持的编解码器core show functions 显示所有的功能函数ps -aux :显示进程命令。
asterisk -rvc 进入到asterisk。
sip测试中一些经验总结
Wireshark的过滤语句
设置捕捉过滤可以减少wireshark的无用信息,语句为(!udp dst port 137)&&(! udp dst port 138)&&!tcp &&! arp &&(!( udp dst port 1900))&&!sctp&&(!(udp src port 1900))&&(!udp dst port 137),这样可以过滤掉arp,tcp,NETBIOS Name Service,ssdp消息。
我们需要udp消息。
设置步骤:
1.Capture→options中双击已添加的捕捉接口
点击ok完成添加过滤项。
然后使用新添加的过滤项。
Wireshark分析语音包
利用wireshark可以分析sip通话流程中的语音,对一些单通问题可以逐段分析,看问题出在哪里?
●入局呼叫当主叫号码存在冲突时,imp发404消息
●Sip消息中显示号码
显示号码有可能和用户号码不一致
From头域包含了请求发起者的逻辑标志,可能是用户的address-of-record。
就像To头域一样,From头域也包含一个URI并且可以包含一个显示的姓名(sip display info)。
●打开dtmf透传命令:shell_imp_as_set_TelEvent 1,关闭命令:shell_imp_as_set_TelEvent 0
设为语音透传后在语音流中有发码
●出局资源被占时,拨完号码后直接听忙音
●Sip呼叫转移的流程(拍插簧的过程)。
asterisk声音抖动SIP设置
asterisk声音抖动SIP设置
sip_general_custom.conf
抖动缓存(jitterbuffer)配置
jbenable = yes ; 打开SIP通道接收端的抖动缓冲。
默认no。
在接收端不能接收
; 抖动的情况下,可以使用抖动缓存来接收抖动。
jbforce = no ; 强迫在SIP通道的接收端使用抖动缓存,默认no。
jbmaxsize = 200 ; 抖动缓存大小(毫秒)
jbresyncthreshold = 1000 ; 跳过抖动缓存的帧的时间长度,再同步缓存的帧。
可以用来提高
; 语音的质量。
外部设备和程序经常会造成大的跳动或中断。
默认; 设置为1000。
jbimpl = fixed ; SIP通道接收端抖动缓存的实现,当前有两种形式:
; fixed 缓存大小等于jbmaxsize,大小固定。
; adaptive 可变大小,实际上用于IAX2的一个新的抖动缓存。
; 默认是fixed。
jblog = no ; 对抖动缓存帧记录日志,默认是no。
SIP系统测试工具SIPP--个人使用经验
SIP系统测试工具SIPP--个人使用经验刚开始接触SIPP,是无意中整理自己的文档时候。
很早的时候从一个FTP上拖下一堆SIP相关的资料,没想到竟然藏了这么强的一个软件。
^^动手使用前,在网上搜索了一些使用SIPP的文章。
长了不少经验,走了不少弯路。
负责任的说,多数是不负责任的互相转来转去。
个人经验1:SIPP的主站上的说明是最详细最完善的(当然!这是废话。
)读的懂原文的人自然不屑看那些互转的文章,正是不愿意或看不懂原文的人才会找所谓的中文资料(比如我)。
个人经验2:即使拿着金山词霸自己翻译原文,也比跑瞎道强!SIPP主站文档地址:/doc/reference.html第一步:安装On Linux, SIPp is provided in the form of source code. You willneed to compile SIPp to actually use it.Pre-requisites to compile SIPp are (see Compilationtips):C++ Compilercurses or ncurses libraryFor authentication and TLS support: OpenSSL >= 0.9.8For pcap play support: libpcap and libnetFor distributed pauses: Gnu ScientificLibrariesYou have four options to compile SIPp:Without TLS (Transport Layer Security) andauthentication support: This is the recommended setup ifyou don't need to handle SIP authentication and/or TLS. In thiscase, there are no depencies to install beforebuilding SIPp. It is straight forward:# gunzip sipp-xxx.tar.gz# tar -xvf sipp-xxx.tar# cd sipp# makeWith TLS andauthenticationsupport, you must have installedOpenSSL library(>=0.9.8) (whichmay come with your system). Building SIPp consist only in addingthe "ossl" option to the make command:# gunzip sipp-xxx.tar.gz# tar -xvf sipp-xxx.tar# cd sipp# make osslWith PCAPplay and withoutauthenticationsupport:# gunzip sipp-xxx.tar.gz# tar -xvf sipp-xxx.tar# cd sipp# make pcapplayWith PCAPplay andauthenticationsupport:# gunzip sipp-xxx.tar.gz# tar -xvf sipp-xxx.tar# cd sipp# make pcapplay_ossl以上原文,太要看看了。
SIP服务器测试工具SIPp使用指导
SIP服务器性能测试工具SIPp使用指导Contents1安装及概述: (1)1.1SIPp安装 (2)1.2SIPp使用 (3)1.2.1 uac.bat: (3)1.2.2 data.csv: (4)1.2.3 uac.xml: (4)2常见问题: (8)2.1uas.bat (8)2.2uas.xml (9)3操作截图: (13)3.1uac: (13)3.2uas: (14)1 安装及概述:SIPp是一个测试SIP协议性能的工具软件。
这是一个GPL的开放源码软件。
它包含了一些基本的SipStone用户代理工作流程(UAC和UAS),并可使用INVITE和B YE 建立和释放多个呼叫。
它也可以读XML的场景文件,即描述任何性能测试的配置文件。
它能动态显示测试运行的统计数据(呼叫速率、信号来回的延迟,以及消息统计)。
周期性地把CSV统计数据转储,在多个套接字上的TCP和UDP,利用重新传输管理的多路复用。
在场景定义文件中可以使用正规表达式,动态调整呼叫速率。
SIPp可以用来测试许多真实的SIP设备,如SIP代理,B2BUAs,SIP媒体服务器,SIP/x网关,SIP PBX,等等,它也可以模仿上千个SIP代理呼叫你的SIP系统。
SIPp的网址:/,这里可以下载最新版的SIPp软件,并且有英文资料可供查阅。
1.1 SIPp安装SIPp提供Linux,Windows和HPUX平台的版本。
Windows平台上的安装很简单,下面说一下Linux下的安装。
首先,可以从/projects/sipp/files/sipp/3.2/下载最新版的SIPp,解压之后就得到一个rpm文件,你可以使用rpm命令来完成安装。
如果你拿到的是绿色版的SIPp,那么你需要对其重新编译才能使用。
SIPp是用C++写的,因此系统必须支持G++才可成功编译。
SIPp支持四种不同的安装模式:1) 没有TLS支持与密码验证支持:a) # tar -xvf sipp-1.1rc6.tar.gzb)# cd sipp-1.1.rc6c)# makeMake出来的sipp文件就是一个可执行的文件,只需要搭配场景xml文件与csv文件即可进行SIP测试,这是最常用的安装。
如何将SIP网关注册到Asterisk
前面是我写给我喜欢的女孩的东北二人转荷子香染衣, 不拘世人前月淡树影寒, 车远客行单雨洒千楼小, 风入九窍曲未闲终成句, 疏散始期许正文开始:布:exten => _1NXXNXXXXXX,1,Dial,H323/${EXTEN}@ip.or.hostnameszmzsm:我装的是TRIXBOX 1。
1就是后面多了个IP?布:你先编译usr/src/asterisk/channels/h323(路径根据你的来)然后拷贝h323.conf.sample到/etc/asterisk配置帐号.然后配置规则.szmzsm:请问SIP gateway怎样连接到ASTERISK上,我用下面的设置在asterisk里的sip show peers 里看到2002 为unspecified.请问怎样解决?我的SIP。
CONF的设置是[2002]type=friendusername=2002secret=2002host=dynamiccontext=outgoingextensions.conf里的设置是[outgoing]exten => _2002,1,Dial(SIP/ ${EXTEN}@192.168.1.46,20,rt)gateway的ip 为192.168.1.46请问哪里有问题呢?布:你这是自己给自己打?需要开两个帐号帐号1 打帐号2szmzsm:我的sip.conf[2001]type=friendusername=2001host=dynamiccontext=outgoing[2002]type=friendusername=2002secret=2002host=dynamiccontext=outgoing[2004]type=friendusername=2004secret=2004host=dynamiccontext=outgoing其中2001,2002为软电话,2004为sip gateway我的extensions.conf[outgoing]exten => _2001,1,Dial(SIP/ ${EXTEN},20,rt)exten => _2002,1,Dial(SIP/ ${EXTEN},20,rt)exten => _1NXXNXXXXXX,1,Dial,SIP/ ${EXTEN}@192.168.1.46 布:你想用SIP 打到H323上?szmzsm不是,是SIP软电话打到sip gateway上请问extensions.conf中最后的改为[outgoing]exten => _2004,1,Dial,SIP/ ${EXTEN}@192.168.1.46szmzsm(624047449) 13:29:55但是现在好象连sip gateway用2004注册到asterisk都不行布:[outgoing]sip.conf[general]port = 5063bindaddr = 0.0.0.0context = default在extensions.conf[2002]type=friendusername=2002secret=2002host=192.168.xx.xx(根据你的情况而定)port=5065szmzsm:我的general是用他默认的,是[general]port = 5060bindaddr = 0.0.0.0disallow=allallow=ulawallow=alawcontext = from-sip-externalcallerid = Unknowntos=0x68是不是把其他的注释掉啊只用port disallow context还有bindaddrport是用5063吗??布:enszmzsm我现在的2002是软电话2004是gateway布你网关能注册到asterisk上不?szmzsm现在不行就是SIP.CONF里怎么加才能注册上布:type=peerport = 5060host=XXX.XXX.XXX.XXXbindaddr=XXX.XXX.XXX.XXX ; Local interface insecure=veryqualify=nocanreinvite=nodisallow=allallow=alawallow=ulawregister=>:@XXX.XXX.XXX.XXX ; Local interface在outgoing中exten => _2XXX,1,Dial(SIP/${EXTEN}@2004,60)试试.szmzsm请问bindaddr=XXX.XXX.XXX.XXX 用的是哪个IP是gateway 的吗?布对szmzsm现在可以call sip gateway了但是他不能call回来我把上面的peer改成friend也是一样,还是只能接,不能打出去布:把sip gateway的context设置成outgoing1[ougoing1]exten => _2XXX,1,Dial(SIP/${EXTEN}@2002,60)。
asterisk sip配置说明详述
asterisk sip配置说明1. 介绍extensions.conf中使用sip设备的语法是SIP/devicename,devicename名在下一节中说明。
如果用户在Internet上,可以使用SIP/username@domain形式,同时不要忘记打开D NS SRV功能。
如果定义了一个SIP代理,可以使用SIP/proxyhostname/user或者SIP/user@proxy hostname形式,proxyhostname的定义在下面的章节说明。
2. 在CLI中的查询命令:u sip show peers 显示所有的SIP peers(包括friends)u sip show users 显示所有的SIP users(包括friends)u sip show registry 显示注册到的主机状态u sip debug 显示所有的Sip信息u module reload chan_sip.so 重新装载sip的配置文件3. 设备命名命名一个设备之前,要先理解Asterisk是怎么处理呼入电话的:1) Asterisk取出SIP From: address中的username,使用它来匹配系统中定义的type=user的的设备名。
2) Asterisk检查INVITE请求中的IP地址和端口号,使用它来匹配系统中定义的t ype=peer的设备。
不要混淆extensions和设备名的概念。
设备需要一个唯一的名字。
设备名不能用于电话号码。
电话号码是拨号计划中的声明的一个extension。
注意:参数username并不是用户名的意思,在大多数情况下,它根本不是必须的。
在后边,我们把它重命名做defaultuser,因为他与defaultip合并使用。
4. 通用属性说明[general] ;通用属性context=default ;呼入电话默认使用的contextallowguest=no ; 允许或拒绝客户呼叫 (默认 yes)allowoverlap=no ; 允许重叠拨号(默认yes)allowtransfer=no ; 允许呼叫转接(默认yes)realm=mydomain.tld ; 认证的领域。
使用SIPP做性能测试
位置服务器(Lcation Server)
• 配合代理服务器和重定向服务器提供可能 的被叫用户的地址(或位置)
注册服务器(Register Server)
消息内容
180 Ringing(振铃) 183 Session Progress(呼 叫进展) 181 Call Is Being Forwarded(呼叫正在前转)
2**消 息
3**消息
Redirectio n
4**消 息 Client Error
406 Not Acceptabel(不 能够接受)
使用SIPP做性能测试
王铁吾
主要内容
• 一,SIP介绍 • 二,SIPP工具介绍及实践
SIP介绍
• SIP概述 • SIP协议特点 • SIP消息
SIP概述
• 1999年3月,IETF推出RFC 2543 • SIP, Session Initiation Protocol,会话初 始化协议,是IETF提出的在IP网络上进行 多媒体通信的应用层控制协议 • 用来发起、修改和终止用户之间的多媒体 会话 • 已经被3GPP采用
SIPP介绍
• SIPP,是一款开源的用于测试SIP的工具 • 支持内置流程UAC和UAS测试 • 支持用户定制测试流程(xml格式)和测试 数据(csv格式) • 官方网站:/
SIPP安装配置
• 支持Linux和Windows • Linux安装配置 下载源代码sipp.svn.tar.gz tar zxvf sipp.svn.tar.gz cd sipp.svn make pcapplay 在当前目录会生成执行文件SIPP及相关目录
Asterisk学习笔记
Asterisk学习笔记1.安装Asterisk需要那些安装包。
a)Asterisk(pure voip only need this)b)Zaptel(support 硬件板卡支持)c)Pri(libpri)2.Asterisk的版本a)Asterisk目前有1.4和1.6两个分支,我们的HCC系统采用的是1.4分支上进行扩展开发。
1.6 no longer support zaptel,增加了很多新features,相对与1.4版本变动比价大。
b)Upgrade:ael 取消了Macro() 用Gosub()来代替。
Applications:ChanIsAvail()增加-t选项3.How to install Asterisk on Linux.a)Login as rootb)tar zxvf Asterisk-1.6…解压c)进入sub folderd)#make cleane)#./configuref)#makeg)#make installh)#make samples(安装示例配置)4.How to run/stop Asteriska)进入console,直接运行#asterisk 来运行b)进入asterisk命令提示界面:#asterisk –r 然后CLI>stop nowc)Asterisk可以用safe_asterisk来安全启动,通过safe_asterisk启动后如果asterisk crash会dump core到/tmp目录,并且给administrator发email告警。
5.Asterisk目录结构a)/usr/lib/asterisk/modules 这个目录下包含所有可加载的asterisk模块b)/var/spool/asterisk 这个目录下包括outgoing gcall tmp voicemail目录asterisk会去monitor这个目录,可以用在做自动外呼等等c)/var/log/asterisk用来store logsd)/var/log/asterisk/cdr-csv用来store cdrs in csv format. CSV=comma-separate-value6.SIP in Asteriska)Asterisk中sip配置文件为/etc/asterisk/sip.confb)Asterisk支持IAX与SIP VOIP协议。
asterisk dialplan学习笔记
asterisk学习笔记1分类:asterisk2009-12-02 10:33 372人阅读评论(0) 收藏举报/etc/asterisk/sip.conf设置[xhtml]view plaincopy1.[general]2.port = 50603.bindaddr = 0.0.0.04.context = others5.6.7.8.[2000]9.type=friend10.context=my-phones11.secret=123412.host=dynamic13.14.15.16.[2001]17.type=friend18.context=my-phones19.secret=123420.host=dynamic[general]中定义的是sip的全局变量,port=5060表示sip协议使用的端口号是5060,bindaddr = 0.0.0.0表示服务器监听服务器定义的所有Ip地址,context = others 指向/etc/asterisk/extensions.conf中对应的[others]节定义的内容。
[2001]节定义了一个2001sip分机,type=friend 表示此sip分机可以拨入和拨出。
type =peer: 只能呼出.type=user: 只能呼入.context=my-phones 指向/etc/asterisk/extensions.conf中对应的[others]节定义的内容。
表示此分机拨入时(Caller)按照[my-phones]中的定义来执行其动作。
secret=1234是其密码。
host=dynamic 则是此分机的IP地址是任意的。
想要查看其所有设置,在asterisk的CLI界面下输入sip show peer 2001asterisk学习笔记2/etc/asterisk/extensions.conf[xhtml]view plaincopy1.[others]2.3.[my-phones]4.exten => 2000,1,Dial(SIP/2000,20)5.exten => 2000,2,VoiceMail(2000,u)6.7.exten => 2001,1,Dial(SIP/2001,20)8.exten => 2001,2,VoiceMail(2001,u)9.10.exten => 2999,1,VoiceMailMain(${CALLERID(num)},s)拨号方式(dialplan)的条目定义方式如下:extern => Number,Priority,Application当一个号码被呼叫,Asterisk 会检查其是否符合dialplan中的一个条目,如果找到,那个条目就会被执行,如果多于一个条目符合被叫号码,Asterisk 会首先执行priority=1的条目。
Asterisk配置笔记(yiqiangsong)
Asterisk配置笔记(yiqiangsong)一、Aterik接口类型二、使用接口配置文件1.Zaptel.conf:硬件接口基层配置,我们将建立一个F某0和一个F 某S通道.2.zapata.conf:硬件配置Aterik的接口.3.e某tenion.conf:拨号方案文件.4.ip.conf:配置SIP协议的文件5.ia某.conf:配置呼入和呼出IA某通道的文件三、F某O与F某S通信区别:区别简单,就在于连接的那端提供拨号音.F某O不生成拨号音,而是接收.F某S端口提供拨号音和震铃电压,在有呼叫的时候提醒用户.两者接口都提供双向通讯(同时双方向的通讯传输).F某S卡必须像中心局(CO)进行运转,使用F某O信令.同理,F某O卡连接CO,就意味着它需要像终端进行运转,使用F某S信令.四、接口文件配置1、Zaptel配置(F某O)在/etc/zaptel.conf文件,用于配置硬件,可以定义F某S端口与F 某O信令的配置f某k=1;定义f某端口采用通道1以k信令协议;f某ok=2;定义f某o端口采用通道2以k信令协议loadzone=udefaultzone=u信令协议:Looptart(l),groundtart(g),kewltart(k),使用k外信令协议,把f某ok中的k替换l或g,Aterik的模拟电路推荐k信令协议.某某某某某某编辑完zaptel.conf文件,需要使用/bin/ztcfg-vv装载配置到硬件(不须要详细输出可以省略-vv);修改信令方法需要重启.在编辑ip.conf和ia某.conf文档后,分别需要装载chan_ia某2.o和chan_ip.o2、Zapata配置硬件配置Aterik的接口[trunkgroup];定义一个主干组;defineanytrunkgroup[channel];硬件通道和他们选项信令方式.;hardwarechannel;硬件通道;default;默认buydetect=ye;增加这两行,要不F某O口不能检测到挂机信号。
使用SIPP做性能测试分析
100 Trying(尝试处理) 182 Queued(排队等待)
180 Ringing(振铃)
183 Session Progress(呼 叫进展)
181 Call Is Being Forwarded(呼叫正在前转)
2**消 息
200 OK(成功)
3**消息
Redirectio n
300 Multiple Choices(多个选择)
应二大类
• 请求消息:
a) INVITE(邀请):类似于SS7信令中的IAM,主叫方初始发出消
息,表征主叫方能力,邀请参加会话。
b) ACK(确认):确认消息,表征最终响应,ACK消息一般和
INVITE消息配合使用。
c) OPTIONS(可选项):用于询问网络中服务器或终端的能力。
电信运营商不希望终端设备能获知网络能力,不容许终端询问网络能 力。实体周期发送OPTIONS消息,获知对端是否成活或可达--系 统信息。
用户代理(UA)
• 用于代表用户发起、接收、结束一个呼叫 • User Agent Client(UAC),用户代理客户
方,用于发起一个呼叫请求 • User Agent Server(UAS),用户代理服
务方,用于对呼叫请求进行回应 • 一个UA,即可以作为UAC发起呼叫,也可
以作为UAS接收呼叫,他们两个是逻辑上 的不同角色,不是独立的物理实体
Payment 付费)
Required(需要
403 Forbidden(禁止)
404 Not Found(没有找到)
405 Method Not Allowed (不支持的模式)
4**消 息
Client Error
406 Not Acceptabel(不 能够接受)
asterisk安装和asterisk_sip控制台信息
asterisk安装和asterisk_sip控制台信息1. 检查依赖的包是否安装:依赖的包有gcc--libpri,zaptelasteriskncurses-devellibtermcap-develkernel-develkernel-smp-develgcc-c++openssl-develnewt-develzlib-develunixODBC-devellibtoolmake利用 rpm -q 名称进行查询看是否安装,无时进行安装,当然用源安装快!2.asterisk 的安装和环境的搭建首先在FTP上(自己Google)得到压缩包,或者ssh 远程得到命令为 get 名称自己的主机名称:放置目录安装到/usr/src目录下解压缩、切换目录(/usr/src/asterisk-xxx)、执行(sudo ./configure)、sudo make、sudo make install 、sudo make samples、sudo make progdocs修改配置: 1.1 在/etc/asterisk/sip.conf 中添加用户:[1001]type=friendsecret=testhost=dynamic[1002]type=friendsecret=testhost=dynamic1.2 /etc/asterisk/extensions.conf 中添加:[test]exten => 1001,1,Dial(SIP/1001)exten => 1002,1,Dial(SIP/1002)===============================各项讲解=================================== sip环境的简易配置:(所有的配置文件都在/etc/asterisk目录下,其它地方的配置无效) sip.conf[general] 所有用户和对端的默认选项allowoverlap=nobindport=5060 监听端口bindaddr=0.0.0.0 监听所有过来的电话srvlookup=yes 使用 DNS 服务qualify=yescontext=test 拨号方案[1001]type=friend 类型用户类型的用于认证呼入呼叫端Peer 是用于呼出呼叫朋友类型两者都有secret=test 密码host=dynamic 动态IP[1002]type=friendsecret=testhost=dynamicextensions.conf在文档的最后添加:[test]exten => 1001,1,Dial(SIP/1001) 呼叫超时秒数exten => 1002,1,Dial(SIP/1002)====================================== ===================================运行asterisk的命令为:asterisk & or sudo /usr/sbin/asterisk -vvvvvvcg停止命令为:stop now连接到命令行:asterisk -rvvvdialplan reloadsip reload显示支持的通信类型: show channeltypes打开调试信息: sip set debug现在astersik下的sip环境就搭建完成了,开启astersik ================================== sudo /usr/sbin/asterisk -vvvvvvcg =============================== ==登录到Astersk服务器运行控制台: asterisk -crvvv查看登录用户 : sip shwo peers*CLI> sip show peersName/username Host Dyn Nat ACL Port Status1004 (Unspecified) D 0 UNKNOW N1003 (Unspecified) D 0 UNKNOW N1002 (Unspecified) D 0 UNKNOW N1001/1001 192.168.123.58 D 39478 OK (101 ms)4 sip peers [Monitored: 1 online, 3 offline Unmonitored: 0 online, 0 offline]*CLI>查看详细记录: sip show peer 1001*CLI> sip show peer 1002 ////注意与查看全部的区别 peers peer* Name : 1002Secret : <Set>MD5Secret : <Not set>Context : testSubscr.Cont. : <Not set>Language :AMA flags : UnknownTransfer mode: openCallingPres : Presentation Allowed, Not ScreenedCallgroup :Pickupgroup :Mailbox :VM Extension : asteriskLastMsgsSent : 32767/65535Call limit : 0Dynamic : YesCallerid : "" <>MaxCallBR : 384 kbpsExpire : -1Insecure : noNat : RFC3581ACL : NoT38 pt UDPTL : NoCanReinvite : YesPromiscRedir : NoUser=Phone : NoVideo Support: NoTrust RPID : NoSend RPID : NoSubscriptions: YesOverlap dial : NoDTMFmode : rfc2833LastMsg : 0ToHost :Addr->IP : (Unspecified) Port 0 Defaddr->IP : 0.0.0.0 Port 5060Def. Username:SIP Options : (none)Codecs : 0x8000e (gsm|ulaw|alaw|h263) Codec Order : (none)Auto-Framing: NoStatus : UNKNOWNUseragent :Reg. Contact :*CLI>重新加载拨号方案:dialplan reload*CLI> dialplan reload== Parsing '/etc/asterisk/extensions.conf': Found== Setting global variable 'CONSOLE' to 'Console/dsp'== Setting global variable 'IAXINFO' to 'guest'== Setting global variable 'TRUNK' to 'Zap/G2'== Setting global variable 'TRUNKMSD' to '1'-- Registered extension context 'dundi-e164-canonical'-- Registered extension context 'dundi-e164-customers'-- Registered extension context 'dundi-e164-via-pstn'-- Registered extension context 'dundi-e164-local'-- Including context 'dundi-e164-canonical' in context 'dundi-e164-local'-- Including context 'dundi-e164-customers' in context 'dundi-e164-local'-- Including context 'dundi-e164-via-pstn' in context 'dundi-e164-local'-- Registered extension context 'dundi-e164-switch'-- Including switch 'DUNDi/e164' in context 'dundi-e164-switch'-- Registered extension context 'dundi-e164-lookup'-- Including context 'dundi-e164-local' in context 'dundi-e164-lookup'-- Including context 'dundi-e164-switch' in context 'dundi-e164-lookup'-- Registered extension context 'macro-dundi-e164'-- Added extension 's' priority 1 to macro-dundi-e164-- Including context 'dundi-e164-lookup' in context 'macro-dundi-e164'-- Registered extension context 'iaxtel700'-- Added extension '_91700XXXXXXX' priority 1 to iaxtel700 -- Registered extension context 'iaxprovider'-- Registered extension context 'trunkint'-- Added extension '_9011.' priority 1 to trunkint-- Added extension '_9011.' priority 2 to trunkint-- Registered extension context 'trunkld'-- Added extension '_91NXXNXXXXXX' priority 1 to trunkld -- Added extension '_91NXXNXXXXXX' priority 2 to trunkld -- Registered extension context 'trunklocal'-- Added extension '_9NXXXXXX' priority 1 to trunklocal-- Registered extension context 'trunktollfree'-- Added extension '_91800NXXXXXX' priority 1 to trunktollfree-- Added extension '_91888NXXXXXX' priority 1 to trunktollfree-- Added extension '_91877NXXXXXX' priority 1 to trunktollfree-- Added extension '_91866NXXXXXX' priority 1 to trunktollfree-- Registered extension context 'international'-- Including context 'longdistance' in context 'international' -- Including context 'trunkint' in context 'international'-- Registered extension context 'longdistance'-- Including context 'local' in context 'longdistance'-- Including context 'trunkld' in context 'longdistance'-- Registered extension context 'local'-- Including context 'default' in context 'local'-- Including context 'trunklocal' in context 'local'-- Including context 'iaxtel700' in context 'local'-- Including context 'trunktollfree' in context 'local'-- Including context 'iaxprovider' in context 'local'-- Including context 'parkedcalls' in context 'local'-- Registered extension context 'macro-trunkdial'-- Added extension 's' priority 1 to macro-trunkdial-- Added extension 's' priority 2 to macro-trunkdial-- Added extension 's-NOANSWER' priority 1 to macro-trunkdial-- Added extension 's-BUSY' priority 1 to macro-trunkdial-- Added extension '_s-.' priority 1 to macro-trunkdial-- Registered extension context 'macro-stdexten'-- Added extension 's' priority 1 to macro-stdexten-- Added extension 's' priority 2 to macro-stdexten-- Added extension 's-NOANSWER' priority 1 to macro-stdexten-- Added extension 's-NOANSWER' priority 2 to macro-stdexten-- Added extension 's-BUSY' priority 1 to macro-stdexten-- Added extension 's-BUSY' priority 2 to macro-stdexten-- Added extension '_s-.' priority 1 to macro-stdexten-- Added extension 'a' priority 1 to macro-stdexten-- Registered extension context 'macro-stdPrivacyexten'-- Added extension 's' priority 1 to macro-stdPrivacyexten -- Added extension 's' priority 2 to macro-stdPrivacyexten -- Added extension 's-NOANSWER' priority 1 to macro-stdPrivacyexten-- Added extension 's-NOANSWER' priority 2 to macro-stdPrivacyexten-- Added extension 's-BUSY' priority 1 to macro-stdPrivacyexten-- Added extension 's-BUSY' priority 2 to macro-stdPrivacyexten-- Added extension 's-DONTCALL' priority 1 to macro-stdPrivacyexten-- Added extension 's-TORTURE' priority 1 to macro-stdPrivacyexten-- Added extension '_s-.' priority 1 to macro-stdPrivacyexten -- Added extension 'a' priority 1 to macro-stdPrivacyexten -- Registered extension context 'macro-page'-- Added extension 's' priority 1 to macro-page-- Added extension 's' priority 2 to macro-page-- Added extension 's' priority 3 to macro-page-- Added extension 's' priority 4 to macro-page-- Added extension 's' priority 5 to macro-page-- Added extension 's' priority 6 to macro-page-- Added extension 's' priority 7 to macro-page-- Registered extension context 'demo'-- Added extension 's' priority 1 to demo-- Added extension 's' priority 2 to demo-- Added extension 's' priority 3 to demo-- Added extension 's' priority 4 to demo-- Added extension 's' priority 5 to demo-- Added extension 's' priority 6 to demo-- Added extension 's' priority 7 to demo-- Added extension '2' priority 1 to demo-- Added extension '2' priority 2 to demo-- Added extension '3' priority 1 to demo-- Added extension '3' priority 2 to demo-- Added extension '1000' priority 1 to demo-- Added extension '1234' priority 1 to demo-- Added extension '1234' priority 2 to demo -- Added extension '1235' priority 1 to demo -- Added extension '1236' priority 1 to demo -- Added extension '1236' priority 2 to demo -- Added extension '#' priority 1 to demo-- Added extension '#' priority 2 to demo-- Added extension 't' priority 1 to demo-- Added extension 'i' priority 1 to demo-- Added extension '500' priority 1 to demo -- Added extension '500' priority 2 to demo -- Added extension '500' priority 3 to demo -- Added extension '500' priority 4 to demo -- Added extension '600' priority 1 to demo -- Added extension '600' priority 2 to demo -- Added extension '600' priority 3 to demo -- Added extension '600' priority 4 to demo -- Added extension '76245' priority 1 to demo -- Added extension '_7XXX' priority 1 to demo -- Added extension '7999' priority 1 to demo -- Added extension '7999' priority 2 to demo -- Added extension '8500' priority 1 to demo -- Added extension '8500' priority 2 to demo -- Registered extension context 'page'-- Added extension '_X.' priority 1 to page-- Registered extension context 'default'-- Including context 'demo' in context 'default' -- Registered extension context 'test'-- Added extension '1001' priority 1 to test-- Added extension '1002' priority 1 to test-- Added extension '1003' priority 1 to test-- Added extension '1004' priority 1 to test== Parsing '/etc/asterisk/users.conf': FoundDialplan reloaded.*CLI>重新加载SIP方案:sip reload*CLI> sip reload*CLI> Reloading SIP== Parsing '/etc/asterisk/sip.conf': Found== Parsing '/etc/asterisk/users.conf': Found== Parsing '/etc/asterisk/sip_notify.conf': Found*CLI>=========================sip 控制台信息=====================================1. 运行调试常用命令./asterisk & 在后台运行./asterisk -vvvc 启动并尽量多的在控制台显示调试信息./asterisk -r 连接控制台set verbose 9999 设置打印详细信息2. 控制台下常用命令sip reload 重新加载sip信息sip set debug 设置显示更多的sip信息sip set debug off 关闭显示更多的sip信息sip show channels 显示所有活动的sip通道sip show users 显示用户情况sip show user xxx 显示用户xxx的情况dialplan show 显示拨号方案dialplan reload 重新加载拨号方案stop gracefully 优雅的停止asteriskstop now 立即停止运行module show 显示已有的加载module load cdr_radius.so 加载模块 cdrxxxmodule reload cdr_radius.so 重新加载模块 cdrxxxmodule unload cdr_radius.so 卸载模块 cdrxxxcore show applications 显示所有的应用比如Dial Radius Hangup Answer等core show channels 显示所有的通话通道core show codecs 显示所有支持的编码core show functions 显示所有的功能函数-------------------------------------------------------------------------*CLI> help! Execute a shell commandabort halt Cancel a running haltael debug contexts Enable AEL contexts debug (does nothing)ael debug macros Enable AEL macros debug (does nothing) ael debug read Enable AEL read debug (does nothing)ael debug tokens Enable AEL tokens debug (does nothing) ael nodebug Disable AEL debug messagesael reload Reload AEL configurationagent logoff Sets an agent offlineagent show Show status of agentsagent show online Show all online agentsagi debug Enable AGI debuggingagi debug off Disable AGI debuggingagi dumphtml Dumps a list of agi commands in html format agi show List AGI commands or specific helpcdr status Display the CDR statusconsole active Sets/displays active consoleconsole answer Answer an incoming console callconsole autoanswer Sets/displays autoanswerconsole boost Sets/displays mic boost in dBconsole dial Dial an extension on the consoleconsole flash Flash a call on the consoleconsole hangup Hangup a call on the consoleconsole mute Disable mic inputconsole send text Send text to the remote deviceconsole transfer Transfer a call to a different extensionconsole unmute Enable mic inputcore clear profile Clear profiling infocore set debug channel Enable/disable debugging on a channelcore set debug Set level of debug chattinesscore set debug off Turns off debug chattinesscore set global Set global dialplan variablecore set verbose Set level of verbosenesscore show applications Shows registered dialplan applicationscore show application Describe a specific dialplan applicationcore show audio codecs Displays a list of audio codecscore show channels Display information on channelscore show channel Display information on a specific channel core show channeltypes List available channel typescore show channeltype Give more details on that channeltypecore show codecs Displays a list of codecscore show codec Shows a specific codeccore show config mappings Display config mappings (file names to config engines)core show file formats Displays file formatscore show file version List versions of files used to build Asteriskcore show functions Shows registered dialplan functionscore show function Describe a specific dialplan functioncore show globals Show global dialplan variablescore show hints Show dialplan hintscore show image codecs Displays a list of image codecscore show image formats Displays image formatscore show license Show the license(s) for this copy of Asteriskcore show profile Display profiling infocore show switches Show alternative switchescore show threads Show running threadscore show translation Display translation matrixcore show uptime Show uptime informationcore show version Display version infocore show video codecs Displays a list of video codecscore show warranty Show the warranty (if any) for this copy of Asteriskdatabase del Removes database key/valuedatabase deltree Removes database keytree/valuesdatabase get Gets database valuedatabase put Adds/updates database valuedatabase show Shows database contentsdatabase showkey Shows database contentsdialplan add extension Add new extension into contextdialplan add ignorepat Add new ignore patterndialplan add include Include context in other contextdialplan reload Reload extensions and *only* extensionsdialplan remove extension Remove a specified extensiondialplan remove ignorepat Remove ignore pattern from contextdialplan remove include Remove a specified include from contextdialplan save Save dialplandialplan show Show dialplandnsmgr reload Reloads the DNS manager configurationdnsmgr status Display the DNS manager statusdundi debug Enable DUNDi debuggingdundi flush Flush DUNDi cachedundi lookup Lookup a number in DUNDidundi no debug Disable DUNDi debuggingdundi no store history Disable DUNDi historic recordsdundi precache Precache a number in DUNDidundi query Query a DUNDi EIDdundi show entityid Display Global Entity IDdundi show mappings Show DUNDi mappingsdundi show peers Show defined DUNDi peersdundi show peer Show info on a specific DUNDi peerdundi show precache Show DUNDi precachedundi show requests Show DUNDi requestsdundi show trans Show active DUNDi transactionsdundi store history Enable DUNDi historic recordsfeature show Lists configured featuresfile convert Convert audio filegroup show channels Display active channels with group(s) help Display help list, or specific help on a commandhttp show status Display HTTP server statusiax2 provision Provision an IAX deviceiax2 prune realtime Prune a cached realtime lookupiax2 reload Reload IAX configurationiax2 set debug Enable IAX debuggingiax2 set debug jb Enable IAX jitterbuffer debuggingiax2 set debug jb off Disable IAX jitterbuffer debuggingiax2 set debug off Disable IAX debuggingiax2 set debug trunk Enable IAX trunk debuggingiax2 set debug trunk off Disable IAX trunk debuggingiax2 show cache Display IAX cached dialplaniax2 show channels List active IAX channelsiax2 show firmware List available IAX firmwaresiax2 show netstats List active IAX channel netstatsiax2 show peers List defined IAX peersiax2 show peer Show details on specific IAX peeriax2 show provisioning Display iax provisioningiax2 show registry Display IAX registration statusiax2 show stats Display IAX statisticsiax2 show threads Display IAX helper thread infoiax2 show users List defined IAX usersiax2 test losspct Set IAX2 incoming frame loss percentage indication add Add the given indication to the countryindication remove Remove the given indication from the countryindication show Display a list of all countries/indicationskeys init Initialize RSA key passcodeskeys show Displays RSA key informationlocal show channels List status of local channelslogger mute Toggle logging output to a consolelogger reload Reopens the log fileslogger rotate Rotates and reopens the log fileslogger show channels List configured log channelsmanager show command Show a manager interface commandmanager show commands List manager interface commandsmanager show connected List connected manager interface usersmanager show eventq List manager interface queued events manager show users List configured manager usersmanager show user Display information on a specific manager usermgcp audit endpoint Audit specified MGCP endpointmgcp reload Reload MGCP configurationmgcp set debug Enable MGCP debuggingmgcp set debug off Disable MGCP debuggingmgcp show endpoints List defined MGCP endpointsmixmonitor Execute a MixMonitor command.module load Load a module by namemodule reload Reload configurationmodule show List modules and infomodule show like List modules and infomodule unload Unload a module by namemoh reload Music On Holdmoh show classes List MOH classesmoh show files List MOH file-based classesno debug channeloriginate Originate a callqueue add member Add a channel to a specified queuequeue remove member Removes a channel from a specified queuequeue show Show status of a specified queuerealtime load Used to print out RealTime variables.realtime pgsql status Shows connection information for the Postgresql RealTime driverrealtime update Used to update RealTime variables.restart gracefully Restart Asterisk gracefullyrestart now Restart Asterisk immediatelyrestart when convenient Restart Asterisk at empty call volumertcp debug ip Enable RTCP debugging on IPrtcp debug Enable RTCP debuggingrtcp debug off Disable RTCP debuggingrtcp stats Enable RTCP statsrtcp stats off Disable RTCP statsrtp debug ip Enable RTP debugging on IPrtp debug Enable RTP debuggingrtp debug off Disable RTP debuggingsay load set/show the say modeshow parkedcalls Lists parked callsshow queuessip history Enable SIP historysip history off Disable SIP historysip notify Send a notify packet to a SIP peersip prune realtime Prune cached Realtime object(s)sip prune realtime peer Prune cached Realtime peer(s)sip prune realtime user Prune cached Realtime user(s)sip reload Reload SIP configurationsip set debug Enable SIP debuggingsip set debug ip Enable SIP debugging on IPsip set debug off Disable SIP debuggingsip set debug peer Enable SIP debugging on Peernamesip show channels List active SIP channelssip show channel Show detailed SIP channel infosip show domains List our local SIP domains.sip show history Show SIP dialog historysip show inuse List all inuse/limitssip show objects List all SIP object allocationssip show peers List defined SIP peerssip show peer Show details on specific SIP peersip show registry List SIP registration statussip show settings Show SIP global settingssip show subscriptions List active SIP subscriptionssip show users List defined SIP userssip show user Show details on specific SIP userskinny reset Reset Skinny device(s)skinny set debug Enable Skinny debuggingskinny set debug off Disable Skinny debuggingskinny show devices List defined Skinny devicesskinny show lines List defined Skinny lines per devicesoft hangup Request a hangup on a given channelstop gracefully Gracefully shut down Asteriskstop now Shut down Asterisk immediatelystop when convenient Shut down Asterisk at empty call volumestun debug Enable STUN debuggingstun debug off Disable STUN debuggingudptl debug Enable UDPTL debuggingudptl debug ip Enable UDPTL debugging on IPudptl debug off Disable UDPTL debuggingvoicemail show users List defined voicemail boxesvoicemail show zones List zone message formats*CLI> [Jan 20 16:15:05] NOTICE[6579]: chan_sip.c:15094 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 1001。
两个ASTERISK服务器之间SIP中继配置方法
allow=gsm
host=192.168.0.100
type=friend
context=from-trunk
username=6000
secret=6000
Qualify=0
insecure=very
canreinvite=no
allow=gsm
中继对端服务器IP地址
6000
200
已分配用于相互认证的分机密码
中继参数
Trunk Name
100to250
250to100
中继名称
PEER Details
host=192.168.0.250
type=friend
context=from-internal
username=200
secret=200
qualify=0
insecure=very
Step6:出局路由配置
Step7:入局路由配置
ASTERISK互联SIP Trunk配置
一、ASTERISK与ASTERISK之间互联SIP中继配置
服务器A
服务器B
说明
服务器参数
IP地址
192.168.0.100
192.168.0.250
中继分机号码
6000
200
已分配用于相互认证的分机号码
中继分机密码
sip代理IP:192.168.0.100
sip端口:5060
能力集:G711ALaw、G711uLaw、DTMFRFC2833
其它参数保持缺省值
interPBX语音网关
说明
服务器参数
IP地址
192.168.0.100
asterisk中sip.conf配置文件详解
asterisk中sip.conf配置文件详解l 安装完asterisk 配置sip.conf文件[8001]type=friendusername=8001accountcode=8001secret=8001context=from-exten-sip;followed advance settingshost=dynamicnat=yesqualify=2000canreinvite=nocallgroup=0,pickupgroup=0,setvar=call-limit=1说明:(1)type:sip的类型。
格式:type =user|peer|friend 。
peer用于认证呼出呼叫,如果想要一个用户(extension)中有多个电话,定义可以呼叫两个SIP peer 的extension。
user用于认证呼入呼叫,用户通过上下文鉴定到达服务器。
friend 用于认证呼入呼出,相当于(peer+user)。
(2)username :格式:username =。
如果Asterisk接受来自远程SIP的SIP INVITE请求的客户端,这字段指定验证的用户名。
(3)accountcode:格式:accountcode =。
此字段,是用来填充“accountcode“领域的CDR(呼叫详细记录)。
(4)secret:用于认证的密码。
如果Asterisk是作为一个SIP代理服务器,那么这个SIP 客户端必须使用此密码登录(一个共享密码)。
如果Asterisk是一个SIP客户端作为一个远程SIP的SIP INVITE的服务器要求身份验证,那么这个字段是用来验证该Asterisk的SIP协议提请发送到远程SIP服务器。
(5)context:格式:context = 定义了指令的地点,用于控制电话的权限,以及如何处理此号码的呼入呼叫。
如果类型为用户,上下文定义呼入呼叫使用。
如果类型为节点,上下文定义呼出呼叫使用。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
用Sipp 对Asterisk 进行性能测试的工作笔记公司需要, 对Asterisk 进行一定的性能测试.测试目标:1. IVR 支持多少路2. 一对一通话, 支持多少路3. 不同编解码的性能影响.4. 通话中,录音, 支持多少路.测试工具: sipp /辅助工具: XliteSIP rfc:/rfc/rfc3261.txtRTP for AV /rfc/rfc3551.txt环境:CPU: xeon 51101.6G*2 , 1 G MEM 物理机Asterisk1.4.7Asterisk 基本操作:启动: safe_asterisk, 或者asterisk -vvvc如果是后台启动, 连接监控: astersisk -r关闭: 在控制栏输入stop nowAsterisk 配置:关注两个配置文件(/etc/asterisk):sip.conf // sip 分机号设置extensions.conf // dail plan 设置, 控制呼入后是什么动作sip.conf 添加2000 个分机号, 以便模拟1000 人呼叫(呼叫,应答)[1000]type=friendhost=dynamiccontext=incoming //和extensions.conf 中对应canreinvite=no //如果设置为yes, 双方通话信息会直接进行, 而不通过asterisk. 设置成no,表示所有交互都通过Asterisk.[1001]type=friendhost=dynamiccontext=incomingcanreinvite=noextensions.conf 这里列举了多种呼叫计划, 包括IVR, 拨号通话, 通话录音等.[incoming];play hello world foreverexten => _XXXX,1,answer()exten => _XXXX,2,playback(hello-world)exten => _XXXX,3,goto(OneToOne,_XXXX,1);[typetest];exten => 1111,1,Wait(2);exten => 1111,2,Record(/tmp/asterisk-recording:gsm);exten => 1111,3,Hangup;exten => 1112,1,Wait(2);exten => 1112,n,Playback(/tmp/asterisk-recording);exten => 1112,n,Hangup;[typetest2];exten => _XXXX,1,answer();exten => _XXXX,2,dial(sip/${EXTEN},10,r);[typetest3];exten => 999,1,answer();exten => 999,2,dial(sip/${EXTEN},10,r);exten => 999,1,Meetme(1234,i,123456);[OneToOne];exten => _XXXX,1,answer();exten => _XXXX,2,mixmonitor(test${EXTEN}.wav|av(0)V(0));exten => _XXXX,3,dial(sip/${EXTEN},10,r);exten => _XXXX,4,Hangup;exten => _XXXX,3,Record(/tmp/asterisk-recording${EXTEN}:gsm);exten => _XXXX,1,answer();exten => _XXXX,2,playback(hello-world);exten => _XXXX,3,goto(IVR,_XXXX,2)Sipp 基本操作:sipp 涉及三个文档(以呼入后,就不停播放IVR 语音):*.bat 批处理命令,方便调用, 其中 -m 参数表示sipp -sf a16.xml -inf a16.csv -p 5062 -m 200 -i 172.16.3.199 10.0.1.4:5060 -trace_err*.xml // 具体的操作, 核心部分, 下篇具体介绍xml 文件*.csv // xml 里面引用的参数, 以便发起不同呼叫SEQUENTIAL2001;1002;2003;1003;2200;1200;xml 文件 . 本文草本出自狼山客人, 保留其相关注释.<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE scenario SYSTEM "sipp.dtd"><!-- This program is free software; you can redistribute itand/or --><!-- modify it under the terms of the GNU General Public License as --> <!-- published by the Free Software Foundation; either version 2 of the --><!-- License, or (at your option) any laterversion. --><!-- --><!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warrantyof --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe --><!-- GNU General Public License for moredetails. --><!--<!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write tothe --><!-- Free Software Foundation,Inc., --><!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307USA --><!-- --><!-- Sipp default 'uac'scenario. --><!-- --><scenario name="Basic Sipstone UAC"><!--狼山客人:下面这一块表示SIPp发送一个INVITE数据包到SIPserver(Wavesplitter的MSP-16)--><send><![CDATA[INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport][local_ip]:[local_port];branch=[branch];rportFrom: [field0]<sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>Call-ID: [call_id]Cseq: 1 INVITEContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Type: application/sdpContent-Length: [len]v=0o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]s=-t=0 0c=IN IP[media_ip_type] [media_ip]m=audio [media_port] RTP/AVP 0a=rtpmap:0 G726/8000]]></send><!--狼山客人:下面这一块表示SIPp在等待SIP server返回一个100的数据包--><recv response="100"> optional="true"</recv><!--狼山客人:下面这一块表示SIPp在等待SIP server返回一个200的数据包,如果收到,说明ViVoice公司的VENUS NW800视频电话已经接听了,用户已经提起话筒--><recv response="200"></recv><!--狼山客人:下面这一块表示SIPp开始通话--><!-- Packet lost can be simulated in any send/recv messageby --><!-- by adding the 'lost = "10"'. Value can be [1-100]percent. --><send><![CDATA[ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp<sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: sut <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id]CSeq: 1 ACKContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Length: 0]]></send><!--狼山客人:下面这一块表示SIPp开始发送语音RTP stream,在VENUS NW800视频电话上可以听到不知道哪国的老外的声音--><!-- Play a pre-recorded PCAP file (RTP stream) --><nop><action><exec play_pcap_audio="pcap/g711a.pcap"/></action></nop><!--狼山客人:暂停10秒钟(10000),一小时, 3600000,等待播放语音完毕--><pause milliseconds="300000"/><!--狼山客人:下面这一块发送BYE信号,这是挂断电话信号--><send retrans="500"><![CDATA[BYE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport] [local_ip]:[local_port]From:sipp <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: sip <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id]Cseq: 2 BYEContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Length: 0]]></send><!--狼山客人:下面这一块表示挂断完毕--><recv response="200"></recv></scenario>里面的业务逻辑需要自己确认, 最好的方法是通过抓包(比如ethereal), 分析其工作流. 不同情况下, 返回的信息有所不同, 需要相应调整.上面是个呼入后,播放IVR 的案例, 比较简单.下面是register 的例子(要测试通话, 就要先注册分机号)<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE scenario SYSTEM "sipp.dtd"><!-- This program is free software; you can redistribute itand/or --><!-- modify it under the terms of the GNU General Public License as --> <!-- published by the Free Software Foundation; either version 2 of the --><!-- License, or (at your option) any laterversion. --><!-- --><!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warrantyof --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe --><!-- GNU General Public License for moredetails. --><!-- --><!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write tothe --><!-- Free Software Foundation,Inc., --><!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307USA --><!-- --><!-- Sipp default 'branchc'scenario. --><!-- --><scenario name="Basic Sipstone UAC"><send retrans="500"><![CDATA[REGISTER sip:[field0]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport][local_ip]:[local_port];branch=[branch];rportFrom: [field0]<sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]To: [field0] <sip:[field0]@[remote_ip]:[remote_port]>Call-ID: [call_id]CSeq: [cseq] REGISTERVia: SIP/2.0/[transport][local_ip]:[local_port];branch=z9hG4bK-d87543-717507386-1--d87543-;rp ortContact: <sip:[field0]@[local_ip]:[local_port]>Expires: 1200Max-Forwards: 70User-Agent: eyeBeam release 3004t stamp 16741Allow:INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFOContent-Length: 0]]></send><recv response="100"> optional="true"</recv><recv response="200" crlf="true"></recv></recv></scenario>Register 后, 先把被叫号码启动, 进入守护状态, 等到有电话呼叫(INVITE) 后, 震铃接通, 并发送数据. 产生通话效果.<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE scenario SYSTEM "sipp.dtd"><!-- This program is free software; you can redistribute itand/or --><!-- modify it under the terms of the GNU General Public License as --> <!-- published by the Free Software Foundation; either version 2 of the --><!-- License, or (at your option) any laterversion. --><!-- --><!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warrantyof --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe --><!-- GNU General Public License for moredetails. --><!-- --><!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write tothe --><!-- Free Software Foundation,Inc., --><!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307USA --><!-- --><!-- Sipp default 'branchs'scenario. --><!-- --><scenario name="branch_server"><!-- Set variable 3 if the ua is of the form ua2... --><recv request="INVITE" crlf="true"></recv><!-- send 180 then trying if variable 3 is set --><send next="1"><![CDATA[SIP/2.0 180 Ringing[last_From:][last_To:];tag=[call_number][last_Call-ID:][last_CSeq:][last_Via:]Contact: <sip:[field0]@[local_ip]:[local_port]>Content-Length: 0]]></send><label id="1"/><send retrans="500"><![CDATA[SIP/2.0 200 OK[last_From:][last_To:];tag=800000[call_number][last_Call-ID:][last_CSeq:][last_Via:]Contact: <sip:[field0]@[local_ip]:[local_port]>Allow:INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFOContent-Type: application/sdpContent-Length: 136v=0o=- 2372001 2372043 IN IP4 [local_ip]s=eyeBeamc=IN IP4 [local_ip]t=0 0c=IN IP4 [media_ip]m=audio [media_port] RTP/AVP 0a=fmtp:101 0-15a=rtpmap:100 speex/16000a=rtpmap:101 telephone-event/8000a=sendrecv]]></send><recv request="ACK"rtd="true"crlf="true"></recv><label id="2"/><nop><action><exec play_pcap_audio="pcap/g711a.pcap"/></action></nop><pause milliseconds="7000" next="2" /><!-- Keep the call open for a while in case the 200 is lost to be --> <!-- able to retransmit it if we receive the BYEagain. --><!-- definition of the response time repartition table (unit isms) --><!-- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> --><!-- definition of the call length repartition table (unit isms) --><!-- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> --><ResponseTimeRepartition value="20, 40, 60, 80, 100, 200, 400, 800"/> <CallLengthRepartition value="20, 100, 200, 1000, 2000, 10000, 20000"/></scenario>被叫准备好以后, 主叫开始呼叫<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE scenario SYSTEM "sipp.dtd"><!-- This program is free software; you can redistribute itand/or --><!-- modify it under the terms of the GNU General Public License as --> <!-- published by the Free Software Foundation; either version 2 of the --><!-- License, or (at your option) any laterversion. --><!-- --><!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warrantyof --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Seethe --><!-- GNU General Public License for moredetails. --><!-- --><!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write tothe --><!-- Free Software Foundation,Inc., --><!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307USA --><!----><!-- Sipp 'uac' scenario with pcap (rtp)play --><!-- --><scenario name="UAC with media"><!-- In client mode (sipp placing calls), the Call-ID MUSTbe --><!-- generated by sipp. To do so, use [call_id]keyword. --><send retrans="500"><![CDATA[INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport][local_ip]:[local_port];branch=[branch];rportFrom: [field0]<sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>Call-ID: [call_id]Cseq: 1 INVITEContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Type: application/sdpContent-Length: [len]v=0o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]s=-c=IN IP[local_ip_type] [local_ip]t=0 0m=audio [auto_media_port] RTP/AVP 8a=rtpmap:8 PCMA/8000a=rtpmap:101 telephone-event/8000a=fmtp:101 0-11,16]]></send><recv response="100" optional="true"></recv><!--<recv response="180" optional="true"></recv>--><!-- By adding rrs="true" (Record Route Sets), the routesets --><!-- are saved and used for following messages sent. Useful totest --><!-- against stateful SIPproxies/B2BUAs. --><recv response="200" rtd="true" crlf="true"></recv><!-- Packet lost can be simulated in any send/recv messageby --><!-- by adding the 'lost = "10"'. Value can be [1-100]percent. --><send><![CDATA[ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp<sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: sut <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id]CSeq: 1 ACKContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Length: 0]]></send><!-- Play a pre-recorded PCAP file (RTPstream) --><label id="1"/><nop><action><exec play_pcap_audio="pcap/g711a.pcap"/></action></nop><pause milliseconds="7000" next="1" /><!-- Play an out of band DTMF'1' --><nop><action><exec play_pcap_audio="pcap/dtmf_2833_1.pcap"/></action></nop><pause milliseconds="1000"/><!-- The 'crlf' option inserts a blank line in the statistics report. --><send retrans="500"><![CDATA[BYE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0Via: SIP/2.0/[transport] [local_ip]:[local_port]From:sipp <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]To: sip <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id]Cseq: 2 BYEContact: sip:[field0]@[local_ip]:[local_port]Max-Forwards: 70Subject: Performance TestContent-Length: 0]]></send><recv response="200" crlf="true"></recv><!-- definition of the response time repartition table (unit isms) --><!-- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> --><!-- definition of the call length repartition table (unit isms) --><!-- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> --><ResponseTimeRepartition value="20, 40, 60, 80, 100, 200, 400, 800"/> <CallLengthRepartition value="20, 100, 200, 1000, 2000, 10000, 20000"/></scenario>编码对性能影响:v=0o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]s=-c=IN IP[local_ip_type] [local_ip]t=0 0m=audio [auto_media_port] RTP/AVP 8a=rtpmap:8 PCMA/8000 //语音发送, 修改PCMA 为G726 等, 不过这个需要asterisk server 支持a=rtpmap:101 telephone-event/8000a=fmtp:101 0-11,16通话录音性能:extensions.conf 中选择通话中录音的方式就可以了. 录音文件保存在:/var/spool/asterisk/monitor测试结果:IVR: 500 路一对一通话: 500 路录音: 300 路编解码转换对性能影响较大, 具体和编码方式相关.。