react-native-pjsip icon indicating copy to clipboard operation
react-native-pjsip copied to clipboard

Endpoint.start() promise never resolves

Open tophed opened this issue 6 years ago • 33 comments

@datso, thanks for taking the time to write this module and share it.

I'm having some trouble getting started with your module. I'm running a new react native project created with react-native init. I installed your project with yarn, ran react-native link and got no errors. I'm running the app in an android emulator (Nexus 5X with API 27) with react-native run-android

I have a component set up to test:

import React from 'react'
import { View, Button } from 'react-native'
import { Endpoint } from 'react-native-pjsip'

class Test extends React.Component {
  async start() {
    console.log('starting...')
    let endpoint = new Endpoint()
    let state = await endpoint.start() // List of available accounts and calls when RN context is started, could not be empty because Background service is working on Android
    let { accounts, calls, settings, connectivity } = state
    console.log(accounts)
  }

  render() {
    return (
      <View>
        <Button title="Start Endpoint" onPress={this.start} />
      </View>
    )
  }
}

export default Test

When the button is pressed, I see the console log 'starting...' but the console log for the accounts variable never occurs. It seems like the promise returned from endpoint.start() never resolves or rejects. I don't receive any errors or any other messages.

Any help is appreciated.

tophed avatar Aug 14 '18 20:08 tophed

When running in iOS from Xcode on an iPhone Simulator, the promise does resolve. Maybe SIP is not supported in the standard android simulator?

tophed avatar Aug 14 '18 21:08 tophed

Hey, thats strange, could you please share iOS logs ?

datso avatar Aug 28 '18 14:08 datso

can confirm same scenario in Android not resolving promises for me. It works on iOS though.

radelcom avatar Sep 26 '18 17:09 radelcom

Hey, do you have any errors in adb logs ?

datso avatar Sep 26 '18 17:09 datso

@datso doesnt look like there is any error in adb

