You might be able to use the possible states of a call as described in the documentation. My suggestion is to use the call_state(callable) function. It waits until there is a change in the phone's connection status (like when a call is disconnected) and calls the callable passed as an argument.
Something like this:
You might have to do some experimenting and change that example.
import appuifw, e32, telephone
app_lock = e32.Ao_lock()
appuifw.app.exit_key_handler = app_lock.signal
#Define the function to be called when a disconnection occurs
if state == telephone.EStatusDisconnecting:
#Make the function be called when a change occurs