open-index/open-npm huggingface dataset:
npm package: @jambon/core
Description: ``` javascript import { createRequestListener } from '@jambon/core'; import http from 'http';
Author: Jonatan Pedersen
Latest version: 1.2.3

# @jambon/core

``` javascript
import { createRequestListener } from '@jambon/core';
import http from 'http';

const server = http.createServer(
    createRequestListener(helloWorld)
);

const port = process.env.PORT || 8000;

server.listen(port);

function helloWorld (context) {
    return {
        ...context,
        response: {
            ...context.response,
            headers: {
                ...context.response.headers,
                'Content-Type': 'text/html'
            }
            body: 'Hello World',
            statusCode: 200
        }
    };
}
```

## Licence

The MIT License (MIT)

Copyright (c) 2018 [Jonatan Pedersen](https://www.jonatanpedersen.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
npm package: @jambon/cors
Description: ``` bash npm i @jambon/cors ```
Author: Jonatan Pedersen
Latest version: 1.2.3

# @jambon/cors

## Install

``` bash
npm i @jambon/cors
```

## Usage

index.js:

``` javascript
import { createRequestListener } from '@jambon/core';
import { setAccessControlResponseHeaders } from '@jambon/cors';
import http from 'http';

const server = http.createServer(
    createRequestListener(
        setAccessControlResponseHeaders
    )
);

const port = process.env.PORT || 8000;

server.listen(port);
```

Test:

``` bash
node .
$ curl http://localhost:8000/ -s -i
...
access-control-allow-origin: *
access-control-allow-credentials: true
access-control-allow-methods: GET, POST, PUT, DELETE
access-control-allow-headers: *
...
```

## Licence

The MIT License (MIT)

Copyright (c) 2018 [Jonatan Pedersen](https://www.jonatanpedersen.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
npm package: @jambon/json
Description: ``` bash npm i @jambon/json ```
Author: Jonatan Pedersen
Latest version: 1.2.3

# @jambon/json

## Install

``` bash
npm i @jambon/json
```

## Usage

index.js:

``` javascript
import { createRequestListener, updateContext } from '@jambon/core';
import { post } from '@jambon/router';
import { jsonParseRequestBody, jsonStringifyResponseBody, setResponseContentTypeHeaderToApplicationJson } from '@jambon/json';
import http from 'http';

const server = http.createServer(
    createRequestListener(
        post(jsonParseRequestBody),
        helloWorld,
        setResponseContentTypeHeaderToApplicationJson,
        jsonStringifyResponseBody
    )
);

const port = process.env.PORT || 8000;

server.listen(port);

async function helloWorld (context) {
    return updateContext(context,
        response: {
            body: {
                id: 1,
                title: 'hello world'
            },
            statusCode: 200
        }
    });
}
```

Test:

``` bash
node .
$ curl http://localhost:8000/ -i -s
HTTP/2 200
...
content-type: application/json
...

{id: 1,title: 'hello world'}
```

## Licence

The MIT License (MIT)

Copyright (c) 2018 [Jonatan Pedersen](https://www.jonatanpedersen.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
npm package: @jambon/pug
Description: ``` bash npm i @jambon/pug ```
Author: Jonatan Pedersen
Latest version: 1.2.3

# @jambon/pug

## Install

``` bash
npm i @jambon/pug
```

## Usage

hello.pug:

``` pug
html
    body Hello World
```

index.js:

``` javascript
import { createRequestListener } from '@jambon/core';
import { pugFile } from '@jambon/pug';
import http from 'http';

const server = http.createServer(
    createRequestListener(
        pugFile('hello.pug')
    )
);

const port = process.env.PORT || 8000;