$ adb logcat *:S ReactNative:V ReactNativeJS:V
--------- beginning of system
--------- beginning of main
09-26 16:45:08.599 13106 13321 D ReactNative: Initializing React Xplat Bridge.
09-26 16:45:08.615 13106 13321 D ReactNative: Initializing React Xplat Bridge before initializeBridge
09-26 16:45:08.618 13106 13321 D ReactNative: Initializing React Xplat Bridge after initializeBridge
09-26 16:45:08.618 13106 13321 D ReactNative: CatalystInstanceImpl.runJSBundle()
09-26 16:45:08.632 13106 13328 D ReactNative: ReactInstanceManager.setupReactContext()
09-26 16:45:08.632 13106 13328 D ReactNative: CatalystInstanceImpl.initialize()
09-26 16:45:08.656 13106 13328 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
09-26 16:46:11.506 13106 13106 D ReactNative: ReactInstanceManager.onReloadWithJSDebugger()
09-26 16:46:11.506 13106 13106 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
09-26 16:46:11.506 13106 13106 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
09-26 16:46:11.507 13106 13106 D ReactNative: ReactInstanceManager.tearDownReactContext()
09-26 16:46:11.517 13106 13106 D ReactNative: CatalystInstanceImpl.destroy() start
09-26 16:46:11.614 13106 13343 D ReactNative: ReactInstanceManager.createReactContext()
09-26 16:46:11.798 13106 13343 D ReactNative: Initializing React Xplat Bridge.
09-26 16:46:11.804 13106 13343 D ReactNative: Initializing React Xplat Bridge before initializeBridge
09-26 16:46:11.806 13106 13343 D ReactNative: Initializing React Xplat Bridge after initializeBridge
09-26 16:46:11.806 13106 13343 D ReactNative: CatalystInstanceImpl.runJSBundle()
09-26 16:46:11.817 13106 13348 D ReactNative: ReactInstanceManager.setupReactContext()
09-26 16:46:11.817 13106 13348 D ReactNative: CatalystInstanceImpl.initialize()
09-26 16:46:11.836 13106 13348 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
09-26 16:47:31.033 13106 13106 D ReactNative: ReactInstanceManager.onReloadWithJSDebugger()
09-26 16:47:31.033 13106 13106 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
09-26 16:47:31.033 13106 13106 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
09-26 16:47:31.033 13106 13106 D ReactNative: ReactInstanceManager.tearDownReactContext()
09-26 16:47:31.053 13106 13106 D ReactNative: CatalystInstanceImpl.destroy() start
09-26 16:47:31.121 13106 13362 D ReactNative: ReactInstanceManager.createReactContext()
09-26 16:47:31.229 13106 13362 D ReactNative: Initializing React Xplat Bridge.
09-26 16:47:31.246 13106 13362 D ReactNative: Initializing React Xplat Bridge before initializeBridge
09-26 16:47:31.247 13106 13362 D ReactNative: Initializing React Xplat Bridge after initializeBridge
09-26 16:47:31.247 13106 13362 D ReactNative: CatalystInstanceImpl.runJSBundle()
09-26 16:47:31.252 13106 13367 D ReactNative: ReactInstanceManager.setupReactContext()
09-26 16:47:31.253 13106 13367 D ReactNative: CatalystInstanceImpl.initialize()
09-26 16:47:31.253 13106 13367 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
09-26 16:54:04.990 13106 13106 D ReactNative: ReactInstanceManager.onReloadWithJSDebugger()
09-26 16:54:04.990 13106 13106 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
09-26 16:54:04.991 13106 13106 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
09-26 16:54:04.991 13106 13106 D ReactNative: ReactInstanceManager.tearDownReactContext()
09-26 16:54:05.008 13106 13106 D ReactNative: CatalystInstanceImpl.destroy() start
09-26 16:54:05.230 13106 13513 D ReactNative: ReactInstanceManager.createReactContext()
09-26 16:54:05.768 13106 13513 D ReactNative: Initializing React Xplat Bridge.
09-26 16:54:05.810 13106 13513 D ReactNative: Initializing React Xplat Bridge before initializeBridge
09-26 16:54:05.812 13106 13513 D ReactNative: Initializing React Xplat Bridge after initializeBridge
09-26 16:54:05.812 13106 13513 D ReactNative: CatalystInstanceImpl.runJSBundle()
09-26 16:54:05.836 13106 13518 D ReactNative: ReactInstanceManager.setupReactContext()
09-26 16:54:05.836 13106 13518 D ReactNative: CatalystInstanceImpl.initialize()
09-26 16:54:05.840 13106 13518 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
09-26 16:55:28.426 13106 13106 D ReactNative: ReactInstanceManager.onReloadWithJSDebugger()
09-26 16:55:28.426 13106 13106 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
09-26 16:55:28.426 13106 13106 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
09-26 16:55:28.427 13106 13106 D ReactNative: ReactInstanceManager.tearDownReactContext()
09-26 16:55:28.434 13106 13106 D ReactNative: CatalystInstanceImpl.destroy() start
09-26 16:55:28.595 13106 13530 D ReactNative: ReactInstanceManager.createReactContext()
09-26 16:55:28.755 13106 13530 D ReactNative: Initializing React Xplat Bridge.
09-26 16:55:28.765 13106 13530 D ReactNative: Initializing React Xplat Bridge before initializeBridge
09-26 16:55:28.767 13106 13530 D ReactNative: Initializing React Xplat Bridge after initializeBridge
09-26 16:55:28.767 13106 13530 D ReactNative: CatalystInstanceImpl.runJSBundle()
09-26 16:55:28.779 13106 13535 D ReactNative: ReactInstanceManager.setupReactContext()
09-26 16:55:28.780 13106 13535 D ReactNative: CatalystInstanceImpl.initialize()
09-26 16:55:28.786 13106 13535 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
09-26 16:55:47.452 13106 13106 D ReactNative: ReactInstanceManager.onReloadWithJSDebugger()
09-26 16:55:47.452 13106 13106 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
09-26 16:55:47.452 13106 13106 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
09-26 16:55:47.452 13106 13106 D ReactNative: ReactInstanceManager.tearDownReactContext()
09-26 16:55:47.459 13106 13106 D ReactNative: CatalystInstanceImpl.destroy() start
09-26 16:55:47.617 13106 13537 D ReactNative: ReactInstanceManager.createReactContext()
09-26 16:55:47.779 13106 13537 D ReactNative: Initializing React Xplat Bridge.
09-26 16:55:47.810 13106 13537 D ReactNative: Initializing React Xplat Bridge before initializeBridge
09-26 16:55:47.810 13106 13537 D ReactNative: Initializing React Xplat Bridge after initializeBridge
09-26 16:55:47.810 13106 13537 D ReactNative: CatalystInstanceImpl.runJSBundle()
09-26 16:55:47.811 13106 13542 D ReactNative: ReactInstanceManager.setupReactContext()
09-26 16:55:47.812 13106 13542 D ReactNative: CatalystInstanceImpl.initialize()
09-26 16:55:47.813 13106 13542 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
09-26 16:59:56.897 13106 13106 D ReactNative: ReactInstanceManager.onReloadWithJSDebugger()
09-26 16:59:56.899 13106 13106 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
09-26 16:59:56.899 13106 13106 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
09-26 16:59:56.900 13106 13106 D ReactNative: ReactInstanceManager.tearDownReactContext()
09-26 16:59:56.903 13106 13106 D ReactNative: CatalystInstanceImpl.destroy() start
09-26 16:59:57.080 13106 13627 D ReactNative: ReactInstanceManager.createReactContext()
09-26 16:59:57.190 13106 13627 D ReactNative: Initializing React Xplat Bridge.
09-26 16:59:57.213 13106 13627 D ReactNative: Initializing React Xplat Bridge before initializeBridge
09-26 16:59:57.217 13106 13627 D ReactNative: Initializing React Xplat Bridge after initializeBridge
09-26 16:59:57.218 13106 13627 D ReactNative: CatalystInstanceImpl.runJSBundle()
09-26 16:59:57.218 13106 13634 D ReactNative: ReactInstanceManager.setupReactContext()
09-26 16:59:57.218 13106 13634 D ReactNative: CatalystInstanceImpl.initialize()
09-26 16:59:57.219 13106 13634 D ReactNative: ReactInstanceManager.attachRootViewToInstance()

