sip-lab 1.7.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/devjournal CHANGED
@@ -431,5 +431,12 @@ The problem is that on_rx_reinvite is getting an offer without media (due RE-INV
431
431
  Instead, I think we should go back to use original on_rx_offer because it seems this is called only when we get media offer and so we would avoid this problem.
432
432
 
433
433
 
434
+ ------------------------------------------------------------
435
+ 2022/08/12 takeshi:
436
+
437
+ When rebuilding the addon, this should be enough (it should be fast):
438
+ ```
439
+ npm install --unsafe-perm
440
+ ```
434
441
 
435
442
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sip-lab",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
package/samples/g729.js CHANGED
@@ -4,6 +4,8 @@ var z = new Zester()
4
4
  var m = require('data-matching')
5
5
  var sip_msg = require('sip-matching')
6
6
 
7
+ var assert = require('assert')
8
+
7
9
  async function test() {
8
10
  //sip.set_log_level(6)
9
11
  sip.dtmf_aggregation_on(500)
@@ -146,6 +148,18 @@ async function test() {
146
148
  },
147
149
  ], 500)
148
150
 
151
+ oc_stat = sip.call.get_stream_stat(oc.id)
152
+ ic_stat = sip.call.get_stream_stat(ic.id)
153
+
154
+ console.log(oc_stat)
155
+ console.log(ic_stat)
156
+
157
+ oc_stat = JSON.parse(oc_stat)
158
+ ic_stat = JSON.parse(ic_stat)
159
+
160
+ assert(oc_stat.CodecInfo == 'G729/8000/1')
161
+ assert(ic_stat.CodecInfo == 'G729/8000/1')
162
+
149
163
  sip.call.terminate(oc.id)
150
164
 
