PJSUA Registration is not proceeding - android

Hello fellow developers,
I am developing SIP application using PJSIP library...
Here is my code
And here is my Logcat log
The problem is application is not trying to proceed registration, and no errors at all... (Or I missed something?)
And log on my Kamailio Server (when my device tries to connect and log stucks nothing happens):
22(32406) DEBUG: <core> [ip_addr.c:229]: print_ip(): tcpconn_new: new tcp connection: 192.168.0.150
22(32406) DEBUG: <core> [tcp_main.c:985]: tcpconn_new(): on port 17749, type 3
22(32406) DEBUG: <core> [tcp_main.c:1295]: tcpconn_add(): hashes: 879:4076:3775, 50
22(32406) DEBUG: <core> [io_wait.h:376]: io_watch_add(): DBG: io_watch_add(0x9f8540, 44, 2, 0x7f6cdbbf3948), fd_no=34
ps. I tested server with ready client and everything is ok...
Thanks in advance :)

I have resolved issue...
The problem was in registering PJSIP in another thread... I was using main Thread and initializing connection on OnCreate() event in MainActivity. Which means, after OnCreate() fired and finishes its job, initialization process was getting destroyed before it connects into server...
What I did:
Before:
UaConfig ua_cfg = epConfig.getUaConfig();
ua_cfg.setUserAgent("Pjsua2 Android " + ep.libVersion().getFull());
ua_cfg.setThreadCnt(0);
ua_cfg.setMainThreadOnly(true);
After:
UaConfig ua_cfg = epConfig.getUaConfig();
ua_cfg.setUserAgent("Pjsua2 Android " + ep.libVersion().getFull());
Removing those lines makes PJSIP library to create its own worker thread...

Related

Using ACRA with tracepot as backend

I have just finished my first android app as part of a school project ..one of my friends encountered a problem while trying to explore one of the activities in the app ..so i searched for solutions to get the crashes reports whenever they happen to fix the bugs ..i came across ACRA ..and I followed one of SO threads to setup ACRA to my app ..
RESULT: when the crashs happens the gmail app get launch in the device and the user (if he want to) he'll send the crash report by email ..Consedering not all users will want to ..i found in a comment in one of the SO threads that some developers use tracepot.
so i have used their link for integration in formUri but exploring my account on tracepot i get nothing ..is there something i am doing wrong (or if there is a better solution than using tracepot a backend , please suggest/explain or link a good tutorial, thanks!)
MyApplication.Java ( AFTER EDITING
#ReportsCrashes(
formUri = "https://collector.tracepot.com/79b1***",
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.PUT,
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text
)
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
CaocConfig.Builder.create()
//.errorActivity(CustomErrorActivity.class) //default: null (default error activity)
.apply();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
EDIT :
msg in logcat if i use the http and email:
09-17 18:37:33.700 14329-14812/ma.ac.iav.menunaviagtion:acra W/ACRA: ma.ac.iav.menunaviagtion reports will be sent by email (if accepted by user).
09-17 18:37:33.703 14329-14812/ma.ac.iav.menunaviagtion:acra I/ACRA: Sending report /data/user/0/ma.ac.iav.menunaviagtion/app_ACRA-approved/2018-09-17T18:37:33.441+01:00-IS_SILENT.stacktrace
if i use only the http :
09-17 22:47:00.648 20116-20137/ma.ac.iav.myapplication:acra E/ACRA: Failed to send crash report for /data/user/0/ma.ac.iav.myapplication/app_ACRA-approved/2018-09-17T22:44:52.199+00:00-IS_SILENT.stacktrace
IMPLEMENTATION:
compile 'ch.acra:acra:4.9.2'
LOGCAT FOR F43nd1r
09-18 01:39:49.631 18508-18803/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: ma.ac.iav.myapplication, PID: 18508
java.lang.InternalError: Thread starting during runtime shutdown
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:733)
at android.app.SharedPreferencesImpl.startLoadFromDisk(SharedPreferencesImpl.java:119)
at android.app.SharedPreferencesImpl.<init>(SharedPreferencesImpl.java:112)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:392)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:373)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.getLastCrashTimestamp(CustomActivityOnCrash.java:673)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.hasCrashedInTheLastSeconds(CustomActivityOnCrash.java:683)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.access$200(CustomActivityOnCrash.java:52)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash$1.uncaughtException(CustomActivityOnCrash.java:112)
at org.acra.builder.ReportExecutor.endApplication(ReportExecutor.java:269)
at org.acra.builder.ReportExecutor.dialogAndEnd(ReportExecutor.java:254)
at org.acra.builder.ReportExecutor.access$400(ReportExecutor.java:42)
at org.acra.builder.ReportExecutor$2.run(ReportExecutor.java:217)
By default, if the mail config is present, Acra 4 will send via mail and nothing else.
To use both you'd have to configure the reportSenderFactories.
400: Client error
Indicates that tracepot rejected your report. This could have multiple reasons. To find out what the problem is, call ACRA.DEV_LOGGING = true; right before ACRA.init and post all logcat with the ACRA tag.
Also note that ACRA 4.9.2 does not support android Oreo and above, it is recommended to upgrade to at least ACRA 4.11, or just the newest version 5.2.0.
You are not sending all required fields to Tracepot.
https://tracepot.uservoice.com/knowledgebase/articles/355272-what-are-the-required-fields-acra-needs-to-send
ANDROID_VERSION
APP_VERSION_CODE
APP_VERSION_NAME
PACKAGE_NAME
REPORT_ID
STACK_TRACE
USER_APP_START_DATE
USER_CRASH_DATE

