SDK for Routr Connect server
$ npm install --save @routr/sdk
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
-
Acls ⇐
APIClient
- new Acls(options)
-
.createAcl(request) ⇒
Promise.<CreateAclResponse>
-
.updateAcl(request) ⇒
Promise.<UpdateAclResponse>
-
.getAcl(ref) ⇒
Promise.<GetAclResponse>
-
.deleteAcl(ref) ⇒
Promise.<void>
-
.listAcls(request) ⇒
Promise.<ListAclResponse>
Constructs a new API object.
Param | Type | Description |
---|---|---|
options | ClientOptions |
Options to indicate the objects endpoint |
Example
const SDK = require("@routr/sdk")
const acl = new SDK.Acls()
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
Creates a new AccessControlList on Routr.
Kind: instance method of Acls
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
Updates an already existing AccessControlList on Routr.
Kind: instance method of Acls
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
Gets an AccessControlList from Routr.
Kind: instance method of Acls
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
Deletes an AccessControlList from Routr.
Kind: instance method of Acls
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
Lists all AccessControlLists from Routr with pagination.
Kind: instance method of Acls
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
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
-
Agents ⇐
APIClient
- new Agents(options)
-
.createAgent(request) ⇒
Promise.<CreateAgentResponse>
-
.updateAgent(request) ⇒
Promise.<UpdateAgentResponse>
-
.getAgent(ref) ⇒
Promise.<GetAgentResponse>
-
.deleteAgent(ref) ⇒
Promise.<void>
-
.listAgents(request) ⇒
Promise.<ListAgentResponse>
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
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
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
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
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
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
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
-
Credentials ⇐
APIClient
- new Credentials(options)
-
.createCredentials(request) ⇒
Promise.<CreateCredentialsResponse>
-
.updateCredentials(request) ⇒
Promise.<UpdateCredentialsResponse>
-
.getCredentials(ref) ⇒
Promise.<GetCredentialsResponse>
-
.deleteCredentials(ref) ⇒
Promise.<void>
-
.listCredentials(request) ⇒
Promise.<ListCredentialsResponse>
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
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
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
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
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
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
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
-
Domains ⇐
APIClient
- new Domains(options)
-
.createDomain(request) ⇒
Promise.<CreateDomainResponse>
-
.updateDomain(request) ⇒
Promise.<UpdateDomainResponse>
-
.getDomain(ref) ⇒
Promise.<GetDomainResponse>
-
.deleteDomain(ref) ⇒
Promise.<void>
-
.listDomains(request) ⇒
Promise.<ListDomainResponse>
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
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.<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
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.<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
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
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
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
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
-
Numbers ⇐
APIClient
- new Numbers(options)
-
.createNumber(request) ⇒
Promise.<CreateNumberResponse>
-
.updateNumber(request) ⇒
Promise.<UpdateNumberResponse>
-
.getNumber(ref) ⇒
Promise.<GetNumberResponse>
-
.deleteNumber(ref) ⇒
Promise.<void>
-
.listNumbers(request) ⇒
Promise.<ListNumberResponse>
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:[email protected]",
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
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:[email protected]) |
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 |
Array.<{name: string, value: string}> |
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:[email protected]",
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
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:[email protected]) |
request.extraHeaders | Array.<{name: string, value: string}> |
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:[email protected]"
}
numbers.updateNumber(request)
.then(console.log)
.catch(console.error) // an error occurred
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
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
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
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
-
Peers ⇐
APIClient
- new Peers(options)
-
.createPeer(request) ⇒
Promise.<CreatePeerResponse>
-
.updatePeer(request) ⇒
Promise.<UpdatePeerResponse>
-
.getPeer(ref) ⇒
Promise.<GetPeerResponse>
-
.deletePeer(ref) ⇒
Promise.<void>
-
.listPeers(request) ⇒
Promise.<ListPeerResponse>
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:[email protected]",
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
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:[email protected]",
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
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
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
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
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
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
-
Trunks ⇐
APIClient
- new Trunks(options)
-
.createTrunk(request) ⇒
Promise.<CreateTrunkResponse>
-
.updateTrunk(request) ⇒
Promise.<UpdateTrunkResponse>
-
.getTrunk(ref) ⇒
Promise.<GetTrunkResponse>
-
.deleteTrunk(ref) ⇒
Promise.<void>
-
.listTrunks(request) ⇒
Promise.<ListTrunkResponse>
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
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
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
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
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
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