engage-engine 1.232.90720004 → 1.233.90730006

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.
@@ -248,31 +248,45 @@ namespace AppConfigurationObjects
248
248
  \
249
249
  std::string serialize(const int indent = -1) \
250
250
  { \
251
- nlohmann::json j; \
252
- to_json(j, *this); \
253
- return j.dump(indent); \
251
+ try \
252
+ { \
253
+ nlohmann::json j; \
254
+ to_json(j, *this); \
255
+ return j.dump(indent); \
256
+ } \
257
+ catch(...) \
258
+ { \
259
+ return std::string("{}"); \
260
+ } \
254
261
  }
255
262
 
256
263
  #define IMPLEMENT_WRAPPED_JSON_SERIALIZATION(_cn) \
257
264
  public: \
258
265
  std::string serializeWrapped(const int indent = -1) \
259
266
  { \
260
- nlohmann::json j; \
261
- to_json(j, *this); \
262
- \
263
- std::string rc; \
264
- char firstChar[2]; \
265
- firstChar[0] = #_cn[0]; \
266
- firstChar[1] = 0; \
267
- firstChar[0] = tolower(firstChar[0]); \
268
- rc.assign("{\""); \
269
- rc.append(firstChar); \
270
- rc.append((#_cn) + 1); \
271
- rc.append("\":"); \
272
- rc.append(j.dump(indent)); \
273
- rc.append("}"); \
274
- \
275
- return rc; \
267
+ try \
268
+ { \
269
+ nlohmann::json j; \
270
+ to_json(j, *this); \
271
+ \
272
+ std::string rc; \
273
+ char firstChar[2]; \
274
+ firstChar[0] = #_cn[0]; \
275
+ firstChar[1] = 0; \
276
+ firstChar[0] = tolower(firstChar[0]); \
277
+ rc.assign("{\""); \
278
+ rc.append(firstChar); \
279
+ rc.append((#_cn) + 1); \
280
+ rc.append("\":"); \
281
+ rc.append(j.dump(indent)); \
282
+ rc.append("}"); \
283
+ \
284
+ return rc; \
285
+ } \
286
+ catch(...) \
287
+ { \
288
+ return std::string("{}"); \
289
+ } \
276
290
  }
277
291
 
278
292
  #define TOJSON_IMPL(__var) \
@@ -4054,13 +4068,13 @@ namespace AppConfigurationObjects
4054
4068
  std::string nodeId;
4055
4069
 
4056
4070
  /* NOTE: Not serialized ! */
4057
- uint8_t _internal_binary_nodeId[MAX_NODE_ID_SIZE];
4071
+ uint8_t _internal_binary_nodeId[ENGAGE_MAX_NODE_ID_SIZE];
4058
4072
 
4059
4073
  /** @brief [Optional] An alias */
4060
4074
  std::string alias;
4061
4075
 
4062
4076
  /* NOTE: Not serialized ! */
4063
- uint8_t _internal_binary_alias[MAX_ALIAS_SIZE];
4077
+ uint8_t _internal_binary_alias[ENGAGE_MAX_ALIAS_SIZE];
4064
4078
 
4065
4079
  Source()
4066
4080
  {
@@ -7536,6 +7550,48 @@ namespace AppConfigurationObjects
7536
7550
  getOptional<std::string>("runCmd", p.runCmd, j);
7537
7551
  }
7538
7552
 
7553
+
7554
+ //-----------------------------------------------------------
7555
+ JSON_SERIALIZED_CLASS(RallypointWebsocketSettings)
7556
+ /**
7557
+ * @brief Defines settings for Rallypoint websockets functionality
7558
+ *
7559
+ * Example: @include[doc] examples/RallypointWebsocketSettings.json
7560
+ *
7561
+ */
7562
+ class RallypointWebsocketSettings : public ConfigurationObjectBase
7563
+ {
7564
+ IMPLEMENT_JSON_SERIALIZATION()
7565
+ IMPLEMENT_JSON_DOCUMENTATION(RallypointWebsocketSettings)
7566
+
7567
+ public:
7568
+ /** @brief Listen port (TCP). Default is 8443 */
7569
+ int listenPort;
7570
+
7571
+ RallypointWebsocketSettings()
7572
+ {
7573
+ clear();
7574
+ }
7575
+
7576
+ void clear()
7577
+ {
7578
+ listenPort = 8443;
7579
+ }
7580
+ };
7581
+
7582
+ static void to_json(nlohmann::json& j, const RallypointWebsocketSettings& p)
7583
+ {
7584
+ j = nlohmann::json{
7585
+ TOJSON_IMPL(listenPort)
7586
+ };
7587
+ }
7588
+ static void from_json(const nlohmann::json& j, RallypointWebsocketSettings& p)
7589
+ {
7590
+ p.clear();
7591
+ getOptional<int>("listenPort", p.listenPort, j, 8443);
7592
+ }
7593
+
7594
+
7539
7595
  //-----------------------------------------------------------
7540
7596
  JSON_SERIALIZED_CLASS(RallypointServer)
7541
7597
  /**
@@ -7553,7 +7609,7 @@ namespace AppConfigurationObjects
7553
7609
 
7554
7610
  public:
7555
7611
  /** @brief [Optional] Settings for the FIPS crypto. */
7556
- FipsCryptoSettings fipsCrypto;
7612
+ FipsCryptoSettings fipsCrypto;
7557
7613
 
7558
7614
  /** @brief [Optional] Settings for the Rallypoint's watchdog. */
7559
7615
  WatchdogSettings watchdog;
@@ -7687,6 +7743,9 @@ namespace AppConfigurationObjects
7687
7743
  /** @brief [Optional] Array of behaviors for roundtrip times to peers */
7688
7744
  std::vector<RallypointRpRtTimingBehavior> peerRtBehaviors;
7689
7745
 
7746
+ /** @brief [Optional] Settings for websocket operation */
7747
+ RallypointWebsocketSettings websocket;
7748
+
7690
7749
  RallypointServer()
7691
7750
  {
7692
7751
  clear();
@@ -7739,6 +7798,7 @@ namespace AppConfigurationObjects
7739
7798
  maxOutboundPeerConnectionIntervalDeltaSecs = 15;
7740
7799
  peerRtTestIntervalMs = 60000;
7741
7800
  peerRtBehaviors.clear();
7801
+ websocket.clear();
7742
7802
  }
7743
7803
  };
7744
7804
 
@@ -7789,7 +7849,8 @@ namespace AppConfigurationObjects
7789
7849
  TOJSON_IMPL(routeMap),
7790
7850
  TOJSON_IMPL(maxOutboundPeerConnectionIntervalDeltaSecs),
7791
7851
  TOJSON_IMPL(peerRtTestIntervalMs),
7792
- TOJSON_IMPL(peerRtBehaviors)
7852
+ TOJSON_IMPL(peerRtBehaviors),
7853
+ TOJSON_IMPL(websocket)
7793
7854
  };
7794
7855
  }
7795
7856
  static void from_json(const nlohmann::json& j, RallypointServer& p)
@@ -7840,6 +7901,7 @@ namespace AppConfigurationObjects
7840
7901
  getOptional<uint32_t>("maxOutboundPeerConnectionIntervalDeltaSecs", p.maxOutboundPeerConnectionIntervalDeltaSecs, j, 15);
7841
7902
  getOptional<int>("peerRtTestIntervalMs", p.peerRtTestIntervalMs, j, 60000);
7842
7903
  getOptional<std::vector<RallypointRpRtTimingBehavior>>("peerRtBehaviors", p.peerRtBehaviors, j);
7904
+ getOptional<RallypointWebsocketSettings>("websocket", p.websocket, j);
7843
7905
  }
