write a freeswitch gui with react and lua - github...native ui builtin freeswitch, no 3rd party...

Post on 21-May-2020

110 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Write a FreeSWITCH GUI with React and Lua

Seven Du

Yantai Xiaoyingtao Network Technology

ClueCon 2017

Yantai China

Yantai China

Met FreeSWITCH at 2007Start patching FreeSWITCH from 2008FreeSWITCH coding all the time

http://book.dujinfang.com

GUI for FreeSWITCH

FusionPBX 2600Hz …

FreeSWITCH Portal

ember.jsmod_xml_rpc

React.jsmod_verto

Natively built in FreeSWITCH, No Apache/Nginx/PHP …C, Lua, SQLite, PostgreSQLRestful APIReact.jsPBX, Small callcenters,…Audio & Video ConferencesIVR BlocksScales from single box to the clouldOpen source https://github.com/seven1240/xui

Features

X86

ARM

Raspberry PI

Orange PI

CubieTruck

Mac

Windows

Linux

XSWITCH

= +FreeSWITCH

https://xswitch.cn

Bypass media

http in mod_verto

<vhosts> <vhost domain="localhost"> <param name="alias" value="seven.local freeswitch.org"/> <param name="root" value="$${base_dir}/xui/www"/> <param name="script-root" value="$${base_dir}/xui/lua/xui/vendor"/> <param name="index" value="index.html"/> <rewrites> <rule expression="^/api" value="/__xtra_init__.lua"/> </rewrites> </vhost> </vhosts>

xTra

MVC

SinatraExpressFlaskBottleMercury

delete("/:uuid", function(params) api("uuid_kill " .. params.uuid) return "ok" end)

-- psudo code channels operation RESTful API

get("/", function(params) return api("show channels as json") end)

get("/:uuid", function(params) return api("uuid_dump " .. params.uuid .. " json") end)

post("/", function(params) return api("originate user/" .. params.dest_number .. " ... ") end)

put("/:uuid", function(prams) return api("uuid_media on/off ...") end)

xdb — simple ORM

delete("/:id", function(params) xdb.delete(“users”, params.id) return params.id end)

-- psudo code users RESTful API

get("/", function(params) return xdb.find_all(“users”) end)

get("/:id", function(params) return xdb.find(“users”, params.id) end)

post("/", function(params) return xdb.create(“users”, params) end)

put("/:id", function(params) user = params.request user.id = params.id return xdb.update(“users”, user) end)

SELECT * FROM users

SELECT * FROM users WHERE id = params.id

INSERT INTO users (name, password) VALUES …

UPDATE users SET name = name, extension = … WHERE id = params.id

DELETE users WHERE id = params.id

Binding to FreeSWITCH

Lua bindings

<param name=“xml-handler-script" value=“/usr/local/freeswitch/xui/lua/xui/fs_xml_handler.lua"/>

<param name=“xml-handler-bindings"value="dialplan|result|config|directory|channels|chatplan|languages"/>

React

https://facebook.github.io/react/

Verto ES6

https://freeswitch.org/jira/browse/FS-10028

react-bootstrapreact-routeri18n-reactFetch instead of XHR

No redux

window.addEventListener("verto-login", this.handleVertoLogin); window.addEventListener("verto-disconnect", this.handleVertoDisconnect);

fire_event("verto-login", v);

Demo

Early stage and in active developmentUsed as office PBXTiny callcentersCall routing with blocksVideo conferences…

Status

416

FreeSWITCH 0 FreeSWITCH 1

FreeSWITCH 2

FreeSWITCH 3

FreeSWITCH 4

FreeSWITCH 5Media

SIPBypass Media

RTP Media

RTP Media between servers

SIP

Connecting two conferences

FreeSWITCH 0

FS1

FS2

FS3

FS4

FS5

FS1

FS2

FS3

FS4

FS5

originate sofia/external/3000@FS1 3000

originate sofia/external/3000@FS2 3000

originate sofia/external/3000@FS3 3000

originate sofia/external/3000@FS4 3000

originate sofia/external/3000@FS5 3000

How ?

400+ video memers on 7 servers with 30% CPU each

720p

passthrough

FS1 FS2 FS3 FS4 FS5FS1

for (var i = 0; i < nodes; i++) verto_connectors[i] = new Verto();

Native UI builtin FreeSWITCH, no 3rd party deps, optionally behind Nginx/Apache

mod_verto and Lua in the back, react.js in browser

SQLite/PostgreSQL

Lua bindings, mod_xml_curl designed for the future maybe for clustering

mod_cdr_sqlite or mod_odbc_cdr for CDR

mod_curl for HTTP client talking to other API providers

IVR blocks

Audio/Video calls/conferences with mod_verto

Web terminal

Security?

We are hiring

https://github.com/seven1240/xui

@dujinfang

dujinfang@gmail.com

top related