Re: Android pjsua2 error on Account::modify()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ahh, figured this one out too.

It's a subtle bug in the pjsua2 java 'MyApp' class.

When deleting the endpoint, because it's declared and initialized as a static member of MyApp, it doesn't get re-initialized the second time the library is initialized.

To make matters worse, the exception handler around 'ep.libCreate();' does nothing, so there's no indication that anything went wrong setting up the endpoint.

I added a check:

if (ep == null) ep = new Endpoint();

right before libCreate(). This seems to have fixed my issues.

This is not an issue for the sample pjsua2 android app, because it's a one-shot use of the library. But to make the samples a little more extensible, this change should probably go into the main trunk....

-Caleb

On 12/24/17 7:24 AM, James T. Kirk wrote:

Hi,

I'm using the swig wrapped pjsua2 library on Android to provide a floating video chat window in an Android service.

This works beautifully the first time around.

But if I try to stop and re-launch the service, I get an exception during Account.modify():

D/FloatingWindowService: Title:       pjsua_acc_modify(id, &pj_acc_cfg)
                         Code:        70004
                         Description: Invalid value or argument (PJ_EINVAL)
                         Location:    ../src/pjsua2/account.cpp:709

When stopping my service, I'm using the same set of calls that the default sample pjsua2 android app uses to shut down the pjsip library:

Runtime.getRuntime().gc();

/* Shutdown pjsua. Note that Endpoint destructor will also invoke
* libDestroy(), so this will be a test of double libDestroy().
*/
try {
    ep.libDestroy();
} catch (Exception e) {
       Log.d(TAG, "Problem destroying SIP endpoint: " + e.getMessage());
}

/* Force delete Endpoint here, to avoid deletion from a non-
* registered thread (by GC?). 
*/
ep.delete();
ep = null;
Notice there is a catch handler here, and it doesn't get called... So it seems shutdown was OK???

Any suggestions?

-Caleb


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux