您的位置:首页 > Web前端 > JavaScript

sip.js基于 FreeSwitch的使用过程

2016-12-05 14:51 344 查看


sip.js基于 FreeSwitch的使用过程

tags:WebRTC
sip.js FreeSwitch 音视频通话 创建时间:2016-10-23 13:29:05
http://139.196.40.50:8088/topics/9?r=1477200242
Configure FreeSWITCH

SIP.js has been tested with FreeSWITCH 1.5.14 without any modification to the source code of SIP.js or FreeSWITCH. Later versions of FreeSWITCH will require similar configuration.

System Setup

FreeSWITCH and SIP.js were tested using the following setup:

CentOS 6.6 minimal (x86_64)

FreeSWITCH 1.5.14

A public IP address to avoid NAT scenarios on the server side. Required Packages

Install the following dependencies: 
git
autoconf automake libtool gcc-c++ libuuid-devel zlib-devel libjpeg-devel ncurses-devel openssl-devel
 Using YUM, all dependencies can be installed with:

yum install git autoconf automake libtool gcc-c++ libuuid-devel zlib-devel libjpeg-devel ncurses-devel openssl-devel

Install FreeSWITCH

FreeSWITCH recommends using the latest version of FreeSWITCH from the FreeSWITCH git repo. This example uses FreeSWITCH tag v1.5.14.

```
cd /usr/local/src/

git clone https://freeswitch.org/stash/scm/fs/freeswitch.git 
cd /usr/local/src/freeswitch

git checkout v1.5.14

./bootstrap.sh

./configure

make (This may take a few minutes.)

make install


```

Configure FreeSWITCH

The default configuration files for FreeSWITCH are located in /usr/local/freeswitch/conf.

Start by editing the internal SIP profile sip_profiles/internal.xml. Uncomment the line to allow web sockets to talk to FreeSWITCH. No other configuration changes are necessary to make FreeSWITCH work with WebRTC.
```
<!--internal.xml-->

<!-- Uncomment the following: -->

<param name="ws-binding"  value=":5066"/>
```


If you’d like to enable video as well as audio, adjust FreeSWITCH’s codec preferences to include VP8.
<!--vars.xml-->

<X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA,VP8">

<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,VP8">
```


Start FreeSWITCH: /usr/local/freeswitch/bin/freeswitch.

Configure SIP.js

SIP.js works with FreeSWITCH without any special configuration parameters. The following UA is configured to connect to a default FreeSWITCH configuration. Replace 127.0.0.1 with the IP address of your FreeSWITCH server.
```
var config = {

// Replace this IP address with your FreeSWITCH IP address

uri: '1000@127.0.0.1',

// Replace this IP address with your FreeSWITCH IP address

// and replace the port with your FreeSWITCH port

ws_servers: 'ws://127.0.0.1:5066',

// FreeSWITCH Default Username

authorizationUser: '1000',

// FreeSWITCH Default Password

password: '1234'

};

var ua = new SIP.UA(config);
```


Troubleshooting

It is known that SIP.js and FreeSWITCH might not interop well if you have the following option enabled on FreeSWITCH:
```
<variable name="sip-force-contact" value="NDLB-connectile-dysfunction"/>
```


Firefox 34+ requires SIP.js 0.6.4 or later to interop with FreeSWITCH or Asterisk.

FreeSWITCH has a wiki article on WebRTC support.

转自:http://www.freeswitch.net.cn/122.html

$(".MathJax").remove();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: