add offers

This commit is contained in:
Андрей Бабушкин 2025-03-25 14:06:02 +01:00
parent 267afd012a
commit 5ca99678c1
3 changed files with 6 additions and 2 deletions

View file

@ -50,6 +50,7 @@ export default class Call {
private agentIds: string[],
) {
socket.on('WEBRTC_AGENT_CALL', (data) => {
console.log('WEBRTC_AGENT_CALL', data);
switch (data.type) {
case WEBRTC_CALL_AGENT_EVENT_TYPES.OFFER:
this.handleOffer(data, true);
@ -235,6 +236,7 @@ export default class Call {
socketId?: string;
localPeerId?: string;
}) {
console.log('ESTABLISHING CONNECTION WITH', remotePeerId, isAgent ? 'AGENT' : 'CLIENT');
try {
// Create RTCPeerConnection with client
const pc = await this.createPeerConnection({
@ -250,7 +252,8 @@ export default class Call {
// Sending offer
if (isAgent) {
this.socket.emit('WEBRTC_AGENT_CALL', {
console.log('SENDING OFFER TO AGENT', socketId);
this.socket.emit('WEBRTC_AGENT_CALL1', {
from: localPeerId,
offer,
toAgentId: socketId,
@ -500,6 +503,7 @@ export default class Call {
}
private callAgentsInSession({ agentIds }: { agentIds: string[] }) {
console.log('CALLING AGENTS IN SESSION', agentIds);
if (agentIds) {
const filteredAgentIds = agentIds.filter(
(id: string) => id.split('-')[3] !== this.agent.id.toString(),

View file

@ -254,7 +254,7 @@ export default class Assist {
return
}
if (args[0] !== 'webrtc_call_ice_candidate') {
app.debug.log('Socket:', ...args)
app.debug.log("Socket:", ...args, args[2]?.data?.toAgentId);
};
socket.on('close', (e) => {
app.debug.warn('Socket closed:', e);