コード例 #1
0
    class CONFIG_CLASS(BaseWorker.CONFIG_CLASS):
        worker_name = ConfigText(
            'Name of the this message store resource worker',
            required=True,
            static=True)
        twisted_endpoint = ConfigServerEndpoint(
            'Twisted endpoint to listen on.',
            required=True,
            static=True,
            fallbacks=[ServerEndpointFallback()])
        web_path = ConfigText('The path to serve this resource on.',
                              required=True,
                              static=True)
        health_path = ConfigText('The path to serve the health resource on.',
                                 default='/health/',
                                 static=True)
        riak_manager = ConfigDict('Riak client configuration.',
                                  default={},
                                  static=True)
        redis_manager = ConfigDict('Redis client configuration.',
                                   default={},
                                   static=True)

        # TODO: Deprecate these fields when confmodel#5 is done.
        host = ConfigText(
            "*DEPRECATED* 'host' and 'port' fields may be used in place of"
            " the 'twisted_endpoint' field.",
            static=True)
        port = ConfigInt(
            "*DEPRECATED* 'host' and 'port' fields may be used in place of"
            " the 'twisted_endpoint' field.",
            static=True)
コード例 #2
0
class TelnetServerConfig(Transport.CONFIG_CLASS):
    """
    Telnet transport configuration.
    """
    twisted_endpoint = ConfigServerEndpoint(
        "The endpoint the Telnet server will listen on.",
        fallbacks=[ServerEndpointFallback('telnet_host', 'telnet_port')],
        required=True,
        static=True)
    to_addr = ConfigText(
        "The to_addr to use for inbound messages. The default is to use"
        " the host:port of the telnet server.",
        default=None,
        static=True)
    transport_type = ConfigText(
        "The transport_type to use for inbound messages.",
        default='telnet',
        static=True)

    # TODO: Deprecate these fields when confmodel#5 is done.
    telnet_host = ConfigText(
        "*DEPRECATED* 'telnet_host' and 'telnet_port' fields may be used in"
        "place of the 'twisted_endpoint' field.",
        static=True)
    telnet_port = ConfigInt(
        "*DEPRECATED* 'telnet_host' and 'telnet_port' fields may be used in"
        " place of the 'twisted_endpoint' field.",
        static=True)
コード例 #3
0
ファイル: netcore.py プロジェクト: miamitops/vumi
class NetcoreTransportConfig(Transport.CONFIG_CLASS):

    twisted_endpoint = ConfigServerEndpoint(
        'The endpoint to listen on.',
        required=True,
        static=True,
        fallbacks=[ServerEndpointFallback()])
    web_path = ConfigText("The path to serve this resource on.",
                          default='/api/v1/netcore/',
                          static=True)
    health_path = ConfigText("The path to serve the health resource on.",
                             default='/health/',
                             static=True)
    reject_none = ConfigBool(
        "Reject messages where the content parameter equals 'None'",
        required=False,
        default=True,
        static=True)

    # TODO: Deprecate these fields when confmodel#5 is done.
    host = ConfigText(
        "*DEPRECATED* 'host' and 'port' fields may be used in place of the"
        " 'twisted_endpoint' field.",
        static=True)
    port = ConfigInt(
        "*DEPRECATED* 'host' and 'port' fields may be used in place of the"
        " 'twisted_endpoint' field.",
        static=True)
コード例 #4
0
ファイル: go_api.py プロジェクト: linkedinyou/vumi-go
 class CONFIG_CLASS(BaseWorker.CONFIG_CLASS):
     worker_name = ConfigText(
         "Name of this Go API worker.", required=True, static=True)
     twisted_endpoint = ConfigServerEndpoint(
         "Twisted endpoint to listen on.", required=True, static=True)
     web_path = ConfigText(
         "The path to serve this resource on.", required=True, static=True)
     health_path = ConfigText(
         "The path to server the health resource on.", default='/health/',
         static=True)
     redis_manager = ConfigDict(
         "Redis client configuration.", default={}, static=True)
     riak_manager = ConfigDict(
         "Riak client configuration.", default={}, static=True)
