Commit bb8334894aa759f073556d4859133155c068b3e1
1 parent
79dd3444
debut allRTP and voipBandwidth
Showing
2 changed files
with
28 additions
and
5 deletions
src/main/java/org/openflow/protocol/Pel/statistics/StatisticVoIP.java
| ... | ... | @@ -7,12 +7,12 @@ public class StatisticVoIP extends Statistic{ |
| 7 | 7 | private int nbCalls; |
| 8 | 8 | private int callID[]; |
| 9 | 9 | private int elapsedTime[]; |
| 10 | - private int SSRC0[]; | |
| 10 | + private long SSRC0[]; | |
| 11 | 11 | private double imos0[]; |
| 12 | 12 | private double loss0[]; |
| 13 | 13 | private double jitter0[]; |
| 14 | 14 | private double delay0[]; |
| 15 | - private int SSRC1[]; | |
| 15 | + private long SSRC1[]; | |
| 16 | 16 | private double imos1[]; |
| 17 | 17 | private double loss1[]; |
| 18 | 18 | private double jitter1[]; |
| ... | ... | @@ -37,12 +37,12 @@ public class StatisticVoIP extends Statistic{ |
| 37 | 37 | |
| 38 | 38 | callID =new int[nbCalls]; |
| 39 | 39 | elapsedTime = new int[nbCalls]; |
| 40 | - SSRC0 =new int[nbCalls]; | |
| 40 | + SSRC0 =new long[nbCalls]; | |
| 41 | 41 | imos0 =new double[nbCalls]; |
| 42 | 42 | loss0 =new double[nbCalls]; |
| 43 | 43 | jitter0 =new double[nbCalls]; |
| 44 | 44 | delay0 =new double[nbCalls]; |
| 45 | - SSRC1 =new int[nbCalls]; | |
| 45 | + SSRC1 =new long[nbCalls]; | |
| 46 | 46 | imos1 =new double[nbCalls]; |
| 47 | 47 | loss1 =new double[nbCalls]; |
| 48 | 48 | jitter1 =new double[nbCalls]; |
| ... | ... | @@ -63,6 +63,15 @@ public class StatisticVoIP extends Statistic{ |
| 63 | 63 | jitter1[i] = getDoubleBytes(b,2)/65.0; |
| 64 | 64 | delay1[i] = getDoubleBytes(b,2)/65.0; |
| 65 | 65 | |
| 66 | + if (SSRC0[i]<0){ //The int received are unsigned, so if the sign is negative, | |
| 67 | + SSRC0[i]*=-1; //we change the sign | |
| 68 | + SSRC0[i]=SSRC0[i]+(1<<31); //and add 2³¹ | |
| 69 | + } | |
| 70 | + if (SSRC1[i]<0){ | |
| 71 | + SSRC1[i]*=-1; | |
| 72 | + SSRC1[i]=SSRC1[i]+(1<<31); | |
| 73 | + } | |
| 74 | + | |
| 66 | 75 | } |
| 67 | 76 | } |
| 68 | 77 | } | ... | ... |
src/main/resources/web/js/models/voipmodel.js
| ... | ... | @@ -221,6 +221,20 @@ window.VoIP = Backbone.Model.extend({ |
| 221 | 221 | src0:vs.caller, dst0:vs.receiver, |
| 222 | 222 | src1:vs.receiver, dst1:vs.caller, |
| 223 | 223 | RTPPort:vs.RTPPort }); |
| 224 | + | |
| 225 | + //if the switch has allRTP activated, and the RTP Metric | |
| 226 | + //isn't activated for the call, we activate it | |
| 227 | + if(allStats.get(self.idswitch).allRtpMetric==true && allStats.get(self.idswitch).ssc.get(vs.idvoip).rtpMetric==false){ | |
| 228 | + $.ajax({ | |
| 229 | + url:hackBase + '/wm/iptv/switch/'+self.idswitch+'/enable/type/5/opt/0.0.0.0/0.0.0.0/30000/'+vs.idvoip+'/json', | |
| 230 | + dataType:"json", | |
| 231 | + success:function (data) { | |
| 232 | + allStats.get(self.model.idswitch).ssc.get(vs.idvoip).rtpMetric=true; | |
| 233 | + console.log("Metric 5 started on "+self.model.idswitch+" for call "+vs.idvoip); | |
| 234 | + }, | |
| 235 | + }); | |
| 236 | + } | |
| 237 | + | |
| 224 | 238 | } |
| 225 | 239 | else { //console.log("Different CallID 6 :"+self.id+" =/= "+vs.idvoip); |
| 226 | 240 | } |
| ... | ... | @@ -275,7 +289,7 @@ window.VoIP = Backbone.Model.extend({ |
| 275 | 289 | _.each(t.enabled, function(s) { |
| 276 | 290 | _.each(s.values, function(q) { |
| 277 | 291 | if (q.protocol=="VoIP"){ |
| 278 | - v.voipBandwidth+= q.bandwidth; | |
| 292 | + v.voipBandwidth+= parseFloat(q.bandwidth); | |
| 279 | 293 | } |
| 280 | 294 | }); |
| 281 | 295 | }); | ... | ... |