mirror of
https://github.com/jambonz/sbc-outbound.git
synced 2025-12-19 04:27:45 +00:00
initial checkin
This commit is contained in:
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
test/*
|
||||||
126
.eslintrc.json
Normal file
126
.eslintrc.json
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"jsx": false,
|
||||||
|
"modules": false
|
||||||
|
},
|
||||||
|
"ecmaVersion": 2017
|
||||||
|
},
|
||||||
|
"plugins": ["promise"],
|
||||||
|
"rules": {
|
||||||
|
"promise/always-return": "error",
|
||||||
|
"promise/no-return-wrap": "error",
|
||||||
|
"promise/param-names": "error",
|
||||||
|
"promise/catch-or-return": "error",
|
||||||
|
"promise/no-native": "off",
|
||||||
|
"promise/no-nesting": "warn",
|
||||||
|
"promise/no-promise-in-callback": "warn",
|
||||||
|
"promise/no-callback-in-promise": "warn",
|
||||||
|
"promise/no-return-in-finally": "warn",
|
||||||
|
|
||||||
|
// Possible Errors
|
||||||
|
// http://eslint.org/docs/rules/#possible-errors
|
||||||
|
"comma-dangle": [2, "only-multiline"],
|
||||||
|
"no-control-regex": 2,
|
||||||
|
"no-debugger": 2,
|
||||||
|
"no-dupe-args": 2,
|
||||||
|
"no-dupe-keys": 2,
|
||||||
|
"no-duplicate-case": 2,
|
||||||
|
"no-empty-character-class": 2,
|
||||||
|
"no-ex-assign": 2,
|
||||||
|
"no-extra-boolean-cast" : 2,
|
||||||
|
"no-extra-parens": [2, "functions"],
|
||||||
|
"no-extra-semi": 2,
|
||||||
|
"no-func-assign": 2,
|
||||||
|
"no-invalid-regexp": 2,
|
||||||
|
"no-irregular-whitespace": 2,
|
||||||
|
"no-negated-in-lhs": 2,
|
||||||
|
"no-obj-calls": 2,
|
||||||
|
"no-proto": 2,
|
||||||
|
"no-unexpected-multiline": 2,
|
||||||
|
"no-unreachable": 2,
|
||||||
|
"use-isnan": 2,
|
||||||
|
"valid-typeof": 2,
|
||||||
|
|
||||||
|
// Best Practices
|
||||||
|
// http://eslint.org/docs/rules/#best-practices
|
||||||
|
"no-fallthrough": 2,
|
||||||
|
"no-octal": 2,
|
||||||
|
"no-redeclare": 2,
|
||||||
|
"no-self-assign": 2,
|
||||||
|
"no-unused-labels": 2,
|
||||||
|
|
||||||
|
// Strict Mode
|
||||||
|
// http://eslint.org/docs/rules/#strict-mode
|
||||||
|
"strict": [2, "never"],
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
// http://eslint.org/docs/rules/#variables
|
||||||
|
"no-delete-var": 2,
|
||||||
|
"no-undef": 2,
|
||||||
|
"no-unused-vars": [2, {"args": "none"}],
|
||||||
|
|
||||||
|
// Node.js and CommonJS
|
||||||
|
// http://eslint.org/docs/rules/#nodejs-and-commonjs
|
||||||
|
"no-mixed-requires": 2,
|
||||||
|
"no-new-require": 2,
|
||||||
|
"no-path-concat": 2,
|
||||||
|
"no-restricted-modules": [2, "sys", "_linklist"],
|
||||||
|
|
||||||
|
// Stylistic Issues
|
||||||
|
// http://eslint.org/docs/rules/#stylistic-issues
|
||||||
|
"comma-spacing": 2,
|
||||||
|
"eol-last": 2,
|
||||||
|
"indent": [2, 2, {"SwitchCase": 1}],
|
||||||
|
"keyword-spacing": 2,
|
||||||
|
"max-len": [2, 120, 2],
|
||||||
|
"new-parens": 2,
|
||||||
|
"no-mixed-spaces-and-tabs": 2,
|
||||||
|
"no-multiple-empty-lines": [2, {"max": 2}],
|
||||||
|
"no-trailing-spaces": [2, {"skipBlankLines": false }],
|
||||||
|
"quotes": [2, "single", "avoid-escape"],
|
||||||
|
"semi": 2,
|
||||||
|
"space-before-blocks": [2, "always"],
|
||||||
|
"space-before-function-paren": [2, "never"],
|
||||||
|
"space-in-parens": [2, "never"],
|
||||||
|
"space-infix-ops": 2,
|
||||||
|
"space-unary-ops": 2,
|
||||||
|
|
||||||
|
// ECMAScript 6
|
||||||
|
// http://eslint.org/docs/rules/#ecmascript-6
|
||||||
|
"arrow-parens": [2, "always"],
|
||||||
|
"arrow-spacing": [2, {"before": true, "after": true}],
|
||||||
|
"constructor-super": 2,
|
||||||
|
"no-class-assign": 2,
|
||||||
|
"no-confusing-arrow": 2,
|
||||||
|
"no-const-assign": 2,
|
||||||
|
"no-dupe-class-members": 2,
|
||||||
|
"no-new-symbol": 2,
|
||||||
|
"no-this-before-super": 2,
|
||||||
|
"prefer-const": 2
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"DTRACE_HTTP_CLIENT_REQUEST" : false,
|
||||||
|
"LTTNG_HTTP_CLIENT_REQUEST" : false,
|
||||||
|
"COUNTER_HTTP_CLIENT_REQUEST" : false,
|
||||||
|
"DTRACE_HTTP_CLIENT_RESPONSE" : false,
|
||||||
|
"LTTNG_HTTP_CLIENT_RESPONSE" : false,
|
||||||
|
"COUNTER_HTTP_CLIENT_RESPONSE" : false,
|
||||||
|
"DTRACE_HTTP_SERVER_REQUEST" : false,
|
||||||
|
"LTTNG_HTTP_SERVER_REQUEST" : false,
|
||||||
|
"COUNTER_HTTP_SERVER_REQUEST" : false,
|
||||||
|
"DTRACE_HTTP_SERVER_RESPONSE" : false,
|
||||||
|
"LTTNG_HTTP_SERVER_RESPONSE" : false,
|
||||||
|
"COUNTER_HTTP_SERVER_RESPONSE" : false,
|
||||||
|
"DTRACE_NET_STREAM_END" : false,
|
||||||
|
"LTTNG_NET_STREAM_END" : false,
|
||||||
|
"COUNTER_NET_SERVER_CONNECTION_CLOSE" : false,
|
||||||
|
"DTRACE_NET_SERVER_CONNECTION" : false,
|
||||||
|
"LTTNG_NET_SERVER_CONNECTION" : false,
|
||||||
|
"COUNTER_NET_SERVER_CONNECTION" : false
|
||||||
|
}
|
||||||
|
}
|
||||||
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# github pages site
|
||||||
|
_site
|
||||||
|
|
||||||
|
#transient test cases
|
||||||
|
examples/nosave.*.js
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
.nyc_output/
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directory
|
||||||
|
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
examples/*
|
||||||
9
.travis.yml
Normal file
9
.travis.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
sudo: required
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "lts/*"
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
script:
|
||||||
|
- npm test
|
||||||
|
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 jambonz
|
||||||
|
|
||||||
|
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.
|
||||||
81
README.md
Normal file
81
README.md
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# sbc-outbound [](http://travis-ci.org/jambonz/sbc-outbound)
|
||||||
|
|
||||||
|
This application provides a part of the SBC (Session Border Controller) functionality of jambonz. It handles outbound INVITE requests from the cpaas application server that is going to carrier sip trunks or registered sip users/devices, including webrtc applications.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Configuration is provided via the [npmjs config](https://www.npmjs.com/package/config) package. Much of the configuration is standard "where is drachtio?, where is rtpengine?, where is redis?" type of thing. This application also needs information about the sip trunk to send PSTN calls out on. In the initial release, only a single outbound SIP trunk is supported.
|
||||||
|
|
||||||
|
The following elements make up the configuration for the application:
|
||||||
|
##### outbound sip trunk
|
||||||
|
```
|
||||||
|
"trunks": {
|
||||||
|
"outbound": {
|
||||||
|
"name": "carrier1",
|
||||||
|
"host": "sip:172.39.0.20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
```
|
||||||
|
The sip uri specifies the sip trunk uri to send PSTN calls to. All outbound PSTN calls from the cpaas application server are expected to be in E.164 format with a leading plus (+) sign. Outbound sip uris that do not begin with a '+' are assumed to be calls to registered devices/users.
|
||||||
|
|
||||||
|
##### drachtio server location
|
||||||
|
```
|
||||||
|
"drachtio": {
|
||||||
|
"port": 3001,
|
||||||
|
"secret": "cymru"
|
||||||
|
},
|
||||||
|
```
|
||||||
|
the `drachtio` object specifies the port to listen on for tcp connections from drachtio servers as well as the shared secret that is used to authenticate to the server.
|
||||||
|
|
||||||
|
> Note: either inbound or [outbound connections](https://drachtio.org/docs#outbound-connections) may be used, depending on the configuration supplied. In production, it is the intent to use outbound connections for easier centralization and clustering of application logic, while inbound connections are used for the automated test suite.
|
||||||
|
|
||||||
|
##### rtpengine location
|
||||||
|
```
|
||||||
|
"rtpengine": {
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 22222
|
||||||
|
},
|
||||||
|
```
|
||||||
|
the `rtpengine` object specifies the location of the rtpengine, which will typically be running on the same server as drachtio.
|
||||||
|
|
||||||
|
##### redis location
|
||||||
|
```
|
||||||
|
"redis": {
|
||||||
|
"port": 6379,
|
||||||
|
"host": "127.0.0.1"
|
||||||
|
},
|
||||||
|
```
|
||||||
|
the `redis` object specifies the ip/dns and port that redis is listening on.
|
||||||
|
|
||||||
|
##### application log level
|
||||||
|
```
|
||||||
|
"logging": {
|
||||||
|
"level": "info"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
##### transcoding options
|
||||||
|
The transcoding options for rtpengine are found in the configuration file, however these should not need to be modified.
|
||||||
|
```
|
||||||
|
"transcoding": {
|
||||||
|
"rtpCharacteristics" : {
|
||||||
|
"transport protocol": "RTP/AVP",
|
||||||
|
"DTLS": "off",
|
||||||
|
"SDES": "off",
|
||||||
|
"ICE": "remove",
|
||||||
|
"rtcp-mux": ["demux"]
|
||||||
|
},
|
||||||
|
"srtpCharacteristics": {
|
||||||
|
"transport-protocol": "UDP/TLS/RTP/SAVPF",
|
||||||
|
"ICE": "force",
|
||||||
|
"SDES": "off",
|
||||||
|
"flags": ["generate mid", "SDES-no"],
|
||||||
|
"rtcp-mux": ["require"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Tests
|
||||||
|
The automated test suite requires a docker installation.
|
||||||
|
|
||||||
|
```
|
||||||
|
npm test
|
||||||
|
```
|
||||||
35
app.js
Normal file
35
app.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
const Srf = require('drachtio-srf');
|
||||||
|
const srf = new Srf();
|
||||||
|
const config = require('config');
|
||||||
|
const logger = require('pino')(config.get('logging'));
|
||||||
|
const {route, setLogger} = require('./lib/middleware');
|
||||||
|
const debug = require('debug')('jambonz:sbc-outbound');
|
||||||
|
|
||||||
|
// disable logging in test mode
|
||||||
|
if (process.env.NODE_ENV === 'test') {
|
||||||
|
const noop = () => {};
|
||||||
|
logger.info = logger.debug = noop;
|
||||||
|
logger.child = () => {return {info: noop, error: noop, debug: noop};};
|
||||||
|
}
|
||||||
|
|
||||||
|
// config dictates whether to use outbound or inbound connections
|
||||||
|
if (config.has('drachtio.host')) {
|
||||||
|
srf.connect(config.get('drachtio'));
|
||||||
|
srf.on('connect', (err, hp) => {
|
||||||
|
debug(`connected to drachtio at ${hp}`);
|
||||||
|
logger.info(`connected to drachtio listening on ${hp}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
srf.listen(config.get('drachtio'));
|
||||||
|
}
|
||||||
|
if (process.env.NODE_ENV === 'test') {
|
||||||
|
srf.on('error', (err) => {
|
||||||
|
logger.error(err, 'Error connecting to drachtio');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
srf.use('invite', [setLogger(logger), route(config.get('redis'))]);
|
||||||
|
srf.invite(require('./lib/invite'));
|
||||||
|
|
||||||
|
module.exports = {srf};
|
||||||
39
config/default.json
Normal file
39
config/default.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"drachtio": {
|
||||||
|
"port": 3003,
|
||||||
|
"secret": "cymru"
|
||||||
|
},
|
||||||
|
"rtpengine": {
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 22222
|
||||||
|
},
|
||||||
|
"redis": {
|
||||||
|
"port": 6379,
|
||||||
|
"host": "127.0.0.1"
|
||||||
|
},
|
||||||
|
"logging": {
|
||||||
|
"level": "info"
|
||||||
|
},
|
||||||
|
"trunks": {
|
||||||
|
"outbound": {
|
||||||
|
"name": "carrier1",
|
||||||
|
"host": "sip:10.123.22.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transcoding": {
|
||||||
|
"rtpCharacteristics" : {
|
||||||
|
"transport protocol": "RTP/AVP",
|
||||||
|
"DTLS": "off",
|
||||||
|
"SDES": "off",
|
||||||
|
"ICE": "remove",
|
||||||
|
"rtcp-mux": ["demux"]
|
||||||
|
},
|
||||||
|
"srtpCharacteristics": {
|
||||||
|
"transport-protocol": "UDP/TLS/RTP/SAVPF",
|
||||||
|
"ICE": "force",
|
||||||
|
"SDES": "off",
|
||||||
|
"flags": ["generate mid", "SDES-no"],
|
||||||
|
"rtcp-mux": ["require"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
config/local-test.json
Normal file
40
config/local-test.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"drachtio": {
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 9060,
|
||||||
|
"secret": "cymru"
|
||||||
|
},
|
||||||
|
"rtpengine": {
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 12222
|
||||||
|
},
|
||||||
|
"redis": {
|
||||||
|
"port": 16379,
|
||||||
|
"host": "127.0.0.1"
|
||||||
|
},
|
||||||
|
"logging": {
|
||||||
|
"level": "info"
|
||||||
|
},
|
||||||
|
"trunks": {
|
||||||
|
"outbound": {
|
||||||
|
"name": "carrier1",
|
||||||
|
"host": "sip:172.39.0.20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transcoding": {
|
||||||
|
"rtpCharacteristics" : {
|
||||||
|
"transport protocol": "RTP/AVP",
|
||||||
|
"DTLS": "off",
|
||||||
|
"SDES": "off",
|
||||||
|
"ICE": "remove",
|
||||||
|
"rtcp-mux": ["demux"]
|
||||||
|
},
|
||||||
|
"srtpCharacteristics": {
|
||||||
|
"transport-protocol": "UDP/TLS/RTP/SAVPF",
|
||||||
|
"ICE": "force",
|
||||||
|
"SDES": "off",
|
||||||
|
"flags": ["generate mid", "SDES-no"],
|
||||||
|
"rtcp-mux": ["require"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
94
lib/invite.js
Normal file
94
lib/invite.js
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
const config = require('config');
|
||||||
|
const Client = require('rtpengine-client').Client ;
|
||||||
|
const rtpengine = new Client();
|
||||||
|
const offer = rtpengine.offer.bind(rtpengine, config.get('rtpengine'));
|
||||||
|
const answer = rtpengine.answer.bind(rtpengine, config.get('rtpengine'));
|
||||||
|
const del = rtpengine.delete.bind(rtpengine, config.get('rtpengine'));
|
||||||
|
const {makeRtpEngineOpts} = require('./utils');
|
||||||
|
const {forwardInDialogRequests} = require('drachtio-fn-b2b-sugar');
|
||||||
|
const debug = require('debug')('jambonz:sbc-outbound');
|
||||||
|
|
||||||
|
module.exports = handler;
|
||||||
|
|
||||||
|
async function handler(req, res) {
|
||||||
|
const logger = req.locals.logger;
|
||||||
|
const srf = req.srf;
|
||||||
|
const useWss = req.locals.registration && req.locals.registration.protocol === 'wss';
|
||||||
|
const rtpEngineOpts = makeRtpEngineOpts(req, false, useWss);
|
||||||
|
const rtpEngineResource = {destroy: del.bind(rtpengine, rtpEngineOpts.common)};
|
||||||
|
try {
|
||||||
|
const response = await offer(rtpEngineOpts.offer);
|
||||||
|
if ('ok' !== response.result) {
|
||||||
|
res.send(480);
|
||||||
|
throw new Error(`failed allocating rtpengine endpoint: ${JSON.stringify(response)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let uri, proxy;
|
||||||
|
if (req.locals.registration) {
|
||||||
|
proxy = req.locals.registration.contact;
|
||||||
|
uri = req.uri;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uri = config.get('trunks.outbound.host');
|
||||||
|
}
|
||||||
|
|
||||||
|
const {uas, uac} = await srf.createB2BUA(req, res, uri, {
|
||||||
|
proxy,
|
||||||
|
proxyRequestHeaders: ['User-Agent', 'Subject'],
|
||||||
|
localSdpB: response.sdp,
|
||||||
|
localSdpA: (sdp, res) => {
|
||||||
|
const opts = Object.assign({sdp, 'to-tag': res.getParsedHeader('To').params.tag},
|
||||||
|
rtpEngineOpts.answer);
|
||||||
|
return answer(opts)
|
||||||
|
.then((response) => {
|
||||||
|
if ('ok' !== response.result) throw new Error('error allocating rtpengine');
|
||||||
|
return response.sdp;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
logger.info('call connected');
|
||||||
|
debug('call connected');
|
||||||
|
setHandlers(logger, uas, uac, rtpEngineOpts, rtpEngineResource);
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(err, 'Error connecting call');
|
||||||
|
rtpEngineResource.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHandlers(logger, uas, uac, rtpEngineOpts, rtpEngineResource) {
|
||||||
|
[uas, uac].forEach((dlg) => {
|
||||||
|
//hangup
|
||||||
|
dlg.on('destroy', () => {
|
||||||
|
logger.info('call ended');
|
||||||
|
rtpEngineResource.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
//re-invite
|
||||||
|
dlg.on('modify', onReinvite.bind(dlg, logger, rtpEngineOpts));
|
||||||
|
});
|
||||||
|
|
||||||
|
// default forwarding of other request types
|
||||||
|
forwardInDialogRequests(uas);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onReinvite(logger, rtpEngineOpts, req, res) {
|
||||||
|
try {
|
||||||
|
let response = await offer(Object.assign({sdp: req.body}, rtpEngineOpts.offer));
|
||||||
|
if ('ok' !== response.result) {
|
||||||
|
res.send(488);
|
||||||
|
throw new Error(`failed allocating rtpengine endpoint: ${JSON.stringify(response)}`);
|
||||||
|
}
|
||||||
|
const sdp = await this.other.modify(response.sdp);
|
||||||
|
const opts = Object.assign({sdp, 'to-tag': res.getParsedHeader('To').params.tag},
|
||||||
|
rtpEngineOpts.answer);
|
||||||
|
response = await answer(opts);
|
||||||
|
if ('ok' !== response.result) {
|
||||||
|
res.send(488);
|
||||||
|
throw new Error(`failed allocating rtpengine endpoint: ${JSON.stringify(response)}`);
|
||||||
|
}
|
||||||
|
res.send(200, {body: response.sdp});
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(err, 'Error handling reinvite');
|
||||||
|
}
|
||||||
|
}
|
||||||
67
lib/middleware.js
Normal file
67
lib/middleware.js
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
const debug = require('debug')('jambonz:sbc-outbound');
|
||||||
|
const parseUri = require('drachtio-srf').parseUri;
|
||||||
|
const Registrar = require('jambonz-mw-registrar');
|
||||||
|
const {selectHostPort}= require('./utils');
|
||||||
|
|
||||||
|
function setLogger(logger) {
|
||||||
|
return (req, res, next) => {
|
||||||
|
debug('setting logger');
|
||||||
|
req.locals = req.locals || {};
|
||||||
|
req.locals.logger = logger.child({callId: req.get('Call-ID')});
|
||||||
|
next();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function route(opts) {
|
||||||
|
const registrar = new Registrar(opts);
|
||||||
|
return async(req, res, next) => {
|
||||||
|
const logger = req.locals.logger;
|
||||||
|
req.locals = req.locals || {};
|
||||||
|
logger.info(`received outbound INVITE to ${req.calledNumber} from server at ${req.server.hostport}`);
|
||||||
|
debug(`received outbound INVITE to ${req.calledNumber} from server at ${req.server.hostport}`);
|
||||||
|
|
||||||
|
// E.164 numbers go through least-cost routing and out a sip trunk
|
||||||
|
if (req.calledNumber.startsWith('+')) {
|
||||||
|
logger.info('sending call to LCR');
|
||||||
|
req.locals.target = 'lcr';
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise, its a call to a sip user
|
||||||
|
const uri = parseUri(req.uri);
|
||||||
|
const aor = `sip:${uri.user}@${uri.host}`;
|
||||||
|
debug(`searching for registered user ${aor}`);
|
||||||
|
const reg = await registrar.query(aor);
|
||||||
|
if (!reg) {
|
||||||
|
logger.info(`sbc-outbound call to a non-registered user ${aor}`);
|
||||||
|
debug(`sbc-outbound call to a non-registered user ${aor}`);
|
||||||
|
|
||||||
|
return res.send(404, 'User Not Found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// user is registered..find out which sbc is handling it
|
||||||
|
// if us => we can put the call through
|
||||||
|
// if another sbc => proxy the call there
|
||||||
|
if (req.server.hostport !== reg.sbcAddress) {
|
||||||
|
//proxy
|
||||||
|
const proxyAddress = selectHostPort(reg.sbcAddress, 'udp');
|
||||||
|
logger.info(`proxying call to SBC at ${proxyAddress}`);
|
||||||
|
debug(`proxying call to SBC at ${proxyAddress}`);
|
||||||
|
req.proxy(`sip:${proxyAddress[1]}`, {followRedirects: true});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
req.locals.registration = reg;
|
||||||
|
req.locals.target = 'user';
|
||||||
|
|
||||||
|
logger.info(`sending call to registered user at ${JSON.stringify(req.locals.registration)}`);
|
||||||
|
debug(`sending call to registered user at ${JSON.stringify(req.locals.registration)}`);
|
||||||
|
|
||||||
|
next();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
setLogger,
|
||||||
|
route
|
||||||
|
};
|
||||||
57
lib/utils.js
Normal file
57
lib/utils.js
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
const config = require('config');
|
||||||
|
let idx = 0;
|
||||||
|
const debug = require('debug')('jambonz:sbc-outbound');
|
||||||
|
|
||||||
|
function fromInboundTrunk(req) {
|
||||||
|
const trunks = config.has('trunks.inbound') ?
|
||||||
|
config.get('trunks.inbound') : [];
|
||||||
|
if (isWSS(req)) return false;
|
||||||
|
const trunk = trunks.find((t) => t.host.includes(req.source_address));
|
||||||
|
if (!trunk) return false;
|
||||||
|
req.carrier_name = trunk.name;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isWSS(req) {
|
||||||
|
return req.getParsedHeader('Via')[0].protocol.toLowerCase().startsWith('ws');
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectHostPort(hostport, protocol) {
|
||||||
|
debug(`selectHostPort: ${hostport}, ${protocol}`);
|
||||||
|
const sel = hostport
|
||||||
|
.split(',')
|
||||||
|
.map((hp) => {
|
||||||
|
const arr = /(.*)\/(.*):(.*)/.exec(hp);
|
||||||
|
return [arr[1], arr[2], arr[3]];
|
||||||
|
})
|
||||||
|
.filter((hp) => {
|
||||||
|
return hp[0] === protocol && hp[1] !== '127.0.0.1';
|
||||||
|
});
|
||||||
|
return sel[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAppserver() {
|
||||||
|
const len = config.get('trunks.appserver').length;
|
||||||
|
return config.get('trunks.appserver')[ idx++ % len];
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeRtpEngineOpts(req, srcIsUsingSrtp, dstIsUsingSrtp) {
|
||||||
|
const from = req.getParsedHeader('from');
|
||||||
|
const common = {'call-id': req.get('Call-ID'), 'from-tag': from.params.tag};
|
||||||
|
const rtpCharacteristics = config.get('transcoding.rtpCharacteristics');
|
||||||
|
const srtpCharacteristics = config.get('transcoding.srtpCharacteristics');
|
||||||
|
return {
|
||||||
|
common,
|
||||||
|
offer: Object.assign({'sdp': req.body, 'replace': ['origin', 'session-connection']}, common,
|
||||||
|
dstIsUsingSrtp ? srtpCharacteristics : rtpCharacteristics),
|
||||||
|
answer: Object.assign({}, common, srcIsUsingSrtp ? srtpCharacteristics : rtpCharacteristics)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
fromInboundTrunk,
|
||||||
|
isWSS,
|
||||||
|
getAppserver,
|
||||||
|
makeRtpEngineOpts,
|
||||||
|
selectHostPort
|
||||||
|
};
|
||||||
4741
package-lock.json
generated
Normal file
4741
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
48
package.json
Normal file
48
package.json
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "sbc-outbound",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"main": "app.js",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8.10.0"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"sip",
|
||||||
|
"drachtio"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jambonz/sbc-outbound.git"
|
||||||
|
},
|
||||||
|
"author": "Dave Horton",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jambonz/sbc-outbound/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/jambonz/sbc-outbound#readme",
|
||||||
|
"description": "jambonz session border controller application for outbound calls",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node app",
|
||||||
|
"test": "NODE_ENV=test node test/ | ./node_modules/.bin/tap-spec",
|
||||||
|
"coverage": "./node_modules/.bin/nyc --reporter html --report-dir ./coverage npm run test",
|
||||||
|
"jslint": "eslint app.js lib"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"config": "^3.2.2",
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"drachtio-fn-b2b-sugar": "^0.0.12",
|
||||||
|
"drachtio-srf": "^4.4.14",
|
||||||
|
"eslint": "^6.2.2",
|
||||||
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
|
"jambonz-mw-registrar": "0.0.3s",
|
||||||
|
"pino": "^5.13.2",
|
||||||
|
"rtpengine-client": "^0.0.8"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"blue-tape": "^1.0.0",
|
||||||
|
"clear-module": "^4.0.0",
|
||||||
|
"nyc": "^14.1.1",
|
||||||
|
"tap": "^14.6.1",
|
||||||
|
"tap-dot": "^2.0.0",
|
||||||
|
"tap-spec": "^5.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
60
test/docker-compose-testbed.yaml
Normal file
60
test/docker-compose-testbed.yaml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
networks:
|
||||||
|
sbc-outbound:
|
||||||
|
driver: bridge
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: 172.39.0.0/16
|
||||||
|
|
||||||
|
services:
|
||||||
|
sbc:
|
||||||
|
image: drachtio/drachtio-server:latest
|
||||||
|
command: drachtio --contact "sip:*;transport=udp" --loglevel debug --sofia-loglevel 9
|
||||||
|
ports:
|
||||||
|
- "9060:9022/tcp"
|
||||||
|
networks:
|
||||||
|
sbc-outbound:
|
||||||
|
ipv4_address: 172.39.0.10
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:5-alpine
|
||||||
|
ports:
|
||||||
|
- "16379:6379/tcp"
|
||||||
|
networks:
|
||||||
|
sbc-outbound:
|
||||||
|
ipv4_address: 172.39.0.11
|
||||||
|
|
||||||
|
rtpengine:
|
||||||
|
image: drachtio/rtpengine:latest
|
||||||
|
ports:
|
||||||
|
- "12222:22222/udp"
|
||||||
|
networks:
|
||||||
|
sbc-outbound:
|
||||||
|
ipv4_address: 172.39.0.12
|
||||||
|
|
||||||
|
registrar:
|
||||||
|
image: jambonz/sbc-registrar:latest
|
||||||
|
command: npm start
|
||||||
|
env_file: registrar.env
|
||||||
|
networks:
|
||||||
|
sbc-outbound:
|
||||||
|
ipv4_address: 172.39.0.13
|
||||||
|
|
||||||
|
auth-server:
|
||||||
|
image: jambonz/customer-auth-server:latest
|
||||||
|
command: npm start
|
||||||
|
env_file: http-auth.env
|
||||||
|
networks:
|
||||||
|
sbc-outbound:
|
||||||
|
ipv4_address: 172.39.0.14
|
||||||
|
|
||||||
|
carrier:
|
||||||
|
image: drachtio/sipp:latest
|
||||||
|
command: sipp -sf /tmp/uas.xml
|
||||||
|
volumes:
|
||||||
|
- ./scenarios:/tmp
|
||||||
|
tty: true
|
||||||
|
networks:
|
||||||
|
sbc-outbound:
|
||||||
|
ipv4_address: 172.39.0.20
|
||||||
12
test/docker_start.js
Normal file
12
test/docker_start.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
const test = require('tape').test ;
|
||||||
|
const exec = require('child_process').exec ;
|
||||||
|
const async = require('async');
|
||||||
|
|
||||||
|
test('starting docker network..', (t) => {
|
||||||
|
exec(`docker-compose -f ${__dirname}/docker-compose-testbed.yaml up -d`, (err, stdout, stderr) => {
|
||||||
|
t.end(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
12
test/docker_stop.js
Normal file
12
test/docker_stop.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
const test = require('tape').test ;
|
||||||
|
const exec = require('child_process').exec ;
|
||||||
|
|
||||||
|
test('stopping docker network..', (t) => {
|
||||||
|
t.timeoutAfter(10000);
|
||||||
|
exec(`docker-compose -f ${__dirname}/docker-compose-testbed.yaml down`, (err, stdout, stderr) => {
|
||||||
|
//console.log(`stderr: ${stderr}`);
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
t.end() ;
|
||||||
|
});
|
||||||
|
|
||||||
2
test/http-auth.env
Normal file
2
test/http-auth.env
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# tip: to minify json into a single string as below, see https://codebeautify.org/jsonminifier
|
||||||
|
NODE_CONFIG={"server":{"port":4000,"path":"/auth","auth":{"users":{"foo":"bar"}}},"credentials":{"jambonz.org":[{"username":"john","password":"1234"},{"username":"jane","password":"5678"}]}}
|
||||||
3
test/index.js
Normal file
3
test/index.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
require('./docker_start');
|
||||||
|
require('./sip-tests');
|
||||||
|
require('./docker_stop');
|
||||||
3
test/registrar.env
Normal file
3
test/registrar.env
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# tip: to minify json into a single string as below, see https://codebeautify.org/jsonminifier
|
||||||
|
NODE_CONFIG={"drachtio":{"host":"sbc","port":9022,"secret":"cymru"},"redis":{"port":6379,"host":"172.39.0.11","prefix":"jb"},"authCallback":{"uri":"http://auth-server:4000/auth","auth":{"username":"foo","password":"bar"}},"logging":{"level":"info"}}
|
||||||
|
DEBUG=jambonz:*
|
||||||
3
test/scenarios/bad_password.csv
Normal file
3
test/scenarios/bad_password.csv
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
SEQUENTIAL
|
||||||
|
# user, domain, authentication
|
||||||
|
jane;jambonz.org;[authentication username=jane password=8765]
|
||||||
|
3
test/scenarios/good_user.csv
Normal file
3
test/scenarios/good_user.csv
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
SEQUENTIAL
|
||||||
|
# user, domain, authentication
|
||||||
|
john;jambonz.org;[authentication username=john password=1234]
|
||||||
|
BIN
test/scenarios/pcap/g711a.pcap
Normal file
BIN
test/scenarios/pcap/g711a.pcap
Normal file
Binary file not shown.
132
test/scenarios/uac-device-invalid-password.xml
Normal file
132
test/scenarios/uac-device-invalid-password.xml
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="401" auth="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@jambonz.org SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 INVITE
|
||||||
|
[authentication username=john password=2222]
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="403">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@jambonz.org SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 ACK
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
132
test/scenarios/uac-device-unknown-realm.xml
Normal file
132
test/scenarios/uac-device-unknown-realm.xml
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@jambones.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="401" auth="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@jambones.org SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@jambones.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 INVITE
|
||||||
|
[authentication username=john password=1234]
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="403">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@jambones.org SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 ACK
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
132
test/scenarios/uac-device-unknown-user.xml
Normal file
132
test/scenarios/uac-device-unknown-user.xml
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="401" auth="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@jambonz.org SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 INVITE
|
||||||
|
[authentication username=jay password=1234]
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="403">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@jambonz.org SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 ACK
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
44
test/scenarios/uac-info-expect-480.xml
Normal file
44
test/scenarios/uac-info-expect-480.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INFO sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INFO
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="480" rtd="true"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
44
test/scenarios/uac-message-expect-480.xml
Normal file
44
test/scenarios/uac-message-expect-480.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
MESSAGE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 MESSAGE
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="480" rtd="true"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
44
test/scenarios/uac-options-expect-480.xml
Normal file
44
test/scenarios/uac-options-expect-480.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
OPTIONS sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 OPTIONS
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="480" rtd="true"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
119
test/scenarios/uac-outbound-user-success.xml
Normal file
119
test/scenarios/uac-outbound-user-success.xml
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:john@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:john@jambonz.org>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-outbound-user-success
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="180" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||||
|
<!-- are saved and used for following messages sent. Useful to test -->
|
||||||
|
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||||
|
<recv response="200" rtd="true" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:john@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:john@jambonz.org>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-outbound-user-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- Play a pre-recorded PCAP file (RTP stream) -->
|
||||||
|
<nop>
|
||||||
|
<action>
|
||||||
|
<exec play_pcap_audio="pcap/g711a.pcap"/>
|
||||||
|
</action>
|
||||||
|
</nop>
|
||||||
|
|
||||||
|
<!-- Pause briefly -->
|
||||||
|
<pause milliseconds="3000"/>
|
||||||
|
|
||||||
|
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
BYE sip:john@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:john@jambonz.org ]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 BYE
|
||||||
|
Subject: uac-outbound-user-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="200" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
116
test/scenarios/uac-pcap-carrier-success.xml
Normal file
116
test/scenarios/uac-pcap-carrier-success.xml
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:+16173333456@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:+16173333456@jambonz.org>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-pcap-carrier-success
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="180" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="200" rtd="true" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:sip:+16173333456@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:sip:+16173333456@jambonz.org>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Subject: uac-pcap-carrier-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- Play a pre-recorded PCAP file (RTP stream) -->
|
||||||
|
<nop>
|
||||||
|
<action>
|
||||||
|
<exec play_pcap_audio="pcap/g711a.pcap"/>
|
||||||
|
</action>
|
||||||
|
</nop>
|
||||||
|
|
||||||
|
<!-- Pause briefly -->
|
||||||
|
<pause milliseconds="2000"/>
|
||||||
|
|
||||||
|
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
BYE sip:sip:+16173333456@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:sip:+16173333456@jambonz.org>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 BYE
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-pcap-carrier-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="200" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
77
test/scenarios/uac-pcap-device-404.xml
Normal file
77
test/scenarios/uac-pcap-device-404.xml
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:jane@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:jane@jambonz.org>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="404" rtd="true" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:sip:jane@jambonz.org SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:sip:jane@jambonz.org>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
187
test/scenarios/uac-pcap-device-success-in-dialog-request.xml
Normal file
187
test/scenarios/uac-pcap-device-success-in-dialog-request.xml
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="401" auth="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@jambonz.org SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 INVITE
|
||||||
|
[authentication username=john password=1234]
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="180" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="200" rtd="true" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 ACK
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- Play a pre-recorded PCAP file (RTP stream) -->
|
||||||
|
<nop>
|
||||||
|
<action>
|
||||||
|
<exec play_pcap_audio="pcap/g711a.pcap"/>
|
||||||
|
</action>
|
||||||
|
</nop>
|
||||||
|
|
||||||
|
<!-- Pause briefly -->
|
||||||
|
<pause milliseconds="1000"/>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INFO sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 3 INFO
|
||||||
|
Max-Forwards: 70
|
||||||
|
Event: X-custom-Event
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Type: application/text
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
foobar
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="200" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
BYE sip:[service]@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 4 BYE
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="200" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
116
test/scenarios/uac-pcap-device-success.xml
Normal file
116
test/scenarios/uac-pcap-device-success.xml
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:john@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:john@jambonz.org>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[local_ip_type] [local_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [auto_media_port] RTP/AVP 8 101
|
||||||
|
a=rtpmap:8 PCMA/8000
|
||||||
|
a=rtpmap:101 telephone-event/8000
|
||||||
|
a=fmtp:101 0-11,16
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="180" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="200" rtd="true" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:sip:john@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:sip:john@jambonz.org>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- Play a pre-recorded PCAP file (RTP stream) -->
|
||||||
|
<nop>
|
||||||
|
<action>
|
||||||
|
<exec play_pcap_audio="pcap/g711a.pcap"/>
|
||||||
|
</action>
|
||||||
|
</nop>
|
||||||
|
|
||||||
|
<!-- Pause briefly -->
|
||||||
|
<pause milliseconds="2000"/>
|
||||||
|
|
||||||
|
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
BYE sip:sip:john@jambonz.org SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: <sip:sip:john@jambonz.org>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 BYE
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: uac-pcap-device-success
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="200" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
45
test/scenarios/uac-publish-expect-480.xml
Normal file
45
test/scenarios/uac-publish-expect-480.xml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
PUBLISH sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 PUBLISH
|
||||||
|
Contact: <sip:sipp@[local_ip]:[local_port]>;expires=3600
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="480" rtd="true"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
64
test/scenarios/uac-register-auth-success.xml
Normal file
64
test/scenarios/uac-register-auth-success.xml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
REGISTER sip:[field1] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
Max-Forwards: 70
|
||||||
|
From: "sipp" <sip:[field0]@[field1]>;tag=[call_number]
|
||||||
|
To: "sipp" <sip:[field0]@[field1]>
|
||||||
|
Call-ID: reg///[call_id]
|
||||||
|
CSeq: 7 REGISTER
|
||||||
|
Contact: <sip:sipp@[local_ip]:[local_port]>
|
||||||
|
Expires: 3600
|
||||||
|
Content-Length: 0
|
||||||
|
User-Agent: SIPp
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="401" auth="true" rtd="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
REGISTER sip:[field1] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
Max-Forwards: 70
|
||||||
|
From: "sipp" <sip:[field0]@[field1]>;tag=[call_number]
|
||||||
|
To: "sipp" <sip:[field0]@[field1]>
|
||||||
|
Call-ID: reg///[call_id]
|
||||||
|
CSeq: 8 REGISTER
|
||||||
|
Contact: <sip:sipp@[local_ip]:[local_port]>
|
||||||
|
Expires: 3600
|
||||||
|
Content-Length: 0
|
||||||
|
User-Agent: SIPp
|
||||||
|
[field2]
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="200">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
45
test/scenarios/uac-register-expect-480.xml
Normal file
45
test/scenarios/uac-register-expect-480.xml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
REGISTER sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 REGISTER
|
||||||
|
Contact: <sip:sipp@[local_ip]:[local_port]>;expires=3600
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="480" rtd="true"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
45
test/scenarios/uac-subscribe-expect-480.xml
Normal file
45
test/scenarios/uac-subscribe-expect-480.xml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 SUBSCRIBE
|
||||||
|
Contact: <sip:sipp@[local_ip]:[local_port]>;expires=3600
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="480" rtd="true"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
71
test/scenarios/uac-unregister-auth-success.xml
Normal file
71
test/scenarios/uac-unregister-auth-success.xml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
REGISTER sip:[field1] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
Max-Forwards: 70
|
||||||
|
From: "sipp" <sip:[field0]@[field1]>;tag=[call_number]
|
||||||
|
To: "sipp" <sip:[field0]@[field1]>
|
||||||
|
Call-ID: reg///[call_id]
|
||||||
|
CSeq: 7 REGISTER
|
||||||
|
Contact: <sip:sipp@[local_ip]:[local_port]>
|
||||||
|
Expires: 0
|
||||||
|
Content-Length: 0
|
||||||
|
User-Agent: SIPp
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="401" auth="true" rtd="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
REGISTER sip:[field1] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
Max-Forwards: 70
|
||||||
|
From: "sipp" <sip:[field0]@[field1]>;tag=[call_number]
|
||||||
|
To: "sipp" <sip:[field0]@[field1]>
|
||||||
|
Call-ID: reg///[call_id]
|
||||||
|
CSeq: 8 REGISTER
|
||||||
|
Contact: <sip:sipp@[local_ip]:[local_port]>
|
||||||
|
Expires: 0
|
||||||
|
Content-Length: 0
|
||||||
|
User-Agent: SIPp
|
||||||
|
[field2]
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="200">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<ResponseTimeRepartition value="10, 20"/>
|
||||||
|
<CallLengthRepartition value="10"/>
|
||||||
|
</scenario>
|
||||||
|
|
||||||
118
test/scenarios/uac.xml
Normal file
118
test/scenarios/uac.xml
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uac' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic Sipstone UAC">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[media_ip_type] [media_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [media_port] RTP/AVP 0
|
||||||
|
a=rtpmap:0 PCMU/8000
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100"
|
||||||
|
optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="180" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="183" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||||
|
<!-- are saved and used for following messages sent. Useful to test -->
|
||||||
|
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||||
|
<recv response="200" rtd="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||||
|
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- This delay can be customized by the -d command-line option -->
|
||||||
|
<!-- or by adding a 'milliseconds = "value"' option here. -->
|
||||||
|
<pause/>
|
||||||
|
|
||||||
|
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 2 BYE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="200" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
115
test/scenarios/uas-simple.xml
Normal file
115
test/scenarios/uas-simple.xml
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uas' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic UAS responder">
|
||||||
|
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||||
|
<!-- are saved and used for following messages sent. Useful to test -->
|
||||||
|
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||||
|
<recv request="INVITE" crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- The '[last_*]' keyword is replaced automatically by the -->
|
||||||
|
<!-- specified header if it was present in the last message received -->
|
||||||
|
<!-- (except if it was a retransmission). If the header was not -->
|
||||||
|
<!-- present or if no message has been received, the '[last_*]' -->
|
||||||
|
<!-- keyword is discarded, and all bytes until the end of the line -->
|
||||||
|
<!-- are also discarded. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- If the specified header was present several times in the -->
|
||||||
|
<!-- message, all occurrences are concatenated (CRLF separated) -->
|
||||||
|
<!-- to be used in place of the '[last_*]' keyword. -->
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
SIP/2.0 180 Ringing
|
||||||
|
[last_Via:]
|
||||||
|
[last_From:]
|
||||||
|
[last_To:];tag=[pid]SIPpTag01[call_number]
|
||||||
|
[last_Call-ID:]
|
||||||
|
[last_CSeq:]
|
||||||
|
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
SIP/2.0 200 OK
|
||||||
|
[last_Via:]
|
||||||
|
[last_From:]
|
||||||
|
[last_To:];tag=[pid]SIPpTag01[call_number]
|
||||||
|
[last_Call-ID:]
|
||||||
|
[last_CSeq:]
|
||||||
|
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[media_ip_type] [media_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [media_port] RTP/AVP 0
|
||||||
|
a=rtpmap:0 PCMU/8000
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv request="ACK"
|
||||||
|
optional="true"
|
||||||
|
rtd="true"
|
||||||
|
crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv request="BYE">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
SIP/2.0 200 OK
|
||||||
|
[last_Via:]
|
||||||
|
[last_From:]
|
||||||
|
[last_To:]
|
||||||
|
[last_Call-ID:]
|
||||||
|
[last_CSeq:]
|
||||||
|
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- Keep the call open for a while in case the 200 is lost to be -->
|
||||||
|
<!-- able to retransmit it if we receive the BYE again. -->
|
||||||
|
<timewait milliseconds="4000"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
130
test/scenarios/uas.xml
Normal file
130
test/scenarios/uas.xml
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp default 'uas' scenario. -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="Basic UAS responder">
|
||||||
|
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||||
|
<!-- are saved and used for following messages sent. Useful to test -->
|
||||||
|
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||||
|
<recv request="INVITE" crlf="true">
|
||||||
|
<action>
|
||||||
|
<ereg regexp=".*" search_in="hdr" header="Subject:" assign_to="1" />
|
||||||
|
</action>
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<!-- The '[last_*]' keyword is replaced automatically by the -->
|
||||||
|
<!-- specified header if it was present in the last message received -->
|
||||||
|
<!-- (except if it was a retransmission). If the header was not -->
|
||||||
|
<!-- present or if no message has been received, the '[last_*]' -->
|
||||||
|
<!-- keyword is discarded, and all bytes until the end of the line -->
|
||||||
|
<!-- are also discarded. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- If the specified header was present several times in the -->
|
||||||
|
<!-- message, all occurrences are concatenated (CRLF separated) -->
|
||||||
|
<!-- to be used in place of the '[last_*]' keyword. -->
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
SIP/2.0 180 Ringing
|
||||||
|
[last_Via:]
|
||||||
|
[last_From:]
|
||||||
|
[last_To:];tag=[pid]SIPpTag01[call_number]
|
||||||
|
[last_Call-ID:]
|
||||||
|
[last_CSeq:]
|
||||||
|
[last_Record-Route:]
|
||||||
|
Subject:[$1]
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
SIP/2.0 200 OK
|
||||||
|
[last_Via:]
|
||||||
|
[last_From:]
|
||||||
|
[last_To:];tag=[pid]SIPpTag01[call_number]
|
||||||
|
[last_Call-ID:]
|
||||||
|
[last_CSeq:]
|
||||||
|
[last_Record-Route:]
|
||||||
|
Subject:[$1]
|
||||||
|
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: [len]
|
||||||
|
|
||||||
|
v=0
|
||||||
|
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||||
|
s=-
|
||||||
|
c=IN IP[media_ip_type] [media_ip]
|
||||||
|
t=0 0
|
||||||
|
m=audio [media_port] RTP/AVP 0
|
||||||
|
a=rtpmap:0 PCMU/8000
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv request="ACK"
|
||||||
|
rtd="true"
|
||||||
|
crlf="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv request="INFO" optional="true" next="1">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv request="BYE">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send next="2">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
SIP/2.0 200 OK
|
||||||
|
[last_Via:]
|
||||||
|
[last_From:]
|
||||||
|
[last_To:]
|
||||||
|
[last_Call-ID:]
|
||||||
|
[last_CSeq:]
|
||||||
|
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<label id="1"/>
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
SIP/2.0 200 OK
|
||||||
|
[last_Via:]
|
||||||
|
[last_From:]
|
||||||
|
[last_To:]
|
||||||
|
[last_Call-ID:]
|
||||||
|
[last_CSeq:]
|
||||||
|
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<label id="2"/>
|
||||||
|
|
||||||
|
</scenario>
|
||||||
|
|
||||||
40
test/sip-tests.js
Normal file
40
test/sip-tests.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
const test = require('blue-tape');
|
||||||
|
const { output, sippUac } = require('./sipp')('test_sbc-outbound');
|
||||||
|
const debug = require('debug')('jambonz:sbc-outbound');
|
||||||
|
const clearModule = require('clear-module');
|
||||||
|
|
||||||
|
process.on('unhandledRejection', (reason, p) => {
|
||||||
|
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
||||||
|
});
|
||||||
|
|
||||||
|
function connect(connectable) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
connectable.on('connect', () => {
|
||||||
|
return resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
test('sbc-outbound tests', async(t) => {
|
||||||
|
const {srf} = require('../app');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await connect(srf);
|
||||||
|
await sippUac('uac-register-auth-success.xml', {ip: '172.39.0.31', data_file: 'good_user.csv'});
|
||||||
|
t.pass('sip user/device registered over udp');
|
||||||
|
const p = sippUac('uas.xml', {ip: '172.39.0.31'});
|
||||||
|
await sippUac('uac-pcap-device-success.xml');
|
||||||
|
await p;
|
||||||
|
t.pass('successfully completed outbound call to the registered user/devices');
|
||||||
|
await sippUac('uac-pcap-device-404.xml');
|
||||||
|
t.pass('return 404 to outbound attempt to unregisteted user/device');
|
||||||
|
await sippUac('uac-pcap-carrier-success.xml');
|
||||||
|
t.pass('successfully completed outbound call to configured sip trunk');
|
||||||
|
|
||||||
|
srf.disconnect();
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
srf.disconnect();
|
||||||
|
t.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
75
test/sipp.js
Normal file
75
test/sipp.js
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
const { spawn } = require('child_process');
|
||||||
|
//const debug = require('debug')('test:sipp');
|
||||||
|
let network;
|
||||||
|
const obj = {};
|
||||||
|
let output = '';
|
||||||
|
let idx = 1;
|
||||||
|
|
||||||
|
function clearOutput() {
|
||||||
|
output = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function addOutput(str) {
|
||||||
|
for (let i = 0; i < str.length; i++) {
|
||||||
|
if (str.charCodeAt(i) < 128) output += str.charAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = (networkName) => {
|
||||||
|
network = networkName ;
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.output = () => {
|
||||||
|
return output;
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.sippUac = (file, opts) => {
|
||||||
|
opts = opts || {};
|
||||||
|
const cmd = 'docker';
|
||||||
|
let args = [
|
||||||
|
'run', '-ti', '--rm', '--net', `${network}`
|
||||||
|
]
|
||||||
|
.concat(opts.ip ? ['--ip', opts.ip] : [])
|
||||||
|
.concat([
|
||||||
|
'-v', `${__dirname}/scenarios:/tmp/scenarios`,
|
||||||
|
'drachtio/sipp', 'sipp'
|
||||||
|
])
|
||||||
|
.concat(opts.remote_host ? opts.remote_host : [])
|
||||||
|
.concat(opts.data_file ? ['-inf', `/tmp/scenarios/${opts.data_file}`] : [])
|
||||||
|
.concat([
|
||||||
|
'-sf', `/tmp/scenarios/${file}`,
|
||||||
|
'-m', '1',
|
||||||
|
'-sleep', '100ms',
|
||||||
|
'-nostdin',
|
||||||
|
'-cid_str', `%u-%p@%s-${idx++}`,
|
||||||
|
'sbc'
|
||||||
|
]);
|
||||||
|
|
||||||
|
//console.log(`args: ${args}`);
|
||||||
|
clearOutput();
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const child_process = spawn(cmd, args, {stdio: ['inherit', 'pipe', 'pipe']});
|
||||||
|
|
||||||
|
child_process.on('exit', (code, signal) => {
|
||||||
|
if (code === 0) {
|
||||||
|
return resolve();
|
||||||
|
}
|
||||||
|
console.log(`sipp exited with non-zero code ${code} signal ${signal}`);
|
||||||
|
reject(code);
|
||||||
|
});
|
||||||
|
child_process.on('error', (error) => {
|
||||||
|
console.log(`error spawing child process for docker: ${args}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
child_process.stdout.on('data', (data) => {
|
||||||
|
//debug(`stdout: ${data}`);
|
||||||
|
addOutput(data.toString());
|
||||||
|
});
|
||||||
|
child_process.stdout.on('data', (data) => {
|
||||||
|
//debug(`stdout: ${data}`);
|
||||||
|
addOutput(data.toString());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user