register use tls (#302)

This commit is contained in:
Hoan Luu Huu
2024-04-04 19:02:29 +07:00
committed by GitHub
parent a4792a521f
commit 187a428a75
6 changed files with 31 additions and 6 deletions

View File

@@ -394,6 +394,7 @@ service_provider_sid CHAR(36),
application_sid CHAR(36) COMMENT 'If provided, all incoming calls from this source will be routed to the associated application',
e164_leading_plus BOOLEAN NOT NULL DEFAULT false COMMENT 'if true, a leading plus should be prepended to outbound phone numbers',
requires_register BOOLEAN NOT NULL DEFAULT false,
register_use_tls BOOLEAN NOT NULL DEFAULT false,
register_username VARCHAR(64),
register_sip_realm VARCHAR(64),
register_password VARCHAR(64),

View File

@@ -551,7 +551,7 @@
</location>
<size>
<width>293.00</width>
<height>540.00</height>
<height>560.00</height>
</size>
<zorder>6</zorder>
<SQLField>
@@ -637,6 +637,13 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[B694DA3E-F58D-44C5-980F-E0CFBE6DFA02]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[register_use_tls]]></name>
<type><![CDATA[BOOLEAN]]></type>
<defaultValue><![CDATA[false]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[1C608C4A-E512-4DCC-8497-07042514054F]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[register_username]]></name>
<type><![CDATA[VARCHAR(64)]]></type>
@@ -3110,11 +3117,11 @@
<SourceSidebarWidth><![CDATA[312.000000]]></SourceSidebarWidth>
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
<windowHeight><![CDATA[1055.000000]]></windowHeight>
<windowLocationX><![CDATA[1826.000000]]></windowLocationX>
<windowLocationY><![CDATA[37.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{2, 0}]]></windowScrollOrigin>
<windowWidth><![CDATA[1682.000000]]></windowWidth>
<windowHeight><![CDATA[1027.000000]]></windowHeight>
<windowLocationX><![CDATA[1824.000000]]></windowLocationX>
<windowLocationY><![CDATA[65.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{2, 122}]]></windowScrollOrigin>
<windowWidth><![CDATA[1728.000000]]></windowWidth>
</SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>

View File

@@ -194,6 +194,7 @@ const sql = {
],
8006: [
'ALTER TABLE sip_gateways ADD COLUMN send_options_ping BOOLEAN NOT NULL DEFAULT 0',
'ALTER TABLE voip_carriers ADD COLUMN register_use_tls BOOLEAN NOT NULL DEFAULT 0',
]
};

View File

@@ -61,6 +61,10 @@ VoipCarrier.fields = [
name: 'requires_register',
type: 'number'
},
{
name: 'register_use_tls',
type: 'number'
},
{
name: 'register_username',
type: 'string'

View File

@@ -1108,6 +1108,9 @@ paths:
requires_register:
type: boolean
description: wehther this provider requires us to send a REGISTER to them in order to receive calls
register_use_tls:
type: boolean
description: wehther this provider requires us to send a REGISTER use TLS protocol
register_username:
type: string
description: sip username to authenticate with, if registration is required

View File

@@ -42,6 +42,7 @@ test('voip carrier tests', async(t) => {
json: true,
});
t.ok(result.name === 'daveh' , 'successfully retrieved voip carrier by sid');
t.ok(result.register_use_tls === 0 , 'successfully create voip_carrier with register_use_tls is false');
/* fail to query one voip carriers with invalid uuid */
try {
@@ -61,6 +62,7 @@ test('voip carrier tests', async(t) => {
body: {
name: 'robb',
requires_register: true,
register_use_tls: true,
register_username: 'foo',
register_sip_realm: 'bar',
register_password: 'baz',
@@ -70,6 +72,13 @@ test('voip carrier tests', async(t) => {
});
t.ok(result.statusCode === 204, 'successfully updated voip carrier');
/* query one voip carriers */
result = await request.get(`/VoipCarriers/${sid}`, {
auth: authAdmin,
json: true,
});
t.ok(result.register_use_tls === 1 , 'successfully updated voip_carrier with register_use_tls is true');
/* provision a phone number for the voip carrier */
result = await request.post('/PhoneNumbers', {
resolveWithFullResponse: true,