server.listen(port);
```

Test:

``` bash
node .
$ curl http://localhost:8000/ -s
<html><body>Hello World</body></html>
```

## Licence

The MIT License (MIT)

Copyright (c) 2018 [Jonatan Pedersen](https://www.jonatanpedersen.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
npm package: @jambon/router
Description: ``` bash npm install @jambon/router ```
Author: Jonatan Pedersen
Latest version: 1.2.3

# @jambon/router

``` bash
npm install @jambon/router
```

## API

### path

``` javascript
function path(path: string, ...reducers: (async context => context)[]) : async context => context
```

Import `path` function:

``` javascript
import {path} from 'jambon-router'
```

Match requests where path starts with `/api`:

``` javascript
const reducer = path('/api', ...reducers});
```

Match requests where path is exactly `/api/foos`:

``` javascript
const reducer = path('/api/foos$', async (context) => {
    const foos = await getFoos();

    return {
        ...context,
        response: {
            ...context.response,
            body: foos,
            statusCode: 200
        }
    };
});
```

Using params:

``` javascript
const reducer = path('/api/foos/:fooId$',  async (context) => {
    const {fooId} = context.request.params;
    const foo = await findFoo(fooId);

    return {
        ...context,
        response: {
            ...context.response,
            body: foo,
            statusCode: foo ? 200 : 404
        }
    };
});
```

## Licence

The MIT License (MIT)

Copyright (c) 2018 [Jonatan Pedersen](https://www.jonatanpedersen.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
npm package: @jambon/static
Description: ``` bash npm i @jambon/static ```
Author: Jonatan Pedersen
Latest version: 1.2.3

# @jambon/static

## Install

``` bash
npm i @jambon/static
```

## Usage

public/index.html:

``` html
<html><body>Hello World</body></html>
```

index.js:

``` javascript
import { createRequestListener } from '@jambon/core';
import { pugFile } from '@jambon/pug';
import http from 'http';

const server = http.createServer(
    createRequestListener(
        dir('public')
    )
);

const port = process.env.PORT || 8000;

server.listen(port);
```

Test:

``` bash
node .
$ curl http://localhost:8000/ -s -i
HTTP/2 200
...
content-type: text/html
...

<html><body>Hello World</body></html>
```

## Licence

The MIT License (MIT)

Copyright (c) 2018 [Jonatan Pedersen](https://www.jonatanpedersen.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
npm package: @jambonn/ocg-cli
Description: CLI to interact with OCG
Author: Jambon @jambonn
Latest version: 1.1.2

@jambonn/ocg-cli
================

CLI to interact with OCG

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g @jambonn/ocg-cli
$ ocg COMMAND
running command...
$ ocg (-v|--version|version)
@jambonn/ocg-cli/0.0.1 darwin-x64 node-v10.18.0
$ ocg --help [COMMAND]
USAGE
  $ ocg COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`ocg serve [PATH_REPO]`](#ocg-serve-entry)
* [`ocg build [PATH_REPO]`](#ocg-build-entry)
* [`ocg help [COMMAND]`](#ocg-help-command)

## `ocg serve [PATH_REPO]`

In your first time, you need to create env file `.env`
Example content:
```
SHOPBASE_ENV=dev
SHOPBASE_STORE=shopname.myshopbase.net
SHOPBASE_THEME_ID=3
SHOPBASE_THEME_VERSION=3
SHOPBASE_STOREFRONT_PATH=$HOME/sites/vue/sbase-storefront
```

start development server

```
USAGE
  $ ocg serve [PATH_REPO]

OPTIONS
  -s, --ssr             With ssr mode
  -i, --ignoreVariables Ignore compile style variables
  -p, --storefrontPath  Storefront path
  -h, --help            show CLI help
  -n, --name=name       name to print

EXAMPLE
  $ ocg-cli serve -s
```

## `ocg build [PATH_REPO]`

build for production

```
USAGE
  $ ocg build [PATH_REPO]

OPTIONS
  -t, --themeId         Theme ID
  -v, --themeVersionId  Theme version ID
  -b, --buildVersionId  Build version ID
  -p, --publicPath      Public path
  -h, --help            show CLI help
  -n, --name=name       name to print

EXAMPLE
  $ ocg-cli serve -s
```

## `ocg-cli help [COMMAND]`

display help for ocg-cli

```
USAGE
  $ ocg-cli help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI
```

<!-- commandsstop -->
npm package: @jambonn/vue-next-progressbar
Description: Slim progress bars for Vue 3.
Author: Jambon
Latest version: 0.1.9

# Vue next progressbar
> Slim progress bars for Vue 3.

## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Development](#compiles-and-hot-reloads-for-development)
- [License](#license)

## Installation
``` bash
npm install @jambonn/vue-next-progressbar
```

or if you prefer yarn

``` bash
yarn add @jambonn/vue-next-progressbar
```

## Usage
### Global
You may install Vue next progressbar globally:
```js
import { createApp } from 'vue';
import { createRouter, createWebHistory } from 'vue-router';
import VueNextProgressbar from '@jambonn/vue-next-progressbar';
import App from './App.vue';

