All Projects → onsip → Sip.js

onsip / Sip.js

Licence: mit
A simple, intuitive, and powerful JavaScript signaling library

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Sip.js

Routr
Routr: Next-generation SIP Server
Stars: ✭ 788 (-38.53%)
Mutual labels:  voip, sip, webrtc
Kamailio
Kamailio - The Open Source SIP Server for large VoIP and real-time communication platforms -
Stars: ✭ 1,358 (+5.93%)
Mutual labels:  voip, sip, webrtc
Browser Phone
A fully featured browser based WebRTC SIP phone for Asterisk
Stars: ✭ 95 (-92.59%)
Mutual labels:  voip, sip, webrtc
Baresip
Baresip is a modular SIP User-Agent with audio and video support
Stars: ✭ 817 (-36.27%)
Mutual labels:  voip, sip, webrtc
sdp
A Go implementation of the SDP
Stars: ✭ 89 (-93.06%)
Mutual labels:  sip, webrtc, voip
Stun
A Go implementation of STUN
Stars: ✭ 141 (-89%)
Mutual labels:  voip, sip, webrtc
Homer
HOMER - 100% Open-Source SIP / VoIP Packet Capture & Monitoring
Stars: ✭ 855 (-33.31%)
Mutual labels:  voip, sip, webrtc
Freeswitch
FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
Stars: ✭ 1,213 (-5.38%)
Mutual labels:  voip, sip, webrtc
Siprtcproxy
网关服务:Sip与Rtc互通,实现Web,Android,iOS,小程序,SIP座机,PSTN电话,手机互通。
Stars: ✭ 217 (-83.07%)
Mutual labels:  voip, sip, webrtc
Flutter Webrtc
WebRTC plugin for Flutter Mobile/Desktop/Web
Stars: ✭ 2,764 (+115.6%)
Mutual labels:  voip, sip, webrtc
Re
Generic library for real-time communications with async IO support
Stars: ✭ 444 (-65.37%)
Mutual labels:  voip, sip, webrtc
Sipsorcery
A WebRTC, SIP and VoIP library for C# and .NET Core. Designed for real-time communications apps.
Stars: ✭ 449 (-64.98%)
Mutual labels:  voip, sip, webrtc
Pjproject
PJSIP project
Stars: ✭ 786 (-38.69%)
Mutual labels:  voip, sip
Linphone Android
Linphone.org mirror for linphone-android (https://gitlab.linphone.org/BC/public/linphone-android)
Stars: ✭ 740 (-42.28%)
Mutual labels:  voip, sip
Asterisk Cdr Viewer Mod
Simple and fast viewer for Asterisk CDRs and Recordings (Mod)
Stars: ✭ 76 (-94.07%)
Mutual labels:  voip, sip
Sipvicious
SIPVicious OSS is a set of security tools that can be used to audit SIP based VoIP systems.
Stars: ✭ 541 (-57.8%)
Mutual labels:  voip, sip
Flexisip
Linphone.org mirror for flexisip (git://git.linphone.org/flexisip.git)
Stars: ✭ 75 (-94.15%)
Mutual labels:  voip, sip
Webrtc
Pure Go implementation of the WebRTC API
Stars: ✭ 8,399 (+555.15%)
Mutual labels:  voip, webrtc
Ejabberd
Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
Stars: ✭ 5,077 (+296.02%)
Mutual labels:  voip, sip
Webrtc
A pure Rust implementation of WebRTC API
Stars: ✭ 922 (-28.08%)
Mutual labels:  voip, webrtc

SIP.js Logo

Build Status npm version

SIP Library for JavaScript

  • Create real-time peer-to-peer audio and video sessions via WebRTC
  • Utilize SIP in your web application via SIP over WebSocket
  • Send instant messages and view presence
  • Support early media, hold and transfers
  • Send DTMF RFC 2833 or SIP INFO
  • Share your screen or desktop
  • Written in TypeScript
  • Runs in all major web browsers
  • Compatible with standards compliant servers including Asterisk and FreeSWITCH

Demo

Want see it in action? The project website, sipjs.com, has a live demo.

Looking for code to get started with? This repository includes demonstrations which run in a web browser.

Usage

To place a SIP call, either utilize the SimpleUser class...

import { Web } from "sip.js";

// Helper function to get an HTML audio element
function getAudioElement(id: string): HTMLAudioElement {
  const el = document.getElementById(id);
  if (!(el instanceof HTMLAudioElement)) {
    throw new Error(`Element "${id}" not found or not an audio element.`);
  }
  return el;
}

// Options for SimpleUser
const options: Web.SimpleUserOptions = {
  aor: "sip:[email protected]", // caller
  media: {
    constraints: { audio: true, video: false }, // audio only call
    remote: { audio: getAudioElement("remoteAudio") } // play remote audio
  }
};

// WebSocket server to connect with
const server = "wss://sip.example.com";

// Construct a SimpleUser instance
const simpleUser = new Web.SimpleUser(server, options);

// Connect to server and place call
simpleUser.connect()
  .then(() => simpleUser.call("sip:[email protected]"))
  .catch((error: Error) => {
    // Call failed
  });

Or, alternatively, use the full API framework...

import { Inviter, SessionState, UserAgent } from "sip.js";

// Create user agent instance (caller)
const userAgent = new UserAgent({
  uri: UserAgent.makeURI("sip:[email protected]"),
  transportOptions: {
    server: "wss://sip.example.com"
  },
});

// Connect the user agent
userAgent.start().then(() => {

  // Set target destination (callee)
  const target = UserAgent.makeURI("sip:[email protected]");
  if (!target) {
    throw new Error("Failed to create target URI.");
  }

  // Create a user agent client to establish a session
  const inviter = new Inviter(userAgent, target, {
    sessionDescriptionHandlerOptions: {
      constraints: { audio: true, video: false }
    }
  });

  // Handle outgoing session state changes
  inviter.stateChange.addListener((newState) => {
    switch (newState) {
      case SessionState.Establishing:
        // Session is establishing
        break;
      case SessionState.Established:
        // Session has been established
        break;
      case SessionState.Terminated:
        // Session has terminated
        break;
      default:
        break;
    }
  });

  // Send initial INVITE request
  inviter.invite()
    .then(() => {
      // INVITE sent
    })
    .catch((error: Error) => {
      // INVITE did not send
    });

});

Installation

Node module

npm install sip.js

UMD bundle

Building, Development and Testing

Clone this repository, then...

npm install
npm run build-and-test

For more info please see the Documentation.

Support

  • For migration guides and API reference please see the Documentation.
  • For bug reports and feature requests please open a GitHub Issue.
  • For questions or usage problems please use the Google Group.
  • For more information see the project website at SIPjs.com.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].