radelcom avatar Sep 26 '18 17:09 radelcom

Here are the logs from Xcode - are these the ones you needed from iOS?

Edit: To clarify, these are from a successful start

2018-09-26 10:16:41.761 [info][tid:main][RCTCxxBridge.mm:209] Initializing <RCTCxxBridge: 0x2819f4000> (parent: <RCTBridge: 0x280de4000>, executor: (null))
2018-09-26 10:16:41.842 [warn][tid:main][RCTModuleData.mm:67] Module RNInCallManager requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
2018-09-26 10:16:41.842 [warn][tid:main][RCTModuleData.mm:67] Module PjSipModule requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
10:16:42.278         os_core_unix.c !pjlib 2.7.1 for POSIX initialized
10:16:42.280         sip_endpoint.c  .Creating endpoint instance...
10:16:42.280                  pjlib  .select() I/O Queue created (0x114890c28)
10:16:42.280         sip_endpoint.c  .Module "mod-msg-print" registered
10:16:42.280        sip_transport.c  .Transport manager created.
10:16:42.280           pjsua_core.c  .PJSUA state changed: NULL --> CREATED
10:16:42.280         sip_endpoint.c  .Module "mod-pjsua-log" registered
10:16:42.280         sip_endpoint.c  .Module "mod-tsx-layer" registered
10:16:42.280         sip_endpoint.c  .Module "mod-stateful-util" registered
10:16:42.281         sip_endpoint.c  .Module "mod-ua" registered
10:16:42.281         sip_endpoint.c  .Module "mod-100rel" registered
10:16:42.281         sip_endpoint.c  .Module "mod-pjsua" registered
10:16:42.282         sip_endpoint.c  .Module "mod-invite" registered
10:16:42.334        coreaudio_dev.c  .. dev_id 0: iPhone IO device  (in=1, out=1) 8000Hz
10:16:42.334        coreaudio_dev.c  ..core audio initialized
10:16:42.334                  pjlib  ..select() I/O Queue created (0x114033a28)
10:16:42.334          speex_codec.c  ..Adjusting quality to 5 for uwb
10:16:42.334           conference.c  ..Creating conference bridge with 12 ports
10:16:42.334           Master/sound  ..Using delay buffer with WSOLA.
10:16:42.339            pjsua_vid.c  ..Initializing video subsystem..
10:16:42.339           openh264.cpp  ...OpenH264 codec initialized
10:16:42.339           opengl_dev.c  ...OpenGL device initialized
10:16:42.391           darwin_dev.m  ...Darwin video initialized with 3 devices:
10:16:42.391           darwin_dev.m  ... 0: [Renderer] iOS - UIView
10:16:42.391           darwin_dev.m  ... 1: [Capturer] AVF - Front Camera
10:16:42.391           darwin_dev.m  ... 2: [Capturer] AVF - Back Camera
10:16:42.391         colorbar_dev.c  ...Colorbar video src initialized with 2 device(s):
10:16:42.391         colorbar_dev.c  ... 0: Colorbar generator
10:16:42.391         colorbar_dev.c  ... 1: Colorbar-active
10:16:42.391         sip_endpoint.c  .Module "mod-evsub" registered
10:16:42.391         sip_endpoint.c  .Module "mod-presence" registered
10:16:42.391                evsub.c  .Event pkg "presence" registered by mod-presence
10:16:42.391         sip_endpoint.c  .Module "mod-mwi" registered
10:16:42.391                evsub.c  .Event pkg "message-summary" registered by mod-mwi
10:16:42.391         sip_endpoint.c  .Module "mod-refer" registered
10:16:42.391                evsub.c  .Event pkg "refer" registered by mod-refer
10:16:42.391         sip_endpoint.c  .Module "mod-pjsua-pres" registered
10:16:42.391         sip_endpoint.c  .Module "mod-pjsua-im" registered
10:16:42.391         sip_endpoint.c  .Module "mod-pjsua-options" registered
10:16:42.391           pjsua_core.c  .1 SIP worker threads created
10:16:42.391           pjsua_core.c  .pjsua version 2.7.1 for iOS-12.0/arm-iPhone10,6/iOS-SDK initialized
10:16:42.391           pjsua_core.c  .PJSUA state changed: CREATED --> INIT
10:16:42.391           pjsua_core.c  SIP UDP socket reachable at 10.198.73.93:53777
10:16:42.392         udp0x113d81de0  SIP UDP transport started, published address is 10.198.73.93:53777
10:16:42.392            tcptp:61764  SIP TCP listener ready for incoming connections at 10.198.73.93:61764
10:16:42.392            tlstp:61765  SIP TLS listener is ready for incoming connections at 10.198.73.93:61765
10:16:42.392           pjsua_core.c  PJSUA state changed: INIT --> STARTING
10:16:42.392         sip_endpoint.c  .Module "mod-unsolicited-mwi" registered
10:16:42.392           pjsua_core.c  .PJSUA state changed: STARTING --> RUNNING
10:16:42.402            pjsua_acc.c  Adding account: id=Mobile App <sip:-username-@-server-ip->
10:16:42.403            pjsua_acc.c  .Account Mobile App <sip:-username-@-server-ip-> added with id 0
10:16:42.403            pjsua_acc.c  .Acc 0: setting registration..
10:16:42.403               endpoint  ..Request msg REGISTER/cseq=19406 (tdta0x1140bcaa8) created.
10:16:42.403         tsx0x1140bdaa8  ...Transaction created for Request msg REGISTER/cseq=19407 (tdta0x1140bcaa8)
10:16:42.403         tsx0x1140bdaa8  ..Sending Request msg REGISTER/cseq=19407 (tdta0x1140bcaa8) in state Null
10:16:42.403          sip_resolve.c  ...Target '-server-ip-:0' type=UDP resolved to '-server-ip-:5060' type=UDP (UDP transport)
10:16:42.403           pjsua_core.c  ...TX 550 bytes Request msg REGISTER/cseq=19407 (tdta0x1140bcaa8) to UDP -server-ip-:5060:
REGISTER sip:-server-ip- SIP/2.0

