使用sipp测试freeswitch环境搭建步骤.docx
《使用sipp测试freeswitch环境搭建步骤.docx》由会员分享,可在线阅读,更多相关《使用sipp测试freeswitch环境搭建步骤.docx(12页珍藏版)》请在冰豆网上搜索。
使用sipp测试freeswitch环境搭建步骤
使用sipp测试freeswitch环境搭建步骤
1、createnum.sh是在服务器的quickvcx/conf/directory/default目录下创建账号的,它拷贝1000.xml到新的文件中。
使用方法是./createnum.sh2000030000,就会创建20000~29999的账号
#/bin/bash
cd/usr/local/freeswitch/conf/directory/default
echo$(pwd)
num=$1
while[$num-lt$2]
do
echo$num
tmpfile=$num.xml.tmp
realfile=$num.xml
cp1000.xml$tmpfile
cat$tmpfile|whilereadline
do
#echo$line
echo${line//1010/$num}>>$realfile
done
rm$tmpfile
letnum=num+1
done
2、createregdata.sh是在本地创建主叫或者被叫注册时使用的数据文件的。
使用方法是./createregdata.shtest-reguac.csv2000030000创建主叫的注册数据文件,我是用偶数作为主叫。
./createregdata.shtest-reguas.csv2000130000创建被叫的注册数据文件,我是用奇数作为被叫。
#!
/bin/bash
echoSEQUENTIAL>>$1
num=$2
while[$num-lt$3]
do
echo"$num;[authenticationusername=$numpassword=$num]">>$1
letnum=num+2
done
3、createuacdata.sh是在本地创建主叫呼叫时使用的数据文件。
使用方法是./createuacdata.shtest-uacmedia.csv2000030000
#/bin/bash
echoSEQUENTIAL>>$1
num=$2
letcallee=num+1
invitecseq=1
invite2cseq=2
byecseq=3
while[$num-lt$3]
do
echo"$num;$callee;[authenticationusername=$numpassword=$num];$invitecseq;$invitecseq;$invite2cseq;$invite2cseq;$byecseq">>$1
letnum=num+2
letcallee=num+1
letinvitecseq=invitecseq+3
letinvite2cseq=invite2cseq+3
letbyecseq=byecseq+3
done
4、编译sipp
解压sipp.3.2.src.tar.gz,编译命令是makepcapplay_ossl,并且把产生的可执行文件sipp和目录pcap拷贝到和之前产生数据文件同一个目录下。
5、注册使用的配置文件是test-reg.xml
xmlversion="1.0"encoding="ISO-8859-1"?
>
DOCTYPEscenarioSYSTEM"sipp.dtd">
--Thisprogramisfreesoftware;youcanredistributeitand/or-->
--modifyitunderthetermsoftheGNUGeneralPublicLicenseas-->
--publishedbytheFreeSoftwareFoundation;eitherversion2ofthe-->
--License,or(atyouroption)anylaterversion.-->
---->
--Thisprogramisdistributedinthehopethatitwillbeuseful,-->
--butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof-->
--MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe-->
--GNUGeneralPublicLicenseformoredetails.-->
---->
--YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense-->
--alongwiththisprogram;ifnot,writetothe-->
--FreeSoftwareFoundation,Inc.,-->
--59TemplePlace,Suite330,Boston,MA02111-1307USA-->
---->
--Sippdefault'branchc'scenario.-->
---->
--首先发送SIP注册消息,Register。
里面的From与To是注册的号码-->
[CDATA[
REGISTERsip:
[remote_ip]SIP/2.0
Via:
SIP/2.0/[transport][local_ip]:
[local_port];branch=[branch]
From:
[field0][field0]@[remote_ip]:
[remote_port]>;tag=[call_number]
To:
[field0][field0]@[remote_ip]:
[remote_port]>
Call-ID:
[call_id]
CSeq:
1REGISTER
Contact:
sip:
[field0]@[local_ip]:
[local_port]
Content-Length:
0
Expires:
3600
]]>
--SIPp会收到来自AST要求验证的401消息体,Recv意思为Receive,接收到来自AST的401要求验证的消息,Next为如果收到401,那么转至Label为1的地方进行操作-->
--sendinvitewithauthenticationmessages-->
--开始发送Register消息,里面将把验证的密码消息发送给对方,在消息体里面是抓不到密码消息的,而且已经被md5方式加密过。
-->
[CDATA[
REGISTERsip:
[field0]@[remote_ip]:
[remote_port]SIP/2.0
Via:
SIP/2.0/[transport][local_ip]:
[local_port]
From:
[field0][field0]@[remote_ip]:
[remote_port]>;tag=[call_number]
To:
[field0][field0]@[remote_ip]:
[remote_port]>
Call-ID:
[call_id]
CSeq:
2REGISTER
Contact:
sip:
[field0]@[local_ip]:
[local_port]
[field1]
Content-Length:
0
Expires:
3600
]]>
--收到来自AST的200ACK消息后,系统转至等待1000ms,或者可以直接去掉该设置-->
--definitionoftheresponsetimerepartitiontable(unitisms)-->
--definitionofthecalllengthrepartitiontable(unitisms)-->
6、主叫使用的配置文件是test-uacmedia.xml
xmlversion="1.0"encoding="ISO-8859-1"?
>
DOCTYPEscenarioSYSTEM"sipp.dtd">
--Thisprogramisfreesoftware;youcanredistributeitand/or-->
--modifyitunderthetermsoftheGNUGeneralPublicLicenseas-->
--publishedbytheFreeSoftwareFoundation;eitherversion2ofthe-->
--License,or(atyouroption)anylaterversion.-->
---->
--Thisprogramisdistributedinthehopethatitwillbeuseful,-->
--butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof-->
--MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe-->
--GNUGeneralPublicLicenseformoredetails.-->
---->
--YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense-->
--alongwiththisprogram;ifnot,writetothe-->
--FreeSoftwareFoundation,Inc.,-->
--5