Commit 1ca6cd94 authored by Łukasz Nowak's avatar Łukasz Nowak

siptester instantiation recipe.

parent 7a2f0ca1
Changelog
=========
0.0.3 (2010-10-13)
----------------
- Use slapos.librecipe to simplify the recipe
0.0.2 (2010-10-13)
----------------
- Change erp5.recipe.siptesterinstance namespace to slapos.recipe.siptester
0.0.1 (2010-09-02)
----------------
- Initial version
[Romain Courteaud]
recursive-include src/erp5/recipe/siptesterinstance *.in
include README.txt
include CHANGES.txt
[egg_info]
tag_build = .dev
tag_svn_revision = 1
from setuptools import setup, find_packages
import os
name = "slapos.recipe.siptester"
version = '0.0.25'
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
long_description=( read('README.txt')
+ '\n' +
read('CHANGES.txt')
)
setup(
name = name,
version = version,
author = 'Romain Courteaud',
author_email = 'romain@nexedi.com',
description =
"zc.buildout recipe that instanciate a siptester",
long_description = long_description,
license = "GPL2",
keywords = "siptester buildout",
classifiers = [
"Framework :: Buildout :: Recipe",
],
package_dir = {'': 'src'},
packages = find_packages('src'),
namespace_packages = ['slapos', 'slapos.recipe'],
include_package_data = True,
install_requires = ['setuptools', 'slapos.lib.recipe'],
entry_points = {'zc.buildout': ['default = %s:CallerRecipe' % name,
'caller = %s:CallerRecipe' % name,
'receiver = %s:ReceiverRecipe' % name,
]},
)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
import os
import pkg_resources
from slapos.lib.recipe.BaseSlapRecipe import BaseSlapRecipe
class SipTesterRecipe(BaseSlapRecipe):
def __init__(self, buildout, name, options):
BaseSlapRecipe.__init__(self, buildout, name, options)
self.pjsua_configuration_file = os.path.join(self.etc_directory,
'pjsua.conf')
def _createPJSUAConfiguration(self, template_name):
pjsua_input = pkg_resources.resource_string(__name__, os.path.join(
'template', template_name))
if self._writeFile(self.pjsua_configuration_file,
pjsua_input % self.options):
# XXX: How to inform slap/slapgrid that something changed and it might
# be not bad idea to restart CP?
pass
return self.pjsua_configuration_file
def _install(self):
path = self._createPJSUAConfiguration(self.config_template)
d = {}
d.update(self.options)
d['pjsua_configuration_file'] = self.pjsua_configuration_file
# XXX Hardcoded path
d['pjsua_binary'] = os.path.join(self.buildout['software_definition'
]['software_home'].strip(), 'parts', 'pjproject-1.7', 'bin', 'pjsua')
d['siptester_binary'] = os.path.join(self.buildout['software_definition'
]['software_home'].strip(), 'bin', 'siptester')
self.running_wrapper_location = pkg_resources.resource_filename(__name__, os.path.join(
'template',
self.wrapper_template))
self._createRunningWrapper(d)
return [path, wrapper_path]
update = install
class ReceiverRecipe(SipTesterRecipe):
config_template = "pjsua_receiver.conf.in"
wrapper_template = "init_receiver.in"
class CallerRecipe(SipTesterRecipe):
config_template = "pjsua_caller.conf.in"
wrapper_template = "init_caller.in"
def _install(self):
# First of all, ask for a sipreceiver
self.request(self.software_release_url, 'sipreceiver')
return SipTesterRecipe._install(self)
#!/bin/sh
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
exec %(siptester_binary)s %(pjsua_binary)s %(pjsua_configuration_file)s %(caller_destination)s
#!/bin/sh
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
exec %(siptester_binary)s %(pjsua_binary)s %(pjsua_configuration_file)s
#
# Logging options:
#
--log-level 0
--app-log-level 0
#
# Account 0:
#
--id %(caller_id)s
--registrar %(caller_registrar)s
--realm %(caller_realm)s
--username %(caller_username)s
--password %(caller_password)s
--reg-timeout 300
#
# Network settings:
#
--local-port 5060
#
# Media settings:
#
--null-audio
--playback-lat 100
--rtp-port 4000
#
# User agent:
#
--max-calls 4
--duration 300
#
# Logging options:
#
--log-level 0
--app-log-level 0
#
# Account 0:
#
--id %(receiver_id)s
--registrar %(receiver_registrar)s
--realm %(receiver_realm)s
--username %(receiver_username)s
--password %(receiver_password)s
--reg-timeout 300
#
# Network settings:
#
--local-port 5060
#
# Media settings:
#
--null-audio
--auto-play
--play-file %(wav_path)s
--playback-lat 100
--rtp-port 4000
#
# User agent:
#
--auto-answer 200
--max-calls 4
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment