How to implement a call APP using sip.js and cordova-plugin-iosrtc against a FreeSwitch PBX?

0

I need your help! Urgent !!

I am developing a hybrid app with Ionic JS / AngularJS based on webrtc to make calls / video calls. The application uses the sip.js library for calls. The server part is a FreeSwitch PBX. To have in IOS WebRtc, we are using the cordova-plugin-iosrtc plugin. When I try to make or receive calls, the application throws errors using the plugin cordova-plugin-iosrtc in the two ways that can be combined with sip sip.js

A) MODE A cordova-plugin-iosrtc Working with the peer connection ....

telephoneService.js (Angular JS)

var pc = new cordova.plugins.iosrtc.RTCPeerConnection({
    iceServers: []
});

cordova.plugins.iosrtc.getUserMedia(
  // constraints
  { audio: true, video: true },
  // success callback
  function (stream) {
    console.log('got local MediaStream: ', stream);
    pc.addStream(stream);
  },
  // failure callback
  function (error) {
    console.error('getUserMedia failed: ', error);
  }
);

var sessionDescriptionHandlerOptions = {

                constraints: {
                    audio: audioId,
                    video: videoId
                },


                media: {
                    local: {
                      audio: document.getElementById('localAudio')
                    },
                    remote: {
                      audio: document.getElementById('remoteAudio')
                    }
                },


            extraHeaders: extraHeaders

            }

}

userAgent.invite('sipusertocall', sessionDescriptionHandlerOptions);

Error:

  

undefined is not a objetc evaluating   'environment.navigator.mediaDevices.getUserMedia' (sip.js lib)

B) MODE B cordova.plugins.iosrtc.registerGlobals (); we use iosrtc plugin with native webrtc (navigator.mediaDevice.getUserMedia (), ....)

navigator.mediaDevices.getUserMedia(
 function (stream) {
    console.log('got local MediaStream: ', stream);

    window.stream = stream;
  },
  // failure callback
  function (error) {
    console.error('getUserMedia failed: ', error);
  }
)

var sessionDescriptionHandlerOptions = {

                constraints: {
                    audio: audioId,
                    video: videoId
                },


                media: {
                    local: {
                      audio: document.getElementById('localAudio')
                    },
                    remote: {
                      audio: document.getElementById('remoteAudio')
                    }
                },


            extraHeaders: extraHeaders

        }

userAgent.invite('sipusertocall', sessionDescriptionHandlerOptions);

App receives the following error via sip.js from the PBX: Failed: WebRTC Error

The app also receives the following error at the same time: "setLocalDescription () must be called with a RTCSessionDescription instance as first argument"

Thank you very much !!

    
asked by ElLoko36 23.10.2018 в 14:14
source

0 answers