const app = createApp(App);
app.use(createRouter({
    history: createWebHistory(),
    routes: [],
}));
app.use(VueNextProgressbar, { router: true });
app.mount('#app');
```
### Use in component
When install global Vue next progressbar, you can control progress in component
```vue
<template>
  <button type="button" @click="progressBar.start()">Shows the progress bar</button>
  <button type="button" @click="progressBar.done()">Completes the progress</button>
</template>
<script>
import { getCurrentInstance, inject } from 'vue';
export default {
  setup() {
    // Get from global properties
    const app = getCurrentInstance();
    const progressBar = app.appContext.config.globalProperties.$Progressbar;

    // Get from provide
    const injectProgressBar = inject('Progressbar');
    return { progressBar, injectProgressBar }
  }
}
</script>
```

### Control progress
Simply call start() and done() to control the Vue next progress bar.
```js
import { VueProgressbar } from '@jambonn/vue-next-progressbar';
VueProgressbar.start();
VueProgressbar.done();
```

### Configuration
#### `trickleSpeed`
Adjust how often to trickle/increment, in ms.
```js
import { createApp } from 'vue';
import VueNextProgressbar from '@jambonn/vue-next-progressbar';
import App from './App.vue';

const app = createApp(App);
const options = {
  trickleSpeed: 500, // default: 800
};
app.use(VueNextProgressbar, options);
```

### Compiles and hot-reloads for development
``` bash
yarn install
yarn dev
```
then navigate to `http://localhost:8080`

### Compiles and minifies for production
```
yarn build
```

## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
npm package: @jambonz/http-authenticator
Description: a drachtio middleware package for jambonz that delegates sip authentication to a customer-supplied http api
Author: Dave Horton
Latest version: 0.2.3

# http-authenticator ![CI](https://github.com/jambonz/http-authenticator/workflows/CI/badge.svg)

drachtio middleware that delegates sip authentication to an http api.  This allows, for instance, a multi-tenant sip application server to delegate authentication to a customer api.

The middleware-returning function can be invoked EITHER with an HTTP URL to call OR a function yielding a Promise that resolves to an HTTP URL.  Alternatively, instead of a returning a URL, and object can be provided with `url`, `username`, and `password` properties if you wish to protect your endpoint with HTTP Basic Authentication. 

An HTTP POST will be made to the specified URL with a JSON body containing the sip method and the components from the Authorization header.  The HTTP server should return a status code of 200 in all cases, containing a JSON body with instructions on whether to admit the request.

To admit the request, send a 200 response with a `status` of `ok`, e.g.
```
{"status": "ok"}
```
To deny the request, send a 200 response with a `status` of `fail`.  The `status` field MUST be provided.  Optionally, a response MAY include a `msg` attribute, an `expires` attribute, and/or a `blacklist` attribute.  

- The `msg` property is simply a human-readable description of why an authentication failed.
- The `expires` value provides a value in seconds for the duration of a granted registration.  This value, if provided, must be less than the requested expiration. If not provided, the requested expires value is granted.
- The `blacklist` property shall contain a number indicating a period of time, in seconds, that the source IP address should be blocked.  A value of -1 means forever.
```
{"status": "fail"}
```
or
```
{"status": "fail", "msg": "unknown user"}
```
```
{"status": "fail", "blaclist": 3600}
```


Additionally, for admitted requests, the middleware adds a `req.authorization` object which contains two properties:
- challengeResponse - an object containing the parsed elements of the sip Authorization header, and
- grant - an object containing the json response received in the 200 OK to the POST request.

```
const authenticator = require('@jambonz/http-authenticator')({
  url: 'https://example.com/auth',
  auth: {
    username: 'foo',
    password: 'bar'
  }
});

srf.use('invite', authenticator);
```
npm package: @jambonz/mcp-schema-server
Description: MCP server that provides jambonz verb schemas and documentation to AI agents
Author: Dave Horton
Latest version: 0.3.0

# @jambonz/mcp-schema-server