Via: SIP/2.0/UDP 10.198.73.93:53777;rport;branch=z9hG4bKPjKKdoeaCBNVhdohu91.RPHdRPd26IRlFu

Max-Forwards: 70

From: "Mobile App" <sip:-username-@-server-ip->;tag=Y6YCsEE7Mka5Bxyp.5qnHIHZX37jSV5y

To: "Mobile App" <sip:-username-@-server-ip->

Call-ID: c45RIvJLsvQxE-zLTKqaSmtWhFSU9kbe

CSeq: 19407 REGISTER

Contact: "Mobile App" <sip:[email protected]:53777;ob>

Expires: 600

Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS

Content-Length:  0




--end msg--
10:16:42.403         tsx0x1140bdaa8  ...State changed from Null to Calling, event=TX_MSG
10:16:42.403            pjsua_acc.c  ..Acc 0: Registration sent
2018-09-26 10:16:42.407 [warn][tid:main][RCTView.m:712] (ADVICE) View #113 of type RCTView has a shadow set but cannot calculate shadow efficiently. Consider setting a background color to fix this, or apply the shadow to a more specific component.
10:16:42.463         sip_endpoint.c !Processing incoming message: Response msg 401/REGISTER/cseq=19407 (rdata0x1140be828)
10:16:42.463           pjsua_core.c  .RX 597 bytes Response msg 401/REGISTER/cseq=19407 (rdata0x1140be828) from UDP -server-ip-:5060:
SIP/2.0 401 Unauthorized

