Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
bandwidth-iris
Advanced tools
NodeJs Client library for IRIS / BBS API
This SDK stable for node versions 7 and above
Version | Support Level |
---|---|
<7 | Unsupported |
7.* | Supported |
8.* | Supported |
9.* | Supported |
10.4.1 | Supported |
Version | Notes |
---|---|
1.0.1 | Fixed issue with https://dashboard.bandwidth.com/api/tns not properly redirecting when not given query params |
Run
npm install bandwidth-iris
var iris = require("bandwidth-iris");
//Using client directly
var client = new iris.Client("accountId", "userName", "password");
iris.Site.list(client, function(err, sites){...});
//Or you can use default client instance (do this only once)
iris.Client.globalOptions.accountId = "accountId";
iris.Client.globalOptions.userName = "userName";
iris.Client.globalOptions.password = "password";
//Now you can call any functions without first arg 'client'
iris.Site.list(function(err, sites){
//Default client will be used to do this call
});
There is an 'examples' folder in the source tree that shows how each of the API objects work with simple example code. To run the examples:
$ cd examples
$ cp config.js.example config.js
Edit the config.js to match your IRIS credentials and run the examples individually. e.g.
node coveredRateCenters-sample.js
If the examples take command line parameters, you will get the usage by just executing the individual script.
When fetching objects from the API, it will always return an object that has the client instantiated so that you can call dependent methods as well as update, delete.
Example:
iris.Site.create({siteObject}, function(err,item){
console.log("the site ID is: " + item.id);
item.delete(function(err,res){ //no need to pass the client again
});
});
Each entity has a get, list, create, update and delete method if appropriate.
All properties are camel-cased for Javascript readability, and are converted on the fly to the proper case by the internals of the API when converted to XML.
iris.AvailableNumbers.list(query, callback);
iris.AvailableNpaNxx.list({areaCode:"818", quantity:5}, callback);
iris.City.list({"available":true, "state":"CA"}, callback);
iris.CoveredRateCenter.list({"zip":"27601"}, callback);
Retrieves a list of disconnected numbers for an account
iris.DiscNumber.list({"areaCode":"919"}, callback);
The Disconnect object is used to disconnect numbers from an account. Creates a disconnect order that can be tracked
iris.Disconnect.create("Disconnect Order Name", ["9195551212", "9195551213"], callback);
iris.Disconnect.get("orderId", {tnDetail:true}, callback);
var note = {userId: "my id", description: "Test"};
iris.Disconnect.get("orderId", {tnDetail:true}, function(err,order){
order.addNote(note, callback);
});
iris.Disconnect.get("orderId", {tnDetail:true}, function(err,order){
order.getNotes(callback);
});
var dlda = {
customerOrderId:"Your Order Id",
dldaTnGroups: [
dldaTnGroup: {
telephoneNumbers: ["9195551212"],
subscriberType: "RESIDENTIAL",
listingType: "LISTED",
listingName:{
firstName:"John",
lastName:"Smith"
},
listAddress:true,
address:{
houseNumber: "123",
streetName: "Elm",
streetSuffix: "Ave",
city: "Carpinteria",
stateCode:"CA",
zip:"93013",
addressType: "DLDA"
}
}
]
}
iris.Dlda.create(dlda, callback);
iris.Dlda.get(id, callback);
iris.Dlda.get(id, function(err,dlda){
dlda.getHistory(callback);
});
iris.Dlda.list({telephoneNumber:"9195551212"}, callback);
This path is generally not available to Bandwidth accounts, and as such is not documented in this API
iris.InServiceNumber.list({"areaCode":"919"}, callback);
iris.InServiceNumber.get("9195551212", callback);
var data = {
customerOrderId:"A test order",
lidbTnGroups:{
lidbTnGroup:{
telephoneNumbers:["8048030097", "8045030098"],
subscriberInformation:"Joes Grarage",
useType: "RESIDENTIAL",
visibility: "PUBLIC"
}
}
}
iris.Lidbs.create(data, callback);
iris.Lidbs.get(id, callback);
iris.Lidbs.list({telephoneNumber:"9195551212"}, callback);
var numbers = ["9195551212", "9195551213"];
var fullCheck = true;
iris.LnpChecker.check(numbers, fullCheck, callback);
var data = {
pon:"Some Pon",
customerOrderId: "MyId5",
sPID:"123C",
billingTelephoneNumber:"9192381468",
requestedFocDate: "2015-11-15",
authorizingPerson: "Jim Hopkins",
subscriber:{
subscriberType:"BUSINESS",
businessName:"BusinessName",
serviceAddress: {
houseNumber:"11",
streetName: "Park",
streetSuffix: "Ave",
city:"New York",
stateCode: "NY",
zip: "90025"
},
accountNumber:"123463",
pinNumber:"1231"
},
listOfTelephoneNumbers: {
telephoneNumber:["9192381848", "9192381467"]
}
};
iris.LsrOrder.create(data, callback);
iris.LsrOrder.get(id, callback);
iris.LsrOrder.list({pon:"Some Pon"}, callback);
iris.LsrOrder.get("id", function(err, order){
order.requestedFocDate = "2015-11-16";
iris.LsrOrder.update(order, callback);
})
iris.LsrOrder.get("id", function(err, order){
order.getHistory(callback);
});
iris.LsrOrder.get("id", function(err,order){
order.getNotes(callback);
});
var note = {userId: "my id", description: "Test"};
iris.LsrOrder.get("id", function(err, order){
order.addNote(note, callback);
});
var order = {
name:"A Test Order",
siteId: 1111,
existingTelephoneNumberOrderType: {
telephoneNumberList:[
{
telephoneNumber:"9195551212"
}
]
}
};
iris.Order.create(order, callback);
iris.Order.get(id, callback);
iris.Order.list(query, callback);
iris.Order.get(id, function(err, order){
order.getAreaCodes(callback);
});
// get Area Codes
order.getAreaCodes(callback);
// add note to order
var note = {userId: "my id", description: "Test"};
order.addNote(note,callback);
//get Npa Nxxs
order.getNpaNxx(callback);
// get number totals
order.getTotals(callback);
// get all Tns for an order
order.getTns(callback)
// get order history
order.getHistory(callback);
// get order notes
order.getNotes(callback);
var data = {
siteId:1234,
peerId:5678,
billingTelephoneNumber: "9195551212",
subscriber: {
subscriberType: "BUSINESS",
businessName: "Company",
serviceAddress: {
houseNumber: "123",
streetName: "EZ Street",
city: "Raleigh",
stateCode: "NC",
county: "Wake"
}
},
loaAuthorizingPerson: "Joe Blow",
listOfPhoneNumbers: {
phoneNumber:["9195551212"]
},
billingType: "PORTIN"
};
iris.PortIn.create(data, callback);
iris.PortIn.get("id", callback)
var query = {pon:"a pon"};
iris.PortIn.list(query, function(err, list){
console.log(JSON.stringify(list));
});
// fetch instance using PortIn.get(callback, portIn)
portIn.update(data, callback);
portIn.delete(callback);
portIn.getAreaCodes(callback);
portIn.getNpaNxx(callback);
portIn.getTotals(callback);
portIn.getTns(callback);
portIn.getNotes(callback);
portIn.addNote(callback);
portIn.getActivationStatus(callback);
iris.PortIn.get("id", function(err, portIn){
// Add File
portIn.createFile(fs.createReadStream("myFile.txt"), callback);
// Update File
portIn.updateFile("myFile.txt", fs.createReadStream("myFile.txt"), callback);
// Get File
portIn.getFile("myFile.txt", callback);
// Get File Metadata
portIn.getFileMetadata("myFile.txt", callback);
// Get Files
portIn.getFiles(callback);
});
var query = {"status":"complete"}
iris.PortOut.list(query, callback);
iris.PortOut.get(id, callback);
var query = {"available":true, "state":"CA"}
iris.RateCenter.list(query, callback);
var data = {
peerName:"A New SIP Peer",
isDefaultPeer:false,
shortMessagingProtocol:"SMPP",
siteId:selectedSite,
voiceHosts:[
{
host:{
hostName:"1.1.1.1"
}
}
],
smsHosts:[
{
host:{
hostName:"1.1.1.1"
}
}
],
terminationHosts:[
{
terminationHost:{
hostName:"1.1.1.1",
port:5060,
}
}
]
};
iris.SipPeer.create(data, callback);
iris.SipPeer.get("id", callback);
iris.SipPeer.list(siteId, callback);
iris.SipPeer.get(function(err, sipPeer){
sipPeer.delete(callback);
});
iris.SipPeer.get(function(err,sipPeer){
// get TN for this peer
sipPeer.getTns(number, callback);
// get all TNs for this peer
sipPeer.getTns(callback);
// Update TNs for this peer
var tns = {fullNumber: "123456", rewriteUser: "test"};
sipPeer.updateTns(number, tns, callback);
// Move Tns to new peer
var numbersToMove = ["9195551212", "9195551213"];
sipPeer.moveTns(numbersToMove, callback);
});
A site is what is called Location in the web UI.
var site = {
name:"A new site",
description:"A new description",
address:{
houseNumber: "123",
streetName: "Anywhere St",
city: "Raleigh",
stateCode:"NC",
zip: "27609",
addressType: "Service"
}
};
iris.Site.create(site, callback);
site.name = "Some new name";
site.update(site, callback);
site.delete(callback);
iris.Site.list(callback);
iris.Site.get(id, function(err,site){
// getInService numbers
site.getInserviceNumbers(query, callback);
// get Orders
site.getOrders(query, callback);
// get PortIns
site.getPortIns(query, callback);
// get Total Tns
site.getTotalTns(query, callback);
});
iris.Site.get(id, function(err,site){
// get Sip Peers
site.getSipPeers(callback);
// get Sip Peer
site.getSipPeer(id, callback);
// create Sip Peer
var sipPeer = {name:"SIP Peer"};
site.createSipPeer(sipPeer, callback);
});
var subscription = {
orderType:"orders",
callbackSubcription: {
url:"http://mycallbackurl.com",
user:"userid",
expiry: 12000
}
};
iris.Subscription.create(subscription, callback);
iris.Subscription.get(id, callback);
iris.Subscription.list(query, callback);
iris.Subscription.get(id, function(err, subscription){
// update subscription
var updatedData = {orderType:"portins"};
subscription.update(updatedData, callback)
// delete subscription
subscription.delete(callback);
});
iris.Tn.get(fullNumber, callback);
iris.Tn.list(query, callback);
iris.Tn.get(fullNumber, function(err, tn){
// Get TN Details
tn.getTnDetails(callback);
// Get Sites
tn.getSites(callback);
// Get Sip Peers
tn.getSipPeers(callback);
// Get Rate Center
tn.getRateCenter(callback)
});
iris.TnReservation.create({"reservedTn":"9195551212"}, callback);
iris.TnReservation.get(id, callback);
iris.TnReservation.get(id, function(err, tn){
tn.delete(callback);
});
FAQs
NodeJs Client library for IRIS / BBS API
We found that bandwidth-iris demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.