7844
7906
 
7845
7907
  //-----------------------------------------------------------
@@ -9154,7 +9216,477 @@ namespace AppConfigurationObjects
9154
9216
  getOptional<uint64_t>("msToNextConnectionAttempt", p.msToNextConnectionAttempt, j, 0);
9155
9217
  }
9156
9218
 
9219
+ //-----------------------------------------------------------
9220
+ JSON_SERIALIZED_CLASS(TranslationSession)
9221
+ /**
9222
+ * @brief Translation session settings
9223
+ *
9224
+ * Helper C++ class to serialize and de-serialize TranslationSession JSON
9225
+ *
9226
+ * Example: @include[doc] examples/TranslationSession.json
9227
+ *
9228
+ * @see TODO: ConfigurationObjects::TranslationSession
9229
+ */
9230
+ class TranslationSession : public ConfigurationObjectBase
9231
+ {
9232
+ IMPLEMENT_JSON_SERIALIZATION()
9233
+ IMPLEMENT_JSON_DOCUMENTATION(TranslationSession)
9234
+
9235
+ public:
9236
+ /** @brief ID */
9237
+ std::string id;
9238
+
9239
+ /** @brief Name */
9240
+ std::string name;
9241
+
9242
+ /** @brief List of group IDs to be included in the session */
9243
+ std::vector<std::string> groups;
9244
+
9245
+ /** @brief [Optional, Default: true] Enable the session */
9246
+ bool enabled;
9247
+
9248
+ TranslationSession()
9249
+ {
9250
+ clear();
9251
+ }
9252
+
9253
+ void clear()
9254
+ {
9255
+ id.clear();
9256
+ name.clear();
9257
+ groups.clear();
9258
+ enabled = true;
9259
+ }
9260
+ };
9261
+
9262
+ static void to_json(nlohmann::json& j, const TranslationSession& p)
9263
+ {
9264
+ j = nlohmann::json{
9265
+ TOJSON_IMPL(id),
9266
+ TOJSON_IMPL(name),
9267
+ TOJSON_IMPL(groups),
9268
+ TOJSON_IMPL(enabled)
9269
+ };
9270
+ }
9271
+ static void from_json(const nlohmann::json& j, TranslationSession& p)
9272
+ {
9273
+ p.clear();
9274
+ FROMJSON_IMPL(id, std::string, EMPTY_STRING);
9275
+ FROMJSON_IMPL(name, std::string, EMPTY_STRING);
9276
+ getOptional<std::vector<std::string>>("groups", p.groups, j);
9277
+ FROMJSON_IMPL(enabled, bool, true);
9278
+ }
9279
+
9280
+ //-----------------------------------------------------------
9281
+ JSON_SERIALIZED_CLASS(TranslationConfiguration)
9282
+ /**
9283
+ * @brief Translation configuration
9284
+ *
9285
+ * Helper C++ class to serialize and de-serialize TranslationConfiguration JSON
9286
+ *
9287
+ * Example: @include[doc] examples/TranslationConfiguration.json
9288
+ *
9289
+ * @see TODO: ConfigurationObjects::TranslationConfiguration
9290
+ */
9291
+ class TranslationConfiguration : public ConfigurationObjectBase
9292
+ {
9293
+ IMPLEMENT_JSON_SERIALIZATION()
9294
+ IMPLEMENT_JSON_DOCUMENTATION(TranslationConfiguration)
9295
+
9296
+ public:
9297
+ /** @brief Array of sessions in the configuration */
9298
+ std::vector<TranslationSession> sessions;
9299
+
9300
+ /** @brief Array of groups in the configuration */
9301
+ std::vector<Group> groups;
9302
+
9303
+ TranslationConfiguration()
9304
+ {
9305
+ clear();
9306
+ }
9307
+
9308
+ void clear()
9309
+ {
9310
+ sessions.clear();
9311
+ groups.clear();
9312
+ }
9313
+ };
9314
+
9315
+ static void to_json(nlohmann::json& j, const TranslationConfiguration& p)
9316
+ {
9317
+ j = nlohmann::json{
9318
+ TOJSON_IMPL(sessions),
9319
+ TOJSON_IMPL(groups)
9320
+ };
9321
+ }
9322
+ static void from_json(const nlohmann::json& j, TranslationConfiguration& p)
9323
+ {
9324
+ p.clear();
9325
+ getOptional<std::vector<TranslationSession>>("sessions", p.sessions, j);
9326
+ getOptional<std::vector<Group>>("groups", p.groups, j);
9327
+ }
9328
+
9329
+ //-----------------------------------------------------------
9330
+ JSON_SERIALIZED_CLASS(LingoServerStatusReportConfiguration)
9331
+ /**
9332
+ * @brief TODO: Configuration for the translation server status report file
9333
+ *
9334
+ * Helper C++ class to serialize and de-serialize LingoServerStatusReportConfiguration JSON
9335
+ *
9336
+ * Example: @include[doc] examples/LingoServerStatusReportConfiguration.json
9337
+ *
9338
+ * @see RallypointServer
9339
+ */
9340
+ class LingoServerStatusReportConfiguration : public ConfigurationObjectBase
9341
+ {
9342
+ IMPLEMENT_JSON_SERIALIZATION()
9343
+ IMPLEMENT_JSON_DOCUMENTATION(LingoServerStatusReportConfiguration)
9344
+
9345
+ public:
9346
+ /** File name to use for the status report. */
9347
+ std::string fileName;
9348
+
9349
+ /** [Optional, Default: 30] The interval at which to write out the status report to file. */
9350
+ int intervalSecs;
9351
+
9352
+ /** [Optional, Default: false] Indicates if status reporting is enabled. */
9353
+ bool enabled;
9354
+
9355
+ /** [Optional, Default: null] Command to be executed every time the status report is produced. */
9356
+ std::string runCmd;
9357
+
9358
+ /** [Optional, Default: false] Indicates whether to include details of each group. */
9359
+ bool includeGroupDetail;
9360
+
9361
+ /** [Optional, Default: false] Indicates whether to include details of each session. */
9362
+ bool includeSessionDetail;
9363
+
9364
+ /** [Optional, Default: false] Indicates whether to include details of each group in each session. */
9365
+ bool includeSessionGroupDetail;
9366
+
9367
+ LingoServerStatusReportConfiguration()
9368
+ {
9369
+ clear();
9370
+ }
9371
+
9372
+ void clear()
9373
+ {
9374
+ fileName.clear();
9375
+ intervalSecs = 60;
9376
+ enabled = false;
9377
+ includeGroupDetail = false;
9378
+ includeSessionDetail = false;
9379
+ includeSessionGroupDetail = false;
9380
+ runCmd.clear();
9381
+ }
9382
+ };
9383
+
9384
+ static void to_json(nlohmann::json& j, const LingoServerStatusReportConfiguration& p)
9385
+ {
9386
+ j = nlohmann::json{
9387
+ TOJSON_IMPL(fileName),
9388
+ TOJSON_IMPL(intervalSecs),
9389
+ TOJSON_IMPL(enabled),
9390
+ TOJSON_IMPL(includeGroupDetail),
9391
+ TOJSON_IMPL(includeSessionDetail),
9392
+ TOJSON_IMPL(includeSessionGroupDetail),
9393
+ TOJSON_IMPL(runCmd)
9394
+ };
9395
+ }
9396
+ static void from_json(const nlohmann::json& j, LingoServerStatusReportConfiguration& p)
9397
+ {
9398
+ p.clear();
9399
+ getOptional<std::string>("fileName", p.fileName, j);
9400
+ getOptional<int>("intervalSecs", p.intervalSecs, j, 60);
9401
+ getOptional<bool>("enabled", p.enabled, j, false);
9402
+ getOptional<std::string>("runCmd", p.runCmd, j);
9403
+ getOptional<bool>("includeGroupDetail", p.includeGroupDetail, j, false);
9404
+ getOptional<bool>("includeSessionDetail", p.includeSessionDetail, j, false);
9405
+ getOptional<bool>("includeSessionGroupDetail", p.includeSessionGroupDetail, j, false);
9406
+ }
9407
+
9408
+ //-----------------------------------------------------------
9409
+ JSON_SERIALIZED_CLASS(LingoServerInternals)
9410
+ /**
9411
+ * @brief Internal translator server settings
9412
+ *
9413
+ * These settings are used to configure internal parameters.
9414
+ *
9415
+ * Helper C++ class to serialize and de-serialize LingoServerInternals JSON
9416
+ *
9417
+ * Example: @include[doc] examples/LingoServerInternals.json
9418
+ *
9419
+ * @see engageInitialize, ConfigurationObjects::LingoServerConfiguration
9420
+ */
9421
+ class LingoServerInternals : public ConfigurationObjectBase
9422
+ {
9423
+ IMPLEMENT_JSON_SERIALIZATION()
9424
+ IMPLEMENT_JSON_DOCUMENTATION(LingoServerInternals)
9425
+
9426
+ public:
9427
+ /** @brief [Optional] Settings for the watchdog. */
9428
+ WatchdogSettings watchdog;
9429
+
9430
+ /** @brief [Optional, Default: 1000] Interval at which to run the housekeeper thread. */
9431
+ int housekeeperIntervalMs;
9432
+
9433
+ LingoServerInternals()
9434
+ {
9435
+ clear();
9436
+ }
9437
+
9438
+ void clear()
9439
+ {
9440
+ watchdog.clear();
9441
+ housekeeperIntervalMs = 1000;
9442
+ }
9443
+ };
9444
+
9445
+ static void to_json(nlohmann::json& j, const LingoServerInternals& p)
9446
+ {
9447
+ j = nlohmann::json{
9448
+ TOJSON_IMPL(watchdog),
9449
+ TOJSON_IMPL(housekeeperIntervalMs)
9450
+ };
9451
+ }
9452
+ static void from_json(const nlohmann::json& j, LingoServerInternals& p)
9453
+ {
9454
+ p.clear();
9455
+ getOptional<WatchdogSettings>("watchdog", p.watchdog, j);
9456
+ getOptional<int>("housekeeperIntervalMs", p.housekeeperIntervalMs, j, 1000);
9457
+ }
9458
+
9459
+ //-----------------------------------------------------------
9460
+ JSON_SERIALIZED_CLASS(LingoServerConfiguration)
9461
+ /**
9462
+ * @brief Configuration for the linguistics server
9463
+ *
9464
+ * Helper C++ class to serialize and de-serialize LingoServerConfiguration JSON
9465
+ *
9466
+ * Example: @include[doc] examples/LingoServerConfiguration.json
9467
+ *
9468
+ */
9469
+ class LingoServerConfiguration : public ConfigurationObjectBase
9470
+ {
9471
+ IMPLEMENT_JSON_SERIALIZATION()
9472
+ IMPLEMENT_JSON_DOCUMENTATION(LingoServerConfiguration)
9473
+
9474
+ public:
9475
+ /** @brief A unqiue identifier for the linguistics server */
9476
+ std::string id;
9477
+
9478
+ /** @brief Number of seconds between checks to see if the service configuration has been updated. Default is 60.*/
9479
+ int serviceConfigurationFileCheckSecs;
9480
+
9481
+ /** @brief Name of a file containing the linguistics configuration. */
9482
+ std::string lingoConfigurationFileName;
9483
+
9484
+ /** @brief Command-line to execute that returns a linguistics configuration */
9485
+ std::string lingoConfigurationFileCommand;
9486
+
9487
+ /** @brief Number of seconds between checks to see if the linguistics configuration has been updated. Default is 60.*/
9488
+ int lingoConfigurationFileCheckSecs;
9489
+
9490
+ /** @brief Details for producing a status report. @see LingoServerStatusReportConfiguration */
9491
+ LingoServerStatusReportConfiguration statusReport;
9492
+
9493
+ /** @brief Details concerning the server's interaction with an external health-checker such as a load-balancer. @see ExternalHealthCheckResponder */
9494
+ ExternalHealthCheckResponder externalHealthCheckResponder;
9495
+
9496
+ /** @brief Internal settings */
9497
+ LingoServerInternals internals;
9498
+
9499
+ /** @brief Path to the certificate store */
9500
+ std::string certStoreFileName;
9501
+
9502
+ /** @brief Hex password for the certificate store (if any) */
9503
+ std::string certStorePasswordHex;
9504
+
9505
+ /** @brief The policy to be used for the underlying Engage Engine */
9506
+ EnginePolicy enginePolicy;
9507
+
9508
+ /** @brief Name to use for signalling a configuration check */
9509
+ std::string configurationCheckSignalName;
9510
+
9511
+ /** @brief [Optional] Settings for the FIPS crypto. */
9512
+ FipsCryptoSettings fipsCrypto;
9513
+
9514
+ /** @brief Address and port of the proxy */
9515
+ NetworkAddress proxy;
9516
+
9517
+ LingoServerConfiguration()
9518
+ {
9519
+ clear();
9520
+ }
9521
+
9522
+ void clear()
9523
+ {
9524
+ id.clear();
9525
+ serviceConfigurationFileCheckSecs = 60;
9526
+ lingoConfigurationFileName.clear();
9527
+ lingoConfigurationFileCommand.clear();
9528
+ lingoConfigurationFileCheckSecs = 60;
9529
+ statusReport.clear();
9530
+ externalHealthCheckResponder.clear();
9531
+ internals.clear();
9532
+ certStoreFileName.clear();
9533
+ certStorePasswordHex.clear();
9534
+ enginePolicy.clear();
9535
+ configurationCheckSignalName = "rts.6cc0651.${id}";
9536
+ fipsCrypto.clear();
9537
+ proxy.clear();
9538
+ }
9539
+ };
9540
+
9541
+ static void to_json(nlohmann::json& j, const LingoServerConfiguration& p)
9542
+ {
9543
+ j = nlohmann::json{
9544
+ TOJSON_IMPL(id),
9545
+ TOJSON_IMPL(serviceConfigurationFileCheckSecs),
9546
+ TOJSON_IMPL(lingoConfigurationFileName),
9547
+ TOJSON_IMPL(lingoConfigurationFileCommand),
9548
+ TOJSON_IMPL(lingoConfigurationFileCheckSecs),
9549
+ TOJSON_IMPL(statusReport),
9550
+ TOJSON_IMPL(externalHealthCheckResponder),
9551
+ TOJSON_IMPL(internals),
9552
+ TOJSON_IMPL(certStoreFileName),
9553
+ TOJSON_IMPL(certStorePasswordHex),
9554
+ TOJSON_IMPL(enginePolicy),
9555
+ TOJSON_IMPL(configurationCheckSignalName),
9556
+ TOJSON_IMPL(fipsCrypto),
9557
+ TOJSON_IMPL(proxy)
9558
+ };
9559
+ }
9560
+ static void from_json(const nlohmann::json& j, LingoServerConfiguration& p)
9561
+ {
9562
+ p.clear();
9563
+ getOptional<std::string>("id", p.id, j);
9564
+ getOptional<int>("serviceConfigurationFileCheckSecs", p.serviceConfigurationFileCheckSecs, j, 60);
9565
+ getOptional<std::string>("lingoConfigurationFileName", p.lingoConfigurationFileName, j);
9566
+ getOptional<std::string>("lingoConfigurationFileCommand", p.lingoConfigurationFileCommand, j);
9567
+ getOptional<int>("lingoConfigurationFileCheckSecs", p.lingoConfigurationFileCheckSecs, j, 60);
9568
+ getOptional<LingoServerStatusReportConfiguration>("statusReport", p.statusReport, j);
9569
+ getOptional<ExternalHealthCheckResponder>("externalHealthCheckResponder", p.externalHealthCheckResponder, j);
9570
+ getOptional<LingoServerInternals>("internals", p.internals, j);
9571
+ getOptional<std::string>("certStoreFileName", p.certStoreFileName, j);
9572
+ getOptional<std::string>("certStorePasswordHex", p.certStorePasswordHex, j);
9573
+ j.at("enginePolicy").get_to(p.enginePolicy);
9574
+ getOptional<std::string>("configurationCheckSignalName", p.configurationCheckSignalName, j, "rts.6cc0651.${id}");
9575
+ getOptional<FipsCryptoSettings>("fipsCrypo", p.fipsCrypto, j);
9576
+ getOptional<NetworkAddress>("proxy", p.proxy, j);
9577
+ }
9578
+
9579
+
9580
+ //-----------------------------------------------------------
9581
+ JSON_SERIALIZED_CLASS(VoiceToVoiceSession)
9582
+ /**
9583
+ * @brief Voice to voice session settings
9584
+ *
9585
+ * Helper C++ class to serialize and de-serialize VoiceToVoiceSession JSON
9586
+ *
9587
+ * Example: @include[doc] examples/VoiceToVoiceSession.json
9588
+ *
9589
+ * @see TODO: ConfigurationObjects::VoiceToVoiceSession
9590
+ */
9591
+ class VoiceToVoiceSession : public ConfigurationObjectBase
9592
+ {
9593
+ IMPLEMENT_JSON_SERIALIZATION()
9594
+ IMPLEMENT_JSON_DOCUMENTATION(VoiceToVoiceSession)
9595
+
9596
+ public:
9597
+ /** @brief ID */
9598
+ std::string id;
9599
+
9600
+ /** @brief Name */
9601
+ std::string name;
9602
+
9603
+ /** @brief List of group IDs to be included in the session */
9604
+ std::vector<std::string> groups;
9605
+
9606
+ /** @brief [Optional, Default: true] Enable the session */
9607
+ bool enabled;
9608
+
9609
+ VoiceToVoiceSession()
9610
+ {
9611
+ clear();
9612
+ }
9613
+
9614
+ void clear()
9615
+ {
9616
+ id.clear();
9617
+ name.clear();
9618
+ groups.clear();
9619
+ enabled = true;
9620
+ }
9621
+ };
9622
+
9623
+ static void to_json(nlohmann::json& j, const VoiceToVoiceSession& p)
9624
+ {
9625
+ j = nlohmann::json{
9626
+ TOJSON_IMPL(id),
9627
+ TOJSON_IMPL(name),
9628
+ TOJSON_IMPL(groups),
9629
+ TOJSON_IMPL(enabled)
9630
+ };
9631
+ }
9632
+ static void from_json(const nlohmann::json& j, VoiceToVoiceSession& p)
9633
+ {
9634
+ p.clear();
9635
+ FROMJSON_IMPL(id, std::string, EMPTY_STRING);
9636
+ FROMJSON_IMPL(name, std::string, EMPTY_STRING);
9637
+ getOptional<std::vector<std::string>>("groups", p.groups, j);
9638
+ FROMJSON_IMPL(enabled, bool, true);
9639
+ }
9640
+
9641
+ //-----------------------------------------------------------
9642
+ JSON_SERIALIZED_CLASS(LingoConfiguration)
9643
+ /**
9644
+ * @brief Lingo configuration
9645
+ *
9646
+ * Helper C++ class to serialize and de-serialize LingoConfiguration JSON
9647
+ *
9648
+ * Example: @include[doc] examples/LingoConfiguration.json
9649
+ *
9650
+ * @see TODO: ConfigurationObjects::LingoConfiguration
9651
+ */
9652
+ class LingoConfiguration : public ConfigurationObjectBase
9653
+ {
9654
+ IMPLEMENT_JSON_SERIALIZATION()
9655
+ IMPLEMENT_JSON_DOCUMENTATION(LingoConfiguration)
9656
+
9657
+ public:
9658
+ /** @brief Array of voiceToVoice sessions in the configuration */
9659
+ std::vector<VoiceToVoiceSession> voiceToVoiceSessions;
9660
+
9661
+ /** @brief Array of groups in the configuration */
9662
+ std::vector<Group> groups;
9157
9663
 
9664
+ LingoConfiguration()
9665
+ {
9666
+ clear();
9667
+ }
9668
+
9669
+ void clear()
9670
+ {
9671
+ voiceToVoiceSessions.clear();
9672
+ groups.clear();
9673
+ }
9674
+ };
9675
+
9676
+ static void to_json(nlohmann::json& j, const LingoConfiguration& p)
9677
+ {
9678
+ j = nlohmann::json{
9679
+ TOJSON_IMPL(voiceToVoiceSessions),
9680
+ TOJSON_IMPL(groups)
9681
+ };
9682
+ }
9683
+ static void from_json(const nlohmann::json& j, LingoConfiguration& p)
9684
+ {
9685
+ p.clear();
9686
+ getOptional<std::vector<VoiceToVoiceSession>>("voiceToVoiceSessions", p.voiceToVoiceSessions, j);
9687
+ getOptional<std::vector<Group>>("groups", p.groups, j);
9688
+ }
9689
+
9158
9690
  //-----------------------------------------------------------
