如何将 RTP 数据包与其他数据包分开
我有一个带有 voip 对话的 pcap 文件,如何将 RTP 数据包与其他数据包分开?
我可以获取 sip 数据包,但无法区分 RTP 数据包和其他数据包。
I got a pcap file with voip conversation, how i can separate RTP packets from the other packets?
I can obtain sip packets, but I can't differenciate the RTP packets from the rest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在文件中搜索 RFC3550 中定义的 RTP 标头。或者更好地使用 pcap-filter,例如使用 this wiki(查找“Q:什么是好的过滤器”仅捕获 SIP 和 RTP 数据包?”)。
Search for RTP headers as defined in RFC3550 within your file. Or better use pcap-filter, for instance with this wiki (look for "Q: What is a good filter for just capturing SIP and RTP packets?").
查看 @macs 关于 PCap 过滤器的建议。如果这不能满足您的需求(例如,您需要过滤掉特定 SIP 会话的 RTP 数据包),则没有简单的方法。您需要解析 SIP 消息、检索 RTP 端口号、在特定时间段获取进出这些端口的数据包,并(可选)通过检查其标头(标头中的
幻数
)来检查这些数据包是否为 RTP )Check @macs recommendation about PCap filter. If this cannot satisfy your needs (e.g. you need to filter out RTP packets of specific SIP session) there's no simple way. You need to parse SIP messages, retrieve RTP port numbers, takes packets going to/from these ports in particular time period and (optionally) check if these packets are RTP by checking their headers (
magic number
in headers)从 pcap 文件中提取 RTP/RTCP 数据包的开源软件是:
从源代码中您可以查看并了解所使用的方法。
如果您能够解码 SIP,那么您可以找到(在 INVITE 消息中)SDP 消息。如果对其进行解码,您可以找到 RTP“流”的 IP 和端口(以及 RTCP => 端口 + 1)。通过这些信息,您可以唯一地识别 RTP 和 RTCP 数据包。请记住,经常有一些带有 STUN 协议的包(具有相同的 IP 端口)必须与 RTP 分开。
你必须考虑数据包捕获在哪里(网络上下文和约束),你可能会考虑 NAT。
An open source software that extract the RTP/RTCP packets from a pcap file are:
From the source code you can view and understand the methodologies used.
If you are able to decode the SIP, then you can find (inside INVITE message) the SDP message. If you decode it you can find the IP and PORT of RTP "stream" (and RTCP => port + 1). With these informations you can identify uniquely the RTP and RTCP packets. Keep in mind that there are often packages (with the same IP-PORT) with the STUN protocol which must be separate from RTP.
You have to consider where is the packet capture (network context and constraints), you may take into account NAT.
如果您想在wireshark中查看RTP流量,则:
希望有帮助。 :)
ps 编辑后注意到这是针对 Wireshark 的。感谢评论者指出这一点!
If you want to see the RTP traffic in wireshark then:
Hope that helps. :)
p.s. edited to note that this is for Wireshark. Thanks to a commentor for pointing that out!