Skip to main content

用于收集 RTCP-XR (RFC 3611) SIP 质量数据包的 python 库

项目描述

rtcpxr_collector

用于收集 RTCP-XR (RFC 3611) SIP 质量数据包的 python 库

前任

非常感谢该项目:https ://github.com/pbertera/vq-collector 核心概念和处理核心取自那里。大多数代码已被重构和剥离。

基本用法

这是一个更大的项目(因此是一个库)的一部分。我强烈建议您将手机配置为发送给您的收藏家,并将“名称”设置为手机的 mac 地址。这是唯一识别手机的唯一方法(至少我已经找到了。)

使用所有默认值运行代码:

#!/usr/bin/python3

from rtcpxr_collector import vqcollector
vqs = vqcollector.CollectorServer()
vqs.listen()

通常您将使用自定义处理程序,因此这里有一个示例:

#!/usr/bin/python3
import datetime
from rtcpxr_collector import vqcollector

def logHandler(r):
    print("%s %s %s CQ:%s LQ:%s Local:%s Remote:%s"%(datetime.datetime.now(), 
                                             r['Handset']['MAC'],
                                             r['CallID'],
                                             r['QualityEst']['MOSCQ'],
                                             r['QualityEst']['MOSLQ'],
                                             "%s %s"%(r['LocalID']['name'],r['LocalID']['desc']),
                                             "%s %s"%(r['RemoteID']['name'],r['RemoteID']['desc']) ))
    return True

vqs = vqcollector.CollectorServer(handler=logHandler)
vqs.listen()

也许您想在非标准 IP 或端口上运行:

#!/usr/bin/python3

from rtcpxr_collector import vqcollector
vqs = vqcollector.CollectorServer(local_ip=10.10.10.15, port=5061)
vqs.listen()

所有选项

The CollectorServer object opens a SIP socket to receive RTCP-XR packets,
parses them, then sends the data to a handler.

Attributes:
    local_ip (ipV4 address): [None] Local IPV4 address to bind to (None: Autodetect)
    port (int)             : [5060] Local Port to bind to
    reply_to_socket (bool) : [False] Should we reply to the address from the socket, or the SIP Header
    debug (bool)           : [False] Print Debugging information
    handler (func)         : [None] Handler function for recieved data (None: pprint res data)
    timeout (int)          : [10] Select Timeout in seconds
    timeout_handler (func) : [None] Handler for select timeout event

Handler Function:
    Takes 1 arg that is the parsed data structure.
    Returns: Send Response Packet? True or False

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

rtcpxr_collector-0.1.7.ta​​r.gz (19.2 kB 查看哈希

已上传 source

内置分布

rtcpxr_collector-0.1.7-py3-none-any.whl (19.9 kB 查看哈希

已上传 py3