skip to Main Content

Please, HELP.
I am trying like for few weeks or months already to make outbound call with sip.js or jssip and react-native-webrtc.
I have stun and turn server from telnyx.

I have default sip.js with API setup like that but with credential data and connection works fine. Getting 200 response all good. Then I am making outbound call to my phone and when I answer or cancel call I get this message:

ERROR Tue Jul 30 2024 06:37:04 GMT+0100 | sip.SessionDescriptionHandler | SessionDescriptionHandler.setDescription failed – Error: Failed to set remote answer sdp: The m= section with mid=’0′ is invalid. RTCP-MUX is not enabled when it is required.
ERROR Tue Jul 30 2024 06:37:04 GMT+0100 | sip.Inviter | Session.setAnswer: SDH setDescription rejected…
ERROR Tue Jul 30 2024 06:37:04 GMT+0100 | sip.Inviter | Failed to set remote answer sdp: The m= section with mid=’0′ is invalid. RTCP-MUX is not enabled when it is required.
ERROR Tue Jul 30 2024 06:37:04 GMT+0100 | sip.Inviter | Failed to set remote answer sdp: The m= section with mid=’0′ is invalid. RTCP-MUX is not enabled when it is required.

My code is below:

import React, { useEffect, useState } from "react";
import {  registerGlobals  } from "react-native-webrtc";
import { Button, Platform, StyleSheet, Text, View } from "react-native";
import { Inviter, Registerer, SIPExtension, 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"
  },
});

  registerGlobals()

// 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
    });

});

I tried most stuff from internet and guides.

2

Answers


  1. have you tried jssip instead of sip.js?

    Login or Signup to reply.
  2. has the above problem been resolved?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search