datso / react-native-pjsip

A PJSIP module for React Native.
http://datso.github.io/react-native-pjsip
GNU General Public License v3.0
273 stars 230 forks source link

Stoped in PJSIP_INV_STATE_CONNECTING #241

Open maurojones opened 3 years ago

maurojones commented 3 years ago

I receive the call, display the call but I can't finish the connecting and answer the call:

My code:

  endpoint.on("call_received", (call) => {
    console.info('call_received', _myCall);
    if (_myCall != null) {
      declineCall(call) // Decline call when more that one calls are ringing
    }
    _myCall = call;
    _myId = uuid.v1();
    RNCallKeep.displayIncomingCall(_myId, call.getRemoteFormattedNumber(), 'Portaria');
  })

  endpoint.on("call_changed", (call) => {
    console.info('call_changed', call.getState());
  })

  endpoint.on("call_terminated", (call) => {
    activeCall = null;
    RNCallKeep.endCall(_myId);
    _myId = '';
    console.info('call_terminated');
  })

  RNCallKeep.addEventListener('answerCall', () => {
    endpoint.answerCall(_myCall)
      .then(x => {
        console.info('answerCall Ok', x);
        activeCall = _myCall;
        console.info('start call');
        endpoint.useSpeaker(_myCall);
        RNCallKeep.startCall(_myId, _myCall.getRemoteFormattedNumber());
      })
      .catch(x => console.info('answerCall error', x));
  })

  RNCallKeep.addEventListener('endCall', () => {
    declineCall(_myCall);
  })

My console: INFO call_received null INFO call_changed PJSIP_INV_STATE_INCOMING INFO call_changed PJSIP_INV_STATE_CONNECTING INFO answerCall Ok true INFO start call

How I made de call CONNECTING ???

m4r00p commented 3 years ago

for me it was the issue with codes please try:

endpoint.changeCodecSettings({ 'G722/16000/1': 0, 'G7221/16000/1': 0, 'G7221/32000/1': 0, 'GSM/8000/1': 80, 'PCMA/8000/1': 100, 'PCMU/8000/1': 120, 'iLBC/8000/1': 0, 'opus/48000/2': 0, 'speex/16000/1': 0, 'speex/32000/1': 0, 'speex/8000/1': 0, })

Also check if you don't have issue with libsrtp if so please take a look at the podfile and get rid of (if possible) openssl. (pjsip has conflict with openssl 1.1.0 and it need to be compiled in the other way to support both openssl and libsrtp)