https://github.com/fivepoint-0/ociconnection
This is a library to help connect to a Broadsoft Application Server running the OCI-Provisioning XML-based API (Open Client Interface – Provisioning). With this library, you instantiate it by creating an OCIConnection instance in your code.
https://github.com/fivepoint-0/ociconnection
broadsoft ocip typescript-library xml
Last synced: 9 months ago
JSON representation
This is a library to help connect to a Broadsoft Application Server running the OCI-Provisioning XML-based API (Open Client Interface – Provisioning). With this library, you instantiate it by creating an OCIConnection instance in your code.
- Host: GitHub
- URL: https://github.com/fivepoint-0/ociconnection
- Owner: fivepoint-0
- Created: 2020-09-24T18:36:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-24T20:56:57.000Z (over 2 years ago)
- Last Synced: 2025-09-14T22:36:10.356Z (9 months ago)
- Topics: broadsoft, ocip, typescript-library, xml
- Language: TypeScript
- Homepage:
- Size: 384 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Welcome to the Broadsoft OCI Application Server Helper Class!
## Changes:
### 1.1.1: adding dist for 1.1.0
### 1.1.0: fixing sentenceToCamelCase function to work on words that are uppercase acronyms like MAC and converts them to i.e. mac instead of mAC
### .1.0: fixing sentenceToCamelCase function to work on words that are uppercase acronyms like MAC and converts them to i.e. mac instead of mAC
### .1.0: fixing sentenceToCamelCase function to work on words that are uppercase acronyms like MAC and converts them to i.e. mac instead of mAC
### 1.0.39: Making host property public
### 1.0.38: Changing sessionId code. The sessionId does not appear to be showing up in debug.
### 1.0.37: Fixing completeData. Thinking about changing XML parsers.
### 1.0.36: Attempt to fix log in OCIConnection class (3)
### 1.0.35: Attempt to fix log in OCIConnection class (2)
### 1.0.34: Attempt to fix log in OCIConnection class
### 1.0.33: Nothing much changed.
### 1.0.32: Added logging next to debug in the constructor
### 1.0.31: Fixed output type for OCIConnection.command()
### 1.0.30: Changing xml2js function to get rid of saxjs error
### 1.0.29: Fixing SAX-JS error with text root outside of node showing up
### 1.0.28: testing new method for xml helper
### 1.0.27: Fixed isError function again
### 1.0.26: Added extra check on the isError function
### 1.0.25: No changes to code
### 1.0.: No changes to code
### 1.0.24: No code changes for patch 24
### 1.0.23: No code changes for patch 23
### 1.0.22: Now building project automatically before publishing.
### 1.0.21: Built project.
### 1.0.20: No breaking changes yet. Had to update the isError function.
### 1.0.19: Added debug function to OCIConnection class. The next version will be a breaking change.
Changelog:
- Added `setDebug(boolean)` function to the OCIConenction class. This will output the command XML and response XML when `command()` is called.
- Copied the `isError()` function from the `OCIConnection` class to the `BroadsoftDataUtility` class. In the next version, that function will be removed from the `OCIConnection` class, causing a possible breaking change for some.
### 1.0.18: Added _dist/_ folder again because of type declarations.
### 1.0.17: Fixed parseOciTable and removed _dist/_ folder.
### 1.0.16: Added another data utility function for parseOciTable.
An example of the arguments would be from a response like ServiceProviderServicePackGetUtilizationListResponse:
```ts
const commandResponse = ServiceProviderServicePackGetUtilizationListResponse
.BroadsoftDocument
.command[0]
const table = commandResponse.serviceUtilizationTable
const names = commandResponse.servicePackNames
const tableData = BroadsoftDataUtility.parseOciTable(table, names)
// Example format for output:
let response = [
{
"name": "ServicePack1",
"items": [
{
"group": "GROUP_ONE",
"totalPacks": "3",
"assigned": "3"
},
{
"group": "GROUP_THREE",
"totalPacks": "3",
"assigned": "3"
}
]
},
{
"name": "ServicePack2",
"items": [
{
"group": "GROUP_TWO",
"totalPacks": "10",
"assigned": "10"
}
]
}
]
```
### 1.0.12: Added _dotenv_ and _jest_ to test Broadsoft data utility and main class function calls for better development. Planning to add easy docker deployment to this project for 1.0.13.
Easy Setup for project using _dotenv_ and _ociconnection_:
`.env` File Setup:
```dotenv
BROADSOFT_TEST_HOST=
BROADSOFT_TEST_PORT=
BROADSOFT_TEST_USERNAME=
BROADSOFT_TEST_PASSWORD=
```
`index.ts` Minimal File Setup:
```ts
import { OCIConnection } from 'ociconnection'
const main = async () => {
const ociConnection = new OCIConnection(
process.env.BROADSOFT_TEST_HOST,
process.env.BROADSOFT_TEST_PORT,
process.env.BROADSOFT_TEST_USERNAME,
process.env.BROADSOFT_TEST_PASSWORD
)
await ociConnection.login()
}
main()
```
### 1.0.10: Added a data utility to help with return data from BroadWorks
- Added OCITable helper static function `BroadsoftDataUtility.parseOciTable` to convert e.g. `ociResponse.BroadsoftDocument.command[0].userTable[0]` from
```ts
import { OCIConnection } from 'ociconnection'
import BroadsoftDataUtility from 'ociconnection'
const ociConnection = new OCIConnection('1.1.1.1', '3333', 'broadworks_user', 'broadworks_password')
await ociConnection.login()
/*
Or instead of `await ociConnection.login()`:
const loggedIn = ociConnection.login()
loggedIn
.then(() => {
/ * code that happens after successful response from server * /
})
.catch(() => {
/ * code that happens after failed response from server * /
})
*/
const ociResponse = await ociConnection.command('UserGetListInServiceProviderRequest', {
serviceProviderId: enterpriseId
})
/*
Or instead of using `await` here:
const ociResponse = ociConnection.command(...)
ociResponse
.then(response => / * Deal with XML/object response here * /)
.catch(serverError => / * Deal with server error here * /)
*/
const table = BroadsoftDataUtility.parseOciTable(ociResponse.BroadsoftDocument.command[0].userTable[0])
console.log(table)
```
### 1.0.8: Had an issue with receiving entire BroadsoftDocument in parser under the `command` function.
### 1.0.4: Added 'isError' static function to OCIConnection class. Took out console logs.
Hi! And welcome. **ociconnection** is a module used to connect to a Broadsoft/BroadWorks Application Server. This package is available at npmjs.org