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

How can i test connection quality to SIP server?

Open pohodnya opened this issue 8 years ago • 5 comments

pohodnya avatar Jul 28 '17 03:07 pohodnya

You can use RTCP statistics, but there are no bindings from RN wrapper yet. Going to add it in the feature.

datso avatar Jul 28 '17 08:07 datso

@datso I'm really looking forward to you adding this feature. I will follow the changes.

pohodnya avatar Jul 28 '17 11:07 pohodnya

@datso can you please explain to me more about this feature? I can work on it, I just want some more details on it.

rcorrie avatar Jan 26 '18 14:01 rcorrie

@rcorrie So currently it is not possible to access RTCP statistics of the call. It would be great if Endpoint will have readCallRtcpStats method that will return all RTCP statistics for each stream of the call.

Here is the example of Android impl

Call.java

    public JSONArray rtcpInfoToJson() {
        JSONArray result = new JSONArray();

        try {
            CallInfo callInfo = getInfo();
            CallMediaInfoVector media = callInfo.getMedia();

            try {
                long size = media.size();
                JSONObject json = new JSONObject();

                for (int i=0; i < size; i++) {
                    CallMediaInfo info = media.get(i);
                    StreamStat streamStat = getStreamStat(info.getIndex());

                    RtcpStreamStat rxStat = streamStat.getRtcp().getRxStat();
                    JSONObject rxStatJson = new JSONObject();
                    rxStatJson.put("update", rxStat.getUpdate().getSec());
                    rxStatJson.put("updateCount", rxStat.getUpdateCount());
                    rxStatJson.put("pkt", rxStat.getPkt());
                    rxStatJson.put("bytes", rxStat.getBytes());
                    rxStatJson.put("discard", rxStat.getDiscard());
                    rxStatJson.put("loss", rxStat.getLoss());
                    rxStatJson.put("lossPeriod", rxStat.getLossPeriodUsec().getMin());
                    JSONObject rxLossType = new JSONObject();
                    rxLossType.put("burst", rxStat.getLossType().getBurst());
                    rxLossType.put("random", rxStat.getLossType().getRandom());
                    rxStatJson.put("lossType", rxLossType);
                    rxStatJson.put("reorder", rxStat.getReorder());
                    rxStatJson.put("dup", rxStat.getDup());
                    
                    json.put("tx", rxStatJson);
                    json.put("rx", "TODO, same as for TX");
                    json.put("jitter", "TODO, pass all info from streamStat.getJbuf()"); 
                    
                    result.put(json);
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

            return result;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

datso avatar Jan 26 '18 14:01 datso

how about this feature? can I receive some call quality information currently?

diasmalibekov avatar Feb 02 '23 15:02 diasmalibekov