Calling a number and actions after a call


I have an application in which authorization is going through a call. I use 'tel:' +somePhone+'_system'

I need the following algorithm to be executed:

  1. the user clicks on the button
  2. makes a call
  3. at the end of the call, the user is transferred back to the application, and does not remain in the phone (the application is not unloaded from the phone memory)

PS I would like this to work even on ancient phones that are not able to withstand two running applications and close my application during a call.