suport voip carrier sip_proxy (#389)

* suport voip carrier sip_proxy

* fix review comment
This commit is contained in:
Hoan Luu Huu
2025-02-17 21:46:20 +07:00
committed by GitHub
parent d81a0167cf
commit d872d9ee87
5 changed files with 26 additions and 12 deletions

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

@@ -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}`, {