Help required to implement call home feature

Currently i am trying to implement the call home feature.
Objective:when ever client connects to server,i need to initiate the call home.As of now i was using builtin ssh for the same.But once client reconnects after the disconnection i have to manually need to execute the conf_cmd command for the call home.
So can you please help me ,so that i will overcome from this issue.
what should be the best option to handle the session and when ever the client disconnects server will get notified and i can restart the call home.
If you can provide the sample example fo the same then it will be really helpful.