Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Requesting and Discarding outgoing call #183

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pytgcalls/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_protocol() -> types.PhoneCallProtocol:
)

async def get_dhc(self):
self.dhc = DH(await self.client.send(functions.messages.GetDhConfig(version=0, random_length=256)))
self.dhc = DH(await self.client.invoke(functions.messages.GetDhConfig(version=0, random_length=256)))
return self.dhc

def check_g(self, g_x: int, p: int) -> None:
Expand Down Expand Up @@ -162,7 +162,7 @@ def call_discarded(self):
self.call_ended()

async def received_call(self):
r = await self.client.send(
r = await self.client.invoke(
functions.phone.ReceivedCall(peer=types.InputPhoneCall(id=self.call_id, access_hash=self.call_access_hash))
)
print(r)
Expand All @@ -171,7 +171,7 @@ async def discard_call(self, reason=None):
if not reason:
reason = types.PhoneCallDiscardReasonDisconnect()
try:
r = await self.client.send(
r = await self.client.invoke(
functions.phone.DiscardCall(
peer=types.InputPhoneCall(id=self.call_id, access_hash=self.call_access_hash),
duration=0, # TODO
Expand All @@ -187,7 +187,7 @@ async def discard_call(self, reason=None):

def signalling_data_emitted_callback(self, data):
async def _():
await self.client.send(
await self.client.invoke(
functions.phone.SendSignalingData(
# peer=self.call_peer,
peer=types.InputPhoneCall(id=self.call_id, access_hash=self.call_access_hash),
Expand All @@ -198,7 +198,7 @@ async def _():
asyncio.ensure_future(_(), loop=self.client.loop)

async def _initiate_encrypted_call(self) -> None:
await self.client.send(functions.help.GetConfig())
await self.client.invoke(functions.help.GetConfig())

self.update_state('ESTABLISHED')
self.auth_key_visualization = generate_visualization(self.auth_key, self.g_a)
Expand Down Expand Up @@ -229,7 +229,7 @@ async def request(self):
self.g_a_hash = hashlib.sha256(i2b(self.g_a)).digest()

self.call = (
await self.client.send(
await self.client.invoke(
functions.phone.RequestCall(
user_id=self.peer,
random_id=randint(0, 0x7FFFFFFF - 1),
Expand All @@ -238,7 +238,7 @@ async def request(self):
)
)
).phone_call

self.call_access_hash = self.call.access_hash
self.update_state('WAITING')

async def process_update(self, _, update, users, chats) -> None:
Expand All @@ -260,7 +260,7 @@ async def call_accepted(self) -> None:
self.key_fingerprint = calc_fingerprint(self.auth_key_bytes)

self.call = (
await self.client.send(
await self.client.invoke(
functions.phone.ConfirmCall(
key_fingerprint=self.key_fingerprint,
# peer=self.call_peer,
Expand Down Expand Up @@ -314,7 +314,7 @@ async def accept(self) -> bool:

try:
self.call = (
await self.client.send(
await self.client.invoke(
functions.phone.AcceptCall(
peer=types.InputPhoneCall(id=self.call_id, access_hash=self.call_access_hash),
g_b=i2b(self.g_b),
Expand Down