< 返回版块

shenjinti 发表于 2025-12-26 09:55

Tags:webrtc,sip,stress test

大家好,https://github.com/restsend/rustpbx 最近开始做压力测试,发现市面上没有一个简单易用的SIP压测工具

最近rustpbx的star马上要到500了,还差⭐️,🙏各位哥哥姐姐帮忙点赞哈哈哈

项目地址在https://github.com/restsend/sipbot

刚好我写完了RustRTC,就用rsipstack和rustrtc写一个简单易用的SIP压测工具

工具要求:

  • 要CLI的,能集成到CI流程中
  • 支持RTP,能知晓是否收发成功音频流
  • 支持NACK,要支持丢包的重传,确保在高丢包率的情况下,能正确统计出数据来,不能简单发了报文了事
  • 要支持录音,呼叫双方都能录制音频,方便查看
  • 可以选择是否播放彩铃
  • 能注册到服务,可以等待呼叫
  • 可以设置并发数量,满足CPS呼叫要求,确保服务器保持一定的通话情况
  • 根据以上的要求,用rust 写了一个版本,效果还是不错,给大家看看:

等待:

sipbot wait

呼叫:

sipbot call -t sip:127.0.0.1

简简单单就完成了一个带音频流的呼叫,

如果需要更多的参数, 等待模式


mpi@mpis-MacBook-Air ~ % sipbot wait --help
Wait for incoming calls

Usage: sipbot wait [OPTIONS]

Options:
  -a, --addr <ADDR>                    Bind address (e.g., 0.0.0.0:5060) [default: 0.0.0.0:5060]
  -C, --conf <CONF>                    Path to the configuration file
  -E, --external <EXTERNAL>            External IP address
  -u, --username <USERNAME>            Username (e.g., sipbot) [default: sipbot]
      --auth-user <AUTH_USER>          Auth username (optional)
  -d, --domain <DOMAIN>                Domain/Realm (e.g., 127.0.0.1)
  -p, --password <PASSWORD>            Password for registration
      --register [<REGISTER>]          Register to SIP server (optional domain)
      --ringback <RINGBACK>            Ringback file (wav)
  -v, --verbose                        
      --ring-duration <RING_DURATION>  Ring duration in seconds
      --answer <ANSWER>                Answer and play file (wav)
      --echo                           Answer and echo
      --hangup <HANGUP>                Hangup after seconds
      --reject <REJECT>                Reject with code (e.g. 486, 603)
      --reject-prob <REJECT_PROB>      Reject probability (1-99%)
      --srtp                           Enable SRTP/SDES
      --nack                           Enable NACK
      --jitter                         Enable Jitter Buffer
  -h, --help                           Print help

呼叫模式:

mpi@mpis-MacBook-Air ~ % sipbot call --help
Initiate a call

Usage: sipbot call [OPTIONS]

Options:
  -C, --conf <CONF>                Path to the configuration file
  -t, --target <TARGET>            Target URI (e.g., sip:user@domain)
  -E, --external <EXTERNAL>        External IP address
  -u, --username <USERNAME>        Username (e.g., sipbot)
      --auth-user <AUTH_USER>      Auth username (optional)
      --password <PASSWORD>        Auth password
      --register [<REGISTER>]      Register to SIP server before calling (optional domain)
      --hangup <HANGUP>            Hangup after seconds
      --play <PLAY>                Play file (wav)
  -v, --verbose                    
      --record <RECORD>            Record to file (wav)
      --srtp                       Enable SRTP/SDES
      --nack                       Enable NACK
      --jitter                     Enable Jitter Buffer
      --total <TOTAL>              Total number of calls to make [default: 1]
      --concurrent <CONCURRENT>    Max concurrent calls [default: 1]
      --cancel-prob <CANCEL_PROB>  Cancel probability (0-99%) [default: 0]
  -h, --help                       Print help

代码也都是开源的,如果大家想学习SIP、WebRTC、Rust,那么这个是一个非常不错的入门项目

并且这个也不是简单的测试呼叫,其实就是一个能完整拨打、应答的SIP Phone了

代码在:

https://github.com/miuda-ai/sipbot


Ext Link: https://github.com/restsend/rustpbx

评论区

写评论

还没有评论

1 共 0 条评论, 1 页