diff --git a/src/call/events/eventTypes.ts b/src/call/events/eventTypes.ts index 11c269a49a..dd82c11366 100644 --- a/src/call/events/eventTypes.ts +++ b/src/call/events/eventTypes.ts @@ -55,42 +55,4 @@ export interface CallEventTypes { */ peerJid: Wid; }; - /** - * Triggered when you a outgoing call - * - * @example - * ```javascript - * WPP.on('call.outgoing_call', (call) => { - * // Your code - * //Example: End any outgoing call - * WPP.call.endCall(call.id); - * }); - * ``` - */ - 'call.outgoing_call': { - /** - * The call id - */ - id: string; - /** - * Is a call from a group - */ - isGroup: boolean; - /** - * Is call with video - */ - isVideo: boolean; - /** - * timestamp of offer - */ - offerTime: number; - /** - * Wid of sender without device id - */ - sender: Wid; - /** - * Wid of sender with device id - */ - peerJid: Wid; - }; } diff --git a/src/call/events/index.ts b/src/call/events/index.ts index 1b8eca211c..d61668b42b 100644 --- a/src/call/events/index.ts +++ b/src/call/events/index.ts @@ -15,4 +15,3 @@ */ import './registerIncomingCallEvent'; -import './registerOutgoingCallEvent'; diff --git a/src/call/events/registerOutgoingCallEvent.ts b/src/call/events/registerOutgoingCallEvent.ts deleted file mode 100644 index 0b574bf19a..0000000000 --- a/src/call/events/registerOutgoingCallEvent.ts +++ /dev/null @@ -1,50 +0,0 @@ -/*! - * Copyright 2024 WPPConnect Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { internalEv } from '../../eventEmitter'; -import * as webpack from '../../webpack'; -import { CallModel, CallStore, WidFactory } from '../../whatsapp'; -import { CALL_STATES } from '../../whatsapp/enums'; - -webpack.onInjected(() => register()); - -function register() { - CallStore.on('add', (call: CallModel) => { - if (call.isGroup) { - internalEv.emit('call.outgoing_call', { - id: call.id, - isGroup: call.isGroup, - isVideo: call.isVideo, - offerTime: call.offerTime, - sender: WidFactory.toChatWid(call.peerJid), - peerJid: call.peerJid, - }); - } - }); - - CallStore.on('change', (call: CallModel) => { - if (call.getState() === CALL_STATES.OUTGOING_RING) { - internalEv.emit('call.outgoing_call', { - id: call.id, - isGroup: call.isGroup, - isVideo: call.isVideo, - offerTime: call.offerTime, - sender: WidFactory.toChatWid(call.peerJid), - peerJid: call.peerJid, - }); - } - }); -} diff --git a/src/call/functions/end.ts b/src/call/functions/end.ts index 60b9210f8c..05e7322847 100644 --- a/src/call/functions/end.ts +++ b/src/call/functions/end.ts @@ -19,18 +19,18 @@ import { CallModel, CallStore, websocket } from '../../whatsapp'; import { CALL_STATES } from '../../whatsapp/enums'; /** - * End a outgoing call + * End a call * * @example * ```javascript - * // End any outgoing call + * // End any call * WPP.call.end(); * * // End specific call id * WPP.call.end(callId); * - * // End any outgoing call - * WPP.on('call.outgoing_call', (call) => { + * // End any incoming call + * WPP.on('call.incoming_call', (call) => { * WPP.call.end(call.id); * }); * ``` @@ -50,7 +50,7 @@ export async function end(callId?: string): Promise { if (callId) { call = CallStore.get(callId); } else { - // First outgoing ring or call group + // First outcoming ring or call group call = CallStore.findFirst( (c) => callOut.includes(c.getState()) || c.isGroup ); @@ -68,8 +68,8 @@ export async function end(callId?: string): Promise { if (!callOut.includes(call.getState()) && !call.isGroup) { throw new WPPError( - 'call_is_not_outgoing_calling', - `Call ${callId || ''} is not outgoing calling`, + 'call_is_not_outcoming_calling', + `Call ${callId || ''} is not incoming calling`, { callId, state: call.getState(),