mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
major merge of features from the hosted branch that was created temporarily during the initial launch of jambonz.org
117 lines
2.0 KiB
JavaScript
117 lines
2.0 KiB
JavaScript
const Model = require('./model');
|
|
const {promisePool} = require('../db');
|
|
const retrieveSql = 'SELECT * from voip_carriers vc WHERE vc.account_sid = ?';
|
|
const retrieveSqlForSP = 'SELECT * from voip_carriers vc WHERE vc.service_provider_sid = ?';
|
|
|
|
|
|
class VoipCarrier extends Model {
|
|
constructor() {
|
|
super();
|
|
}
|
|
static async retrieveAll(account_sid) {
|
|
if (!account_sid) return super.retrieveAll();
|
|
const [rows] = await promisePool.query(retrieveSql, account_sid);
|
|
return rows;
|
|
}
|
|
static async retrieveAllForSP(service_provider_sid) {
|
|
const [rows] = await promisePool.query(retrieveSqlForSP, service_provider_sid);
|
|
return rows;
|
|
}
|
|
}
|
|
|
|
VoipCarrier.table = 'voip_carriers';
|
|
VoipCarrier.fields = [
|
|
{
|
|
name: 'voip_carrier_sid',
|
|
type: 'string',
|
|
primaryKey: true
|
|
},
|
|
{
|
|
name: 'name',
|
|
type: 'string',
|
|
required: true
|
|
},
|
|
{
|
|
name: 'description',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'account_sid',
|
|
type: 'string',
|
|
},
|
|
{
|
|
name: 'service_provider_sid',
|
|
type: 'string',
|
|
},
|
|
{
|
|
name: 'application_sid',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'e164_leading_plus',
|
|
type: 'number'
|
|
},
|
|
{
|
|
name: 'requires_register',
|
|
type: 'number'
|
|
},
|
|
{
|
|
name: 'register_username',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'register_sip_realm',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'register_password',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'tech_prefix',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'inbound_auth_username',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'inbound_auth_password',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'diversion',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'is_active',
|
|
type: 'number'
|
|
},
|
|
{
|
|
name: 'smpp_system_id',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'smpp_password',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'smpp_inbound_system_id',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'smpp_inbound_password',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'smpp_enquire_link_interval',
|
|
type: 'number'
|
|
},
|
|
{
|
|
name: 'smpp_system_id',
|
|
type: 'string'
|
|
},
|
|
];
|
|
|
|
module.exports = VoipCarrier;
|