SIPp的使用-SIPp的教程
SIPp的使用-SIPp的教程 在rocky9.5操作系统上编译SIPp 提供简单用法
sudo dnf update -y
sudo dnf install -y gcc-c++ make ncurses-devel openssl-deve
wget http://www.tcpdump.org/release/libpcap-X.X.X.tar.gz
tar -xvzf libpcap-X.X.X.tar.gz
cd libpcap-X.X.X
./configure
make
sudo make install
git clone https://github.com/SIPp/sipp.git
cd sip
mkdir build
cd build
cmake ..
make && make install
测试
sipp -v
SIPp v3.7.3-26-g464cf74-TLS-PCAP-SHA256.
This program is free software; you can redistribute it and/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 later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author: see source files.
sipp -sn uac # 用 SIPp 进行 SIP 测试。例如,运行一个简单的测试场景
2025-01-28 01:32:17.361516 1737999137.361516: Missing remote host parameter. This scenario requires it
------------------------------ Scenario Screen -------- [1-9]: Change Screen --
Call rate (length) Port Total-time Total-calls Remote-host
10.0(0 ms)/1.000s 0 0.00 s 0 :5060(UDP)
0 new calls during 0.000 s period 0 ms scheduler resolution
0 calls (limit 30) Peak was 0 calls, after 0 s
0 Running, 0 Paused, 0 Woken up
0 dead call msg (discarded) 0 out-of-call msg (discarded)
0 open sockets 0/0/0 UDP errors (send/recv/cong)
0 open sockets 0/0/0 UDP errors (send/recv/cong)
Messages Retrans Timeout Unexpected-Msg
0 : INVITE ----------> 0 0 0
1 : 100 <---------- 0 0 0 0
2 : 180 <---------- 0 0 0 0
3 : 183 <---------- 0 0 0 0
4 : 200 <---------- E-RTD1 0 0 0 0
5 : ACK ----------> 0 0
6 : Pause [ 0ms] 0 0
7 : BYE ----------> 0 0 0
8 : 200 <---------- 0 0 0 0
------------------------------ Test Terminated --------------------------------
----------------------------- Statistics Screen ------- [1-9]: Change Screen --
Start Time | 2025-01-28 01:32:17.360400 1737999137.360400
Last Reset Time | 2025-01-28 01:32:17.360400 1737999137.360400
Current Time | 2025-01-28 01:32:17.361818 1737999137.361818
-------------------------+---------------------------+--------------------------
Counter Name | Periodic value | Cumulative value
-------------------------+---------------------------+--------------------------
Elapsed Time | 00:00:00:001000 | 00:00:00:001000
Call Rate | 0.000 cps | 0.000 cps
-------------------------+---------------------------+--------------------------
Incoming calls created | 0 | 0
Outgoing calls created | 0 | 0
Total Calls created | | 0
Current Calls | 0 |
-------------------------+---------------------------+--------------------------
Successful call | 0 | 0
Failed call | 0 | 0
-------------------------+---------------------------+--------------------------
Response Time 1 | 00:00:00:000000 | 00:00:00:000000
Call Length | 00:00:00:000000 | 00:00:00:000000
------------------------------ Test Terminated --------------------------------
2025-01-28 01:32:17.361516 1737999137.361516: Missing remote host parameter. This scenario requires it
测试 SIP over TLS,可以使用以下命令:
sipp -t l1 -tls_cert cert.pem -tls_key key.pem -sn uac <remote_ip>
-t l1:使用 TLS 传输。
-tls_cert cert.pem:指定 TLS 证书文件。
-tls_key key.pem:指定 TLS 私钥文件。
测试 PCAP 支持
如果需要捕获网络流量,可以使用以下命令:
sipp -pcap <output_file>.pcap -sn uac <remote_ip>
-pcap <output_file>.pcap:将捕获的网络流量保存到指定的 .pcap 文件中。
uac 场景是一个 UAC(User Agent Client) 场景,用于模拟 SIP 客户端向远程 SIP 服务器发送请求。
该场景需要以下参数:
远程主机地址:SIP 服务器的 IP 地址或域名。
远程端口:SIP 服务器的端口号(默认是 5060)。
在运行 sipp 时,必须指定远程主机的地址和端口。以下是正确的命令格式:
基本命令
sipp -sn uac <remote_host>
<remote_host>:远程 SIP 服务器的 IP 地址或域名。
指定端口
如果远程 SIP 服务器使用的不是默认端口 5060,可以通过 -p 参数指定端口:
sipp -sn uac <remote_host> -p <remote_port>
<remote_port>:远程 SIP 服务器的端口号。
示例
假设远程 SIP 服务器的地址是 192.168.1.100,端口是 5060,可以运行以下命令:
sipp -sn uac 192.168.1.100
如果端口是 5080,可以运行:
sipp -sn uac 192.168.1.100 -p 5080
其他常用参数
除了 -sn 和 -p,SIPp 还支持许多其他参数。以下是一些常用的选项:
设置呼叫速率
sipp -sn uac <remote_host> -r 10
-r 10:每秒发送 10 个呼叫。
设置最大呼叫数
sipp -sn uac <remote_host> -m 100
-m 100:最多发送 100 个呼叫。
使用 TCP 传输
sipp -sn uac <remote_host> -t t1
-t t1:使用 TCP 传输协议。
使用 TLS 传输
sipp -sn uac <remote_host> -t l1 -tls_cert cert.pem -tls_key key.pem
-t l1:使用 TLS 传输协议。
-tls_cert cert.pem:指定 TLS 证书文件。
-tls_key key.pem:指定 TLS 私钥文件。