9159
9691
  JSON_SERIALIZED_CLASS(BridgingConfiguration)
9160
9692
  /**
@@ -9302,7 +9834,7 @@ namespace AppConfigurationObjects
9302
9834
  IMPLEMENT_JSON_DOCUMENTATION(BridgingServerInternals)
9303
9835
 
9304
9836
  public:
9305
- /** @brief [Optional] Settings for the EAR's watchdog. */
9837
+ /** @brief [Optional] Settings for the watchdog. */
9306
9838
  WatchdogSettings watchdog;
9307
9839
 
9308
9840
  /** @brief [Optional, Default: 1000] Interval at which to run the housekeeper thread. */
@@ -11,6 +11,8 @@
11
11
  #ifndef EngageAudioDevice_h
12
12
  #define EngageAudioDevice_h
13
13
 
14
+ #include <stdint.h>
15
+
14
16
 
15
17
  #ifdef __cplusplus
16
18
  extern "C"
@@ -8,6 +8,69 @@
8
8
 
9
9
  #include <stdint.h>
10
10
 
11
+ #if 1
12
+ #include <cstddef>
13
+ #include <cstdint>
14
+
15
+ #ifdef WIN32
16
+ #include <winsock2.h>
17
+ #include <windows.h>
18
+ #include <ws2tcpip.h>
19
+ #else
20
+ #include <netinet/in.h>
21
+ #endif
22
+
23
+ static const int ENGAGE_INVALID_IP_ADDRESS_FAMILY = -1;
24
+
25
+ static const size_t ENGAGE_MAX_RTP_OUTPUT_QUEUE_PACKETS = 100;
26
+
27
+ static const size_t ENGAGE_MAX_IP_ADDR_SIZE = sizeof(struct sockaddr_in6);
28
+ static const size_t ENGAGE_MAX_ALIAS_SIZE = 16;
29
+ static const size_t ENGAGE_MAX_NODE_ID_SIZE = 16;
30
+
31
+ static const size_t ENGAGE_BLOB_PACKET_BUFFER_ALLOCATION_EXTRA_BYTES = 512;
32
+
33
+ static const int16_t ENGAGE_PCM_MIN_VALUE = -32768;
34
+ static const int16_t ENGAGE_PCM_MAX_VALUE = 32767;
35
+
36
+ static const uint16_t ENGAGE_SELECT_FUNCTION_TIMEOUT_SECS = 1;
37
+ static const uint16_t ENGAGE_MULTICAST_REJOIN_SECS = 8;
38
+
39
+ static const size_t ENGAGE_MAX_DATAGRAM_SIZE = 4096;
40
+ static const long ENGAGE_MAX_RECONNECT_PAUSE_MS = 30000;
41
+ static const long ENGAGE_RECONNECT_FAILURE_PAUSE_INCREMENT_MS = 1500;
42
+
43
+ static const size_t ENGAGE_BASE_RTP_HEADER_SIZE = 12;
44
+ static const uint16_t ENGAGE_ACCEPTED_RTP_VERSION = 2;
45
+ static const size_t ENGAGE_MAX_RTP_SAMPLES_THAT_CAN_BE_DECODED = (8000 * 5);
46
+
47
+ static const size_t ENGAGE_PCM_SAMPLE_COUNT_PER_MS = 8;
48
+ static const size_t ENGAGE_PCM_10_MS_SAMPLE_COUNT = (ENGAGE_PCM_SAMPLE_COUNT_PER_MS * 10);
49
+
50
+ #if defined(__APPLE__)
51
+ static const size_t ENGAGE_PCM_MIN_PLATFORM_SAMPLE_COUNT = (ENGAGE_PCM_SAMPLE_COUNT_PER_MS * 40);
52
+ #elif defined(__ANDROID__)
53
+ static const size_t ENGAGE_PCM_MIN_PLATFORM_SAMPLE_COUNT = (ENGAGE_PCM_SAMPLE_COUNT_PER_MS * 250);
54
+ #elif defined(__linux__)
55
+ static const size_t ENGAGE_PCM_MIN_PLATFORM_SAMPLE_COUNT = (ENGAGE_PCM_SAMPLE_COUNT_PER_MS * 250);
56
+ #elif defined(WIN32)
57
+ static const size_t ENGAGE_PCM_MIN_PLATFORM_SAMPLE_COUNT = (ENGAGE_PCM_SAMPLE_COUNT_PER_MS * 250);
58
+ #elif defined(__EMSCRIPTEN__)
59
+ static const size_t ENGAGE_PCM_MIN_PLATFORM_SAMPLE_COUNT = (ENGAGE_PCM_SAMPLE_COUNT_PER_MS * 250);
60
+ #endif
61
+
62
+ static const long ENGAGE_TLS_CONNECTION_KEY_MATERIAL_SIZE = 32;
63
+ static const uint64_t ENGAGE_RTP_RESET_AFTER_IDLE_MS = (1000 * 30);
64
+
65
+ #if defined(RTS_DEBUG_BUILD)
66
+ static const uint64_t ENGAGE_GROUP_HEALTH_ERROR_ERROR_NOTIFICATION_INTERVAL_MS = (1000 * 10);
67
+ #else
68
+ static const uint64_t ENGAGE_GROUP_HEALTH_ERROR_ERROR_NOTIFICATION_INTERVAL_MS = (1000 * 30);
69
+ #endif
70
+
71
+ static const size_t ENGAGE_MAX_GROUPS_PER_BRIDGE = 128;
72
+ #endif
73
+
11
74
  /** @addtogroup resultCodes Engage Engine Result Codes
12
75
  *
13
76
  * Result codes are returned by calls to the API functions and most often are related to
@@ -37,6 +100,8 @@ static const int ENGAGE_RESULT_ALREADY_STARTED = -6;
37
100
  static const int ENGAGE_RESULT_INSUFFICIENT_DESTINATION_SPACE = -7;
38
101
  /** @brief Initialization of the crypto module failed */
