get call stats (txPackets rxPackets e.t.c)

431 views
Skip to first unread message

Oleksii Vinogradov

unread,
Dec 21, 2012, 2:38:31 AM12/21/12
to csipsim...@googlegroups.com
Hi to all
i try to get from call stats. in C code it's pretty simple:

    pjsua_stream_stat statMain;
    pj_status_t statusMediaGetStream = pjsua_call_get_stream_stat(_call_id,0,&statMain);
    if (statusMediaGetStream == PJ_SUCCESS) {
        pjmedia_rtcp_stat stat = statMain.rtcp;
        pjmedia_rtcp_stream_stat tx = stat.tx;
        pjmedia_rtcp_stream_stat rx = stat.rx;
        pj_math_stat    jitterRX = rx.jitter;
        txPackets = [NSNumber numberWithInt:tx.pkt];


For cSipSimple i was found simular function:

                   int callState = call.getCallState();
                    pjsua_stream_stat stat = new pjsua_stream_stat();

                    

                    int result = pjsua.call_get_stream_stat(call.getCallId(),0,stat);
                    if (result == pjsuaConstants.PJ_SUCCESS) {
                        Log.e(THIS_FILE, "stat->" + stat);
                    }


E/AndroidRuntime( 6350): FATAL EXCEPTION: main
E/AndroidRuntime( 6350): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 6350):  at org.pjsip.pjsua.pjsua_stream_stat.<init>(pjsua_stream_stat.java:55)
E/AndroidRuntime( 6350):  at android.os.Handler.handleCallback(Handler.java:618)
E/AndroidRuntime( 6350):  at android.os.Handler.dispatchMessage(Handler.java:123)
E/AndroidRuntime( 6350):  at android.os.Looper.loop(Looper.java:154)
E/AndroidRuntime( 6350):  at android.app.ActivityThread.main(ActivityThread.java:4668)
E/AndroidRuntime( 6350):  at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 6350):  at java.lang.reflect.Method.invoke(Method.java:552)
E/AndroidRuntime( 6350):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:919)
E/AndroidRuntime( 6350):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:676)
E/AndroidRuntime( 6350):  at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 6350): Caused by: java.lang.UnsatisfiedLinkError: swig_module_init
E/AndroidRuntime( 6350):  at org.pjsip.pjsua.pjsuaJNI.swig_module_init(Native Method)
E/AndroidRuntime( 6350):  at org.pjsip.pjsua.pjsuaJNI.<clinit>(pjsuaJNI.java:1362)
E/AndroidRuntime( 6350):  ... 11 more

Régis Montoya

unread,
Dec 21, 2012, 1:24:51 PM12/21/12
to csipsim...@googlegroups.com
Apparently not a problem with the method (that is correct apparently and should work) but with the rest of your code.
Apparently you are not running the method in the correct correct process + thread.

Where can we see your entiere code so that could help better?
Also what is the purpose for these stats? If it something that makes sense we can add it to the csipsimple service api which is definitely the clean and reliable way to do that ;)

Oleksii Vinogradov

unread,
Dec 21, 2012, 2:59:35 PM12/21/12
to csipsim...@googlegroups.com
 up to you :) better is explain, how it can work well...
if no - i will find solution anyway... but i can't to share solution between community...
when u place source code, u must be ready to guys, who will seen more deep, then you :) this is a why u do that...
don't ask us to dance by u rules... u have to dance by our rules... we r know it, and u r know it....
Regis, u have to understand - this is a strong point... u r do and product a company, which respond for that u project...
or... we are rip u as programmer................
u choice......
p.s. don't ask me how i avoid u jni protection.. - i do that.... if i publish that way, u lost tonns of customers...
i can't approve that, bcs i like to work with u.....


пятница, 21 декабря 2012 г., 20:24:51 UTC+2 пользователь r3gis написал:

Régis Montoya

unread,
Dec 21, 2012, 3:23:05 PM12/21/12
to csipsim...@googlegroups.com

