Пример #1
0
    def test_receive_call(self):
        """Make a phone call from Plivo to the phone."""
        PLIVO_TIMEOUT = 30

        self.plivo = PlivoUtil(self.testvars['plivo']['auth_id'],
                               self.testvars['plivo']['auth_token'],
                               self.testvars['plivo']['phone_number'])
        self.call_uuid = self.plivo.make_call(
            to_number=self.testvars['carrier']['phone_number'].replace(
                '+', ''),
            timeout=PLIVO_TIMEOUT)

        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call()
        call_screen.answer_call()

        # Wait for Plivo to report the call as connected
        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_connected(self.call_uuid),
            message='The call was not connected.')

        # Wait for the state to be connected
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state == 'connected',
            timeout=30)

        call_screen.hang_up()

        # Wait for Plivo to report the call as completed
        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_completed(self.call_uuid),
            message='The call was not completed.')
        self.call_uuid = None
    def test_receive_call(self):
        """Make a phone call from Plivo to the phone."""
        PLIVO_TIMEOUT = 30

        self.plivo = PlivoUtil(
            self.testvars['plivo']['auth_id'],
            self.testvars['plivo']['auth_token'],
            self.testvars['plivo']['phone_number']
        )
        self.call_uuid = self.plivo.make_call(
            to_number=self.testvars['carrier']['phone_number'].replace('+', ''),
            timeout=PLIVO_TIMEOUT)

        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call()
        call_screen.answer_call()

        # Wait for Plivo to report the call as connected
        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_connected(self.call_uuid),
            message='The call was not connected.')

        # Wait for the state to be connected
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state == 'connected',
            timeout=30)

        call_screen.hang_up()

        # Wait for Plivo to report the call as completed
        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_completed(self.call_uuid),
            message='The call was not completed.')
        self.call_uuid = None
    def test_dsds_receive_call_on_both_sims(self, sim_value, sim_name):
        """Make a phone call from Plivo to each SIM."""
        PLIVO_TIMEOUT = 30

        from gaiatest.utils.plivo.plivo_util import PlivoUtil
        self.plivo = PlivoUtil(
            self.testvars['plivo']['auth_id'],
            self.testvars['plivo']['auth_token'],
            self.testvars['plivo']['phone_number']
        )
        self.call_uuid = self.plivo.make_call(
            to_number=self.testvars['local_phone_numbers'][sim_value].replace('+', ''),
            timeout=PLIVO_TIMEOUT)

        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call()

        # TODO Replace the following line by a check on the l10n ID
        # once bug 1104667 lands
        self.assertTrue(sim_name in call_screen.incoming_via_sim)

        call_screen.answer_call()

        # Wait for Plivo to report the call as connected
        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_connected(self.call_uuid),
            message='The call was not connected.')

        # Wait for the state to be connected
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state == 'connected',
            timeout=30)

        # TODO Replace the following line by a check on the l10n ID
        # once bug 1104667 lands
        self.assertTrue(sim_name in call_screen.incoming_via_sim)

        call_screen.hang_up()

        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_completed(self.call_uuid),
            message="Plivo didn't report the call as completed")
        self.call_uuid = None
    def test_dsds_receive_call_on_both_sims(self, sim_value, sim_name):
        """Make a phone call from Plivo to each SIM."""
        PLIVO_TIMEOUT = 30

        from gaiatest.utils.plivo.plivo_util import PlivoUtil
        self.plivo = PlivoUtil(self.testvars['plivo']['auth_id'],
                               self.testvars['plivo']['auth_token'],
                               self.testvars['plivo']['phone_number'])
        self.call_uuid = self.plivo.make_call(
            to_number=self.testvars['local_phone_numbers'][sim_value].replace(
                '+', ''),
            timeout=PLIVO_TIMEOUT)

        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call()

        # TODO Replace the following line by a check on the l10n ID
        # once bug 1104667 lands
        self.assertTrue(sim_name in call_screen.incoming_via_sim)

        call_screen.answer_call()

        # Wait for Plivo to report the call as connected
        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_connected(self.call_uuid),
            message='The call was not connected.')

        # Wait for the state to be connected
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state == 'connected',
            timeout=30)

        # TODO Replace the following line by a check on the l10n ID
        # once bug 1104667 lands
        self.assertTrue(sim_name in call_screen.incoming_via_sim)

        call_screen.hang_up()

        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_completed(self.call_uuid),
            message="Plivo didn't report the call as completed")
        self.call_uuid = None