changed AGENT_WEBRTC_CALL handling in socket server
This commit is contained in:
parent
5ca99678c1
commit
420919d00d
3 changed files with 3 additions and 6 deletions
|
|
@ -191,7 +191,7 @@ async function onUpdateEvent(socket, ...args) {
|
|||
|
||||
async function onWebrtcAgentHandler(socket, ...args) {
|
||||
if (socket.handshake.query.identity === IDENTITIES.agent) {
|
||||
const agentIdToConnect = args[0]?.data?.toAgentId;
|
||||
const agentIdToConnect = args[2]?.toAgentId;
|
||||
logger.debug(`${socket.id} sent webrtc event to agent:${agentIdToConnect}`);
|
||||
if (agentIdToConnect && socket.handshake.sessionData.AGENTS_CONNECTED.includes(agentIdToConnect)) {
|
||||
socket.to(agentIdToConnect).emit(EVENTS_DEFINITION.listen.WEBRTC_AGENT_CALL, args[0]);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ 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);
|
||||
|
|
@ -236,7 +235,6 @@ 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({
|
||||
|
|
@ -252,8 +250,7 @@ export default class Call {
|
|||
|
||||
// Sending offer
|
||||
if (isAgent) {
|
||||
console.log('SENDING OFFER TO AGENT', socketId);
|
||||
this.socket.emit('WEBRTC_AGENT_CALL1', {
|
||||
this.socket.emit('WEBRTC_AGENT_CALL', {
|
||||
from: localPeerId,
|
||||
offer,
|
||||
toAgentId: socketId,
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ export default class Assist {
|
|||
return
|
||||
}
|
||||
if (args[0] !== 'webrtc_call_ice_candidate') {
|
||||
app.debug.log("Socket:", ...args, args[2]?.data?.toAgentId);
|
||||
app.debug.log("Socket:", ...args);
|
||||
};
|
||||
socket.on('close', (e) => {
|
||||
app.debug.warn('Socket closed:', e);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue