Skip to main content

Numbers

Numbers ⇐ APIClient

Use Fonoster Numbers, a capability of Fonoster SIP Proxy subsystem, to create, update, get and delete numbers. Fonoster Numbers requires of a running Fonoster deployment.

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

new Numbers(options)

Constructs a new Numbers object.

ParamTypeDescription
optionsClientOptionsOptions to indicate the objects endpoint

Example

const Fonoster = require("@fonoster/sdk");
const numbers = new Fonoster.Numbers();

const request = {
providerRef: "516f1577bcf86cd797439012",
e164Number: "+17853177343",
ingressInfo: {
webhook: "https://webhooks.acme.com/hooks"
}
};

numbers.createNumber(request)
.then(result => {
console.log(result) // successful response
}).catch(e => console.error(e)); // an error occurred

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

Creates a new Number on the SIP Proxy subsystem.

Kind: instance method of Numbers
Note: You can only provider an aorLink or an ingressInfo but no both

ParamTypeDescription
requestCreateNumberRequestRequest for the provision of a new Number
request.providerRefstringIdenfier to the Provider this Number belongs with
request.e164NumberstringA valid number @ Provider
request.aorLinkstringAn AOR where ingress calls will be directed to
request.ingressInfostringWebhook to connect call to

Example

const request = {
providerRef: "516f1577bcf86cd797439012",
e164Number: "+17853177343",
aorLink: "sip:1001@sip.local"
};

numbers.createNumber(request)
.then(result => {
console.log(result) // returns the CreateNumberResponse interface
}).catch(e => console.error(e)); // an error occurred

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

Retrives a Number by its reference.

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

  • if ref is null or Number does not exist
ParamTypeDescription
refstringReference to Number

Example

numbers.getNumber(ref)
.then(result => {
console.log(result) // returns the GetNumberResponse object
}).catch(e => console.error(e)); // an error occurred

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

Update a Number at the SIP Proxy subsystem.

Kind: instance method of Numbers
Note: You can only provider an aorLink or an ingressApp but no both

ParamTypeDescription
requestUpdateNumberRequestRequest for the update of an existing Number
request.aorLinkstringAn AOR where ingress calls will be directed to
request.ingressInfostringA webhook to direct the call for flow control

Example

const request = {
ref: "516f1577bcf86cd797439012",
aorLink: "sip:1001@sip.local"
};

numbers.updateNumber(request)
.then(result => {
console.log(result) // returns the Number from the DB
}).catch(e => console.error(e)); // an error occurred

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

List the Numbers registered in Fonoster SIP Proxy subsystem.

Kind: instance method of Numbers
Returns: Promise.<ListNumbersResponse> - List of Numbers

ParamTypeDescription
requestListNumbersRequest
request.pageSizenumberNumber of element per page (defaults to 20)
request.pageTokenstringThe next_page_token value returned from a previous List request, if any

Example

const request = {
pageSize: 20,
pageToken: 2
};

numbers.listNumbers(request)
.then(() => {
console.log(result) // returns a ListNumbersResponse object
}).catch(e => console.error(e)); // an error occurred

numbers.deleteNumber(ref)

Deletes a Number from SIP Proxy subsystem.

Kind: instance method of Numbers

ParamTypeDescription
refstringReference to the Number

Example

const ref = "cb8V0CNTfH";

numbers.deleteNumber(ref)
.then(() => {
console.log("done") // returns an empty object
}).catch(e => console.error(e)) // an error occurred

numbers.getIngressInfo(request) ⇒ Promise.<GetIngressAppResponse>

Get the Ingress App for a given e164 number.

Kind: instance method of Numbers
Throws:

  • if the Number is not register in Fonoster
ParamTypeDescription
requestGetIngressAppRequest
request.e164NumberstringA number in E164 format for incomming calls

Example

const request = {
e164Number: "+17853178071"
};

numbers.getIngressApp(request)
.then(result => {
console.log(result) // returns the Application
}).catch(e => console.error(e)); // an error occurred