I run this bash function when a button is pressed, it calls my mobile, however when the call ends or I reject the call, it hangs in /dev/tty and does not return to the main program
call.sh
#!/bin/bash
printf %s\\n 'call sip:[email protected]' | cat - /dev/tty |twinkle -c
Here is the main program:
while(1):
if lcd.buttonPressed(lcd.SELECT):
os.system("./call.sh")
When phone is offline or call is rejected, it hangs and does not return back to the python program:

I would then have to press CTRL + C and CTRL + Z to exit which closes the python program too.

Is it possible to return back to the main program after a 408 Request timeout error or a 468 Busy Here message?

EDIT:
The answer was mkfifo /tmp/pipe; exec 3<>/tmp/pipe; (trap '' TTIN TTOU; twinkle -c) <&3 & printf '\ncall sip:'[email protected] >&3 thanks to @mikeserv
heador something between thecatandtwinkleand add/proc/self/statto the list ofcat's files likecat /proc/self/stat - /dev/tty- that would write a bunch of information about thecatprocess that you could capture and use to shut it down later - the first few bytes are the pid.