bakatrouble / pytgvoip_pyrogram

GNU Lesser General Public License v3.0
39 stars 15 forks source link

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

Open dauheeIRL opened 3 years ago

dauheeIRL commented 3 years ago

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)

StefanoGiu commented 3 years ago

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)
supersuperfranz commented 3 years ago

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

joel122002 commented 2 years ago

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