39
102
  static const int ENGAGE_RESULT_CRYPTO_MODULE_INITIALIZATION_FAILED = -8;
103
+ /** @brief An application high resolution timer is already defined */
104
+ static const int ENGAGE_RESULT_HIGH_RES_TIMER_ALREADY_EXISTS = -9;
40
105
  /** @} */
41
106
 
42
107
 
@@ -13,6 +13,11 @@
13
13
  #define EngageInterface_h
14
14
 
15
15
  #include <stdint.h>
16
+
17
+ #if defined(__EMSCRIPTEN__)
18
+ #include <emscripten.h>
19
+ #endif
20
+
16
21
  #include "EngageConstants.h"
17
22
 
18
23
  #ifdef __cplusplus
@@ -20,6 +25,10 @@ extern "C"
20
25
  {
21
26
  #endif
22
27
 
28
+ #if defined(ENGAGE_ALLOW_NATIVE)
29
+ #include "ILogger.h"
30
+ #endif
31
+
23
32
  #if !defined(ENGAGE_API)
24
33
  #if defined(WIN32)
25
34
  #ifdef ENGAGE_EXPORTS
@@ -29,7 +38,11 @@ extern "C"
29
38
  #define ENGAGE_API extern
30
39
  #endif
31
40
  #else
32
- #define ENGAGE_API __attribute__ ((visibility ("default")))
41
+ #if defined(__EMSCRIPTEN__)
42
+ #define ENGAGE_API EMSCRIPTEN_KEEPALIVE __attribute__ ((visibility ("default")))
43
+ #else
44
+ #define ENGAGE_API __attribute__ ((visibility ("default")))
45
+ #endif
33
46
  #endif
34
47
  #endif
35
48
 
@@ -41,6 +54,9 @@ extern "C"
41
54
  /** @brief Prototype for logging callbacks */
42
55
  typedef void (*PFN_ENGAGE_LOG_HOOK)(int level, const char * _Nonnull tag, const char * _Nonnull message);
43
56
 
57
+ /** @brief Prototype for the high-resolution timer callback */
58
+ typedef void (*PFN_ENGAGE_HIGH_RES_TIMER_TICK)(uint32_t tickType, uint64_t ticksSoFar);
59
+
44
60
  // Structures (all packed on 1-byte boundaries)
45
61
  #pragma pack(push, 1)
46
62
 
@@ -273,6 +289,9 @@ typedef struct _EngageEvents_t
273
289
 
274
290
  /** @brief Fired when an audio recording has ended */
275
291
  void (* _Nullable PFN_ENGAGE_AUDIO_RECORDING_ENDED)(const char * _Nonnull pId, const char * _Nullable eventExtraJson);
292
+
293
+ /** @brief Fired whenever the previously-registered high-resolution timer interval ticks. 'tickType' is 1, 2, or 3 for pre-tick, tick, and post-tick respectively */
294
+ // void (* _Nullable PFN_ENGAGE_ON_HIGH_RESOLUTION_TIMER_TICK)(uint32_t tickType, uint32_t ticksSoFarLow, uint32_t ticksSoFarHigh, const char * _Nullable eventExtraJson);
276
295
  } EngageEvents_t;