Via: SIP/2.0/UDP 10.198.73.93:53777;rport=6714;received=166.170.37.164;branch=z9hG4bKPjKKdoeaCBNVhdohu91.RPHdRPd26IRlFu

Call-ID: c45RIvJLsvQxE-zLTKqaSmtWhFSU9kbe

From: "Mobile App" <sip:-username-@-server-ip->;tag=Y6YCsEE7Mka5Bxyp.5qnHIHZX37jSV5y

To: "Mobile App" <sip:-username-@-server-ip->;tag=z9hG4bKPjKKdoeaCBNVhdohu91.RPHdRPd26IRlFu

CSeq: 19407 REGISTER

WWW-Authenticate: Digest  realm="asterisk",nonce="1537982202/ef8587a9406c843a83e7a74d107b8b99",opaque="4f88cd1d0b0441fd",algorithm=md5,qop="auth"

Server: Asterisk PBX 15.4.1

Content-Length:  0




--end msg--
10:16:42.463         tsx0x1140bdaa8  .Incoming Response msg 401/REGISTER/cseq=19407 (rdata0x1140be828) in state Calling
10:16:42.463         tsx0x1140bdaa8  ..State changed from Calling to Completed, event=RX_MSG
10:16:42.463            pjsua_acc.c  ....IP address change detected for account 0 (10.198.73.93:53777 --> 166.170.37.164:6714). Updating registration (using method 4)
10:16:42.464         tsx0x1148ba2a8  ....Transaction created for Request msg REGISTER/cseq=19408 (tdta0x1140bcaa8)
10:16:42.464         tsx0x1148ba2a8  ...Sending Request msg REGISTER/cseq=19408 (tdta0x1140bcaa8) in state Null
10:16:42.464               endpoint  ....Request msg REGISTER/cseq=19408 (tdta0x1140bcaa8): skipping target resolution because address is already set
10:16:42.464           pjsua_core.c  ....TX 835 bytes Request msg REGISTER/cseq=19408 (tdta0x1140bcaa8) to UDP -server-ip-:5060:
REGISTER sip:-server-ip- SIP/2.0

Via: SIP/2.0/UDP 166.170.37.164:6714;rport;branch=z9hG4bKPjxuze5sejqhkLhjURALqlBPj8iWCCSEOL

Max-Forwards: 70

From: "Mobile App" <sip:-username-@-server-ip->;tag=Y6YCsEE7Mka5Bxyp.5qnHIHZX37jSV5y

To: "Mobile App" <sip:-username-@-server-ip->

Call-ID: c45RIvJLsvQxE-zLTKqaSmtWhFSU9kbe

CSeq: 19408 REGISTER

Contact: <sip:[email protected]:6714;ob>

Expires: 600

Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS

Authorization: Digest username="-username-", realm="asterisk", nonce="1537982202/ef8587a9406c843a83e7a74d107b8b99", uri="sip:-server-ip-", response="e0d4d579ba370365f46c20ddfc146117", algorithm=md5, cnonce="A4JHSYkyxp.gUPB0sdoRBdkbv9kcQzGX", opaque="4f88cd1d0b0441fd", qop=auth, nc=00000001

Content-Length:  0




--end msg--
10:16:42.464         tsx0x1148ba2a8  ....State changed from Null to Calling, event=TX_MSG
10:16:42.515         sip_endpoint.c  Processing incoming message: Response msg 200/REGISTER/cseq=19408 (rdata0x1148bbc28)
10:16:42.515           pjsua_core.c  .RX 555 bytes Response msg 200/REGISTER/cseq=19408 (rdata0x1148bbc28) from UDP -server-ip-:5060:
SIP/2.0 200 OK

Via: SIP/2.0/UDP 166.170.37.164:6714;rport=6714;received=166.170.37.164;branch=z9hG4bKPjxuze5sejqhkLhjURALqlBPj8iWCCSEOL

