Skip to content

Commit 09cd922

Browse files
committed
fixed bot leave
1 parent ed90d1b commit 09cd922

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/services/botManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BotManager {
3131
async stopBot(botId) {
3232
try {
3333
logger.logInfo('Stopping bot:', botId);
34-
await recallService.deleteBot(botId);
34+
await recallService.leaveCall(botId);
3535
this.activeBots.delete(botId);
3636
} catch (error) {
3737
logger.logError('Error stopping bot:', error);

src/services/recallService.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,18 @@ class RecallService {
145145
}
146146
}
147147

148+
async leaveCall(botId) {
149+
try {
150+
await axios.post(`${this.baseUrl}/api/v1/bot/${botId}/leave_call/`, {}, {
151+
headers: this.headers
152+
});
153+
logger.logInfo('Bot left call successfully');
154+
} catch (error) {
155+
logger.logError('Error making bot leave call:', error.response?.data || error.message);
156+
throw new Error('Failed to make bot leave call. Please try again.');
157+
}
158+
}
159+
148160
async deleteBot(botId) {
149161
try {
150162
await axios.delete(`${this.baseUrl}/api/v1/bot/${botId}/`, {

0 commit comments

Comments
 (0)