Esempio n. 1
0
    def __init__(self,
                 client: pyrogram.Client,
                 input_filename: str = None,
                 output_filename: str = None):
        self.client = client

        self.native_instance = tgcalls.NativeInstance()
        self.native_instance.setEmitJoinPayloadCallback(
            self.emit_join_payload_callback)

        self.me = None
        self.group_call = None

        self.chat_peer = None
        self.my_ssrc = None

        self.enable_action = True
        self.is_connected = False

        # feature of impl tgcalls
        self._input_filename = ''
        if input_filename:
            self._input_filename = input_filename
        self._output_filename = ''
        if output_filename:
            self._output_filename = output_filename

        self.update_to_handler = {
            types.UpdateGroupCallParticipants:
            self._process_group_call_participants_update,
            types.UpdateGroupCall: self._process_group_call_update,
        }

        self._update_handler = RawUpdateHandler(self.process_update)
        self.client.add_handler(self._update_handler, -1)
Esempio n. 2
0
    def __create_and_setup_native_instance(self,
                                           enable_logs_to_console: bool,
                                           path_to_log_file='group_call.log'):
        """Create NativeInstance of tgcalls C++ part.

        Args:
            enable_logs_to_console (`bool`): Is enable logs to stderr from tgcalls.
            path_to_log_file (`str`, optional): Path to log file for logs of tgcalls.
        """

        # bypass None value
        if not path_to_log_file:
            path_to_log_file = ''

        logger.debug('Create a new native instance..')
        native_instance = tgcalls.NativeInstance(enable_logs_to_console,
                                                 path_to_log_file)

        native_instance.setupGroupCall(
            self.__emit_join_payload_callback,
            self.__network_state_updated_callback,
            self.__participant_descriptions_required_callback)

        logger.debug('Native instance created.')

        return native_instance
Esempio n. 3
0
    def __create_and_setup_native_instance(self):
        logger.debug('Create a new native instance..')
        native_instance = tgcalls.NativeInstance(self.enable_logs_to_console, self.path_to_log_file)

        native_instance.setupGroupCall(
            self.__emit_join_payload_callback,
            self.__network_state_updated_callback,
            self.__participant_descriptions_required_callback
        )

        logger.debug('Native instance created.')

        return native_instance
Esempio n. 4
0
        async def process_call(call: Call):
            print('Outgoing call: ', call.auth_key_visualization)
            print(rtc_servers(call.call.connections))

            out_call.native_instance = tgcalls.NativeInstance()
            out_call.native_instance.setSignalingDataEmittedCallback(
                out_call.signalling_data_emitted_callback)
            out_call.native_instance.startCall(
                rtc_servers(call.call.connections),
                [x for x in call.auth_key_bytes], out_call.is_outgoing,
                log_path1)

            # await asyncio.sleep(10)
            # await call.received_call()
            await asyncio.sleep(60)
            await call.discard_call()