Call-ID: c45RIvJLsvQxE-zLTKqaSmtWhFSU9kbe

From: "Mobile App" <sip:-username-@-server-ip->;tag=Y6YCsEE7Mka5Bxyp.5qnHIHZX37jSV5y

To: "Mobile App" <sip:-username-@-server-ip->;tag=z9hG4bKPjxuze5sejqhkLhjURALqlBPj8iWCCSEOL

CSeq: 19408 REGISTER

Date: Wed, 26 Sep 2018 17:16:42 GMT

Contact: <sip:-username-@-server-ip-:6714;ob>;expires=599

Expires: 600

Server: Asterisk PBX 15.4.1

Content-Length:  0




--end msg--
10:16:42.515         tsx0x1148ba2a8  .Incoming Response msg 200/REGISTER/cseq=19408 (rdata0x1148bbc28) in state Calling
10:16:42.515         tsx0x1148ba2a8  ..State changed from Calling to Completed, event=RX_MSG
10:16:42.515            pjsua_acc.c  ....SIP outbound status for acc 0 is not active
10:16:42.516            pjsua_acc.c  ....Mobile App <sip:-username-@-server-ip->: registration success, status=200 (OK), will re-register in 599 seconds
10:16:42.516            pjsua_acc.c  ....Keep-alive timer started for acc 0, destination:-server-ip-:5060, interval:15s
10:16:47.465         tsx0x1140bdaa8  Timeout timer event
10:16:47.465         tsx0x1140bdaa8  .State changed from Completed to Terminated, event=TIMER
10:16:47.465         tsx0x1140bdaa8  Timeout timer event
10:16:47.465         tsx0x1140bdaa8  .State changed from Terminated to Destroyed, event=TIMER
10:16:47.465         tsx0x1140bdaa8  Transaction destroyed!
10:16:47.516         tsx0x1148ba2a8  Timeout timer event
10:16:47.516         tsx0x1148ba2a8  .State changed from Completed to Terminated, event=TIMER
10:16:47.516         tsx0x1148ba2a8  Timeout timer event
10:16:47.516         tsx0x1148ba2a8  .State changed from Terminated to Destroyed, event=TIMER
10:16:47.516        tdta0x1140bcaa8  ..Destroying txdata Request msg REGISTER/cseq=19408 (tdta0x1140bcaa8)
10:16:47.516         tsx0x1148ba2a8  Transaction destroyed!
10:16:57.518            pjsua_acc.c  Sending 2 bytes keep-alive packet for acc 0 to -server-ip-:5060
10:16:57.518        tdta0x116001ca8  Destroying txdata raw

tophed avatar Sep 26 '18 17:09 tophed

iOS logs looks good, check your code at JS side

datso avatar Sep 26 '18 18:09 datso

@radelcom I believe that there is an issue in JS side, can you post gist for the code that you are trying to run ?

datso avatar Sep 26 '18 18:09 datso

@datso

try {
      const state = await endpoint.start({
        service: {
          ua: 'RN SIP',
        },
        network: {
          useWifi: true,
          useOtherNetworks: true,
        },
      });

      dispatch({
        type: types.INIT_SERVICE_SUCCESS,
        endpoint,
        connectivity: state.connectivity,
      });
    } catch (error) {
      dispatch({
        type: types.INIT_SERVICE_ERROR,
        error,
      });
    }

radelcom avatar Sep 26 '18 18:09 radelcom

@radelcom Please share a code that doesn't related to redux and I could run in a single JS file.

datso avatar Sep 26 '18 18:09 datso

@datso unfortunately, I dont have that.I believe it is happening as well in the react-native-pjsip demo app for android

radelcom avatar Sep 26 '18 18:09 radelcom

Demo app was updated 2 years ago and not maintained at all.

datso avatar Sep 26 '18 18:09 datso

I'm trying to debug this in Android Studio, and I'm having a little bit of trouble since I'm not familiar with Java. It seems to me that since the promise isn't getting resolved, the callback passed here is never getting called.

So maybe there's an issue with the way the callback is being set in createStartIntent?

tophed avatar Sep 26 '18 21:09 tophed

I am experiencing this on Android Lollipop (API 21 and 22). On my newer devices it works well.

It seems like the callback passed to the start method is never invoked.

There are no errors in the logs or anything.

rcidt avatar Oct 17 '18 18:10 rcidt

