def __init__(self, fsm):
     self._bridges = dict()
     self._channels = dict()
     self.client = client.get_client(
         '1',
         endpoint=CONF.asterisk.uri,
         username=CONF.asterisk.username,
         password=CONF.asterisk.password)
     self.events = event.Event(
         url=CONF.asterisk.uri, username=CONF.asterisk.username,
         password=CONF.asterisk.password, app='demo')
     self.events.register_event('StasisStart', self._handle_stasis_start)
     self.events.register_event('StasisEnd', self._handle_stasis_stop)
     self.events.register_event(
         'ChannelStateChange', self._handle_channel_state_change)
     self.events.register_event(
         'ChannelEnteredBridge', self._handle_channel_entered_bridge)
     self.fsm = fsm
示例#2
0
    def authenticate_user(self):
        if not self.options.ari_username:
            raise exception.CommandError(
                'You must provide a username via either --ari-username or'
                ' env[ARI_USERNAME]'
            )

        if not self.options.ari_password:
            raise exception.CommandError(
                'You must provide a password via either --ari-password or'
                ' env[ARI_PASSWORD]'
            )

        if not self.options.ari_url:
            raise exception.CommandError(
                'You must provide an url via either --ari-url or env[ARI_URL]'
            )

        self.client_manager = client.get_client(
            self.api_version, **(self.options.__dict__)
        )

        return