277
296
  /** @} */
278
297
 
@@ -1635,6 +1654,46 @@ ENGAGE_API int engageCompress(const uint8_t * _Nonnull src, size_t srcSize, uint
1635
1654
  ENGAGE_API int engageDecompress(const uint8_t * _Nonnull src, size_t srcSize, uint8_t * _Nonnull dst, size_t maxDstSize);
1636
1655
  #endif
1637
1656
 
1657
+
1658
+ #if defined(ENGAGE_ALLOW_NATIVE)
1659
+ /**
1660
+ * @brief [SYNC] Returns a pointer to the library's internbal logger as an ILogger interface
1661
+ *
1662
+ * No events are generated by this API call.
1663
+ *
1664
+ * @return ILogger*
1665
+ */
1666
+ ENGAGE_API ILogger * _Nullable engageGetLoggerNative();
1667
+
1668
+ /**
1669
+ * @brief [SYNC] Registers for a high resolution (millisecond-precision) timer via direct native callback
1670
+ *
1671
+ * Creates an ongoing timer at millisecond resolution. Only a single high resolution
1672
+ * timer can exist at any one time.
1673
+ *
1674
+ * No events are generated by this API call.
1675
+ *
1676
+ * @param durationMs Milliseconds between intervals
1677
+ * @param pfnDirectCallback Pointer to the application callback function
1678
+ * @return ENGAGE_RESULT_OK on success, other values on failure
1679
+ * @see engageUnregisterFromHighResolutionTimerNative()
1680
+ */
1681
+ ENGAGE_API int engageRegisterForHighResolutionTimerNative(uint32_t durationMs, PFN_ENGAGE_HIGH_RES_TIMER_TICK _Nullable pfnDirectCallback);
1682
+
1683
+
1684
+ /**
1685
+ * @brief [SYNC] Unregisters the previously-registered native high-resolution timer if any.
1686
+ *
1687
+ * Unregisters the previously registered timer. If none exists no error occurs.
1688
+ *
1689
+ * No events are generated by this API call.
1690
+ *
1691
+ * @return ENGAGE_RESULT_OK on success, other values on failure
1692
+ * @see engageRegisterForHighResolutionTimerNative()
1693
+ */
1694
+ ENGAGE_API int engageUnregisterFromHighResolutionTimerNative(void);
1695
+ #endif
1696
+
1638
1697
  #endif
1639
1698
 
1640
1699
  #ifdef __cplusplus
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "engage-engine",
3
- "version": "1.232.90720004",
3
+ "version": "1.233.90730006",
4
4
  "description": "Use Engage to communicate with everyone, everywhere, from any device",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -23,6 +23,6 @@
23
23
  "dependencies": {
24
24
  "bindings": "^1.5.0",
25
25
  "nan": "^2.14.0",
26
- "node-gyp": "^7.1.2"
26
+ "node-gyp": "^9.0.3"
27
27
  }
28
28
  }