FreeSWITCH中文网,电话机器人开发网 ,微信订阅号:

FreeSWITCH及VOIP,Openser,电话机器人等产品中文技术资讯、交流、沟通、培训、咨询、服务一体化网络。QQ群:293697898

sip.js基于 FreeSwitch的使用过程


tags:WebRTC sip.js FreeSwitch 音视频通话 创建时间:2016-10-23 13:29:05

加QQ群: 293697898 和更多群友一起成长

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.



上海老李,QQ:1354608370,FreeSWITCH QQ群: