Skip to content

Commit 32ee1bf

Browse files
committed
transcribe use forward url if incoming audio
1 parent 663658c commit 32ee1bf

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unoapi-cloud",
3-
"version": "2.10.0",
3+
"version": "2.10.1",
44
"description": "Unoapi Cloud",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/jobs/transcriber.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getConfig, Webhook } from '../services/config'
33
import logger from '../services/logger'
44
import { Outgoing } from '../services/outgoing'
55
import { BASE_URL } from '../defaults'
6+
import { UNOAPI_BASE_ID } from '../utils/id'
67
import mediaToBuffer from '../utils/media_to_buffer'
78
import { extractDestinyPhone } from '../services/transformer'
89
import { generateUnoId } from '../utils/id'
@@ -32,7 +33,7 @@ export class TranscriberJob {
3233
const mediaKey = audioMessage.audio.id
3334
let token = config.authToken
3435
let mediaUrl = `${BASE_URL}/v13.0/${mediaKey}`
35-
if (config.connectionType == 'forward') {
36+
if (config.connectionType == 'forward' && mediaKey.indexOf(`${UNOAPI_BASE_ID}.`) < 0) {
3637
mediaUrl = `${config.webhookForward.url}/${config.webhookForward.version}/${mediaKey}`
3738
token = config.webhookForward.token
3839
}

src/utils/id.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { v1 as uuid } from 'uuid'
2-
const UNOAPI_BASE_ID = 'UNO'
2+
export const UNOAPI_BASE_ID = 'UNO'
33

44
export type ID_ADD =
55
| 'INC' // incoming messages

0 commit comments

Comments
 (0)