VOIP In Matrix JS SDK

This module outlines how two users in a room can set up a Voice over IP (VoIP) call to each other. Voice and video calls are built upon the WebRTC 1.0 standard. Call signalling is achieved by sending message events to the room. In this version of the spec, only two-party communication is supported (e.g. between two peers, or between a peer and a multi-point conferencing unit). This means that clients MUST only send call events to rooms with exactly two participants.

For a complete overview of Matrix Javascript SDK configuration, please go to our Matrix Javascript SDK.

Matrix Javascript SDK

Establish a call

This method is call by the caller when they wish to establish a call.

For voice call

For video call

Incoming call event for callee

Callee answer the call

This method is call by the callee when they wish to answer the call.

Hangup the call

Method call by either party to signal their termination of the call. This can be sent either once the call has has been established or before to abort the call.

Examples

 

SIP Request Methods Response Codes

SIP Request Methods Response Codes.

SIP Request Methods

There are several different Request methods to server different purposes. SIP borrowed headers and body format from the protocol HTTP. Like HTTP SIP also has different methods. following table will describe those request methods

 

SIP Request Methods
S.No Method Description
1 REGISTER Registers to receive inbound calls on registrar or SIP server
2 INVITE Established a new session
3 ACK Confirms that message/request has been received
4 BYE Ends Session
5 CANCEL Cancels establishing session
6 OPTIONS Queries capabilities of server
7 PARK Provisional Acknowledgement
8 SUBSCRIBE Subsribes for an Notifications from the Notifier
9 NOTIFY Notify the subscriber a new Event
10 PUBLISH Publish and event to the Server
11 INFO Sends mid-session information
12 REFERER Asks the recipient to issue call transfer
13 MESSAGE Transport Insant Message
14 UPDATE Modifies the state of a session without changing the state of the dialog.

….

SIP Responses

Like I mentioned earlier, SIP protocol borrowed few things from protocol HTTP. SIP borrowed response code from HTTP. Most of response codes are similar to HTTP and  SIP extends them codes to 6xx.

SIP Response Codes
S.No Code Description
1 1xx Informational responses
2 2xx Success Responses
3 3xx Redirect Responses
4 4xx Request Failure/Client Error
5 5xx Server Error
6 6xx Global Failures

How to Fix G729a CODEC NEGOTIATION ERROR in FreeSWITCH

Are you facing issue of failing calls that are having G729a codec with 488 response? This article tells you how to fix that issue. When using G729 codec in FreeSWITCH if it receives following SDP in INVITE packet, that call is going to fail with 488 Incompatible Destination printing the error message mod_sofia.c:2226 CODEC NEGOTIATION ERROR.  SDP:

FreeSWITCH is not the offending party here, but the device that is sending G729 as G729a. The correct encoding name assigned to this codec by IANA is G729 not G729a.

To fix interop quirks like these FreeSWITCH has implemented some options that can be enabled. They are prefixed with NDLB means No Device Left Behind. The particular option that helps us with the current issue is

If you set this option to true in sofia profile as shown below, FreeSWITCH will be more forgiving to devices that are using non standard IANA codec names in SDP.

Note:- The situation described in this article has commercial G729 module loaded in FreeSWITCH