def test_login_id(self):
        expected = {
            'class': 'login_id',
            'sessionid': s.session_id,
            'wazoversion': xivo_cti.CTI_PROTOCOL_VERSION
        }

        result = CTIMessageFormatter.login_id(s.session_id)

        assert_that(result, equal_to(expected))
Example #2
0
    def _on_login_id(self, userlogin, xivo_version, cti_connection):
        if cti_connection != self._connection:
            return

        LoginID.deregister_callback(self._on_login_id)

        if xivo_version != xivo_cti.CTI_PROTOCOL_VERSION:
            logger.info(
                '%s failed to connect: the client protocol version %s is different from the server protocol version %s',
                userlogin, xivo_version, xivo_cti.CTI_PROTOCOL_VERSION)
            msg = 'wazoversion_client:{};{}'.format(
                xivo_version, xivo_cti.CTI_PROTOCOL_VERSION)
            self._fatal('login_id', msg)
            return

        self._username = userlogin

        LoginPass.register_callback_params(self._on_login_pass,
                                           ['password', 'cti_connection'])

        msg = CTIMessageFormatter.login_id(self._session_id)
        self._send_msg(msg)