@ipcom/asterisk-ari 0.0.155 → 0.0.156
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/dist/cjs/index.cjs
CHANGED
|
@@ -975,7 +975,6 @@ var BridgeInstance = class {
|
|
|
975
975
|
this.client = client;
|
|
976
976
|
this.baseClient = baseClient;
|
|
977
977
|
this.id = bridgeId || `bridge-${Date.now()}`;
|
|
978
|
-
console.log(`BridgeInstance inicializada com ID: ${this.id}`);
|
|
979
978
|
}
|
|
980
979
|
eventEmitter = new import_events.EventEmitter();
|
|
981
980
|
bridgeData = null;
|
|
@@ -998,7 +997,7 @@ var BridgeInstance = class {
|
|
|
998
997
|
*
|
|
999
998
|
* @example
|
|
1000
999
|
* bridge.on('BridgeCreated', (event) => {
|
|
1001
|
-
*
|
|
1000
|
+
*
|
|
1002
1001
|
* });
|
|
1003
1002
|
* @param event
|
|
1004
1003
|
* @param listener
|
|
@@ -1013,7 +1012,6 @@ var BridgeInstance = class {
|
|
|
1013
1012
|
}
|
|
1014
1013
|
};
|
|
1015
1014
|
this.eventEmitter.on(event, wrappedListener);
|
|
1016
|
-
console.log(`Event listener registered for ${event} on bridge ${this.id}`);
|
|
1017
1015
|
}
|
|
1018
1016
|
/**
|
|
1019
1017
|
* Registers a one-time listener for specific bridge events.
|
|
@@ -1031,9 +1029,6 @@ var BridgeInstance = class {
|
|
|
1031
1029
|
}
|
|
1032
1030
|
};
|
|
1033
1031
|
this.eventEmitter.once(event, wrappedListener);
|
|
1034
|
-
console.log(
|
|
1035
|
-
`One-time listener registered for ${event} on bridge ${this.id}`
|
|
1036
|
-
);
|
|
1037
1032
|
}
|
|
1038
1033
|
/**
|
|
1039
1034
|
* Removes event listener(s) from the bridge.
|
|
@@ -1047,12 +1042,8 @@ var BridgeInstance = class {
|
|
|
1047
1042
|
}
|
|
1048
1043
|
if (listener) {
|
|
1049
1044
|
this.eventEmitter.off(event, listener);
|
|
1050
|
-
console.log(
|
|
1051
|
-
`Specific listener removed for ${event} on bridge ${this.id}`
|
|
1052
|
-
);
|
|
1053
1045
|
} else {
|
|
1054
1046
|
this.eventEmitter.removeAllListeners(event);
|
|
1055
|
-
console.log(`All listeners removed for ${event} on bridge ${this.id}`);
|
|
1056
1047
|
}
|
|
1057
1048
|
}
|
|
1058
1049
|
/**
|
|
@@ -1067,7 +1058,6 @@ var BridgeInstance = class {
|
|
|
1067
1058
|
}
|
|
1068
1059
|
if ("bridge" in event && event.bridge?.id === this.id) {
|
|
1069
1060
|
this.eventEmitter.emit(event.type, event);
|
|
1070
|
-
console.log(`Event ${event.type} emitted for bridge ${this.id}`);
|
|
1071
1061
|
}
|
|
1072
1062
|
}
|
|
1073
1063
|
/**
|
|
@@ -1075,7 +1065,6 @@ var BridgeInstance = class {
|
|
|
1075
1065
|
*/
|
|
1076
1066
|
removeAllListeners() {
|
|
1077
1067
|
this.eventEmitter.removeAllListeners();
|
|
1078
|
-
console.log(`All listeners removed from bridge ${this.id}`);
|
|
1079
1068
|
}
|
|
1080
1069
|
/**
|
|
1081
1070
|
* Retrieves the current details of the bridge.
|
|
@@ -1091,7 +1080,6 @@ var BridgeInstance = class {
|
|
|
1091
1080
|
this.bridgeData = await this.baseClient.get(
|
|
1092
1081
|
`/bridges/${this.id}`
|
|
1093
1082
|
);
|
|
1094
|
-
console.log(`Details retrieved for bridge ${this.id}`);
|
|
1095
1083
|
return this.bridgeData;
|
|
1096
1084
|
} catch (error) {
|
|
1097
1085
|
const message = getErrorMessage(error);
|
|
@@ -1114,7 +1102,6 @@ var BridgeInstance = class {
|
|
|
1114
1102
|
await this.baseClient.post(
|
|
1115
1103
|
`/bridges/${this.id}/addChannel?${queryParams}`
|
|
1116
1104
|
);
|
|
1117
|
-
console.log(`Channels added to bridge ${this.id}`);
|
|
1118
1105
|
} catch (error) {
|
|
1119
1106
|
const message = getErrorMessage(error);
|
|
1120
1107
|
console.error(`Error adding channels to bridge ${this.id}:`, message);
|
|
@@ -1135,7 +1122,6 @@ var BridgeInstance = class {
|
|
|
1135
1122
|
await this.baseClient.post(
|
|
1136
1123
|
`/bridges/${this.id}/removeChannel?${queryParams}`
|
|
1137
1124
|
);
|
|
1138
|
-
console.log(`Channels removed from bridge ${this.id}`);
|
|
1139
1125
|
} catch (error) {
|
|
1140
1126
|
const message = getErrorMessage(error);
|
|
1141
1127
|
console.error(`Error removing channels from bridge ${this.id}:`, message);
|
|
@@ -1161,7 +1147,6 @@ var BridgeInstance = class {
|
|
|
1161
1147
|
`/bridges/${this.id}/play?${queryParams}`,
|
|
1162
1148
|
{ media: request.media }
|
|
1163
1149
|
);
|
|
1164
|
-
console.log(`Media playback started on bridge ${this.id}`);
|
|
1165
1150
|
return result;
|
|
1166
1151
|
} catch (error) {
|
|
1167
1152
|
const message = getErrorMessage(error);
|
|
@@ -1180,7 +1165,6 @@ var BridgeInstance = class {
|
|
|
1180
1165
|
await this.baseClient.delete(
|
|
1181
1166
|
`/bridges/${this.id}/play/${playbackId}`
|
|
1182
1167
|
);
|
|
1183
|
-
console.log(`Playback ${playbackId} stopped on bridge ${this.id}`);
|
|
1184
1168
|
} catch (error) {
|
|
1185
1169
|
const message = getErrorMessage(error);
|
|
1186
1170
|
console.error(`Error stopping playback on bridge ${this.id}:`, message);
|
|
@@ -1198,7 +1182,6 @@ var BridgeInstance = class {
|
|
|
1198
1182
|
await this.baseClient.post(
|
|
1199
1183
|
`/bridges/${this.id}/videoSource/${channelId}`
|
|
1200
1184
|
);
|
|
1201
|
-
console.log(`Video source set for bridge ${this.id}`);
|
|
1202
1185
|
} catch (error) {
|
|
1203
1186
|
const message = getErrorMessage(error);
|
|
1204
1187
|
console.error(
|
|
@@ -1216,7 +1199,6 @@ var BridgeInstance = class {
|
|
|
1216
1199
|
async clearVideoSource() {
|
|
1217
1200
|
try {
|
|
1218
1201
|
await this.baseClient.delete(`/bridges/${this.id}/videoSource`);
|
|
1219
|
-
console.log(`Video source removed from bridge ${this.id}`);
|
|
1220
1202
|
} catch (error) {
|
|
1221
1203
|
const message = getErrorMessage(error);
|
|
1222
1204
|
console.error(
|
|
@@ -1270,20 +1252,16 @@ var Bridges = class {
|
|
|
1270
1252
|
if (!id) {
|
|
1271
1253
|
const instance = new BridgeInstance(this.client, this.baseClient);
|
|
1272
1254
|
this.bridgeInstances.set(instance.id, instance);
|
|
1273
|
-
console.log(`New bridge instance created with ID: ${instance.id}`);
|
|
1274
1255
|
return instance;
|
|
1275
1256
|
}
|
|
1276
1257
|
if (!this.bridgeInstances.has(id)) {
|
|
1277
1258
|
const instance = new BridgeInstance(this.client, this.baseClient, id);
|
|
1278
1259
|
this.bridgeInstances.set(id, instance);
|
|
1279
|
-
console.log(`New bridge instance created with provided ID: ${id}`);
|
|
1280
1260
|
return instance;
|
|
1281
1261
|
}
|
|
1282
|
-
console.log(`Returning existing bridge instance: ${id}`);
|
|
1283
1262
|
return this.bridgeInstances.get(id);
|
|
1284
1263
|
} catch (error) {
|
|
1285
1264
|
const message = getErrorMessage(error);
|
|
1286
|
-
console.error(`Error creating/retrieving bridge instance:`, message);
|
|
1287
1265
|
throw new Error(`Failed to manage bridge instance: ${message}`);
|
|
1288
1266
|
}
|
|
1289
1267
|
}
|
|
@@ -1305,7 +1283,6 @@ var Bridges = class {
|
|
|
1305
1283
|
const instance = this.bridgeInstances.get(bridgeId);
|
|
1306
1284
|
instance?.removeAllListeners();
|
|
1307
1285
|
this.bridgeInstances.delete(bridgeId);
|
|
1308
|
-
console.log(`Inst\xE2ncia de bridge removida: ${bridgeId}`);
|
|
1309
1286
|
} else {
|
|
1310
1287
|
console.warn(`Tentativa de remover inst\xE2ncia inexistente: ${bridgeId}`);
|
|
1311
1288
|
}
|
|
@@ -1337,9 +1314,6 @@ var Bridges = class {
|
|
|
1337
1314
|
const instance = this.bridgeInstances.get(event.bridge.id);
|
|
1338
1315
|
if (instance) {
|
|
1339
1316
|
instance.emitEvent(event);
|
|
1340
|
-
console.log(
|
|
1341
|
-
`Evento propagado para bridge ${event.bridge.id}: ${event.type}`
|
|
1342
|
-
);
|
|
1343
1317
|
} else {
|
|
1344
1318
|
console.warn(
|
|
1345
1319
|
`Nenhuma inst\xE2ncia encontrada para bridge ${event.bridge.id}`
|
|
@@ -1361,7 +1335,7 @@ var Bridges = class {
|
|
|
1361
1335
|
* @example
|
|
1362
1336
|
* try {
|
|
1363
1337
|
* const bridges = await bridgesInstance.list();
|
|
1364
|
-
*
|
|
1338
|
+
*
|
|
1365
1339
|
* } catch (error) {
|
|
1366
1340
|
* console.error('Failed to fetch bridges:', error);
|
|
1367
1341
|
* }
|