diff --git a/config.ini.sample b/config.ini.sample index c2fca4a..79b9714 100644 --- a/config.ini.sample +++ b/config.ini.sample @@ -1,139 +1,140 @@ ; SylkServer configuration file [Server] ; The following settings are the default used by the software, uncomment ; them only if you want to make changes ; default_application = conference ; Statically map a Request URI to a specific application. In the example ; below, 123 is matched 1st against the domain part, than the username part ; of the Request URI This static mapping can be overwritten by adding ; X-Sylk-App header set to the value of a valid SylkServer application name ; application_map = echo:echo,123:conference,test:ircconference,gmail.com:xmppgateway +application_map = echo:echo,playback:playback ; Disable the specified applications -; disabled_applications = +disabled_applications = ircconference, xmppgateway ; Directory where extra applications are stored ; extra_applications_dir = trace_dir = /var/log/sylkserver ; trace_dns = False ; trace_sip = False ; trace_msrp = False ; trace_core = False ; trace_notifications = False ; Log level (one of debug, info, warning, error or critical). ;log_level = info ; TLS is used by default for SIP signaling and MSRP media using a self-signed ; certificate. You may want to use a properly signed X.509 certificate and ; configure it below ; The X.509 Certificate Authorities file ca_file = /etc/sylkserver/tls/ca.crt ; The file containing X.509 certificate and private key in unencrypted format certificate = /etc/sylkserver/tls/default.crt ; verify_server = False ; Enable Bonjour capabilities for applications ; enable_bonjour = False ; Base directory for files created by the server, excluding log files ; spool_dir = /var/spool/sylkserver [SIP] ; SIP transport settings ; IP address used for SIP signaling and RTP media; an empty string or 'any' means listening on ; the interface used by the default route ; local_ip = ; IP address to be advertised in the SDP, useful in 1-to-1 NAT scenarios such as Amazon EC2 ; advertised_ip = ; Ports used for SIP transports, if not set to any value the transport will be disabled ; local_udp_port = 5060 ; local_tcp_port = 5060 ; local_tls_port = 5061 ; If set, all outbound SIP requests will be sent through this SIP proxy ; The proxy address format is: proxy.example.com:5061;transport=tls ; Transport can be udp, tcp or tls, if skipped it is considered udp ; If only the hostname is set, RFC3263 lookups are performed to lookup ; the outbound proxy server address ; outbound_proxy = ; A comma-separated list of hosts or networks to trust. ; The elements can be an IP address in CIDR format, a ; hostname or an IP address (in the latter 2 a mask of 32 ; is assumed), or the special keywords 'any' and 'none' ; (being equivalent to 0.0.0.0/0 and 0.0.0.0/32 ; respectively). It defaults to 'any'. ; trusted_peers = ; Toggle ICE support (RFC 5245) ; enable_ice = False [MSRP] ; MSRP transport settings ; A valid X.509 certificate is required for MSRP to work over TLS. ; TLS is enabled by default, a default TLS certificate is provided with SylkServer. ; use_tls = True [RTP] ; RTP transport settings ; Allowed codec list, valid values: opus, G722, speex, PCMU, PCMA, iLBC, GSM ; audio_codecs = opus,G722,speex,PCMU,PCMA ; Port range used for RTP ; port_range = 50000:50500 ; SRTP valid values: disabled, sdes, zrtp, opportunistic ; srtp_encryption = opportunistic ; RTP stream timeout, session will be disconnected after this value ; timeout = 30 ; Audio sampling rate ; sample_rate = 48000 [WebServer] ; Global web server settings ; IP address used for serving HTTP(S) requests, empty string ; means listen on interface used by the default route ; local_ip = ; Port where the web server will listen on, set to 0 for random ; local_port = 10888 ; X.509 server certificate for HTTPS connections, the certificate private ; key must be concatenated inside the same file, set to empty in order to ; disable HTTPS ; certificate = /etc/sylkserver/tls/default.crt ; Certificat chain file containing all the certificates that the server ; should present to the client. If specified, it must also contain the ; certificate in the file specified by the 'certificate' option. ; certificate_chain ; Hostname used when publishing the server URL. Must match the common name ; of server X.509 certificate set above, otherwise clients will raise ; warning. If not set the listening IP address will be used ; hostname = diff --git a/playback.ini.sample b/playback.ini.sample index 44933e9..28cd7e3 100644 --- a/playback.ini.sample +++ b/playback.ini.sample @@ -1,16 +1,20 @@ ; Playback application configuration [Playback] ; files_dir = /usr/share/sylkserver/sounds/playback ; Toggle video support (SylkServer will send a color bar) ; enable_video = False ; Delay for answering sessions ; answer_delay = 1 ; [test@conference.example.com] ; file = test.wav - ; enable_video and answer_delay can be overridden here + +[playback] +file = moh/Cool_Grass_vbr.wav +enable_video = True +answer_delay = 2 diff --git a/sylk/applications/playback/configuration.py b/sylk/applications/playback/configuration.py index 17c4b76..a8614ff 100644 --- a/sylk/applications/playback/configuration.py +++ b/sylk/applications/playback/configuration.py @@ -1,46 +1,46 @@ import os from application.configuration import ConfigFile, ConfigSection, ConfigSetting from sylk.configuration.datatypes import Path from sylk.resources import Resources __all__ = 'get_config', class GeneralConfig(ConfigSection): __cfgfile__ = 'playback.ini' __section__ = 'Playback' - files_dir = ConfigSetting(type=Path, value=Path(Resources.get('sounds/playback'))) + files_dir = ConfigSetting(type=Path, value=Path(Resources.get('sounds'))) enable_video = False answer_delay = 1 class PlaybackConfig(ConfigSection): __cfgfile__ = 'playback.ini' file = ConfigSetting(type=Path, value=None) enable_video = GeneralConfig.enable_video answer_delay = GeneralConfig.answer_delay class Configuration(object): def __init__(self, data): self.__dict__.update(data) def get_config(uri): config_file = ConfigFile(PlaybackConfig.__cfgfile__) GeneralConfig.read(cfgfile=config_file) section = config_file.get_section(uri) if section is not None: PlaybackConfig.read(section=uri) if not os.path.isabs(PlaybackConfig.file): PlaybackConfig.file = os.path.join(GeneralConfig.files_dir, PlaybackConfig.file) config = Configuration(dict(PlaybackConfig)) PlaybackConfig.reset() return config return None