Compare commits

...

5 Commits

Author SHA1 Message Date
Hoan Luu Huu
d872d9ee87 suport voip carrier sip_proxy (#389)
* suport voip carrier sip_proxy

* fix review comment
2025-02-17 09:46:20 -05:00
Dave Horton
d81a0167cf scripts for import and export of database 2025-02-12 08:28:43 -05:00
Hoan Luu Huu
c7c56d8ea0 update speech utils version (#388) 2025-02-07 08:00:21 -05:00
Hoan Luu Huu
9cfe990bb8 support rimelabs new voices (#387) 2025-02-07 07:22:42 -05:00
Hoan Luu Huu
6c7d2c9074 support rime mistv2 model (#386) 2025-02-06 21:36:34 -05:00
11 changed files with 95 additions and 29 deletions

22
db/export_jambonz.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# This script exports the 'jambones' database (schema and data)
# from the source MySQL server into a file.
# Configuration variables
SOURCE_HOST=
DB_USER=
DB_PASS=
DB_NAME=
EXPORT_FILE="jambones_export.sql"
# Export the database using mysqldump
echo "Exporting database '$DB_NAME' from $SOURCE_HOST..."
mysqldump -h "$SOURCE_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" > "$EXPORT_FILE"
# Check for errors
if [ $? -eq 0 ]; then
echo "Database export successful. Export file created: $EXPORT_FILE"
else
echo "Error exporting database '$DB_NAME'."
exit 1
fi

31
db/import_jambonz.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
# This script imports the SQL dump file into the target MySQL server.
# It first drops the existing 'jambones' database (if it exists),
# recreates it, and then imports the dump file.
# Configuration variables
TARGET_HOST=
DB_USER=
DB_PASS=
DB_NAME=
IMPORT_FILE="jambones_export.sql"
# Drop the existing database (if any) and create a new one
echo "Dropping and recreating database '$DB_NAME' on $TARGET_HOST..."
mysql -h "$TARGET_HOST" -u "$DB_USER" -p"$DB_PASS" -e "DROP DATABASE IF EXISTS \`$DB_NAME\`; CREATE DATABASE \`$DB_NAME\`;"
if [ $? -ne 0 ]; then
echo "Error dropping/creating database '$DB_NAME'."
exit 1
fi
# Import the SQL dump into the newly created database
echo "Importing dump file '$IMPORT_FILE' into database '$DB_NAME'..."
mysql -h "$TARGET_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" < "$IMPORT_FILE"
if [ $? -eq 0 ]; then
echo "Database import successful."
else
echo "Error importing the database."
exit 1
fi

View File

@@ -162,7 +162,7 @@ regex VARCHAR(32) NOT NULL COMMENT 'regex-based pattern match against dialed num
description VARCHAR(1024),
priority INTEGER NOT NULL COMMENT 'lower priority routes are attempted first',
PRIMARY KEY (lcr_route_sid)
) COMMENT='An ordered list of digit patterns in an LCR table. The pat';
) COMMENT='An ordered list of digit patterns in an LCR table. The patterns are tested in sequence until one matches';
CREATE TABLE lcr
(
@@ -173,7 +173,7 @@ default_carrier_set_entry_sid CHAR(36) COMMENT 'default carrier/route to use whe
service_provider_sid CHAR(36),
account_sid CHAR(36),
PRIMARY KEY (lcr_sid)
) COMMENT='An LCR (least cost routing) table that is used by a service ';
) COMMENT='An LCR (least cost routing) table that is used by a service provider or account to make decisions about routing outbound calls when multiple carriers are available.';
CREATE TABLE password_settings
(
@@ -417,6 +417,7 @@ register_from_domain VARCHAR(255),
register_public_ip_in_contact BOOLEAN NOT NULL DEFAULT false,
register_status VARCHAR(4096),
dtmf_type ENUM('rfc2833','tones','info') NOT NULL DEFAULT 'rfc2833',
outbound_sip_proxy VARCHAR(255),
PRIMARY KEY (voip_carrier_sid)
) COMMENT='A Carrier or customer PBX that can send or receive calls';

View File

@@ -551,7 +551,7 @@
</location>
<size>
<width>293.00</width>
<height>560.00</height>
<height>580.00</height>
</size>
<zorder>6</zorder>
<SQLField>
@@ -744,6 +744,11 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[87355F68-CC01-4B7C-855A-976CE634634D]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[outbound_sip_proxy]]></name>
<type><![CDATA[VARCHAR(255)]]></type>
<uid><![CDATA[556ABA45-BC63-444D-8CB1-973EFCCF9FE7]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[28]]></labelWindowIndex>
<objectComment><![CDATA[A Carrier or customer PBX that can send or receive calls]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
@@ -1287,8 +1292,8 @@
<schema><![CDATA[]]></schema>
<comment><![CDATA[a regex-based pattern match for call routing]]></comment>
<location>
<x>25.00</x>
<y>997.00</y>
<x>16.00</x>
<y>1007.00</y>
</location>
<size>
<width>254.00</width>
@@ -3151,17 +3156,17 @@
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
<PageGridVisible><![CDATA[0]]></PageGridVisible>
<RightSidebarWidth><![CDATA[1235.000000]]></RightSidebarWidth>
<RightSidebarWidth><![CDATA[1393.000000]]></RightSidebarWidth>
<sidebarIndex><![CDATA[2]]></sidebarIndex>
<snapToGrid><![CDATA[0]]></snapToGrid>
<SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
<windowHeight><![CDATA[871.000000]]></windowHeight>
<windowLocationX><![CDATA[-1516.000000]]></windowLocationX>
<windowLocationY><![CDATA[1121.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{10, 338}]]></windowScrollOrigin>
<windowWidth><![CDATA[1512.000000]]></windowWidth>
<windowHeight><![CDATA[1055.000000]]></windowHeight>
<windowLocationX><![CDATA[58.000000]]></windowLocationX>
<windowLocationY><![CDATA[24.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{0, 278}]]></windowScrollOrigin>
<windowWidth><![CDATA[1670.000000]]></windowWidth>
</SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>

View File

@@ -209,6 +209,7 @@ const sql = {
'ALTER TABLE google_custom_voices ADD COLUMN voice_cloning_key MEDIUMTEXT',
'ALTER TABLE google_custom_voices ADD COLUMN use_voice_cloning_key BOOLEAN DEFAULT false',
'ALTER TABLE voip_carriers ADD COLUMN dtmf_type ENUM(\'rfc2833\',\'tones\',\'info\') NOT NULL DEFAULT \'rfc2833\'',
'ALTER TABLE voip_carriers ADD COLUMN sip_proxy VARCHAR(255)',
]
};