cordova.file.* (all directories) are null

I'm working on Ionic mobile app development.
My requirement is to create client side logger to track issues in app. I used the methods mentioned in https://github.com/pbakondy/filelogger, and I could able to create the log file in both Android and iOS.
For the first time when I open the app, it creates the log file in cordova.file.dataDirectory, when I close and reopen the app in i*OS, I'm trying to read the content of the file which was created using the below
$fileLogger.getLogfile().then(function (loggerContent) {
var temp =loggerContent;
});
But the application says
{
"applicationDirectory":null,
"applicationStorageDirectory":null,
"dataDirectory":null,
"cacheDirectory":null,
"externalApplicationStorageDirectory":null,
"externalDataDirectory":null,
"externalCacheDirectory":null,
"externalRootDirectory":null,
"tempDirectory":null,
"syncedDataDirectory":null,
"documentsDirectory":null,
"sharedDirectory":null
}
So I couldn't able to find the file where i saved my logs.
Please help me resolve this issue or if you could recommend me a different method to get around this issue, that would be great!
Thanks for the answers
There is a check list here and should solve your problem :
1-Be sure that the cordova-file-plugin is installed and works in your test environment.
2-Be sure that the cordova.js file is refrenced by your html and before your code usage.
3-Be sure to call your codes after device_ready state :
check this
4-Call your function after a short delay (use setTimeOut in Javascirpt)
Ali's item 4 is very important:
I had a similiar problem on different platforms: cordova.file.dataDirectory was null.
I tracked cordova.file.dataDirectory over the lifecycle and it was first accessed by my Ionic 2 code BEFORE the device ready event was fired.
My "mistake": I wanted to load data during the constructor(!) of a service. Seems too early.

Error while running PJSUA android sample application

I am trying to build & run pjsua sample app of pjsip and have successfully build it.
I have followed this PJSIP tutorial.
ID : sip:150#123.12.xxx.123:5060
Registrar : sip:123.12.xxx.123:5060
Proxy : sip:123.12.xxx.123:5060
Username : 150
Password : 111111
I am able to register as i am getting "Registration Successful" as response on dialog screen and 200 ok response in log.
I added a buddy with URI as sip:151 (username). It is being shown in list.
When i select buddy from list and try to make call i get a crash with following error log.
10-24 10:57:13.644: A/libc(7553): ../src/pjmedia/sdp_neg.c:110: pjmedia_sdp_neg_create_w_local_offer: assertion "(status=pjmedia_sdp_validate(local))==PJ_SUCCESS" failed
10-24 10:57:13.644: A/libc(7553): Fatal signal 6 (SIGABRT), code -6 in tid 7699 (Thread-21990)
I am not sure where i am going wrong but i am not able to establish a sip call with my sip server.
I have tested my server with CSipSimple app available from this link and it is working fine with it.
Thanks in advance.
Just a theory, but maybe try adding him using the URI of "sip:151#YourServer"
Same crash and lot of search bring me to this post.
I'm build pjsip without video codecs and size of CodecInfoVector was 0.
CodecInfoVector mCodecInfoVectorV = mEndpoint.videoCodecEnum();
for (int i = 0; i < mCodecInfoVectorV.size(); i++) {
System.out.println(mCodecInfoVectorV.get(i).getCodecId() + "\n" +
mCodecInfoVectorV.get(i).getDesc());
}
So i had to enable video codecs and re-build pjsip even if they are isn't used. And after that i've been able to make call

