如何将 pcap 文件流式传输到 RTP/RTCP 流?
我已经捕获了三个不同的流作为带有元数据的 pcap 文件。如何流回 RTP/RTCP 流?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我已经捕获了三个不同的流作为带有元数据的 pcap 文件。如何流回 RTP/RTCP 流?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
如果我理解正确的话,你有 pcap,但你想从他们那里得到 RTP 吗?
Wireshark UI
您可以使用 Wireshark 的 UI 通过菜单轻松地从 pcap 获取 RTP:电话/RTP/,然后显示所有流...单击它列出的流,然后“分析”。
但是,如果您想自动化此操作并避免使用 UI...您可以使用 tshark。我在网上找到了几个教程,并使用它们构建了一个测试工具,可以自动在 pcap 上重建音频/rtp,然后制作一个 wav 并将该 wav 上的音频转录为文本。
使用 Tshark 自动化
我正在进行测试通话,想要将录制的 pcap 转换为音频。为此,我从 pcap 中剥离了 RTP,然后将 rtp 文件转换为原始音频,然后转换为 wav。
我通过命令行完成这一切,因此它可以自动化。所以我真的有一个 shell 脚本可以做到这一点:
上面记录了 20 秒的数据包捕获(同时进行呼叫的持续时间)并将数据包输出为 sip_1call.pcap
我将变量 ssrc 设置为此使用 tshark 提取 rtp ssrc 值的操作。 ssrc是什么,是RTP流的标识符。如果您有一个流,则您将拥有一个 RTP ssrc 值。您需要捕获所有 RTP.ssrc 并将它们输出到文件中,这样就可以轻松地再次变成原始音频。
在我的 shell 脚本的这一点上,我再次在记录的 pcap 上运行 tshark 并获取该 ssrc 值并说“将它们全部查找为‘有效负载’”
现在脚本正在将这些 RTP.ssrc 设置为输出文件,我正在调用 sip_1call.raw
出于我的目的,我还想将该原始文件转换为 wav,因此我使用了 sox:
我在自动化框架中做了更多的事情(例如将音频转录为文本并与已知字符串进行比较)。 ..但这超出了你的问题范围。
我希望这有助于...
有关 SSRc 的更多信息: http://en.wikipedia.org/wiki/ Real-time_Transport_Protocol 有关
我正在使用的完整 shell 脚本的更多详细信息:
http://www.continuous-qa.com /2013/04/automated-verification-of-voip-audio.html
If I understand correctly, you have the pcaps, but you want to get the RTP from them?
Wireshark UI
You could use Wireshark's UI to easily take the RTP from the pcap via the Menu: Telephony/RTP/ then show all streams... click a stream it lists, and then 'analyize.'
However, if you want to automate this, and avoid the UI... you can use tshark. I found several tutorials online and used them to build a test harness that automatically rebuilds the audio/rtp on a pcap, then makes a wav and transcribes the audio on that wav to text.
Automated with Tshark
I was making a test call, and wanted to convert the pcap recorded to audio. To do this, I stripped the RTP out of the pcap, then converted the rtp file to raw audio, and then to a wav.
I do this all via the command line so it can be automated. So really I have a shell script that does this:
The above records a packet capture for 20 seconds (the duration of the call going on at the same time) and outputs the packets as sip_1call.pcap
I'm setting the variable ssrc to this action of using tshark to pull out the rtp ssrc value. What the ssrc is is, is an identifier of a RTP stream. If you have one stream, you'd have one RTP ssrc value. You would need to capture all the RTP.ssrc's and output them to a file and that can easily become raw audio again.
At this point of my shell script, I'm running tshark again on the recorded pcap and taking that ssrc value and saying "find all of them as 'payload'"
Now the script is setting those RTP.ssrc's to a output file, i'm calling sip_1call.raw
For my purpose I also wanted to convert that raw file to a wav, so I used sox:
I did some more stuff in my automation framework (like transcribe the audio to text and compare against a known string)... but that's outside the scope of your question.
I hope that helps...
More on SSRc: http://en.wikipedia.org/wiki/Real-time_Transport_Protocol
More details on the full shell script I'm using:
http://www.continuous-qa.com/2013/04/automated-verification-of-voip-audio.html
有一个工具专门用于此目的,作为 SIPp sip 测试包的一部分。
http://sipp.sourceforge.net/doc/reference.html#PCAP+Play
(免责声明:我自己从未使用过它,尽管我确实使用过 SIPp 本身,并且非常喜欢它)
There is a tool just for this purpose, as part of the SIPp sip testing package.
http://sipp.sourceforge.net/doc/reference.html#PCAP+Play
(disclaimer: I've never used it myself, though I did use SIPp itself, and was very fond of it)
您可以使用这个简单、免费的工具重播所有捕获的数据包(包括 RTP)。
PlayCap - Wireshark 捕获回放
You can replay all of your captured packets (including RTP) with this simple, free tool.
PlayCap - Playback for Wireshark Captures
进行 pcap 并(我认为)重放它是一件不简单的事情;据我所知,没有任何软件包可以做到这一点。这是可以做到的,但需要对 SIP(我假设您正在使用 SIP)和 RTP 有很好的了解。您还必须小心地在正确的时间重播数据包,而不是尽可能快。
真正了解自己在做什么的人可以在 3-5 天内编写出这样的工具。
Taking a pcap and (I assume) replaying it is a non-trivial thing to do; there are no packages that I know of to do it. It can be done, but requires very good knowledge both of SIP (I assume you're using SIP) and RTP. You also have to be careful to replay the packets at the right times, not as fast as you can.
Someone who really knows what they're doing could write such a tool in 3-5 days.
如果您只想重播/收听音频,您可以使用wireshark将RTP有效负载保存在原始音频文件中,然后您可以重新发送它(或使用音频编辑器收听它),但如果您想重现确切的RTP/ RTCP流比较复杂
If you just want to replay/listen the audio you can save the RTP payload in a raw audio file using wireshark, then you can resend it (or listen to it using an audio editor), but if you want to reproduce the exact RTP/RTCP stream it's more complicated
为了实现您的目标,有一个名为 rtpplay 的特定工具(免费): http://www .cs.columbia.edu/irt/software/rtptools/
To achive your goal there is a specific tool (free) named rtpplay: http://www.cs.columbia.edu/irt/software/rtptools/
我也用这个把头撞在墙上有一段时间了……但是,我找到了解决方案。因此,首先,请确保您可以正确地拨打软电话/电话……如果您可以使连接正常,那么其余的还不错。
这是我的命令行:
sudo sipp -s [我的电话号码] [我的代理/软交换机的 IP] -sf /home/sipp-3.3/uac_pcap_g711.xml -m 2000 -mi [发送负载的计算机的 IP ] -d 1200 -trace_rtt -trace_err -stat_delimiter ,
所以我使用我自己的场景文件,但上面的参数应该适合你。这就是我对 SIPP 所做的事情:
sudo:为什么是 sudo?如果您不执行此命令,则它无法创建发送音频/媒体所需的套接字。
mi:mi 指定您用于发送媒体的 IP...我不需要指定端口。
d:我在暂停
trace_rtt和trace_err中添加了1200毫秒:我输出日志文件和性能报告
stat_delimiter:我更改默认值;无论如何,
这对我有用。
编辑:
另外,请注意,我以默认速率 (10CPS) 进行了 2000 次调用...您可能想暂时将其设置为 -m 1,以便可以验证它是否有效。它应该播放 pcap 音频,然后发送 DTMF。
在我完成这项工作后,我将所有这些导入到 Jenkins CI 中,并通过 Jenkins 作业调用 sipp,并将 csv 输出转换为可视化图表,并且还在加载期间进行一些 tshark 捕获...所有这些都通过 Jenkins 进行...如果您'如果有兴趣,请查看我的博客(在我的个人资料中提到)以获取有关如何设置该内容的详细信息。
I banged my head on a wall for some time with this as well... But, I got a solution. So first, make sure you can correctly get your call to a softphone/phone... if you can make that connection fine, the rest isn't so bad.
Here's my command line:
sudo sipp -s [my phone number] [ip of my proxy/softswitch] -sf /home/sipp-3.3/uac_pcap_g711.xml -m 2000 -mi [ip of my computer sending the load] -d 1200 -trace_rtt -trace_err -stat_delimiter ,
So I'm using my own scenario file, but the above params should work fine for you. here's what I'm doing with SIPP:
sudo: Why sudo? If you don't sudo this, it can't create the socket needed to send the audio/media.
mi: mi specifies your IP for sending media... I didn't need to specify the port.
d: I added 1200 ms to the pause
trace_rtt and trace_err: I output the log files and performance report
stat_delimiter: i change the default ; to ,
Anyway this worked for me.
Edit:
Also, note that I have this for 2000 calls, at the default rate (10CPS)... you might want to make that -m 1 for now so that you can verify it works. It should play the pcap audio, and then send a DTMF.
After I got this working, I imported this all in Jenkins CI and call sipp via Jenkins jobs, and convert the csv output to visual graphs, and also do some tshark captures during the load... all via Jenkins... if you're interested, check out my blog (mentioned in my profile) for details on how to set that stuff up.