MT#62544 support transcription via task-agent

Change-Id: I07e646f7c3387b7c96a04391bb9958c1fae9de46
mr13.4
Richard Fuchs 8 months ago
parent fe2ce0360e
commit fcedd54255

@ -12,3 +12,4 @@ install:
$(INSTALL_DIR) $(DESTDIR)/usr/bin
$(INSTALL_PROGRAM) vmnotify $(DESTDIR)/usr/bin/ngcp-vmnotify
$(INSTALL_PROGRAM) vmsmsnotify $(DESTDIR)/usr/bin/ngcp-vmsmsnotify
$(INSTALL_PROGRAM) recnotify $(DESTDIR)/usr/bin/ngcp-recnotify

1
debian/control vendored

@ -11,6 +11,7 @@ Homepage: https://www.sipwise.com/
Package: ngcp-vmnotify
Architecture: all
Depends:
jq,
libconfig-any-perl,
libdbd-mysql-perl,
libdbi-perl,

@ -0,0 +1,26 @@
#!/bin/bash
# Wrapper script to trigger transcription from an rtpengine recording
################################################################################
set -e
set -u
set -o pipefail
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <file name> <DB ID>"
exit 1
fi
FILENAME="$1"
DB_ID="$2"
ENC_DB_ID="$(echo "$DB_ID" | jq -R)"
if [ -n "$FILENAME" ] && [ -f "$FILENAME" ]; then
ENC_FILENAME="$(echo "$FILENAME" | jq -R)"
exec ngcp-invoke-task --task transcribe_rtpengine_file_recording --dst localhost --data \
"{\"filename\":$ENC_FILENAME, \"db_id\":$ENC_DB_ID}"
fi
exec ngcp-invoke-task --task transcribe_rtpengine_db_recording --dst localhost --data \
"{\"db_id\":$ENC_DB_ID}"

@ -250,6 +250,19 @@ EOF
return;
}
sub transcribe {
my $msgnum = 0 + $data{msgnum};
my $fh;
open($fh, '-|', "ngcp-invoke-task --task transcribe_voicemail --dst localhost --data " .
"'{\"msgnum\":$msgnum,\"uuid\":\"$data{uuid}\"}' 2>&1 < /dev/null");
my @out = <$fh>;
close($fh);
my $status = $?;
if ($status) {
$log->warn("Failed to invoke transcription, exit code $status, output: @out");
}
}
sub get_etag {
my $user = shift;
my $domain = shift;
@ -281,7 +294,7 @@ sub main {
my $extended = 1;
foreach my $arg (qw(msgnum from date duration)) {
$data{$arg} = $ARGV[$idx] or $extended = 0;
defined($data{$arg} = $ARGV[$idx]) or $extended = 0;
$idx++;
}
@ -351,6 +364,11 @@ sub main {
$CONFIG{EXT_NOTIFY} && $CONFIG{EXT_NOTIFY} eq "yes") {
send_ext_notify();
}
if ($extended &&
$CONFIG{TRANSCRIBE} && $CONFIG{TRANSCRIBE} eq "yes") {
transcribe();
}
};
if ($EVAL_ERROR) {
$log->error($EVAL_ERROR);

@ -3,3 +3,4 @@ LOCAL_IP=127.0.0.1
DEBUG=0
SIPFILE="/etc/ngcp-vmnotify/mwi.sip"
EXT_NOTIFY=no
TRANSCRIBE=no

Loading…
Cancel
Save