how to detect a phone call end state

I want to do something via code once a phone call ends and returns to my App's interface UI , but how I detect a phone call end state? thanks

how to detect a phone call end state
 
 
Q