View File

@@ -140,6 +140,10 @@ VoipCarrier.fields = [
{
name: 'dtmf_type',
type: 'string'
},
{
name: 'sip_proxy',
type: 'string'
}
];

View File

@@ -1,5 +1,6 @@
module.exports = [
{ name: 'Mist', value: 'mist' },
{ name: 'Mistv2', value: 'mistv2' },
{ name: 'V1', value: 'v1' },
];

View File

@@ -988,19 +988,17 @@ async function getLanguagesVoicesForRimelabs(credential) {
const get = bent('https://users.rime.ai', 'GET', 'json', {
'Accept': 'application/json'
});
const voices = await get('/data/voices/all.json');
let selectedVoices = model_id ? voices[model_id] : Object.values(voices).reduce((acc, val) => [...acc, ...val], []);
selectedVoices = selectedVoices.map((v) => ({
name: v.charAt(0).toUpperCase() + v.slice(1),
value: v
const voices = await get('/data/voices/all-v2.json');
const modelVoices = model_id ? voices[model_id] :
Object.keys(voices).length > 0 ? voices[Object.keys(voices)[0]] : [];
const ttsVoices = Object.entries(modelVoices).map(([key, voices]) => ({
value: key,
name: key.charAt(0).toUpperCase() + key.slice(1),
voices: voices.map((v) => ({
name: v.charAt(0).toUpperCase() + v.slice(1),
value: v
}))
}));
const ttsVoices = [
{
value: 'en-US',
name: 'English (US)',
voices: selectedVoices
}
];
return tranform(ttsVoices, undefined, TtsModelRimelabs);
}

8
package-lock.json generated
View File

@@ -19,7 +19,7 @@
"@jambonz/lamejs": "^1.2.2",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.10",
"@jambonz/speech-utils": "^0.2.1",
"@jambonz/speech-utils": "^0.2.3",
"@jambonz/time-series": "^0.2.8",
"@jambonz/verb-specifications": "^0.0.72",
"@soniox/soniox-node": "^1.2.2",
@@ -2292,9 +2292,9 @@
}
},
"node_modules/@jambonz/speech-utils": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.2.1.tgz",
"integrity": "sha512-LIZ3HCW+vra626L18NiudY4v7zXVW4EvqUeeVLFM9S8fi1nGP2lHbDur/DFiN/VsJXYdNIdO4PAsILxeZXoOLg==",
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.2.3.tgz",
"integrity": "sha512-ffx0TYggGDeEEB5yZ9y+BkF6dtDmKvCEgyK0lmzjkRQ2h3xaIWao3c5VCU9WXhKb+d2o6mLL06GebBMdzWIGhg==",
"license": "MIT",
"dependencies": {
"@aws-sdk/client-polly": "^3.496.0",

View File

@@ -30,7 +30,7 @@
"@jambonz/lamejs": "^1.2.2",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.10",
"@jambonz/speech-utils": "^0.2.1",
"@jambonz/speech-utils": "^0.2.3",
"@jambonz/time-series": "^0.2.8",
"@jambonz/verb-specifications": "^0.0.72",
"@soniox/soniox-node": "^1.2.2",

View File

@@ -15,6 +15,7 @@ test('voip carrier tests', async(t) => {
let sid;
try {
let result;
const outbound_sip_proxy = 'foo.bar.com';
/* add a voip carrier */
result = await request.post('/VoipCarriers', {
@@ -23,7 +24,8 @@ test('voip carrier tests', async(t) => {
json: true,
body: {
name: 'daveh',
e164_leading_plus: true
e164_leading_plus: true,
outbound_sip_proxy,
}
});
t.ok(result.statusCode === 201, 'successfully created voip carrier');
@@ -35,6 +37,7 @@ test('voip carrier tests', async(t) => {
json: true,
});
t.ok(result.length === 1 && result[0].e164_leading_plus, 'successfully queried all voip carriers');
t.ok(result.length === 1 && result[0].outbound_sip_proxy === outbound_sip_proxy, 'successfully queried all voip carriers');
/* query one voip carriers */
result = await request.get(`/VoipCarriers/${sid}`, {