@tophed Can you also confirm that this only happens on Android Lollipop (APIs 21 and 22)?

rcidt avatar Oct 18 '18 12:10 rcidt

@datso https://github.com/datso/react-native-pjsip/blob/c0fea7ac7c197b41c9912a10d292f3354839b88c/android/src/main/java/com/carusto/ReactNativePjSip/PjSipService.java#L245-L250

That Runnable never runs, so the intent is never handled.

rcidt avatar Oct 18 '18 13:10 rcidt

@datso any idea why that run method is never invoked?

rcorrie avatar Oct 29 '18 13:10 rcorrie

@datso any update on this issue. I've created a sample test file if you want to test: https://github.com/krajay015/pjsipAndroid/tree/android-device-setup

It's not resolving endpoint.start()

  const endpoint = await new Endpoint();
    console.log('SIP INIT');
    const state = await endpoint.start();
  console.log("state: ", state) //is not consoling anything

@cmendes0101 can you help us here?

krajay015 avatar Dec 19 '18 13:12 krajay015

How come you do await on const endpoint = await new Endpoint(); ?

This is mine: const endpoint = new Endpoint(); const state = await endpoint.start({ service: { ua: Platform.select({ ios: 'USERAGENT', android: 'USERAGENT', }), stun: stunList, }, network: { useWifi: true, useOtherNetworks: true, }, });

cmendes0101 avatar Dec 20 '18 10:12 cmendes0101

This is what I'm using @cmendes0101

  async componentDidMount(){
    console.log('SIP STARTED');
    const endpoint = new Endpoint();
    const state = await endpoint.start({
          service: {
            ua: 'RN SIP',
          },
          network: {
            useWifi: true,
            useOtherNetworks: true,
          },
        });
    console.log({state}); //I'm not getting anything here
  }

also you can check here: https://github.com/krajay015/pjsipAndroid

krajay015 avatar Dec 20 '18 12:12 krajay015

Sorry, I have no idea. I use mine with redux and I have it setup similar to the demo app without any issue: https://github.com/datso/react-native-pjsip-app/blob/master/app/modules/pjsip.js

cmendes0101 avatar Dec 20 '18 12:12 cmendes0101

it's working perfectly with iOS device but android device is throwing issues. I'll try to go with redux method also and will post here. Thanks for sharing the link

krajay015 avatar Dec 20 '18 12:12 krajay015

@krajay015 can you confirm this only happens on Android devices API 21 and 22?

rcidt avatar Dec 20 '18 21:12 rcidt

@rcidt I've tried on Android API (28, 25, 23 and 22 ) and it's failing on all

krajay015 avatar Dec 21 '18 07:12 krajay015

@cmendes0101 which version of React-native you are using. I've faced this issue with RN-0. 56 and RN-0.57.

ajay28kumar avatar Dec 22 '18 05:12 ajay28kumar

@tophed Added in the - AndroidManifest.xml

       <service
                android:name="com.carusto.ReactNativePjSip.PjSipService"
                android:enabled="true"
                android:exported="true" />
      <receiver android:name="com.carusto.ReactNativePjSip.PjSipConnectivityReceiver">
        <intent-filter>
          <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
        </intent-filter>
      </receiver>

aronStein avatar Dec 25 '18 09:12 aronStein

       <service
                android:name="com.carusto.ReactNativePjSip.PjSipService"
                android:enabled="true"
                android:exported="true" />
      <receiver android:name="com.carusto.ReactNativePjSip.PjSipConnectivityReceiver">
        <intent-filter>
          <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
        </intent-filter>
      </receiver>

thanks a lot, this solve this problem, recommended. should have been written in the docs.

pazualo avatar Dec 25 '18 10:12 pazualo

This step was mentioned in the old markdown docs, which was later removed. You can browse the docs by cloning the repo and opening the /docs/index.html file on your browser.

glocore avatar Feb 18 '19 12:02 glocore

Hello everybody,

Where can I find the demo app?

I'm trying to create a VoIP app that connects to my SIP Server.

Thanks.

faridlopez avatar Apr 02 '19 18:04 faridlopez

Hello everybody,

Where can I find the demo app?

I'm trying to create a VoIP app that connects to my SIP Server.

Thanks.

https://github.com/tariq86/reactnative-sip

alwsBgood avatar Apr 18 '19 14:04 alwsBgood