Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount()
{
this._mounted = true;
const settings = this.props.settings;
const socket = new JsSIP.WebSocketInterface(settings.socket.uri);
if (settings.socket['via_transport'] !== 'auto')
socket['via_transport'] = settings.socket['via_transport'];
try
{
this._ua = new JsSIP.UA(
{
uri : settings.uri,
password : settings.password,
'display_name' : settings.display_name,
sockets : [ socket ],
'registrar_server' : settings.registrar_server,
'contact_uri' : settings.contact_uri,
'authorization_user' : settings.authorization_user,
'instance_id' : settings.instance_id,
'session_timers' : settings.session_timers,
'use_preloaded_route' : settings.use_preloaded_route
});
// TODO: For testing.
window.UA = this._ua;
}
controller.call('softphone::configuration', configuration => {
useragent = new JsSIP.UA(configuration);
let events = ['connected', 'disconnected', 'registered', 'unregistered', 'registrationFailed', 'newSession', 'newMessage'];
for (let event of events) {
useragent.on(event, function(...args) {
controller.trigger(`softphone::${event}`, Array.from(args));
});
}
runningConfiguration = configuration;
useragent.start();
});
});