コード例 #5
0
ファイル: mtn_rwanda_ussd.py プロジェクト: musabaloyi/vumi
class MTNRwandaUSSDTransportConfig(Transport.CONFIG_CLASS):
    """
    MTN Rwanda USSD transport configuration.
    """
    twisted_endpoint = ConfigServerEndpoint(
        "The listening endpoint that the remote client will connect to.",
        required=True,
        static=True,
        fallbacks=[ServerEndpointFallback()])
    timeout = ConfigInt(
        "No. of seconds to wait before removing a request that hasn't "
        "received a response yet.",
        default=30,
        static=True)
    redis_manager = ConfigDict("Parameters to connect to redis with",
                               default={},
                               static=True)
    session_timeout_period = ConfigInt("Maximum length of a USSD session",
                                       default=600,
                                       static=True)
    web_path = ConfigText("The path to serve this resource on.",
                          required=True,
                          static=True)
    health_path = ConfigText("The path to serve the health resource on.",
                             default='/health/',
                             static=True)

    # TODO: Deprecate these fields when confmodel#5 is done.
    host = ConfigText(
        "*DEPRECATED* 'host' and 'port' fields may be used in place of the"
        " 'twisted_endpoint' field.",
        static=True)
    port = ConfigInt(
        "*DEPRECATED* 'host' and 'port' fields may be used in place of the"
        " 'twisted_endpoint' field.",
        static=True)
コード例 #6
0
ファイル: voice.py プロジェクト: praekelt/vumi-freeswitch-esl
class VoiceServerTransportConfig(Transport.CONFIG_CLASS):
    """
    Configuration parameters for the voice transport
    """

    to_addr = ConfigText("The ``to_addr`` to use for inbound messages.",
                         default="freeswitchvoice",
                         static=True)

    tts_type = ConfigText(
        "Either 'freeswitch' or 'local' to specify where TTS is executed.",
        default="freeswitch",
        static=True)

    tts_fs_engine = ConfigText(
        "Specify Freeswitch TTS engine to use (only affects tts_type"
        " 'freeswitch').",
        default="flite",
        static=True)

    tts_fs_voice = ConfigText(
        "Specify Freeswitch TTS voice to use (only affects tts_type"
        " 'freeswitch').",
        default="kal",
        static=True)

    tts_local_command = ConfigText(
        "Specify command template to use for generating voice files (only"
        " affects tts_type 'local'). E.g. 'flite -o {filename} -t {text}'."
        " Command parameters are split on whitespace (no shell-like escape"
        " processing is performed on the command).",
        default=None,
        static=True)

    tts_local_cache = ConfigText(
        "Specify folder to cache voice files (only affects tts_type"
        " 'local').",
        default=".",
        static=True)

    tts_local_ext = ConfigText(
        "Specify the file extension used for cached voice files (only affects"
        " tts_type 'local').",
        default="wav",
        static=True)

    twisted_endpoint = ConfigServerEndpoint(
        "The endpoint the voice transport will listen on (and that Freeswitch"
        " will connect to).",
        required=True,
        default="tcp:port=8084",
        static=True)

    freeswitch_endpoint = ConfigClientEndpoint(
        "The endpoint the voice transport will send originate commands"
        "to (and that Freeswitch listens on).",
        default=None,
        static=True)

    freeswitch_auth = ConfigText(
        "Password for connecting to the Freeswitch endpoint."
        " None means no authentication credentials are offered.",
        default=None,
        static=True)

    originate_parameters = ConfigDict(
        "The parameters to pass to the originate command when initiating"
        " outbound calls. This dictionary of parameters is passed to the"
        " originate call template:\n\n"
        "  %(template)r\n\n"
        "All call parameters are required but the following defaults are"
        " supplied:\n\n"
        "  %(defaults)r" % {
            'template': OriginateFormatter.PROTO_TEMPLATE,
            'defaults': OriginateFormatter.DEFAULT_PARAMS,
        },
        default=None,
        static=True)

    wait_for_answer = ConfigBool(
        "If True, the transport waits for a ChannelAnswer event for outbound "
        "(originated) calls before playing any media.",
        default=True,
        static=True)

    @property
    def supports_outbound(self):
        return self.freeswitch_endpoint is not None

    def post_validate(self):
        super(VoiceServerTransportConfig, self).post_validate()
        required_outbound = (self.freeswitch_endpoint
                             is not None, self.originate_parameters
                             is not None)
        if self.supports_outbound and not all(required_outbound):
            raise ConfigError(
                "If any outbound message parameters are supplied"
                " (freeswitch_endpoint or originate_params), all must be"
                " given.")
        if self.originate_parameters is not None:
            try:
                OriginateFormatter(**self.originate_parameters)
            except OriginateMissingParameter as err:
                raise ConfigError(str(err))