You have to understand that CSipSimple is NOT a company !!! So "u r do and product a company" is absolutely WRONG !!!!

It's an opensource project released under GPL license terms !
If you don't understand what it means and that it means that your source code (or part depending on the mode) also has to be open... you should not choose CSipSimple as a base for your work.
It's clear and explained on the wiki page.
Re read it :
http://code.google.com/p/csipsimple/wiki/Licensing?wl=en

I remind that as many time as I can here and everywhere. The goal of the project is USERS !! Not companies ! If companies wants to play the game and wants to grants the same rights I grant by releasing CSipSimple, it's just fine, and they are welcome to do their own version.

If they don't want to give users the same rights I give by releasing the app, they are clearly not welcome and will not respect law as it's the terms of the GPL. And I'll sue anyone doing that because it's clearly not the reason why I release the code.

You must understand the license before using an opensource project.
GPL is not Apache or MIT license. There is various opensource licenses and not all are equal regarding what you are allowed to do with. Each license has a purpose and choosing the GPL for CSipSimple is a deliberate choice, and there is a reason behind.

So if you want to leave the project and base your work on something that doesn't take care of users feel free.. but it will not be csipsimple ! My spare time spent by coding csipsimple will never benefit a company that wants to handcuff their users !

Besides I don't understand the point about the "jni" protection. What do you mean ??
If you find a security hole,  it's a very bad reaction to keep it for you !
I would prefer you to publish it here or to send me a mail about that !! I don't known in which spirit you are basing your work on csipsimple but it's clearly not in the goal to benefit users, so it's apparently incompatible with my approach.

I know it's rare to see a real opensource GPL project, but this one is this kind of project !
It's not commercial, will never be, and if you don't want to dance by this rule, just don't use it as it's forbidden by the license.

I develop the app 1 day a week as a hobby and I will never accept rude guys telling me what I should do of my free time. I don't know what you thought, but was wrong ;). I will never dance your rules !


I hope you understand my position and that you'll change your mind on freedom you give to your users. If not, just don't work on the top of csipsimple it will not be legal when released !

Oleksii Vynogradov

unread,
Dec 22, 2012, 4:47:43 AM12/22/12
to csipsim...@googlegroups.com

Dec 21, 2012, в 8:24 PM, Régis Montoya <r3gi...@gmail.com> написал(а):

Also what is the purpose for these stats? If it something that makes sense we can add it to the csipsimple service api which is definitely the clean and reliable way to do that ;)

i'm using those stat to calculate voice quality and show inside client....

Jakub Cebrzyna

unread,
Dec 22, 2012, 5:07:23 AM12/22/12
to csipsim...@googlegroups.com

There is some kind of rtcp support in csipsimple and pjsua... I also wanted to use that to adapt codec to quality of the connection... Is this possible to make reinvite easy way in csipsimple?

Régis Montoya

unread,
Dec 22, 2012, 5:25:49 AM12/22/12
to csipsim...@googlegroups.com
Ok, so for stats there is a dedicated method :
http://r3gis3r.github.com/SampleCSipSimpleApp/javadoc/com/csipsimple/api/ISipService.html#showCallInfosDialog(int)

It returns the pjsua dump info of the call which includes the codec, the rx/tx stats for audio and video.

Régis Montoya

unread,
Dec 22, 2012, 5:32:12 AM12/22/12
to csipsim...@googlegroups.com
Yes pjsip supports rtcp stats.

If you want to change the codec during the call the best approach is to add a pjsip module and to do that in the C part (not in java android part).
But yes what you describe is technically possible.

However a best way which is what is planned to add on my side is to use codecs that can adapt bandwidth such as opus, silk etc for audio and vp8, h264 for video and accordingly to detected packet loss to adapt bandwidth of the codec.
This will also be done in the native part of the app as doesn't make sense in the upper layer (it's not related to android but something that should go as improvement of pjsip ;) )

