pytgvoip_pyrogram icon indicating copy to clipboard operation
pytgvoip_pyrogram copied to clipboard

make_call.py, await pyrogram.idle() never reached

Open dauheeIRL opened this issue 4 years ago • 3 comments

Hi, in make_call.py, await pyrogram.idle() is never reached and the program runs forever. What I did as a kludge was to put sys.exit() in end of async def call_ended(call)

dauheeIRL avatar Dec 31 '20 00:12 dauheeIRL

Same issue here....

I'm using this....

async def main():
    global in_call
    in_call = True
    await client.start()
    call = await voip_service.start_call('@XXX')
    call.play('input.raw')
    call.play_on_hold(['input.raw'])
    call.set_output_file('output.raw')
   @call.on_call_state_changed
    def state_changed(call, state):
        print('State changed:', call, state)

    @call.on_call_ended
    async def call_ended(call):
        print('Call Ended!!')
        await asyncio.sleep(5)
        await client.stop()
        global in_call
        in_call = False

    while in_call:
        await asyncio.sleep(1)

StefanoGiu avatar Jan 20 '21 17:01 StefanoGiu

I face the same problem using the ALSA version modified for incoming calls. The call never terminate and the alsa is left busy.

supersuperfranz avatar Mar 18 '21 18:03 supersuperfranz

pyrogram.idle() is meant to put the app in a state such that it only closes when a signal (i.e. Ctrl + C) is given. In order to change that behaviour you could use @StefanoGiu's answer

joel122002 avatar Jul 05 '22 05:07 joel122002