151
165
  await z.wait([
package/src/sip.cpp CHANGED
@@ -196,6 +196,7 @@ Pair_Call_CallId_Buf g_LastCalls(1000);
196
196
  typedef map<pjsip_transport*, int> SipTransportMap;
197
197
  SipTransportMap g_SipTransportMap;
198
198
  int g_TlsTransportId = -100;
199
+ int g_TcpTransportId = -100;
199
200
 
200
201
  typedef set< pair<string,string> > PackageSet;
201
202
  PackageSet g_PackageSet;
@@ -322,10 +323,13 @@ pjsip_transport *allocate_udp_transport(pjsip_endpoint* sip_endpt, pj_str_t *ipa
322
323
  pjsip_tpfactory *create_tls_tpfactory(pjsip_endpoint* sip_endpt, pj_str_t *ipaddr, int *allocated_port);
323
324
  pjsip_tpfactory *allocate_tls_tpfactory(pjsip_endpoint* sip_endpt, pj_str_t *ipaddr, int port);
324
325
 
326
+ pjsip_tpfactory *create_tcp_factory(pjsip_endpoint* sip_endpt, pj_str_t *ipaddr, int *allocated_port);
327
+ pjsip_tpfactory *allocate_tcp_tpfactory(pjsip_endpoint* sip_endpt, pj_str_t *ipaddr, int port);
328
+
325
329
  bool set_proxy(pjsip_dialog *dlg, const char *proxy_uri);
326
330
 
327
331
  void build_local_contact(char *dest, pjsip_transport *transport, const char *contact_username);
328
- void build_local_contact_from_tpfactory(char *dest, pjsip_tpfactory *tpfactory, const char *contact_username);
332
+ void build_local_contact_from_tpfactory(char *dest, pjsip_tpfactory *tpfactory, const char *contact_username, pjsip_transport_type_e type);
329
333
 
330
334
  pj_bool_t add_additional_headers(pj_pool_t *pool, pjsip_tx_data *tdata, const char *additional_headers);
331
335
 
@@ -346,7 +350,7 @@ void process_in_dialog_subscribe(pjsip_dialog *dlg, pjsip_rx_data *rdata);
346
350
 
347
351
  static pj_bool_t set_ports(Call *call, pjmedia_port *stream_port, pjmedia_port *media_port);
348
352
  //static pj_bool_t stop_media_operation(Call *call);
349
- static void build_stream_stat(ostringstream &oss, pjmedia_rtcp_stat *stat, pjmedia_port *port);
353
+ static void build_stream_stat(ostringstream &oss, pjmedia_rtcp_stat *stat, pjmedia_stream_info *stream_info);
350
354
 
351
355
  bool init_media_ports(Call *c, unsigned sampling_rate, unsigned channel_count, unsigned samples_per_frame, unsigned bits_per_sample);
352
356
  void connect_media_ports(Call *c);
@@ -812,6 +816,52 @@ pjsip_transport *create_udp_transport(pjsip_endpoint* sip_endpt, pj_str_t *ipadd
812
816
  return NULL;
813
817
  }
814
818
 
819
+ pjsip_tpfactory *allocate_tcp_tpfactory(pjsip_endpoint* sip_endpt, pj_str_t *ipaddr, int port) {
820
+ printf("allocate_tcp_tpfactory ipaddr=%.*s port=%i\n", ipaddr->slen, ipaddr->ptr, port);
821
+ pj_status_t status;
822
+ pjsip_tpfactory *tpfactory;
823
+ pj_sockaddr local_addr;
824
+ pjsip_host_port a_name;
825
+
826
+ int af;
827
+ af = pj_AF_INET();
828
+ pj_sockaddr_init(af, &local_addr, NULL, 0);
829
+
830
+ pj_sockaddr_set_port(&local_addr, (pj_uint16_t)port);
831
+
832
+ status = pj_sockaddr_set_str_addr(af, &local_addr, ipaddr);
833
+ if (status != PJ_SUCCESS) {
834
+ return NULL;
835
+ }
836
+
837
+ status = pjsip_tcp_transport_start2(sip_endpt, &local_addr.ipv4, NULL, 1, &tpfactory);
838
+ if (status != PJ_SUCCESS) {
839
+ printf("status=%i\n", status);
840
+ return NULL;
841
+ }
842
+
843
+ return tpfactory;
844
+ }
845
+
846
+ pjsip_tpfactory *create_tcp_tpfactory(pjsip_endpoint* sip_endpt, pj_str_t *ipaddr, int *allocated_port)
847
+ {
848
+ pj_status_t status;
849
+ pjsip_tpfactory *tpfactory;
850
+
851
+ int port = 6060;
852
+ for(int i=0 ; i<1000 ; ++i)
853
+ {
854
+ port += i;
855
+ tpfactory = allocate_tcp_tpfactory(sip_endpt, ipaddr, port);
856
+ if (tpfactory) {
857
+ *allocated_port = port;
858
+ return tpfactory;
859
+ }
860
+ }
861
+
862
+ return NULL;
863
+ }
864
+
815
865
  pjsip_tpfactory *allocate_tls_tpfactory(pjsip_endpoint* sip_endpt, pj_str_t *ipaddr, int port) {
816
866
  addon_log(LOG_LEVEL_DEBUG, "allocate_tls_tpfactory ipaddr=%.*s port=%i\n", ipaddr->slen, ipaddr->ptr, port);
817
867
  pj_status_t status;
@@ -904,7 +954,37 @@ int pjw_transport_create(const char *sip_ipaddr, int port, pjsip_transport_type_
904
954
  if(type == PJSIP_TRANSPORT_UDP) {
905
955
  g_SipTransportMap.insert(make_pair(sip_transport, t_id));
906
956
  }
957
+ } else if(type == PJSIP_TRANSPORT_TCP) {
958
+ pjsip_tpfactory *tpfactory;
959
+ int af;
960
+
961
+
962
+ if(port != 0) {
963
+ tpfactory = allocate_tcp_tpfactory(g_sip_endpt, &ipaddr, port);
964
+ } else {
965
+ tpfactory = create_tcp_tpfactory(g_sip_endpt, &ipaddr, &port);
966
+ }
967
+
968
+ if(!tpfactory)
969
+ {
970
+ PJW_UNLOCK();
971
+ set_error("Unable to start TCP transport");
972
+ return -1;
973
+ }
907
974
 
975
+ t = new Transport;
976
+ t->type = PJSIP_TRANSPORT_TCP;
977
+ t->tpfactory = tpfactory;
978
+
979
+ if(!g_transport_ids.add((long)t, t_id)){
980
+ status = (tpfactory->destroy)(tpfactory);
981
+
982
+ PJW_UNLOCK();
983
+ set_error("Failed to allocate id");
984
+ return -1;
985
+ }
986
+
987
+ g_TcpTransportId = t_id;
908
988
  } else {
909
989
  pjsip_tpfactory *tpfactory;
910
990
  int af;
@@ -1392,7 +1472,7 @@ int pjw_call_create(long t_id, unsigned flags, const char *from_uri, const char
1392
1472
  if(t->type == PJSIP_TRANSPORT_UDP) {
1393
1473
  build_local_contact(local_contact, t->sip_transport, contact_username);
1394
1474
  } else {
1395
- build_local_contact_from_tpfactory(local_contact, t->tpfactory, contact_username);
1475
+ build_local_contact_from_tpfactory(local_contact, t->tpfactory, contact_username, t->type);
1396
1476
  }
1397
1477
 
1398
1478
  if(!dlg_create(&dlg, t, from_uri, to_uri, request_uri, realm, username, password, local_contact)) {
@@ -1417,7 +1497,7 @@ out:
1417
1497
  }
1418
1498
 
1419
1499
 
1420
- bool set_transport(pjsip_transport *sip_transport, pjsip_dialog *dlg) {
1500
+ bool dlg_set_transport(pjsip_transport *sip_transport, pjsip_dialog *dlg) {
1421
1501
  //Maybe we don't need to allocation sel from the pool
1422
1502
  pjsip_tpselector *sel = (pjsip_tpselector*)pj_pool_zalloc(dlg->pool, sizeof(pjsip_tpselector));
1423
1503
  //pjsip_tpselector sel;
@@ -1434,7 +1514,7 @@ bool set_transport(pjsip_transport *sip_transport, pjsip_dialog *dlg) {
1434
1514
  return true;
1435
1515
  }
1436
1516
 
1437
- bool set_transport_by_t(Transport *t, pjsip_dialog *dlg) {
1517
+ bool dlg_set_transport_by_t(Transport *t, pjsip_dialog *dlg) {
1438
1518
  //Maybe we don't need to allocation sel from the pool
1439
1519
  pjsip_tpselector *sel = (pjsip_tpselector*)pj_pool_zalloc(dlg->pool, sizeof(pjsip_tpselector));
1440
1520
  //pjsip_tpselector sel;
@@ -1469,12 +1549,14 @@ void build_local_contact(char *dest, pjsip_transport *t, const char *contact_use
1469
1549
  }
1470
1550
  if(t->key.type == PJSIP_TRANSPORT_UDP) {
1471
1551
  p += sprintf(p,">");
1552
+ } else if(t->key.type == PJSIP_TRANSPORT_TCP) {
1553
+ p += sprintf(p,";transport=tcp>");
1472
1554
  } else {
1473
1555
  p += sprintf(p,";transport=tls>");
1474
1556
  }
1475
1557
  }
1476
1558
 
1477
- void build_local_contact_from_tpfactory(char *dest, pjsip_tpfactory *tpfactory, const char *contact_username) {
1559
+ void build_local_contact_from_tpfactory(char *dest, pjsip_tpfactory *tpfactory, const char *contact_username, pjsip_transport_type_e type) {
1478
1560
  char *p = dest;
1479
1561
  int len;
1480
1562
  p += sprintf(p, "<sip:%s@", contact_username);
@@ -1484,7 +1566,11 @@ void build_local_contact_from_tpfactory(char *dest, pjsip_tpfactory *tpfactory,
1484
1566
  if(tpfactory->addr_name.port) {
1485
1567
  p += sprintf(p, ":%d",tpfactory->addr_name.port);
1486
1568
  }
1487
- p += sprintf(p,";transport=tls>");
1569
+ if(type == PJSIP_TRANSPORT_TCP) {
1570
+ p += sprintf(p,";transport=tcp>");
1571
+ } else {
1572
+ p += sprintf(p,";transport=tls>");
1573
+ }
1488
1574
  }
1489
1575
 
1490
1576
 
@@ -1662,7 +1748,7 @@ int call_create(Transport *t, unsigned flags, pjsip_dialog *dlg, const char *pro
1662
1748
  return -1;
1663
1749
  }
1664
1750
 
1665
- if(!set_transport_by_t(t, dlg)){
1751
+ if(!dlg_set_transport_by_t(t, dlg)){
1666
1752
  return -1;
1667
1753
  }
1668
1754
  addon_log(LOG_LEVEL_DEBUG, "inv=%x tdata=%x\n",inv,tdata);
@@ -2151,7 +2237,7 @@ int pjw_call_get_stream_stat(long call_id, char *out_stats){
2151
2237
  pj_status_t status;
2152
2238
 
2153
2239
  pjmedia_rtcp_stat stat;
2154
- pjmedia_port *port;
2240
+ pjmedia_stream_info stream_info;
2155
2241
 
2156
2242
  status = pjmedia_stream_get_stat(call->med_stream, &stat);
2157
2243
  if(status != PJ_SUCCESS){
@@ -2160,15 +2246,15 @@ int pjw_call_get_stream_stat(long call_id, char *out_stats){
2160
2246
  return -1;
2161
2247
  }
2162
2248
 
2163
- status = pjmedia_stream_get_port(call->med_stream, &port);
2249
+ status = pjmedia_stream_get_info(call->med_stream, &stream_info);
2164
2250
  if(status != PJ_SUCCESS){
2165
2251
  PJW_UNLOCK();
2166
- set_error("Could not get stream stats. Call to pjmedia_stream_get_port failed.");
2252
+ set_error("Could not get stream info. Call to pjmedia_stream_get_info failed.");
2167
2253
  return -1;
2168
2254
  }
2169
2255
 
2170
2256
  ostringstream oss;
2171
- build_stream_stat(oss, &stat, port);
2257
+ build_stream_stat(oss, &stat, &stream_info);
2172
2258
 
2173
2259
  PJW_UNLOCK();
2174
2260
 
@@ -2752,7 +2838,7 @@ static pj_bool_t on_rx_request( pjsip_rx_data *rdata ){
2752
2838
  return PJ_TRUE;
2753
2839
  }
2754
2840
 
2755
- if(!set_transport(t, dlg)) {
2841
+ if(!dlg_set_transport(t, dlg)) {
2756
2842
  close_media_transport(med_transport);
2757
2843
  reason = pj_str("Internal Server Error (set_transport failed)");
2758
2844
  pjsip_endpt_respond_stateless(g_sip_endpt, rdata, 500, &reason, NULL, NULL);
@@ -2839,7 +2925,9 @@ static pj_bool_t on_rx_request( pjsip_rx_data *rdata ){
2839
2925
  if( iter != g_SipTransportMap.end() ){
2840
2926
  transport_id = iter->second;
2841
2927
  } else {
2842
- if(t->key.type == PJSIP_TRANSPORT_TLS) {
2928
+ if(t->key.type == PJSIP_TRANSPORT_TCP) {
2929
+ transport_id = g_TcpTransportId;
2930
+ } else if(t->key.type == PJSIP_TRANSPORT_TLS) {
2843
2931
  transport_id = g_TlsTransportId;
2844
2932
  } else {
2845
2933
  transport_id = -1;
@@ -3384,7 +3472,7 @@ static const char *good_number(char *buf, pj_int32_t val)
3384
3472
  return buf;
3385
3473
  }
3386
3474
 
3387
- static void build_stream_stat(ostringstream &oss, pjmedia_rtcp_stat *stat, pjmedia_port* port)
3475
+ static void build_stream_stat(ostringstream &oss, pjmedia_rtcp_stat *stat, pjmedia_stream_info *stream_info)
3388
3476
  {
3389
3477
  char temp[200];
3390
3478
  char duration[80], last_update[80];
@@ -3396,7 +3484,7 @@ static void build_stream_stat(ostringstream &oss, pjmedia_rtcp_stat *stat, pjmed
3396
3484
  oss << "{ ";
3397
3485
 
3398
3486
  PJ_TIME_VAL_SUB(now, stat->start);
3399
- sprintf(duration, "'Duration':'%02ld:%02ld:%02ld.%03ld'",
3487
+ sprintf(duration, "\"Duration\": \"%02ld:%02ld:%02ld.%03ld\"",
3400
3488
  now.sec / 3600,
3401
3489
  (now.sec % 3600) / 60,
3402
3490
  (now.sec % 60),
@@ -3404,59 +3492,54 @@ static void build_stream_stat(ostringstream &oss, pjmedia_rtcp_stat *stat, pjmed
3404
3492
 
3405
3493
  oss << duration;
3406
3494
 
3407
- sprintf(temp, ", 'CodecInfo':'%.*s@%dHz'",
3408
- /*
3409
- (int)port->info.encoding_name.slen,
3410
- port->info.encoding_name.ptr,
3411
- port->info.clock_rate);
3412
- */
3413
- /* lets put fake info for now */
3414
- 4,
3415
- "FAKE",
3416
- 0);
3495
+ sprintf(temp, ", \"CodecInfo\": \"%.*s/%d/%d\"",
3496
+ stream_info->fmt.encoding_name.slen,
3497
+ stream_info->fmt.encoding_name.ptr,
3498
+ stream_info->fmt.clock_rate,
3499
+ stream_info->fmt.channel_cnt);
3417
3500
 
3418
3501
  oss << temp << ",";
3419
3502
 
3420
- oss << " 'RX' : { "; //Opening RX
3503
+ oss << " \"RX\": { "; //Opening RX
3421
3504
 
3422
3505
  if (stat->rx.update_cnt == 0)
3423
- strcpy(last_update, "'LastUpdate':''");
3506
+ strcpy(last_update, "\"LastUpdate\": \"\"");
3424
3507
  else {
3425
- sprintf(last_update, "'LastUpdate':'%ld.%ld'",
3508
+ sprintf(last_update, "\"LastUpdate\": \"%ld.%ld\"",
3426
3509
  stat->rx.update.sec,
3427
3510
  stat->rx.update.msec);
3428
3511
  }
3429
3512
 
3430
3513
  oss << last_update;
3431
3514
 
3432
- oss << ", 'Packets': " << good_number(packets, stat->rx.pkt);
3433
- oss << ", 'Loss':" << stat->rx.loss;
3434
- oss << ", 'Dup':" << stat->rx.dup;
3435
- oss << ", 'Reorder':" << stat->rx.reorder;
3436
-
3437
- oss << ", 'LossPeriod': {";
3438
- oss << "'Min':" << stat->rx.loss_period.min / 1000.0;
3439
- oss << ", 'Mean':" << stat->rx.loss_period.mean / 1000.0;
3440
- oss << ", 'Max':" << stat->rx.loss_period.max / 1000.0;
3441
- oss << ", 'Last':" << stat->rx.loss_period.last / 1000.0;
3442
- oss << ", 'StandardDeviation':" << pj_math_stat_get_stddev(&stat->rx.loss_period) / 1000.0 << " }";
3443
-
3444
- oss << ", 'Jitter': { ";
3445
- oss << "'Min':" << stat->rx.jitter.min / 1000.0;
3446
- oss << ", 'Mean':" << stat->rx.jitter.mean / 1000.0;
3447
- oss << ", 'Max':" << stat->rx.jitter.max / 1000.0;
3448
- oss << ", 'Last':" << stat->rx.jitter.last / 1000.0;
3449
- oss << ", 'StandardDeviation':" << pj_math_stat_get_stddev(&stat->rx.jitter) / 1000.0 << " }";
3515
+ oss << ", \"Packets\": " << good_number(packets, stat->rx.pkt);
3516
+ oss << ", \"Loss\": " << stat->rx.loss;
3517
+ oss << ", \"Dup\": " << stat->rx.dup;
3518
+ oss << ", \"Reorder\": " << stat->rx.reorder;
3519
+
3520
+ oss << ", \"LossPeriod\": {";
3521
+ oss << "\"Min\": " << stat->rx.loss_period.min / 1000.0;
3522
+ oss << ", \"Mean\": " << stat->rx.loss_period.mean / 1000.0;
3523
+ oss << ", \"Max\": " << stat->rx.loss_period.max / 1000.0;
3524
+ oss << ", \"Last\": " << stat->rx.loss_period.last / 1000.0;
3525
+ oss << ", \"StandardDeviation\": " << pj_math_stat_get_stddev(&stat->rx.loss_period) / 1000.0 << " }";
3526
+
3527
+ oss << ", \"Jitter\": { ";
3528
+ oss << "\"Min\": " << stat->rx.jitter.min / 1000.0;
3529
+ oss << ", \"Mean\": " << stat->rx.jitter.mean / 1000.0;
3530
+ oss << ", \"Max\": " << stat->rx.jitter.max / 1000.0;
3531
+ oss << ", \"Last\": " << stat->rx.jitter.last / 1000.0;
3532
+ oss << ", \"StandardDeviation\": " << pj_math_stat_get_stddev(&stat->rx.jitter) / 1000.0 << " }";
3450
3533
 
3451
3534
  oss << " }"; //Closing RX
3452
3535
 
3453
3536
 
3454
- oss << ", 'TX' : { "; //Opening TX
3537
+ oss << ", \"TX\": { "; //Opening TX
3455
3538
 
3456
3539
  if (stat->tx.update_cnt == 0)
3457
- strcpy(last_update, "'LastUpdate':''");
3540
+ strcpy(last_update, "\"LastUpdate\": \"\"");
3458
3541
  else {
3459
- sprintf(last_update, "'LastUpdate':'%ld.%ld'",
3542
+ sprintf(last_update, "\"LastUpdate\": \"%ld.%ld\"",
3460
3543
  stat->tx.update.sec,
3461
3544
  stat->tx.update.msec);
3462
3545
  }
@@ -3464,34 +3547,34 @@ static void build_stream_stat(ostringstream &oss, pjmedia_rtcp_stat *stat, pjmed
3464
3547
 
3465
3548
  oss << last_update;
3466
3549
 
3467
- oss << ", 'Packets': " << good_number(packets, stat->tx.pkt);
3468
- oss << ", 'Loss':" << stat->tx.loss;
3469
- oss << ", 'Dup':" << stat->tx.dup;
3470
- oss << ", 'Reorder':" << stat->tx.reorder;
3471
-
3472
- oss << ", 'LossPeriod': { ";
3473
- oss << "'Min':" << stat->tx.loss_period.min / 1000.0;
3474
- oss << ", 'Mean':" << stat->tx.loss_period.mean / 1000.0;
3475
- oss << ", 'Max':" << stat->tx.loss_period.max / 1000.0;
3476
- oss << ", 'Last':" << stat->tx.loss_period.last / 1000.0;
3477
- oss << ", 'StandardDeviation':" << pj_math_stat_get_stddev(&stat->tx.loss_period) / 1000.0 << " }";
3478
-
3479
- oss << ", 'Jitter': { ";
3480
- oss << "'Min':" << stat->tx.jitter.min / 1000.0;
3481
- oss << ", 'Mean':" << stat->tx.jitter.mean / 1000.0;
3482
- oss << ", 'Max':" << stat->tx.jitter.max / 1000.0;
3483
- oss << ", 'Last':" << stat->tx.jitter.last / 1000.0;
3484
- oss << ", 'StandardDeviation':" << pj_math_stat_get_stddev(&stat->tx.jitter) / 1000.0 << " }";
3550
+ oss << ", \"Packets\": " << good_number(packets, stat->tx.pkt);
3551
+ oss << ", \"Loss\": " << stat->tx.loss;
3552
+ oss << ", \"Dup\": " << stat->tx.dup;
3553
+ oss << ", \"Reorder\": " << stat->tx.reorder;
3554
+
3555
+ oss << ", \"LossPeriod\": { ";
3556
+ oss << "\"Min\": " << stat->tx.loss_period.min / 1000.0;
3557
+ oss << ", \"Mean\": " << stat->tx.loss_period.mean / 1000.0;
3558
+ oss << ", \"Max\": " << stat->tx.loss_period.max / 1000.0;
3559
+ oss << ", \"Last\":" << stat->tx.loss_period.last / 1000.0;
3560
+ oss << ", \"StandardDeviation\": " << pj_math_stat_get_stddev(&stat->tx.loss_period) / 1000.0 << " }";
3561
+
3562
+ oss << ", \"Jitter\": { ";
3563
+ oss << "\"Min\": " << stat->tx.jitter.min / 1000.0;
3564
+ oss << ", \"Mean\": " << stat->tx.jitter.mean / 1000.0;
3565
+ oss << ", \"Max\": " << stat->tx.jitter.max / 1000.0;
3566
+ oss << ", \"Last\": " << stat->tx.jitter.last / 1000.0;
3567
+ oss << ", \"StandardDeviation\": " << pj_math_stat_get_stddev(&stat->tx.jitter) / 1000.0 << " }";
3485
3568
 
3486
3569
  oss << " }"; //Closing TX
3487
3570
 
3488
- oss << ", 'RTT': { "; // Opening RTT
3571
+ oss << ", \"RTT\": { "; // Opening RTT
3489
3572
 
3490
- oss << "'Min':" << stat->rtt.min / 1000.0;
3491
- oss << ", 'Mean':" << stat->rtt.mean / 1000.0;
3492
- oss << ", 'Max':" << stat->rtt.max / 1000.0;
3493
- oss << ", 'Last':" << stat->rtt.last / 1000.0;
3494
- oss << ", 'StandardDeviation':" << pj_math_stat_get_stddev(&stat->rtt) / 1000.0;
3573
+ oss << "\"Min\": " << stat->rtt.min / 1000.0;
3574
+ oss << ", \"Mean\": " << stat->rtt.mean / 1000.0;
3575
+ oss << ", \"Max\": " << stat->rtt.max / 1000.0;
3576
+ oss << ", \"Last\": " << stat->rtt.last / 1000.0;
3577
+ oss << ", \"StandardDeviation\": " << pj_math_stat_get_stddev(&stat->rtt) / 1000.0;
3495
3578
  oss << " }"; //Closing RTT
3496
3579
  oss << " }";
3497
3580
  }
@@ -4642,7 +4725,7 @@ int pjw_subscription_create(long transport_id, const char *event, const char *ac
4642
4725
  goto out;
4643
4726
  }
4644
4727
 
4645
- if(!set_transport_by_t(t, dlg)){
4728
+ if(!dlg_set_transport_by_t(t, dlg)){
4646
4729
  goto out;
4647
4730
  }
4648
4731