add index on sip_gateways (inbound,voip_carrier_sid) and trunk_type to predefined carriers (#512)

This commit is contained in:
Dave Horton
2025-11-11 10:48:14 -05:00
committed by GitHub
parent 4f0f8a0f46
commit 4c86adf1f7
3 changed files with 50 additions and 20 deletions

View File

@@ -1,4 +1,5 @@
/* SQLEditor (MySQL (2))*/ /* SQLEditor (MySQL (2))*/
SET FOREIGN_KEY_CHECKS=0; SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS account_static_ips; DROP TABLE IF EXISTS account_static_ips;
@@ -161,7 +162,7 @@ regex VARCHAR(32) NOT NULL COMMENT 'regex-based pattern match against dialed num
description VARCHAR(1024), description VARCHAR(1024),
priority INTEGER NOT NULL COMMENT 'lower priority routes are attempted first', priority INTEGER NOT NULL COMMENT 'lower priority routes are attempted first',
PRIMARY KEY (lcr_route_sid) PRIMARY KEY (lcr_route_sid)
) COMMENT='An ordered list of digit patterns in an LCR table. The patterns are tested in sequence until one matches'; ) COMMENT='An ordered list of digit patterns in an LCR table. The pat';
CREATE TABLE lcr CREATE TABLE lcr
( (
@@ -172,7 +173,7 @@ default_carrier_set_entry_sid CHAR(36) COMMENT 'default carrier/route to use whe
service_provider_sid CHAR(36), service_provider_sid CHAR(36),
account_sid CHAR(36), account_sid CHAR(36),
PRIMARY KEY (lcr_sid) PRIMARY KEY (lcr_sid)
) 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.'; ) COMMENT='An LCR (least cost routing) table that is used by a service ';
CREATE TABLE password_settings CREATE TABLE password_settings
( (
@@ -203,6 +204,7 @@ tech_prefix VARCHAR(16) COMMENT 'tech prefix to prepend to outbound calls to thi
inbound_auth_username VARCHAR(64), inbound_auth_username VARCHAR(64),
inbound_auth_password VARCHAR(64), inbound_auth_password VARCHAR(64),
diversion VARCHAR(32), diversion VARCHAR(32),
trunk_type ENUM('static_ip','auth','reg') NOT NULL DEFAULT 'static_ip',
PRIMARY KEY (predefined_carrier_sid) PRIMARY KEY (predefined_carrier_sid)
); );
@@ -703,6 +705,8 @@ ALTER TABLE phone_numbers ADD FOREIGN KEY service_provider_sid_idxfk_8 (service_
CREATE INDEX sip_gateway_idx_hostport ON sip_gateways (ipv4,port); CREATE INDEX sip_gateway_idx_hostport ON sip_gateways (ipv4,port);
CREATE INDEX idx_sip_gateways_inbound_carrier ON sip_gateways (inbound,voip_carrier_sid);
CREATE INDEX voip_carrier_sid_idx ON sip_gateways (voip_carrier_sid); CREATE INDEX voip_carrier_sid_idx ON sip_gateways (voip_carrier_sid);
ALTER TABLE sip_gateways ADD FOREIGN KEY voip_carrier_sid_idxfk_2 (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid); ALTER TABLE sip_gateways ADD FOREIGN KEY voip_carrier_sid_idxfk_2 (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid);
@@ -744,4 +748,4 @@ ALTER TABLE accounts ADD FOREIGN KEY device_calling_application_sid_idxfk (devic
ALTER TABLE accounts ADD FOREIGN KEY siprec_hook_sid_idxfk (siprec_hook_sid) REFERENCES applications (application_sid); ALTER TABLE accounts ADD FOREIGN KEY siprec_hook_sid_idxfk (siprec_hook_sid) REFERENCES applications (application_sid);
SET FOREIGN_KEY_CHECKS=1; SET FOREIGN_KEY_CHECKS=0;

View File

@@ -1887,7 +1887,7 @@
</location> </location>
<size> <size>
<width>302.00</width> <width>302.00</width>
<height>260.00</height> <height>280.00</height>
</size> </size>
<zorder>20</zorder> <zorder>20</zorder>
<SQLField> <SQLField>
@@ -1966,6 +1966,13 @@
<type><![CDATA[VARCHAR(32)]]></type> <type><![CDATA[VARCHAR(32)]]></type>
<uid><![CDATA[CE2015BC-8538-4FB0-B4D9-454436FAB1D9]]></uid> <uid><![CDATA[CE2015BC-8538-4FB0-B4D9-454436FAB1D9]]></uid>
</SQLField> </SQLField>
<SQLField>
<name><![CDATA[trunk_type]]></name>
<type><![CDATA[ENUM('static_ip','auth','reg')]]></type>
<defaultValue><![CDATA[static_ip]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[F50906E5-2CA5-47D0-BF7B-6CB75EFD83B8]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[17]]></labelWindowIndex> <labelWindowIndex><![CDATA[17]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded> <ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[AF34726D-EDFD-414E-9B44-5243DA9D9497]]></uid> <uid><![CDATA[AF34726D-EDFD-414E-9B44-5243DA9D9497]]></uid>
@@ -2370,8 +2377,8 @@
<y>17.00</y> <y>17.00</y>
</location> </location>
<size> <size>
<width>281.00</width> <width>391.00</width>
<height>280.00</height> <height>300.00</height>
</size> </size>
<zorder>7</zorder> <zorder>7</zorder>
<SQLField> <SQLField>
@@ -2460,6 +2467,13 @@
<notNull><![CDATA[1]]></notNull> <notNull><![CDATA[1]]></notNull>
<uid><![CDATA[C5C0043B-100A-4476-BF01-BE0777AE27C0]]></uid> <uid><![CDATA[C5C0043B-100A-4476-BF01-BE0777AE27C0]]></uid>
</SQLField> </SQLField>
<SQLField>
<name><![CDATA[protocol]]></name>
<type><![CDATA[ENUM('udp','tcp','tls', 'tls/srtp')]]></type>
<defaultValue><![CDATA[udp]]></defaultValue>
<objectComment><![CDATA[Outbound call protocol]]></objectComment>
<uid><![CDATA[30661D66-96EC-4B02-995C-5E7EB8A3BD70]]></uid>
</SQLField>
<SQLIndex> <SQLIndex>
<name><![CDATA[sip_gateway_idx_hostport]]></name> <name><![CDATA[sip_gateway_idx_hostport]]></name>
<fieldName><![CDATA[ipv4]]></fieldName> <fieldName><![CDATA[ipv4]]></fieldName>
@@ -2477,13 +2491,23 @@
<indexNamePrefix><![CDATA[sip_gateway]]></indexNamePrefix> <indexNamePrefix><![CDATA[sip_gateway]]></indexNamePrefix>
<uid><![CDATA[1C744DE3-39BD-4EC6-B427-7EB2DD258771]]></uid> <uid><![CDATA[1C744DE3-39BD-4EC6-B427-7EB2DD258771]]></uid>
</SQLIndex> </SQLIndex>
<SQLField> <SQLIndex>
<name><![CDATA[protocol]]></name> <name><![CDATA[idx_sip_gateways_inbound_carrier]]></name>
<type><![CDATA[ENUM('udp','tcp','tls', 'tls/srtp')]]></type> <fieldName><![CDATA[inbound]]></fieldName>
<defaultValue><![CDATA[udp]]></defaultValue> <fieldName><![CDATA[voip_carrier_sid]]></fieldName>
<objectComment><![CDATA[Outbound call protocol]]></objectComment> <SQLIndexEntry>
<uid><![CDATA[30661D66-96EC-4B02-995C-5E7EB8A3BD70]]></uid> <name><![CDATA[inbound]]></name>
</SQLField> <prefixSize><![CDATA[]]></prefixSize>
<fieldUid><![CDATA[CDE029DC-0C7C-400C-85E9-5005C53B7460]]></fieldUid>
</SQLIndexEntry>
<SQLIndexEntry>
<name><![CDATA[voip_carrier_sid]]></name>
<prefixSize><![CDATA[]]></prefixSize>
<fieldUid><![CDATA[BC25D27E-54E4-4D14-B53D-D1C6254D1D72]]></fieldUid>
</SQLIndexEntry>
<indexNamePrefix><![CDATA[sip_gateways]]></indexNamePrefix>
<uid><![CDATA[BCE047C6-F70E-42AD-9201-FECF1BAD6BEA]]></uid>
</SQLIndex>
<labelWindowIndex><![CDATA[31]]></labelWindowIndex> <labelWindowIndex><![CDATA[31]]></labelWindowIndex>
<objectComment><![CDATA[A whitelisted sip gateway used for origination/termination]]></objectComment> <objectComment><![CDATA[A whitelisted sip gateway used for origination/termination]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded> <ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
@@ -3169,17 +3193,17 @@
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden> <overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible> <pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
<PageGridVisible><![CDATA[0]]></PageGridVisible> <PageGridVisible><![CDATA[0]]></PageGridVisible>
<RightSidebarWidth><![CDATA[1643.000000]]></RightSidebarWidth> <RightSidebarWidth><![CDATA[1235.000000]]></RightSidebarWidth>
<sidebarIndex><![CDATA[2]]></sidebarIndex> <sidebarIndex><![CDATA[2]]></sidebarIndex>
<snapToGrid><![CDATA[0]]></snapToGrid> <snapToGrid><![CDATA[0]]></snapToGrid>
<SourceSidebarWidth><![CDATA[312.000000]]></SourceSidebarWidth> <SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion> <SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid> <uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
<windowHeight><![CDATA[1055.000000]]></windowHeight> <windowHeight><![CDATA[876.000000]]></windowHeight>
<windowLocationX><![CDATA[1728.000000]]></windowLocationX> <windowLocationX><![CDATA[-1164.000000]]></windowLocationX>
<windowLocationY><![CDATA[37.000000]]></windowLocationY> <windowLocationY><![CDATA[1161.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{0, 376}]]></windowScrollOrigin> <windowScrollOrigin><![CDATA[{0, 0}]]></windowScrollOrigin>
<windowWidth><![CDATA[1920.000000]]></windowWidth> <windowWidth><![CDATA[1512.000000]]></windowWidth>
</SQLDocumentInfo> </SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert> <AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded> <defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>

View File

@@ -233,6 +233,8 @@ const sql = {
'UPDATE applications SET speech_synthesis_voice = \'en-US-Standard-C\' WHERE speech_synthesis_voice IS NULL AND speech_synthesis_vendor = \'google\' AND speech_synthesis_language = \'en-US\'', 'UPDATE applications SET speech_synthesis_voice = \'en-US-Standard-C\' WHERE speech_synthesis_voice IS NULL AND speech_synthesis_vendor = \'google\' AND speech_synthesis_language = \'en-US\'',
'ALTER TABLE applications MODIFY COLUMN speech_synthesis_voice VARCHAR(255) DEFAULT \'en-US-Standard-C\'', 'ALTER TABLE applications MODIFY COLUMN speech_synthesis_voice VARCHAR(255) DEFAULT \'en-US-Standard-C\'',
'ALTER TABLE voip_carriers ADD COLUMN trunk_type ENUM(\'static_ip\',\'auth\',\'reg\') NOT NULL DEFAULT \'static_ip\'', 'ALTER TABLE voip_carriers ADD COLUMN trunk_type ENUM(\'static_ip\',\'auth\',\'reg\') NOT NULL DEFAULT \'static_ip\'',
'ALTER TABLE predefined_carriers ADD COLUMN trunk_type ENUM(\'static_ip\',\'auth\',\'reg\') NOT NULL DEFAULT \'static_ip\'',
'CREATE INDEX idx_sip_gateways_inbound_carrier ON sip_gateways (inbound,voip_carrier_sid)',
] ]
}; };