python-3.x - PJSUA 转移调用在 python37 中不起作用如何在 python27 中起作用
问题描述
current_call.transfer("sip:1001@xx.xx.xx.xx") 正在运行 python2.7 但是它在下面的 python3.7 中不起作用是错误
Original exception was:
Traceback (most recent call last):
File "trycall.py", line 151, in <module>
current_call.transfer("sip:1001@xx.xx.xx.xx")
File "/usr/local/lib/python3.7/dist-packages/pjsua.py", line 1734, in transfer
Lib._create_msg_data(hdr_list))
SystemError: <built-in function call_xfer> returned NULL without setting an error
解决方案
我正在使用 PJSIP 的这个分支:Link for PJSUA implementation with Python 3.6 并且遇到了同样的传输问题。
从函数py_pjsua_call_xfer (pjproject/pjsip-apps/src/python/_pjsua.c) 中删除此检查解决了我的问题:
if (!PyBytes_Check(pDstUri))
return NULL;
在我的所有测试中,此检查始终返回 NULL。我无法用 Python 解决这个问题。删除上面提到的代码解决了这个问题,现在它还没有产生任何新问题。我已经用 Asterisk 和 3 个 SIP 端点测试了这个修改,并且传输得到了正确处理。
(注意:我不是 C/C++ 程序员,所以我无法详细说明为什么这段代码不起作用。这种方法基于反复试验。)
推荐阅读
- python - 有没有办法在 for 循环中嵌套迭代器
- javascript - 如何在 TS 中访问场景、渲染器、相机对象 Forge viewer v6
- powershell-2.0 - 通过匹配字符串查找文件内容并输出在 PowerShell 2.0 中找不到的内容
- java - 无法将名称 [org.hibernate.spatial.dialect.postgis.PostgisDialect] 解析为策略 [org.hibernate.dialect.Dialect]
- c# - c# 从 Handler 类中的流中读取 .csv
- javascript - 面板使用 jQuery 中的 mouseover、mouseout 事件
- ojs - 存档路径在 ojs 3.1.2.1 下不起作用
- java - Intellij 插件 JBTabbedPane UI 在主题切换后被替换
- traefik - 配置 traefik 的 ForwardAuth 中间件的问题
- firebase - .onAuthStateChanged 方法是否计入 Firebase 身份验证验证?