
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Verto (VER-to) RTC is a FreeSWITCH endpoint that implements a subset of a JSON-RPC connection designed for use over secure websockets. The initial target is WebRTC to simplify coding and implementing calls from web browsers and devices to FreeSWITCH. This allows a web browser or other WebRTC client to originate a call using Verto into a FreeSWITCH installation and then out to the PSTN using SIP, SS7, or other supported protocol.
This is a zero-dependency implementation that is no need to include jquery as an in original one. It doesn't contain any html stuff inside or media handlers as well. You should take care of fetch media tracks yourself (I think it is better not to hide useful features of you, browser provides a great API to handle media)
This is a work in progress code. However, it is stable enough to use basic functions (calls). I believe and I hope the source code is much better than my English :-)
Package directory content
/dist — contains a minified bundle exporting Verto symbol to a global namespace
/src — contains source Typescript files
To use this package you can either include dist/verto.js as a html <script> tag or import it using webpack like that
import { Verto } from 'vertojs'
Check index.html in the package directory to find out how to use this code with a html <script> tag
let verto = new Verto(options: VertoOptions)
interface VertoOptions {
transportConfig : JsonRpcClientParams
// Verto transport configuration, check below
rtcConfig? : RTCConfiguration
// RTCConfiguration object, as described here
// https://developer.mozilla.org/en-US/docs/Web/API/RTCConfiguration
// The most important thing is iceServers item that should be set to go over NAT
debug? : boolean
// Set true to get some useful debug info in browser console
ice_timeout? : number
// Milliseconds to stop waiting for ice candidates, default to 3000ms
}
interface JsonRpcClientParams {
socketUrl : string
// The URL where the verto interface lives
// wss://server.example.com:8082
login : string
passwd : string
}
You should register to verto to receive calls.
The following code is a simplified example of using the handler function to auto answer the first incoming call and add first received audio track to some <video> element.
try {
let data = await verto.login()
} catch (error) {
alert("Access denied")
return
}
let local_stream = await navigator.mediaDevices.getUserMedia({audio:true})
verto.subscribeEvent('invite', call => {
call.subscribeEvent('track', (track) => {
if(track.kind!='audio') return
let stream = new MediaStream()
stream.addTrack(track)
let el = document.getElementById('video')
el.srcObject = stream
})
call.answer(local_stream.getTracks())
})
let local_stream = await navigator.mediaDevices.getUserMedia({audio:true})
let call = verto.call(local_stream.getTracks(), "9664")
call.subscribeEvent('track', (track) => {
if(track.kind!='audio') return
let stream = new MediaStream()
stream.addTrack(track)
let el = document.getElementById('video')
el.srcObject = stream
})
There's a number (pretty small number) of Classes and Interfaces provided.
constructor
let verto = new Verto(options: VertoOptions)
interface VertoOptions {
transportConfig : JsonRpcClientParams
// Verto transport configuration, check below
rtcConfig? : RTCConfiguration
// RTCConfiguration object, as described here
// https://developer.mozilla.org/en-US/docs/Web/API/RTCConfiguration
// The most important thing is iceServers item that should be set to go over NAT
debug? : boolean
// Set true to get some useful debug info in browser console
ice_timeout? : number
// Milliseconds to stop waiting for ice candidates, default to 3000ms
}
interface JsonRpcClientParams {
socketUrl : string
// The URL where the verto interface lives
// wss://server.example.com:8082
login : string
passwd : string
}
login
Parameters
Returns
verto.login()
call
Parameters
Returns
let call = verto.call(tracks, destination, options)
Fires on incoming call. As a parameter handler will receive a VertoCall instance.
verto.subscribeEvent('invite', call => {
call.subscribeEvent('track', (track) => {
if(track.kind!='audio') return
let stream = new MediaStream()
stream.addTrack(track)
let el = document.getElementById('video')
el.srcObject = stream
})
call.answer(local_stream.getTracks())
})
This class instances should never be built manually, but using verto.call or incoming call handler.
answer
Parameters
Returns
call.answer(tracks)
hangup
Parameters
Returns
call.hangup()
id
options
direction
Fires when the call is answered.
call.subscribeEvent('answer', () => {
// Do something on answer
})
Fires when a MediaStreamTrack is received
verto.subscribeEvent('invite', call => {
call.subscribeEvent('track', (track) => {
if(track.kind!='audio') return
let stream = new MediaStream()
stream.addTrack(track)
let el = document.getElementById('video')
el.srcObject = stream
})
call.answer(local_stream.getTracks())
})
Fires when the call is ended.
call.subscribeEvent('bye', cause => {
// Do something on call end
})
interface VertoCallOptions {
caller_id_number? : string
caller_id_name? : string
callee_id_number? : string
callee_id_name? : string
}
interface VertoOptions {
transportConfig : JsonRpcClientParams
// Verto transport configuration, check below
rtcConfig? : RTCConfiguration
// RTCConfiguration object, as described here
// https://developer.mozilla.org/en-US/docs/Web/API/RTCConfiguration
// The most important thing is iceServers item that should be set to go over NAT
debug? : boolean
// Set true to get some useful debug info in browser console
ice_timeout? : number
// Milliseconds to stop waiting for ice candidates, default to 3000ms
}
interface JsonRpcClientParams {
socketUrl : string
// The URL where the verto interface lives
// wss://server.example.com:8082
login : string
passwd : string
}
enum CallDirection {
Incoming,
Outgoing
}
Both Verto and VertoCall classes uses the same event handling system.
subscribeEvent
Parameters
Returns
let handler_id = verto.subscribeEvent(name, handler)
unsubscribeEvent
Parameters
Returns
verto.unsubscribeEvent(name, handler_id)
Copyright (c) 2019 Roman Yerin <r.yerin@640kb.co.uk>
Licensed under the 3-clause BSD license.
FAQs
Verto FreeSWITCH interface
The npm package vertojs receives a total of 131 weekly downloads. As such, vertojs popularity was classified as not popular.
We found that vertojs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.