def discard_call(self, reason=None): # TODO: rating if not reason: reason = types.PhoneCallDiscardReasonDisconnect() try: self.client.send( functions.phone.DiscardCall( peer=types.InputPhoneCall( id=self.call_id, access_hash=self.call_access_hash), duration=self.ctrl.call_duration, connection_id=self.ctrl.get_preferred_relay_id(), reason=reason)) except (errors.CallAlreadyDeclined, errors.CallAlreadyAccepted): pass self.call_ended()
def discard_call(self, reason=None): # TODO: rating if not reason: reason = types.PhoneCallDiscardReasonDisconnect() try: self.client.send( functions.phone.DiscardCall( peer=types.InputPhoneCall( id=self.call_id, access_hash=self.call_access_hash), duration=self.ctrl.call_duration, connection_id=self.ctrl.get_preferred_relay_id(), reason=reason)) except errors.Error as e: if e.ID not in ('CALL_ALREADY_DECLINED', 'CALL_ALREADY_ACCEPTED'): raise e self.call_ended()