That's basically why I asked Oleksii why he needed the info. Depending on the purpose the correct way to get and use it is very different. And apparenty (from all questions asked here) Oleksii doesn't understand yet the overall software architecture, that's why help on the place to put thing is the first topic to solve.

Oleksii Vynogradov

unread,
Dec 23, 2012, 3:22:05 AM12/23/12
to csipsim...@googlegroups.com
Hi.
yep, i don't understand some issues there, but i moving to understand more ;) 
method works fine, thanks. little bit hard to parce that string:

E/PhonePadActivity( 1047):    Call time: 00h:00m:29s, 1st res in 5366 ms, conn in 11304ms
E/PhonePadActivity( 1047):    #0 audio PCMU @8kHz, sendrecv, peer=208.71.117.247:17360
E/PhonePadActivity( 1047):       SRTP status: Not active Crypto-suite: (null)
E/PhonePadActivity( 1047):       RX pt=0, last update:00h:00m:04.259s ago
E/PhonePadActivity( 1047):          total 1.6Kpkt 268.9KB (336.2KB +IP hdr) @avg=60.3Kbps/75.4Kbps
E/PhonePadActivity( 1047):          pkt loss=79 (4.5%), discrd=0 (0.0%), dup=0 (0.0%), reord=1 (0.1%)
E/PhonePadActivity( 1047):                (msec)    min     avg     max     last    dev
E/PhonePadActivity( 1047):          loss period:  20.000 263.334 1220.000  20.000  61.585
E/PhonePadActivity( 1047):          jitter     :   1.250  23.456 156.000  17.625   7.651
E/PhonePadActivity( 1047):       TX pt=0, ptime=20, last update:00h:00m:00.298s ago
E/PhonePadActivity( 1047):          total 1.7Kpkt 283.0KB (353.9KB +IP hdr) @avg=63.5Kbps/79.4Kbps
E/PhonePadActivity( 1047):          pkt loss=83 (4.5%), dup=0 (0.0%), reorder=0 (0.0%)
E/PhonePadActivity( 1047):                (msec)    min     avg     max     last    dev 
E/PhonePadActivity( 1047):          loss period:  60.000 237.143 500.000 260.000  65.163
E/PhonePadActivity( 1047):          jitter     :  19.000  24.750  28.625  26.500   2.923
E/PhonePadActivity( 1047):       RTT msec      : 1160.000 1623.286 3518.000 1160.000  65.505

but i sure, that i can do it... :) C structure to return i guess much better....
interesting question in additional - in C version of pjsip i was using pjsua_get_stream_stat function, but there was zero info for TX leg (RX leg was fine)
in my mind i guess, what this is client seen only RX stats inside RTCP, but in function, which u suggest to me, call_dump i seen both stats...

Maybe this is a subject to report bug inside pjsua_get_stream_stat to pjsip development team?
Anyway thanks, i guess i will using dump call and probably using in C version same function....

Dec 22, 2012, в 12:32 PM, Régis Montoya <r3gi...@gmail.com> написал(а):

Oleksii Vynogradov

unread,
Dec 23, 2012, 4:38:01 AM12/23/12
to csipsim...@googlegroups.com
E/PjService( 1393): Impossible to retrieve string from pjsip 
E/PjService( 1393): java.lang.StringIndexOutOfBoundsException
E/PjService( 1393): at java.lang.String.substring(String.java:1610)

this is what i receive for one of request of dumpCallInfo inside pjStrToString function...

looks like bug...

Dec 22, 2012, в 12:32 PM, Régis Montoya <r3gi...@gmail.com> написал(а):

Elishiah Miller

unread,
Apr 8, 2013, 2:09:37 PM4/8/13
to csipsim...@googlegroups.com
Hi,

I am trying to get the same information. Can you post the code on how you called showCallInfosDialog? I saw that on http://developer.android.com/guide/components/aidl.html gives example on how to call the method. Should I use this?

Thank you
Reply all
Reply to author
Forward
0 new messages