How to use jssip - 9 common examples

To help you get started, we’ve selected a few jssip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bipbop / harlan / src / js / internals / modules / softphone.js View on Github external
/*jshint -W083 */

import JsSIP from 'jssip';
JsSIP.debug.enable('JsSIP:*');

let useragent /* jssip instance */;
let runningConfiguration /* jssip configuration */;
let makecall /* callback for registered jssip */;
let cachedPCConfig /* cached peer connection config */;

module.exports = controller => {

    controller.registerTrigger('findDatabase::instantSearch', 'softphone', (args, callback) => {
        callback();
        let [text, modal] = args;

        if (!/phone|limpar|configuração/i.test(text)) {
            return;
        }
github versatica / tryit-jssip / lib / components / Phone.jsx View on Github external
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;
		}
github bipbop / harlan / src / js / internals / modules / softphone.js View on Github external
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();
        });
    });
github versatica / tryit-jssip / lib / components / Session.jsx View on Github external
componentWillUnmount()
	{
		logger.debug('componentWillUnmount()');

		this._mounted = false;
		JsSIP.Utils.closeMediaStream(this._localClonedStream);
	}
github versatica / tryit-jssip / lib / components / Phone.jsx View on Github external
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,
github flowroute / jssip_client / src / FlowrouteClient.js View on Github external
socket: new WebSocketInterface(`wss://${urls[0]}:4443`),
        weight: 20,
      },
      {
        socket: new WebSocketInterface(`wss://${urls[1]}:4443`),
        weight: 10,
      },
    ];

    this.micMuted = false;
    this.qualityOfServiceEmitter = null;
    this.outputVolume = 1;
    this.isRegistered = false;
    this.onCallAction = () => {};
    this.onUserAgentAction = this.params.onUserAgentAction;
    this.sipUserAgent = new UA({
      sockets,
      uri: `sip:${this.params.callerId}@wss.flowroute.com`,
      password: this.params.password,
      display_name: this.params.displayName,
    });

    this.sipUserAgent.on('newRTCSession', this.handleNewRTCSession.bind(this));

    this.sipUserAgent.on('registered', (payload) => {
      this.isRegistered = true;
      this.onUserAgentAction({ type: 'registered', payload });
    });

    const defaultAgentEventsToHandle = [
      'connecting',
      'connected',
github flowroute / jssip_client / src / FlowrouteClient.js View on Github external
password: 'nopassword',
      extraHeaders: [],
      debug: false,
      intervalOfQualityReport: undefined,
      onUserAgentAction: () => {},
      ...params,
    };

    const urls = FR_POINTS_OF_PRESENCE_DOMAINS[this.params.pointOfPresence];
    const sockets = [
      {
        socket: new WebSocketInterface(`wss://${urls[0]}:4443`),
        weight: 20,
      },
      {
        socket: new WebSocketInterface(`wss://${urls[1]}:4443`),
        weight: 10,
      },
    ];

    this.micMuted = false;
    this.qualityOfServiceEmitter = null;
    this.outputVolume = 1;
    this.isRegistered = false;
    this.onCallAction = () => {};
    this.onUserAgentAction = this.params.onUserAgentAction;
    this.sipUserAgent = new UA({
      sockets,
      uri: `sip:${this.params.callerId}@wss.flowroute.com`,
      password: this.params.password,
      display_name: this.params.displayName,
    });
github flowroute / jssip_client / src / FlowrouteClient.js View on Github external
start() {
    if (this.params.debug) {
      debug.enable('JsSIP:*');
    } else {
      debug.disable('JsSIP:*');
    }

    this.sipUserAgent.start();
  }
github flowroute / jssip_client / src / FlowrouteClient.js View on Github external
start() {
    if (this.params.debug) {
      debug.enable('JsSIP:*');
    } else {
      debug.disable('JsSIP:*');
    }

    this.sipUserAgent.start();
  }