WebCallServer WebRTC with Asterisk

本文介绍如何配置Asterisk以支持WebRTC客户端进行音频呼叫,并确保不同NAT网络间及与SIP软电话之间的互操作性。文章详细说明了配置步骤,包括启用ICE、SRTP和AVPF,定义SIP对等方,禁用视频支持等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Main goal

In this tutorial we will show how to configure Asterisk to receive SIP calls from WebCallServer WebRTC client.
After configuration you will get:

  • Audio calls between WebRTC based WebCallServer clients behind different NATed networks
  • Audio calls between WebRTC based WebCallServer clients and softphones connected to your Asterisk server

What will not work:

  • As current Asterisk version is not supports VP8 video codec, you will not be able to make video calls

Prerequisites

We are not covering Asterisk installation process. There are lot of tutorials on the net that explains how to setup Asterisk.
As a prerequisites, you will need:

  • Up and running Asterisk 11.3.0 or latest with SRTP support
  • Up and running WebCallServer 3.0-257 or latest (installation process)
  • WebCallServer client 3.0.299 or latest
  • Chrome 26 or latest

Asterisk ICE support

As WebRTC is using ICE, we will need to enable it at Asterisk side.
All what you will need to do is add ICE support on peer basis in sip conf:

icesupport=yes

Enable SRTP and AVPF

All media streams in WebRTC is encrypted using SRTP. Asterisk using libsrtp to provide SRTP support.
You will need to enable encryption support on each peer that you create for WebCallServer WebRTC based client.
Also, WebRTC is using AVPF so you will need to enable it too.

encryption=yes
avpf=yes

Peers definition in sip.conf

For tests we will configure 3 SIP peers, two of them for WebCallServer WebRTC based client and one for SIP softphone.

WebRTC
[1000]
type=friend
host=dynamic
nat=no
qualify=no
secret=passwordtouprefer
callerid=1000 <1000>
canreinvite=no
context=internal
avpf=yes
encryption=yes
icesupport=yes
disallow=all
allow=alaw

[1001]
type=friend
host=dynamic
nat=no
qualify=no
secret=passwordtouprefer
callerid=1001 <1001>
canreinvite=no
context=internal
avpf=yes
encryption=yes
icesupport=yes
disallow=all
allow=alaw
Softphone SIP peer
[1002]
type=friend
host=dynamic
nat=no        ;use comedia, force_rport if your softphone is behind nat
qualify=no
secret=passwordtouprefer
callerid=1002 <1002>
canreinvite=no
context=internal
allow=all


After configuration was done, you will need to reload sip.conf:

asterisk -rx "sip reload"

Extensions.conf

Here is sample config for Asterisk extensions.conf that defines "internal" context and enables calls between previously defined sip peers.
Add it to the end of extensions.conf file:

internal context
exten => _XXXX,1,Dial(SIP/${EXTEN})

After configuration were done, you will need to reload dialplan:

asterisk -rx "dialplan reload"

Disable video support on WebCallServer client

We need to disable video support on client side because Asterisk is not supporting VP8 video codec.
Change code in file js/rtc/WebRtcMediaManager.js:

from
}, {"optional": [], "mandatory": {"OfferToReceiveAudio": true, "OfferToReceiveVideo": true}});
to
}, {"optional": [], "mandatory": {"OfferToReceiveAudio": true, "OfferToReceiveVideo": false}});

Test calls

To test functionality you will need to register all three sip peers as follows:

  • peers 1000 and 1001 should be registered using WebCallServer WebRTC based client
  • peer 1002 should be registered using sip softphone

After all done, you will be able to call between extensions without any problem.
Asterisk will proxy RTP and SIP, and convert media stream for sip softphone if needed.

If you have any questions, feel free to contact our support at support@flashphoner.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值