背景
在上一章中,我们介绍了dtmf
按键功能,可以看到rtpengine
能够把收到的rfc2833
和inbound
类型的dtmf
透传到uas
。
在实际项目中, 我们可能还需要对dtmf
做按键类型转换, 在rtpengine
的官方文档transcoding中,我们找到这样一段话:
Rtpengine supports transcoding between RFC 2833/4733 DTMF event packets (telephone-event payloads) and in-band DTMF audio tones. When enabled, rtpengine translates DTMF event packets to in-band DTMF audio by generating DTMF tones and injecting them into the audio stream, and translates in-band DTMF tones by running the audio stream through a DSP, and generating DTMF event packets when a DTMF tone is detected.
所以可以得知rfc2833/4733
和inbound
类型可以互相转换。
本次测试的rtpengine版本:
Version: 13.1.0.0+0~mr13.1.0.0 git-heads/mr13.0.1.2-3ac08574
rfc2833 转inbound
在opensips
调用rtpengine_manager
里,参数设置如下:
always-transcode codec-mask-all codec-transcode-telephone-event codec-strip-telephone-event
通过抓包得到的结果如下:
opensips
转发给uas
的RTP
按键内容为:
所以可以确定rfc2833
转inbound
成功。
另外uac
发送的invite
的SDP
信息为:
opensips
转发给uas
的invite
的sdp
信息:
可能有点问题的是: 这个转发的invite
居然把media
相关的信息都去掉了。
inbound 转rfc2833
目前没有成功,我用了always-transcode detect-DTMF codec-transcode-telephone-event codec-strip=telephone-event
和always-transcode inject-DTMF codec-transcode-telephone-event codec-strip=telephone-event
,都没转成功。
在rtpengine
的group发的帖子,一直自动删除. 后面如果有成功的,会在这里补充。
INFO 转 rfc2833
按键INFO
的sip
信令如下:
可以看到按键的INFO
的sip
头里的content-type
为application/dtmf-relay
,
BODY
里的Signal
即为按键内容。
在opensips
的配置中,设置如下:
|
|
能接收的按键为:(0-9)
和(*,#,A,B,C,D)
。
另外还要在转发的invite
,生成SDP
信息时,rtpengine_manager
的参数添加如下:
always-transcode inject-DTMF codec-mask-all
实际抓包的sip
信令如下:
确实可以看到INFO
转成了rfc2833
类型的按键。
uac
发送的invite
的SDP
信息为:
opensips
转发给uas
的invite
的sdp
信息:
INFO 转 inbound
暂未成功。
总结
rtpengine
的按键转换功能, 目前验证成功是rfc2833
转inbound
和INFO
转rfc2833
。inbound
转rfc2833
和INFO
转inbound
暂未成功。rfc2833
或者inbound
应该不能转成INFO
类型。