コード例 #7
0
class WeChatConfig(Transport.CONFIG_CLASS):

    api_url = ConfigText('The URL the WeChat API is accessible at.',
                         default='https://api.wechat.com/cgi-bin/',
                         required=False,
                         static=True)
    auth_token = ConfigText(
        'This WeChat app\'s auth token. '
        'Used for initial message authentication.',
        required=True,
        static=True)
    twisted_endpoint = ConfigServerEndpoint(
        'The endpoint to listen on.',
        required=True,
        static=True,
        fallbacks=[ServerEndpointFallback()])
    web_path = ConfigText("The path to serve this resource on.",
                          default='/api/v1/wechat/',
                          static=True)
    health_path = ConfigText("The path to serve the health resource on.",
                             default='/health/',
                             static=True)
    redis_manager = ConfigDict('Parameters to connect to Redis with.',
                               default={},
                               required=False,
                               static=True)
    wechat_appid = ConfigText(
        'The WeChat app_id. Issued by WeChat for developer accounts '
        'to allow push API access.',
        required=True,
        static=True)
    wechat_secret = ConfigText(
        'The WeChat secret. Issued by WeChat for developer accounts '
        'to allow push API access.',
        required=True,
        static=True)
    wechat_menu = ConfigDict('The menu structure to create at boot.',
                             required=False,
                             static=True)
    wechat_mask_lifetime = ConfigInt(
        'How long, in seconds, to maintain an address mask for. '
        '(default 1 hour)',
        default=60 * 60 * 1,
        static=True)
    embed_user_profile = ConfigBool(
        'Whether or not to embed the WeChat User Profile info in '
        'messages received.',
        required=True,
        default=False,
        static=True)
    embed_user_profile_lang = ConfigText(
        'What language to request User Profile as.',
        required=False,
        default='en',
        static=True)
    embed_user_profile_lifetime = ConfigInt(
        'How long to cache User Profiles for.',
        default=(60 * 60),
        required=False,
        static=True)
    double_delivery_lifetime = ConfigInt(
        'How long to keep track of Message IDs and responses for double '
        'delivery tracking.',
        default=(60 * 60),
        required=False,
        static=True)

    # TODO: Deprecate these fields when confmodel#5 is done.
    host = ConfigText(
        "*DEPRECATED* 'host' and 'port' fields may be used in place of the"
        " 'twisted_endpoint' field.",
        static=True)
    port = ConfigInt(
        "*DEPRECATED* 'host' and 'port' fields may be used in place of the"
        " 'twisted_endpoint' field.",
        static=True)
コード例 #8
0
class ManholeMiddlewareConfig(BaseMiddlewareConfig):
    twisted_endpoint = ConfigServerEndpoint(
        "Twisted endpoint to listen on", default="tcp:0", static=True)
    autorized_keys = ConfigList(
        "List of absolute paths to `authorized_keys` files containing SSH "
        "public keys that are allowed access.", default=None, static=True)
コード例 #9
0
ファイル: service.py プロジェクト: musabaloyi/vumi
class SmppServiceConfig(SmppTransportConfig):
    twisted_endpoint = ConfigServerEndpoint('Server endpoint description',
                                            required=True,
                                            static=True)