@routr/sdk
TypeScript icon, indicating that this package has built-in type declarations

2.11.2 • Public • Published

sdk

SDK for Routr Connect server

routr Version Downloads/week License

Installation

$ npm install --save @routr/sdk

APIs

ACL ⇐ APIClient

Use Routr ACL, a capability of Routr SIP Proxy, to create, update, get and delete Access Control Lists. The ACL API requires of a running Routr deployment.

Kind: global class
Extends: APIClient
See: module:core:APIClient

new ACL(options)

Constructs a new ACL API object.

Param Type Description
options ClientOptions Options to indicate the objects endpoint

Example

const SDK = require("@routr/sdk")
const acl = new SDK.ACL()

const request = {
  name: "Peer network",
  allow: "27.116.56.0/22",
  deny: "0.0.0.0/0"
}

acl.createACL(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

acL.createACL(request) ⇒ Promise.<CreateACLResponse>

Creates a new AccessControlList on Routr.

Kind: instance method of ACL
Returns: Promise.<CreateACLResponse> - The newly created AccessControlList
Throws:

  • if request is null
Param Type Description
request CreateACLRequest The request to create an ACL
request.name string Name of the ACL
request.allow Array.<string> List of IP addresses or CIDR blocks to allow
request.deny Array.<string> List of IP addresses or CIDR blocks to deny
request.extended Object Optional extended attributes

Example

const request = {
  name: "Peer network",
  allow: "27.116.56.0/22",
  deny: "0.0.0.0/0"
}

acl.createACL(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

acL.updateACL(request) ⇒ Promise.<UpdateACLResponse>

Updates an already existing AccessControlList on Routr.

Kind: instance method of ACL
Returns: Promise.<UpdateACLResponse> - The AccessControlList

Param Type Description
request UpdateACLRequest Partial with the fields to update
request.name string Name of the ACL
request.allow Array.<string> List of IP addresses or CIDR blocks to allow
request.deny Array.<string> List of IP addresses or CIDR blocks to deny
request.extended Object Optional extended attributes

Example

const request = {
  ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  name: "Peer network updated",
}

acl.updateACL(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

acL.getACL(ref) ⇒ Promise.<GetACLResponse>

Gets an AccessControlList from Routr.

Kind: instance method of ACL
Returns: Promise.<GetACLResponse> - The AccessControlList

Param Type Description
ref string The ACL reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

acl.getACL(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

acL.deleteACL(ref) ⇒ Promise.<void>

Deletes an AccessControlList from Routr.

Kind: instance method of ACL

Param Type Description
ref string The ACL reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

acl.deleteACL(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

acL.listACLs(request) ⇒ Promise.<ListACLResponse>

Lists all AccessControlLists from Routr with pagination.

Kind: instance method of ACL
Returns: Promise.<ListACLResponse> - The list of AccessControlLists

Param Type Description
request ListACLRequest The request to list ACLs
request.pageSize number The number of ACLs to return
request.pageToken string The page token to use for pagination

Example

const request = {
 pageSize: 10
}

acl.listACLs(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

Agents ⇐ APIClient

Use Routr Agents, a capability of Routr SIP Proxy, to create, update, get and delete Agents. The Agents API requires of a running Routr deployment.

Kind: global class
Extends: APIClient
See: module:core:APIClient

new Agents(options)

Constructs a new Agent API object.

Param Type Description
options ClientOptions Options to indicate the objects endpoint

Example

const SDK = require("@routr/sdk")
const agents = new SDK.Agents()

const request = {
  name: "Jonh Doe",
  username: "jdoe",
  privacy: Privacy.PRIVATE,
  domainRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  enabled: true,
  extended: {
    "key": "value"
  }
}

agents.createAgent(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

agents.createAgent(request) ⇒ Promise.<CreateAgentResponse>

Creates a new Agent on Routr.

Kind: instance method of Agents
Returns: Promise.<CreateAgentResponse> - The newly created Agent
Throws:

  • if request is null
Param Type Description
request CreateAgentRequest The request to create an Agent
request.name string Name of the Agent
request.username string Username of the Agent
request.privacy Privacy Privacy of the Agent (e.g., Privacy.PRIVATE)
request.domainRef string Domain reference of the Domain the Agent belongs to
request.credentialsRef string Credentials reference of the Credentials for the Agent
request.enabled boolean Whether the Agent is enabled or not (for future use)
request.extended Object Optional extended attributes

Example

const request = {
  name: "Jonh Doe",
  username: "jdoe",
  privacy: Privacy.PRIVATE,
  domainRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  enabled: true,
  extended: {
    "key": "value"
  }
}

agents.createAgent(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

agents.updateAgent(request) ⇒ Promise.<UpdateAgentResponse>

Updates an already existing Agent on Routr.

Kind: instance method of Agents
Returns: Promise.<UpdateAgentResponse> - The updated Agent

Param Type Description
request UpdateAgentRequest Partial with the fields to update
request.name string Name of the Agent
request.privacy Privacy Privacy of the Agent (e.g., Privacy.PRIVATE)
request.domainRef string Domain reference of the Domain the Agent belongs to
request.credentialsRef string Credentials reference of the Credentials for the Agent
request.enabled boolean Whether the Agent is enabled or not (for future use)
request.extended Object Optional extended attributes

Example

const request = {
  ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  name: "John D Doe",
  enabled: false
}

agents.updateAgent(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

agents.getAgent(ref) ⇒ Promise.<GetAgentResponse>

Gets an Agent from Routr.

Kind: instance method of Agents
Returns: Promise.<GetAgentResponse> - The Agent

Param Type Description
ref string The Agent's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

agents.getAgent(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

agents.deleteAgent(ref) ⇒ Promise.<void>

Deletes an Agent from Routr.

Kind: instance method of Agents

Param Type Description
ref string The Agent's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

agents.deleteAgent(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

agents.listAgents(request) ⇒ Promise.<ListAgentResponse>

Lists all Agents from Routr with pagination.

Kind: instance method of Agents
Returns: Promise.<ListAgentResponse> - The list of Agents in the current page

Param Type Description
request ListAgentRequest The request to list Agents
request.pageSize number The number of Agents to return
request.pageToken string The page token to use for pagination

Example

const request = {
 pageSize: 10
}

agents.listAgents(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

Credentials ⇐ APIClient

Use Routr Credentials, a capability of Routr SIP Proxy, to create, update, get and delete Credentials. The Credentials API requires of a running Routr deployment.

Kind: global class
Extends: APIClient
See: module:core:APIClient

new Credentials(options)

Constructs a new Credentials API object.

Param Type Description
options ClientOptions Options to indicate the objects endpoint

Example

const SDK = require("@routr/sdk")
const credentials = new SDK.Credentials()

const request = {
  name: "Credentials for John Doe",
  username: "jdoe",
  password: "123456",
  extended: {
    "key": "value"
  }
}

credentials.createCredentials(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

credentials.createCredentials(request) ⇒ Promise.<CreateCredentialsResponse>

Creates a new Credentials on Routr.

Kind: instance method of Credentials
Returns: Promise.<CreateCredentialsResponse> - The newly created Credentials
Throws:

  • if request is null
Param Type Description
request CreateCredentialsRequest The request to create an Credentials
request.name string The friendly name of the Credentials
request.username string Username of the Credentials
request.password string Password of the Credentials
request.extended Object Optional extended attributes

Example

const request = {
  name: "Credentials for John Doe",
  username: "jdoe",
  password: "123456",
  extended: {
    "key": "value"
  }
}

credentials.createCredentials(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

credentials.updateCredentials(request) ⇒ Promise.<UpdateCredentialsResponse>

Updates an already existing Credentials on Routr.

Kind: instance method of Credentials
Returns: Promise.<UpdateCredentialsResponse> - The updated Credentials

Param Type Description
request UpdateCredentialsRequest Partial with the fields to update
request.name string The friendly name of the Credentials
request.username string Username of the Credentials
request.password string Password of the Credentials
request.extended Object Optional extended attributes

Example

const request = {
  ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  name: "John Doe's Credentials"
}

credentials.updateCredentials(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

credentials.getCredentials(ref) ⇒ Promise.<GetCredentialsResponse>

Gets an Credentials from Routr.

Kind: instance method of Credentials
Returns: Promise.<GetCredentialsResponse> - The Credentials

Param Type Description
ref string The Credentials's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

credentials.getCredentials(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

credentials.deleteCredentials(ref) ⇒ Promise.<void>

Deletes an Credentials from Routr.

Kind: instance method of Credentials

Param Type Description
ref string The Credentials's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

credentials.deleteCredentials(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

credentials.listCredentials(request) ⇒ Promise.<ListCredentialsResponse>

Lists all Credentials from Routr with pagination.

Kind: instance method of Credentials
Returns: Promise.<ListCredentialsResponse> - The list of Credentials in the current page

Param Type Description
request ListCredentialsRequest The request to list Credentials
request.pageSize number The number of Credentials to return
request.pageToken string The page token to use for pagination

Example

const request = {
 pageSize: 10
}

credentials.listCredentials(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

Domains ⇐ APIClient

Use Routr Domains, a capability of Routr SIP Proxy, to create, update, get and delete Domains. The Domains API requires of a running Routr deployment.

Kind: global class
Extends: APIClient
See: module:core:APIClient

new Domains(options)

Constructs a new Domain API object.

Param Type Description
options ClientOptions Options to indicate the objects endpoint

Example

const SDK = require("@routr/sdk")
const domains = new SDK.Domains()

const request = {
  name: "Local domain",
  domainUri: "sip.local",
  accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  egressPolicies: [{
    rule: ".*",
    numberRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
  }],
  extended: {
    "key": "value"
  }
}

domains.createDomain(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

domains.createDomain(request) ⇒ Promise.<CreateDomainResponse>

Creates a new Domain on Routr.

Kind: instance method of Domains
Returns: Promise.<CreateDomainResponse> - The newly created Domain
Throws:

  • if request is null
Param Type Description
request CreateDomainRequest The request to create an Domain
request.name string Name of the Domain
request.domainUri string The FQDN of the Domain
request.accessControlListRef string The reference to the AccessControlList for the Domain
request.egressPolicies Array.<CC.EgressPolicy> The list of EgressPolicies for the Domain
request.extended string Optional extended attributes

Example

const request = {
  name: "Local domain",
  domainUri: "sip.local",
  accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  egressPolicies: [{
    rule: ".*",
    numberRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
  }],
  extended: {
    "key": "value"
  }
}

domains.createDomain(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

domains.updateDomain(request) ⇒ Promise.<UpdateDomainResponse>

Updates an already existing Domain on Routr.

Kind: instance method of Domains
Returns: Promise.<UpdateDomainResponse> - The updated Domain

Param Type Description
request UpdateDomainRequest Partial with the fields to update
request.name string Name of the Domain
request.accessControlListRef string The reference to the AccessControlList for the Domain
request.egressPolicies Array.<CC.EgressPolicy> The list of EgressPolicies for the Domain
request.extended string Optional extended attributes

Example

const request = {
  name: "Local domain updated",
  accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
}

domains.updateDomain(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

domains.getDomain(ref) ⇒ Promise.<GetDomainResponse>

Gets a Domain from Routr.

Kind: instance method of Domains
Returns: Promise.<GetDomainResponse> - The Domain

Param Type Description
ref string The Domain's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

domains.getDomain(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

domains.deleteDomain(ref) ⇒ Promise.<void>

Deletes a Domain from Routr.

Kind: instance method of Domains

Param Type Description
ref string The Domain's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

domains.deleteDomain(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

domains.listDomains(request) ⇒ Promise.<ListDomainResponse>

Lists all Domains from Routr with pagination.

Kind: instance method of Domains
Returns: Promise.<ListDomainResponse> - The list of Domains

Param Type Description
request ListDomainRequest The request to list Domains
request.pageSize number The number of Domains to return
request.pageToken string The page token to use for pagination

Example

const request = {
  pageSize: 10
}

domains.listDomains(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

Numbers ⇐ APIClient

Use Routr Numbers, a capability of Routr SIP Proxy, to create, update, get and delete Numbers. The Number API requires of a running Routr deployment.

Kind: global class
Extends: APIClient
See: module:core:APIClient

new Numbers(options)

Constructs a new Number API object.

Param Type Description
options ClientOptions Options to indicate the objects endpoint

Example

const SDK = require("@routr/sdk")
const numbers = new SDK.Numbers()

const request = {
  name: "(415) 555-1212",
  telUrl: "teL:+14155551212",
  trunkRef: "6f941c63-880c-419a-a72a-4a107cbaf5c5",
  aorLink: "sip:100@sip.local",
  city: "San Francisco",
  country: "United States",
  countryISOCode: "US",
  sessionAffinityHeader: "X-Room-Id"
  extraHeaders: [{
    name: "X-Room-Id",
    value: "abc-us-123"
  }],
  extended: {
    "key": "value"
  }
}

numbers.createNumber(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

numbers.createNumber(request) ⇒ Promise.<CreateNumberResponse>

Creates a new Number on Routr.

Kind: instance method of Numbers
Returns: Promise.<CreateNumberResponse> - The newly created Number
Throws:

  • if request is null
Param Type Description
request CreateNumberRequest The request to create an Number
request.name string Name of the Number
request.telUrl string The number URI to be used (e.g., te:+1234567890)
request.aorLink string The AOR link to be used (e.g., sip:1001@sip.local)
request.city string The city where the number is located
request.country string The country where the number is located
request.countryISOCode string The country ISO code where the number is located
request.extraHeaders Array.<JsonObject> Extra headers to be used (e.g., [{name: "X-Room-Id", value: "abc-us-123"}])
request.trunkRef string The Trunk reference to be used
request.sessionAffinityHeader string Optional session affinity header
request.extended string Optional extended attributes

Example

const request = {
  name: "(415) 555-1212",
  telUrl: "teL:+14155551212",
  trunkRef: "6f941c63-880c-419a-a72a-4a107cbaf5c5",
  aorLink: "sip:100@sip.local",
  city: "San Francisco",
  country: "United States",
  countryISOCode: "US",
  sessionAffinityHeader: "X-Room-Id"
  extraHeaders: [{
    name: "X-Room-Id",
    value: "abc-us-123"
  }],
  extended: {
    "key": "value"
  }
}

numbers.createNumber(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

numbers.updateNumber(request) ⇒ Promise.<UpdateNumberResponse>

Updates an already existing Number on Routr.

Kind: instance method of Numbers
Returns: Promise.<UpdateNumberResponse> - The updated Number

Param Type Description
request UpdateNumberRequest Partial with the fields to update
request.name string Name of the Number
request.aorLink string The AOR link to be used (e.g., sip:1001@sip.local)
request.extraHeaders Array.<JsonObject> Extra headers to be used (e.g., [{name: "X-Room-Id", value: "abc-us-123"}])
request.trunkRef string The Trunk reference to be used
request.sessionAffinityHeader string Optional session affinity header
request.extended string Optional extended attributes

Example

const request = {
  name: "(415) 555-1212 (friendly name)",
  aorLink: "sip:2001@sip.local"
}

numbers.updateNumber(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

numbers.getNumber(ref) ⇒ Promise.<GetNumberResponse>

Gets a Number from Routr.

Kind: instance method of Numbers
Returns: Promise.<GetNumberResponse> - The Number

Param Type Description
ref string The Number's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

numbers.getNumber(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

numbers.deleteNumber(ref) ⇒ Promise.<void>

Deletes a Number from Routr.

Kind: instance method of Numbers

Param Type Description
ref string The Number's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

numbers.deleteNumber(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

numbers.listNumbers(request) ⇒ Promise.<ListNumberResponse>

Lists all Numbers from Routr with pagination.

Kind: instance method of Numbers
Returns: Promise.<ListNumberResponse> - The list of Numbers

Param Type Description
request ListNumberRequest The request to list Numbers
request.pageSize number The number of Numbers to return
request.pageToken string The page token to use for pagination

Example

const request = {
 pageSize: 10
}

numbers.listNumbers(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

Peers ⇐ APIClient

Use Routr Peers, a capability of Routr SIP Proxy, to create, update, get and delete Peers. The Peers API requires of a running Routr deployment.

Kind: global class
Extends: APIClient
See: module:core:APIClient

new Peers(options)

Constructs a new Peer API object.

Param Type Description
options ClientOptions Options to indicate the objects endpoint

Example

const SDK = require("@routr/sdk")
const peers = new SDK.Peers()

const request = {
  name: "Asterisk Conference Server",
  username: "conference",
  aor: "sip:conference@sip.local",
  contactAddr: "10.0.0.1:5060",
  accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  balancingAlgorithm: LoadBalancingAlgorithm.LEAST_SESSIONS,
  withSessionAffinity: true,
  enabled: true,
  extended: {
    "key": "value"
  }
}

peers.createPeer(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

peers.createPeer(request) ⇒ Promise.<CreatePeerResponse>

Creates a new Peer on Routr.

Kind: instance method of Peers
Returns: Promise.<CreatePeerResponse> - The newly created Peer
Throws:

  • if request is null
Param Type Description
request CreatePeerRequest The request to create an Peer
request.name string Name of the Peer
request.aor string Address of Record of the Peer
request.contactAddr string Optional contact address of the Peer
request.accessControlListRef string Access Control List reference of the Peer
request.credentialsRef string Credentials reference of the Credentials for the Peer
request.balancingAlgorithm LoadBalancingAlgorithm Optional balancing algorithm for the Peer (defaults to "round-robin")
request.withSessionAffinity boolean Whether the Peer has session affinity or not (defaults to false)
request.enabled boolean Whether the Peer is enabled or not (for future use)
request.extended Object Optional extended attributes

Example

const request = {
  name: "Asterisk Conference Server",
  username: "conference",
  aor: "sip:conference@sip.local",
  contactAddr: "10.0.0.1:5060",
  accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  balancingAlgorithm: LoadBalancingAlgorithm.LEAST_SESSIONS,
  withSessionAffinity: true,
  enabled: true,
  extended: {
    "key": "value"
  }
}

peers.createPeer(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

peers.updatePeer(request) ⇒ Promise.<UpdatePeerResponse>

Updates an already existing Peer on Routr.

Kind: instance method of Peers
Returns: Promise.<UpdatePeerResponse> - The updated Peer

Param Type Description
request UpdatePeerRequest Partial with the fields to update
request.name string Name of the Peer
request.aor string Address of Record of the Peer
request.contactAddr string Optional contact address of the Peer
request.accessControlListRef string Access Control List reference of the Peer
request.credentialsRef string Credentials reference of the Credentials for the Peer
request.balancingAlgorithm LoadBalancingAlgorithm Optional balancing algorithm for the Peer (defaults to "round-robin")
request.withSessionAffinity boolean Whether the Peer has session affinity or not (defaults to false)
request.enabled boolean Whether the Peer is enabled or not (for future use)
request.extended Object Optional extended attributes

Example

const request = {
  ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  name: "Feature Server"
}

peers.updatePeer(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

peers.getPeer(ref) ⇒ Promise.<GetPeerResponse>

Gets an Peer from Routr.

Kind: instance method of Peers
Returns: Promise.<GetPeerResponse> - The Peer

Param Type Description
ref string The Peer's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

peers.getPeer(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

peers.deletePeer(ref) ⇒ Promise.<void>

Deletes an Peer from Routr.

Kind: instance method of Peers

Param Type Description
ref string The Peer's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

peers.deletePeer(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

peers.listPeers(request) ⇒ Promise.<ListPeerResponse>

Lists all Peers from Routr with pagination.

Kind: instance method of Peers
Returns: Promise.<ListPeerResponse> - The list of Peers in the current page

Param Type Description
request ListPeerRequest The request to list Peers
request.pageSize number The number of Peers to return
request.pageToken string The page token to use for pagination

Example

const request = {
 pageSize: 10
}

peers.listPeers(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

Trunks ⇐ APIClient

Use Routr Trunks, a capability of Routr SIP Proxy, to create, update, get and delete Trunks. The Trunks API requires of a running Routr deployment.

Kind: global class
Extends: APIClient
See: module:core:APIClient

new Trunks(options)

Constructs a new Trunk API object.

Param Type Description
options ClientOptions Options to indicate the objects endpoint

Example

const SDK = require("@routr/sdk")
const trunks = new SDK.Trunks()

const request = {
  name: "Trunk from Twilio",
  inboundUri: "sip:twilio.sip.acme.io",
  accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  inboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  outboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  uris: [{
    host: "acme.sip.twilio.com",
    port: 5060,
    transport: "udp",
    user: "AC1234567890",
    weight: 1,
    priority: 1
  }],
  extended: {
    "key": "value"
  }
}

trunks.createTrunk(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

trunks.createTrunk(request) ⇒ Promise.<CreateTrunkResponse>

Creates a new Trunk on Routr.

Kind: instance method of Trunks
Returns: Promise.<CreateTrunkResponse> - The newly created Trunk
Throws:

  • if request is null
Param Type Description
request CreateTrunkRequest The request to create an Trunk
request.name string Name of the Trunk
request.inboundUri string Inbound URI of the Trunk
request.accessControlListRef string Access Control List reference
request.inboundCredentialsRef string The reference of the inbound credentials
request.outboundCredentialsRef string The reference of the outbound credentials
request.uris Array.<TrunkURI> The outbound URIs of the Trunk

Example

const request = {
  name: "Trunk from Twilio",
  inboundUri: "sip:twilio.sip.acme.io",
  accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  inboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  outboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  uris: [{
    host: "acme.sip.twilio.com",
    port: 5060,
    transport: "udp",
    user: "AC1234567890",
    weight: 1,
    priority: 1
  }],
  extended: {
    "key": "value"
  }
}

trunks.createTrunk(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

trunks.updateTrunk(request) ⇒ Promise.<UpdateTrunkResponse>

Updates an already existing Trunk on Routr.

Kind: instance method of Trunks
Returns: Promise.<UpdateTrunkResponse> - The updated Trunk

Param Type Description
request UpdateTrunkRequest Partial with the fields to update
request.name string Name of the Trunk
request.inboundUri string Inbound URI of the Trunk
request.accessControlListRef string Access Control List reference
request.inboundCredentialsRef string The reference of the inbound credentials
request.outboundCredentialsRef string The reference of the outbound credentials
request.uris Array.<TrunkURI> The outbound URIs of the Trunk
request.extended Object Optional extended attributes

Example

const request = {
  ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
  name: "Trunk from Twilio (US-East)",
}

trunks.updateTrunk(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

trunks.getTrunk(ref) ⇒ Promise.<GetTrunkResponse>

Gets an Trunk from Routr.

Kind: instance method of Trunks
Returns: Promise.<GetTrunkResponse> - The Trunk

Param Type Description
ref string The Trunk's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

trunks.getTrunk(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

trunks.deleteTrunk(ref) ⇒ Promise.<void>

Deletes an Trunk from Routr.

Kind: instance method of Trunks

Param Type Description
ref string The Trunk's reference

Example

const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"

trunks.deleteTrunk(ref)
  .then(console.log)
  .catch(console.error)   // an error occurred

trunks.listTrunks(request) ⇒ Promise.<ListTrunkResponse>

Lists all Trunks from Routr with pagination.

Kind: instance method of Trunks
Returns: Promise.<ListTrunkResponse> - The list of Trunks in the current page

Param Type Description
request ListTrunkRequest The request to list Trunks
request.pageSize number The number of Trunks to return
request.pageToken string The page token to use for pagination

Example

const request = {
 pageSize: 10
}

trunks.listTrunks(request)
  .then(console.log)
  .catch(console.error)   // an error occurred

Readme

Keywords

none

Package Sidebar

Install

npm i @routr/sdk

Weekly Downloads

24

Version

2.11.2

License

MIT

Unpacked Size

152 kB

Total Files

51

Last publish

Collaborators

  • fonoster-oss