我已经用 2.7.1 版本和 python 3.6 编译了源代码。如上所述,PJSIP 工作得很好。我在发送 DTMF 时遇到了一个问题,
我在做什么:
- 注册账户
- 拨打电话
- 检查媒体状态是否处于活动状态
- 然后调用方法 self.call.dial_dtmf("4")
那是当我收到错误消息时:
self.call.dial_dtmf("4")
File "C:\Python36-32\lib\site-packages\pjsua.py", line 1761, in dial_dtmf
self._lib()._err_check("dial_dtmf()", self, err)
File "C:\Python36-32\lib\site-packages\pjsua.py", line 2722, in _err_check
raise Error(op_name, obj, err_code, err_msg)
pjsua.Error: Object: {Call sip:2002@192.168.100.127:5060},
operation=dial_dtmf(), error=b'Invalid value or argument (PJ_EINVAL)'
我还与 SDP 确认有 101 个电话事件可用。如下图所示:
Session Description Protocol
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): 3cxPS 496286826496 76722208769 IN IP4 192.168.100.127
Session Name (s): 3cxPS Audio call
Connection Information (c): IN IP4 192.168.100.122
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 5004 RTP/AVP 0 8 9 109 101
Media Attribute (a): sendrecv
Media Attribute (a): rtpmap:0 PCMU/8000
Media Attribute (a): ptime:20
Media Attribute (a): rtpmap:8 PCMA/8000
Media Attribute (a): rtpmap:9 G722/8000
Media Attribute (a): rtpmap:109 iLBC/8000
Media Attribute (a): fmtp:109 mode=30
Media Attribute (a): rtpmap:101 telephone-event/8000
Media Attribute Fieldname: rtpmap
Media Format: 101
MIME Type: telephone-event
Sample Rate: 8000
Media Attribute (a): fmtp:101 0-15
Media Attribute Fieldname: fmtp
Media Format: 101 [telephone-event]
Media format specific parameters: 0-15
我已经检查了从我们编译源代码时生成的控制台应用程序发送 DTMF,它完美无缺。相同的控制台应用 pjsua_app.py 有错误,我无法运行它来测试发送 DTMF。
谁能让我在哪里做错了,或者有没有其他方法可以使用 RFC 2833 发送 DTMF。
-- 虚拟机