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 233 forks source link

When processing the received call I get this on logcat along with crash #5

Closed jojonarte closed 8 years ago

jojonarte commented 8 years ago

Calling pjlib from unknown/external thread. You must “ ”register external threads with pj_thread_register()

datso commented 8 years ago

Hi, please add whole log from "adb logcat"

jojonarte commented 8 years ago

It was actually the start of the crash, then it reloads the logcat to this 08-29 15:40:49.855 32683-32683/? I/art: Late-enabling -Xcheck:jni 08-29 15:40:49.880 32683-32692/? I/art: Debugger is no longer active 08-29 15:40:50.035 32683-32683/? D/PjSipService: onCreate 08-29 15:40:50.037 32683-32705/? W/linker: libopenh264.so has text relocations. This is wasting memory and prevents security hardening. Please fix. 08-29 15:40:50.039 32683-32705/? W/linker: libpjsua2.so has text relocations. This is wasting memory and prevents security hardening. Please fix. 08-29 15:40:50.048 32683-32705/? D/PjSipLogWriter: 15:40:50.048 sip_endpoint.c !.Module "mod-pjsua-log" registered 08-29 15:40:50.048 32683-32705/? D/PjSipLogWriter: 15:40:50.048 sip_endpoint.c .Module "mod-tsx-layer" registered 08-29 15:40:50.048 32683-32705/? D/PjSipLogWriter: 15:40:50.048 sip_endpoint.c .Module "mod-stateful-util" registered 08-29 15:40:50.048 32683-32705/? D/PjSipLogWriter: 15:40:50.048 sip_endpoint.c .Module "mod-ua" registered 08-29 15:40:50.048 32683-32705/? D/PjSipLogWriter: 15:40:50.048 sip_endpoint.c .Module "mod-100rel" registered 08-29 15:40:50.048 32683-32705/? D/PjSipLogWriter: 15:40:50.048 sip_endpoint.c .Module "mod-pjsua" registered 08-29 15:40:50.049 32683-32705/? D/PjSipLogWriter: 15:40:50.048 sip_endpoint.c .Module "mod-invite" registered 08-29 15:40:50.049 32683-32705/? D/PjSipLogWriter: 15:40:50.049 opensl_dev.c ..OpenSL sound library initialized 08-29 15:40:50.049 32683-32705/? D/PjSipLogWriter: 15:40:50.049 pjlib ..select() I/O Queue created (0xeed02414) 08-29 15:40:50.054 32683-32705/? D/PjSipLogWriter: 15:40:50.054 pjsua_vid.c ..Initializing video subsystem.. 08-29 15:40:50.054 32683-32705/? D/PjSipLogWriter: 15:40:50.054 openh264.cpp ...OpenH264 codec initialized 08-29 15:40:50.055 32683-32705/? D/PjSipLogWriter: 15:40:50.055 opengl_dev.c ...OpenGL device initialized 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.162 android_dev.c ...Android video capture initialized with 2 device(s): 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 android_dev.c ... 0: Front camera 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 android_dev.c ... supported format = NV21/640x480 NV21/480x640 NV21/352x288 NV21/288x352 NV21/320x240 NV21/240x320 NV21/176x144 NV21/144x176 YV12/640x480 YV12/480x640 YV12/352x288 YV12/288x352 YV12/320x240 YV12/240x320 YV12/176x144 YV12/144x176 I420/640x480 I420/480x640 I420/352x288 I420/288x352 I420/320x240 I420/240x320 I420/176x144 I420/144x176 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 android_dev.c ... 1: Back camera 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 android_dev.c ... supported format = NV21/640x480 NV21/480x640 NV21/352x288 NV21/288x352 NV21/320x240 NV21/240x320 NV21/176x144 NV21/144x176 YV12/640x480 YV12/480x640 YV12/352x288 YV12/288x352 YV12/320x240 YV12/240x320 YV12/176x144 YV12/144x176 I420/640x480 I420/480x640 I420/352x288 I420/288x352 I420/320x240 I420/240x320 I420/176x144 I420/144x176 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 colorbar_dev.c ...Colorbar video src initialized with 2 device(s): 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 colorbar_dev.c ... 0: Colorbar generator 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 colorbar_dev.c ... 1: Colorbar-active 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 sip_endpoint.c .Module "mod-evsub" registered 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 sip_endpoint.c .Module "mod-presence" registered 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 sip_endpoint.c .Module "mod-mwi" registered 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 sip_endpoint.c .Module "mod-refer" registered 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 sip_endpoint.c .Module "mod-pjsua-pres" registered 08-29 15:40:50.163 32683-32705/? D/PjSipLogWriter: 15:40:50.163 sip_endpoint.c .Module "mod-pjsua-im" registered 08-29 15:40:50.164 32683-32705/? D/PjSipLogWriter: 15:40:50.163 sip_endpoint.c .Module "mod-pjsua-options" registered 08-29 15:40:50.164 32683-32705/? D/PjSipLogWriter: 15:40:50.164 pjsua_core.c .1 SIP worker threads created 08-29 15:40:50.164 32683-32705/? D/PjSipLogWriter: 15:40:50.164 pjsua_core.c .pjsua version 2.4.5 for Linux-3.10/x86_64 initialized 08-29 15:40:50.164 32683-32705/? D/PjSipLogWriter: 15:40:50.164 pjsua_core.c .PJSUA state changed: CREATED --> INIT 08-29 15:40:50.165 32683-32705/? D/PjSipLogWriter: 15:40:50.165 pjsua_core.c PJSUA state changed: INIT --> STARTING 08-29 15:40:50.165 32683-32705/? D/PjSipLogWriter: 15:40:50.165 sip_endpoint.c .Module "mod-unsolicited-mwi" registered 08-29 15:40:50.165 32683-32705/? D/PjSipLogWriter: 15:40:50.165 pjsua_core.c .PJSUA state changed: STARTING --> RUNNING

then crashed.

datso commented 8 years ago

You added only logs from startup. Add whole log from the begging till crash (e.g. attach file).

jojonarte commented 8 years ago

I've found out it was not the one caused the crash but some other UI stuff, but this is weird.

I've got this kind of bug where I can't answer the call.

It gives me this logcat message

W/PjSipBroadcastReceiver: Callback executed with exception state: Call with specified "1" id not found

The answerCall method doesn't seem to work there must be something missing here. Let's examine the handleCallAnswer method of the PjSipService class.

`

private void handleCallAnswer(Intent intent) {
        try {
            int callId = intent.getIntExtra("call_id", -1);

            // -----
            PjSipCall call = findCall(callId);  // this seems to be the one  causing the issue of not being able to answer the call //
            call.answer(new CallOpParam(true));

            mEmitter.fireIntentHandled(intent);
        } catch (Exception e) {
            mEmitter.fireIntentHandled(intent, e);
        }
    }`
`

The service still doesn't hold the id of the call as there is no logic of adding the call on receiving of the incoming call.

datso commented 8 years ago

Fixed in c288084