以前的Kamailio一直没有支持RTP媒体服务器内置模块,现在开发人员通过和oRTP集成,实现了媒体服务器模块的功能。它可以通过外部的媒体服务器支持包(MediaStreamer2 和 oRTP),通过API调用的方式实现媒体功能。
![](http://www.ctiforum.com/uploadfile/2019/0312/20190312095930237.jpg)
oRTP支持的功能包括:
- Written in C, works under Linux (and probably any Unix) and Windows
- Implements the RFC 3550 (RTP) with an easy-to-use API with high- and low-level access
- Features an adaptive jitter algorithm that enables a receiver to adapt to the clock rate of the sender and network jitter
- Includes support for multiple profiles, (AV profile (RFC 3551) is the default)
- Supports part of RFC 4733 for telephone events over RTP
- Includes an API to parse and compose RTCP packets, including AVPF RTCP packets
- Features a congestion detector based on an analysis of the packet's arrival time
- Comprises a download capacity estimator that is usable for video streams
媒体服务器模块可以实现媒体文件播放,电话桥接,DTMF生成,编码和重采样等功能。具体的功能仍然在测试开发阶段,相信在不久的未来可以看到稳定版本面世。
代码示例:
…
event_route[rms:start] {
xnotice("[rms:start] play …\n");
rms_play("/tmp/reference_8000.wav", "rms:after_play");
}; // 播放语音文件
event_route[rms:after_play] {
xnotice("[rms:after_play] play done…\n");
rms_hangup();
};
route {
if (t_precheck_trans()) {
t_check_trans();
exit;
}
t_check_trans();
if (is_method("INVITE") && !has_totag()) {
if (!rms_answer("rms:start")) {
t_reply("503", "server error");
}
}
rms_sip_request();
…
笔者认为,Kamailio集成媒体服务器的功能以后,可能会成为继Asterisk,FreeSWITCH媒体服务器以后另外一个比较强大的媒体信令软交换平台,可能更加适合互联网模式开发环境和灵活的语音应用场景。
关于媒体模块的使用,读者可以访问:
http://kamailio.org/docs/modules/devel/modules/rtp_media_server.html
![](http://www.ctiforum.com/uploadfile/2019/0304/20190304034102652.jpg)
![](http://www.ctiforum.com/uploadfile/2019/0304/20190304034119526.jpg)
关注微信公众号:asterisk-cn,获得有价值的Asterisk行业分享
Asterisk freepbx 中文官方论坛:http://bbs.freepbx.cn/forum.php
Asterisk freepbx技术文档: www.freepbx.org.cn
融合通信商业解决方案,协同解决方案首选产品:www.hiastar.com
Asterisk/FreePBX中国合作伙伴,官方qq技术分享群(3000千人):589995817
Asterisk/FreePBX中国合作伙伴,官方qq技术分享群(3000千人):589995817