How do I use WL.Client.getID() properly?

I'm trying to get the ID of a mobile phone where my hybrid worklight (v6.2) app is running on and the app is hanging on the following code:
WL.Logger.log("About to getID...");
WL.Client.getID({onSuccess : function(o) {
WL.Logger.log("getID: " + o);
devID = o.deviceID;
}, onFailure : function(e) {
WL.Logger.log("Error getting ID: " + e);
}});
WL.Logger.log("After getID...");
I see the "About to getID" output in the LogCat log, but that is it. I never see the onSuccess logging nor the onFailure logging. And the "After getID" logging never appears either.
From reading the Knowledge center documentation, it doesn't appear this method is making a call back to the Worklight server at all. This has failed both in an Android emulator and on an Android device.
Any suggestions/insight to get this method to work would be appreciated.
If you will look at the API reference for Worklight 6.2, you will see there is no such API method as WL.Client.getID: http://www-01.ibm.com/support/knowledgecenter/#!/SSZH4A_6.2.0/com.ibm.worklight.apiref.doc/html/refjavascript-client/html/WL.Client.html?cp=SSZH4A_6.2.0%2F10-0-0-1-6
There is however WL.Device.getID: http://www-01.ibm.com/support/knowledgecenter/#!/SSZH4A_6.2.0/com.ibm.worklight.apiref.doc/html/refjavascript-client/html/WL.Device.html%23getID

Persitent Error 580 Invalid Authentication Parameters with an Android App connecting to Sybase SUP

I am trying to register my native application to tye Sybase Control Center, but I always
get the Invalid Authentication Parameters. The problem is, that my Application and connection
profile disappeared from the SCC and I cant recreate it. Also, I created a new connection profile,
but the activation code is grayed out and blank, so I cannot restore it.
I already tried unregistering/registering, reinstalling the app on the emulator, but the Error 580 persists. I cannot declare the app on the SCC manually again, so I am now in a dead end, and without any fresh ideas.
Any suggestions? (below is my code, asume that the SCC is brand new, without any regsistered apps)
writeToLog("STARTING SYNC THREAD...");
app.setApplicationContext(ZServicesActivity.this); // context is the android.content.Context
//SMPNostrumDB.getSynchronizationProfile();
//-----------------------Connection Properties---------------------------
writeToLog("SETTING Connection PROPERTIES...");
ConnectionProperties connProps = app.getConnectionProperties();
connProps.setServerName(SERVER_172);
// connProps.setServerName(PUBLIC_SERVER);
connProps.setPortNumber(MSG_SERVER_PORT);
connProps.setActivationCode(ACTIVE_CODE);
connProps.setFarmId("0");
writeToLog("CONN Properties are SET.");
SMPNostrumDB.setApplication(app); // Set the android.content.Context for the application
LoginCredentials loginCredentials = new LoginCredentials(USER,PWD);
connProps.setLoginCredentials(loginCredentials);
writeToLog("Login Credentials, SET.");
if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
//app.unregisterApplication();
//writeToLog("...your nemesis");
writeToLog("REGISTERING App...");
connProps.setActivationCode(ACTIVE_CODE);
app.registerApplication();
writeToLog("APP REGISTERED...");
progressConnection.dismiss();
}
else{
writeToLog("App already created, CONNECTING...");
app.startConnection(10000);
writeToLog("APP CONNECTED...");
}
//-----------------------Connection Profile---------------------------
writeToLog("SETTING Connection PROFILE...");
ConnectionProfile connectionProperties=SMPNostrumDB.getSynchronizationProfile();
writeToLog(" (CP): APP DB and Server, are SET.");
connectionProperties.setServerName(SERVER_172);
connectionProperties.setPortNumber(SYNC_SERVER_PORT);
writeToLog("Connection PROFILE is SET.");
writeToLog("APP CONNECTED...");
progressConnection.dismiss();
app.setApplicationCallback(new MyApplicationCallback());
SMPNostrumDB.registerCallbackHandler(new MyCallbackHandler());
I am using SUP 2.3.3, and after a few days of waiting for a reply, a SAP consultant recommended me to leave out the activation code.
I removed all traces of the activation code from my android side code, and it WORKED! so I was able to move to close this chapter and move on with the app development.

Categories

Resources