MCP server that provides jambonz verb schemas and documentation to AI agents via the [Model Context Protocol](https://modelcontextprotocol.io/).

## How It Works

This server exposes the schemas and developer guide from the [@jambonz/schema](https://github.com/jambonz/schema) package as MCP tools. AI coding agents can query verb definitions, component types, callback payloads, and the full developer guide without needing local access to the schema files.

## Tools

| Tool | Description |
|------|-------------|
| `jambonz_developer_toolkit` | Returns the full developer guide and schema index. Call this first before writing any jambonz code. |
| `get_jambonz_schema` | Fetch the JSON Schema for any verb, component, or callback (e.g. `verb:say`, `component:synthesizer`, `callback:gather`, `guide:session-commands`). |

## Usage

### stdio transport

```bash
npx @jambonz/mcp-schema-server
```

### HTTP transport

```bash
npx @jambonz/mcp-schema-server --http --port 3000
```

## Configuration

### Claude Code CLI

Add to `.mcp.json` in your project root:

```json
{
  "mcpServers": {
    "jambonz": {
      "command": "npx",
      "args": ["-y", "@jambonz/mcp-schema-server"]
    }
  }
}
```

### Cursor

Add to `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "jambonz": {
      "command": "npx",
      "args": ["-y", "@jambonz/mcp-schema-server"]
    }
  }
}
```

### VS Code

Add to `.vscode/mcp.json`:

```json
{
  "servers": {
    "jambonz": {
      "command": "npx",
      "args": ["-y", "@jambonz/mcp-schema-server"]
    }
  }
}
```

### Remote Hosted Server

A hosted instance is available at:

```
https://mcp-server.jambonz.app/mcp
```

To use the remote server in `.mcp.json`:

```json
{
  "mcpServers": {
    "jambonz": {
      "type": "url",
      "url": "https://mcp-server.jambonz.app/mcp"
    }
  }
}
```

## Links

- [@jambonz/schema](https://github.com/jambonz/schema) -- schema package this server exposes
- [jambonz.org](https://jambonz.org) -- platform documentation
- [GitHub](https://github.com/jambonz/mcp-server)

## License

MIT
npm package: @jambonz/messaging-382com
Description: body parsing function for incoming SMS from 382 com
Author: Dave Horton
Latest version: 0.0.2

# messaging-382comm  [![Build Status](https://secure.travis-ci.org/jambonz/messaging-382com.png)](http://travis-ci.org/jambonz/messaging-382com)

Helper functions for parsing incoming SMS/MMS messages from 382com into a standard format for application processing.

## Functions

### fromProviderFormat({messageSid, applicationSid, accountSid}, url, payload)
translates an incoming SMS from 382com into a standard format for application processing.

382com SMS format looks like this:
```
{
	"source": "5083084809",
	"destination": "3393646057",
	"type": "sms",
	"message": "Hello there"
}
```

and MMS format looks like this:
```
{
	"source": "5083084809",
	"destination": "3393646057",
	"type": "mms",
	"message": "http://picmsg.org/[unique_identifier].jpg"
}
```

standard format is:
```
{
	"messageSid": "7c626e1b-7796-4f77-9848-056900b071c4",
	"applicationSid": "9fd9866f-d4bc-46e2-91f1-43da922d80ce",
	"accountSid": "505faa3d-e1cb-4855-8346-f57fb5611b7d",
	"from": "+15083084809",
	"to": ["+17743008772"],
	"text": "Hi there!",
	"cc": [],
	"media": []
}
```

### sendSms(opts, payload)
send an outgoing SMS message from a payload that is presented in standard application format.

The `opts` parameter may include properties that are needed to construct the proper URL, perform HTTP basic authentication, etc.
npm package: @jambonz/messaging-peerless
Description: body parsing function for incoming SMS from Peerless
Author: Dave Horton
Latest version: 0.0.9

# messaging-peerless  [![Build Status](https://secure.travis-ci.org/jambonz/messaging-peerless.png)](http://travis-ci.org/jambonz/messaging-peerless)

Helper functions for parsing incoming SMS/MMS messages from Peerless into a standard format for application processing.

## Functions

### fromProviderFormat({messageSid, applicationSid, accountSid}, url, payload)
translates an incoming SMS from Peerless into a standard format for application processing.

Peerless format looks like this:
```
{
	"from": "+15083084809",
	"recipients": ["+17743008772"],
	"ccRecipients": [],
	"text": "Hi there!",
	"mediaURL": null,
	"contentId": null
}
```

standard format is:
```
{
	"messageSid": "7c626e1b-7796-4f77-9848-056900b071c4",
	"applicationSid": "9fd9866f-d4bc-46e2-91f1-43da922d80ce",
	"accountSid": "505faa3d-e1cb-4855-8346-f57fb5611b7d",
	"from": "+15083084809",
	"to": ["+17743008772"],
	"text": "Hi there!",
	"cc": [],
	"media": []
}
```

### formatProviderResponse(messageSid)
This function will be called before sending a response to Peerless for an incoming SMS. Peerless requires a 200 OK with a JSON body in response to incoming SMS, e.g.

```
{"receipt": "7c626e1b-7796-4f77-9848-056900b071c4"}
```

### sendSms(opts, payload)
send an outgoing SMS message from a payload that is presented in standard application format.

The `opts` parameter may include properties that are needed to construct the proper URL, perform HTTP basic authentication, etc.
npm package: @jambonz/messaging-simwood
Description: body parsing function for incoming SMS from Simwood
Author: Dave Horton
Latest version: 0.0.4

# messaging-simwood  [![Build Status](https://secure.travis-ci.org/jambonz/messaging-simwood.png)](http://travis-ci.org/jambonz/messaging-simwood)

Helper functions for parsing incoming SMS/MMS messages from Simwood into a standard format for application processing.

## Functions

### fromProviderFormat({messageSid, applicationSid, accountSid}, url, payload)
translates an incoming SMS from Simwood into a standard format for application processing.

Simwood format looks like this:
```
{
	"app": "sms_inbound",
	"id": "9a171a847f3238d8e3b33120d2a",
	"data": {
		"destination": "15085710838",
		"length": 8,
		"message": "Hi there",
		"originator": "15083084809",
		"time": "2020-10-06 20:36:05"
	}
}
```

standard format is:
```
{
	"messageSid": "7c626e1b-7796-4f77-9848-056900b071c4",
	"applicationSid": "9fd9866f-d4bc-46e2-91f1-43da922d80ce",
	"accountSid": "505faa3d-e1cb-4855-8346-f57fb5611b7d",
	"from": "15083084809",
	"to": ["15085710838"],
	"text": "Hi there!",
	"cc": [],
	"media": []
}
```

### sendSms(opts, payload)
send an outgoing SMS message from a payload that is presented in standard application format.

The `opts` parameter may include properties that are needed to construct the proper URL, perform HTTP basic authentication, etc.
npm package: @jambonz/mw-registrar
Description: jambonz middleware that provides access to the database of active registrations maintained as part of the SBC function
Author: Dave Horton
Latest version: 0.2.7

# mw-registrar ![CI](https://github.com/jambonz/jambonz-mw-registrar/workflows/CI/badge.svg)

Jambonz class that handles inserting, removing, and querying the database of active sip registrations

```
const Registrar = require('jambonz-mw-registrar');
const registrar = new Registrar({host: '127.0.0.1', port: 6379});

// add a registration, optionally with an expires value in secs
registrar.add('daveh@drachtio.org', {
  contact: '10.10.1.1',
  sbcAddress: '192.168.1.1',
  protocol: 'udp'
}, 40);

const registrationDetails = await registrar.query('daveh@drachtio.org');
// {"contact":"10.10.1.1","sbcAddress":"192.168.1.1","protocol":"udp"}

// get count of users for a realm
const userCount = await registrar.getCountOfUsers('drachtio.org');

// remove a user
registrar.remove('daveh@drachtio.org');
```
npm package: @jambonz/rtpengine-utils
Description: utility functions for managing rtpengine
Author: Dave Horton
Latest version: 0.4.4

# jambonz/rtpengine-utils ![CI](https://github.com/jambonz/rtpengine-utils/workflows/CI/badge.svg)

Usage
```
const {getRtpEngine} = require('@jambonz/rtpengine-utils')(['10.10.0.1:2222', '10.10.02:2222']);
const obj = getRtpEngine(logger):
/*
  obj is {
    offer:    /* bound function that calls 'offer' on least loaded rtpengine */
    answer:   /* ditto answer.. */
    del:      /* ditto delete.. */
    client:   /* rtpengine client that will be used for sending commands */
  }
*/
```
npm package: @jambonz/schema
Description: JSON Schema definitions and validation for jambonz verb applications
Author: Dave Horton
Latest version: 0.1.5

# @jambonz/schema

JSON Schema definitions and validation for jambonz verb applications.

## What's Included

- **33 verb schemas** (`verbs/`) -- every jambonz verb (say, gather, dial, openai_s2s, pipeline, etc.)
- **42 component schemas** (`components/`) -- shared types (synthesizer, recognizer, target, actionHook, etc.)
- **32 callback schemas** (`callbacks/`) -- actionHook payload definitions for each verb
- **AGENTS.md** -- language-agnostic developer guide covering the verb model, transport modes, and protocol
- **docs/** -- additional reference documentation
- **jambonz-app.schema.json** -- the full application schema (JSON Schema draft 2020-12)

## Installation

```bash
npm install @jambonz/schema
```

## Usage

```javascript
const { validate, validateVerb, normalizeJambones } = require('@jambonz/schema');

// Validate a single verb object
const verb = { verb: 'say', text: 'Hello world' };
const result = validateVerb(verb);
if (!result.valid) {
  console.error(result.errors);
}

// Validate a full jambonz application (array of verbs)
const app = [
  { verb: 'say', text: 'Welcome.' },
  { verb: 'gather', input: ['speech'], actionHook: '/input', timeout: 10 }
];
const appResult = validate(app);

// Normalize legacy verb names and formats
const normalized = normalizeJambones(app);
```

## Schema Format

All schemas use **JSON Schema draft 2020-12**. The root application schema (`jambonz-app.schema.json`) references individual verb and component schemas via `$ref`.

## API

| Function | Description |
|----------|-------------|
| `validate(app)` | Validate a verb array or single verb against the schema |
| `validateVerb(verb)` | Validate a single verb object |
| `validateApp(app)` | Validate a complete jambonz application array |
| `normalizeJambones(app)` | Normalize legacy verb names and synonyms (e.g. `listen` -> `stream`, `llm` -> `s2s`) |

## Links

- [jambonz.org](https://jambonz.org) -- platform documentation
- [@jambonz/mcp-schema-server](https://github.com/jambonz/mcp-server) -- MCP server for AI agent integration
- [GitHub](https://github.com/jambonz/schema)

## License

MIT
npm package: @jambonz/stats-collector
Description: report metrics from jambonz servers
Author: Dave Horton
Latest version: 0.1.10

# jambonz/stats-collector ![CI](https://github.com/jambonz/stats-collector/workflows/CI/badge.svg)

Utility class for sending metrics.  Currently supports Telegraf or Datadog as metrics collector.

## usage
The following environment variables are used:

- `ENABLE_METRICS` set to a value of 1 to enable sending metrics; this package will do nothing if this env var is not set
- `STATS_HOST` ip address or dns name to send stats to (presumably either the Telegraf or Datadog collector is listening there)
- `STATS_PORT` port to send stats to
- `STATS_PROTOCOL` - optional, protocol to use when sending stats; defaults to udp
- `STATS_CACHE_DNS` - optional, whether to cache dns results; defaults to false
- `STATS_TELEGRAF` - set to 1 if sending to Telegraf; otherwise when sending to Datadog
```
const StatsCollector = require('@jambonz/stats-collector');
const stats = new StatsCollector(logger); // optionally, pass a pino logger
stats.gauge('sbc.calls.count', 10);
stats.increment('mycounter');
stats.decrement('mycounter');
```

## Telegraf configuration
When sending stats to Telegraf, your /etc/telegraf.conf configuration file should set `datadog_extensions = true` as shown below.

```
[[inputs.statsd]]
  protocol = "udp"
  max_tcp_connections = 250
  tcp_keep_alive = false
  # tcp_keep_alive_period = "2h"
  service_address = ":8125"
  delete_gauges = true
  delete_counters = true
  delete_sets = true
  delete_timings = true
  ## Percentiles to calculate for timing & histogram stats.
  percentiles = [50.0, 90.0, 99.0, 99.9, 99.95, 100.0]
  metric_separator = "_"
  datadog_extensions = true
  allowed_pending_messages = 10000
  percentile_limit = 1000
  # read_buffer_size = 65535
```
npm package: @jambonz/time-series
Description: write and query data to time series daetabase
Author: Dave Horton
Latest version: 0.2.18

# time-series
Read and write call detail records and alerts to an influxdb database.

## Usage
Import a function and invoke it with the ip address of the influxdb database and a [pino](https://www.npmjs.com/package/pino) logger.

```js
const {
  writeCdrs,
  queryCdrs,
  writeAlerts,
  queryAlerts,
  AlertType
} = require('@jambonz/time-series')(pinoLogger, '172.32.10.44');
```
### CDRs
#### writing

```
await writeCdrs([{
    from: 'me',
    to: 'you',
    sip_callid: 'foo@127.0.0.1',
    answered: true,
    duration: 22,
    attempted_at: new Date(Date.now() - (3600 * 1000)),
    answered_at: Date.now() - (3590 * 1000),
    terminated_at: Date.now(),
    termination_reason: 'caller hungup',
    direction: 'inbound',
    host: '10.10.100.1',
    remote_host: '10.10.100.8',
    trunk: 'device',
    account_sid: 'xxxx',
    call_sid: 'foo'
  }]);
```
#### reading
Reading is pagination-based: request a page of data, providing the page number and count of records (i.e page size).  

Begin by querying page 1 and a count of records >= 25 and <= 500.  The response will include a "total" property indicating the total number of records meeting the supplied criteria; based on this you can calculate the total number of page and then provide pagination.
```
result = await queryCdrs({account_sid: 'yyyy', page: 1, page_size:50});

{
	"total": 1,
	"page_size": 50,
	"page": 1,
	"data": [{cdr 1}, {cdr 2}, .. {cdr 50}]
}
```

##### filtering data
CDR data has these tags, of which you *must* provide at least `account_sid` in your query, and you may optionally filter the data further by providing any of the other tags and associated values to filter on:
- account_sid
- host (IP address of SBC that generated the CDR)
- trunk (carrier name)
- direction (inbound or outbound)
- answered (true or false)
```
result = await queryCdrs({account_sid: 'yyyy', direction: 'inbound', page: 1, page_size:50});
```
### Alerts
#### writing
```
await writeAlerts([{
      alert_type: AlertType.WEBHOOK_STATUS_FAILURE,
      account_sid: 'yyyy',
      url: 'http://foo.bar',
      status: 404
    },
    {
      alert_type: AlertType.TTS_NOT_PROVISIONED,
      account_sid: 'yyyy',
      vendor: 'google'
    },
    {
      alert_type: AlertType.CARRIER_NOT_PROVISIONED,
      account_sid: 'yyyy',
    },
    {
      alert_type: AlertType.CALL_LIMIT,
      account_sid: 'yyyy',
      count: 50,
    }
]);
```
#### reading
```
result = await queryAlerts({account_sid: 'yyyy', page: 1, page_size:50});

{
	"total": 1,
	"page_size": 50,
	"page": 1,
	"data": [{alert 1}, {alert 2}, .. {alert 50}]
}
```
##### filtering data
Alert data has these tags, of which you *must* provide at least `account_sid` in your query, and you may optionally filter the data further by providing any of the other tags and associated values to filter on:
- account_sid
- alert_type
```
result = await queryAlerts({account_sid: 'yyyy', alert_type: AlertType.CARRIER_NOT_PROVISIONED, page: 1, page_size:50});
```
npm package: @jambopay/ng-jambopaycheckout
Description: This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.14.
Author: Hosea Ochieng
Latest version: 0.0.1

# NgJambopaycheckout

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.14.

## Code scaffolding

Run `ng generate component component-name --project ng-jambopaycheckout` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ng-jambopaycheckout`.
> Note: Don't forget to add `--project ng-jambopaycheckout` or else it will be added to the default project in your `angular.json` file. 

## Build

Run `ng build ng-jambopaycheckout` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build ng-jambopaycheckout`, go to the dist folder `cd dist/ng-jambopaycheckout` and run `npm publish`.

## Running unit tests

Run `ng test ng-jambopaycheckout` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).