I think you are looking for information on the Application Gateway interface. It's an extensible protocol which allows partners to develop services which can be accessed from the CCE admin or routing scripts. You can find details on the Cisco develop...
have you put your script in monitor mode to watch what path is being taken for calls? Where is it failing out?It could be that the transfer to IVR from dialer is failing because of incomplete or incorrect configuration in ICM or the voice network.
But you can get Agent Desk Settings via CTI Server protocol which will contain the configuration for wrap time.Once the agent starts wrap, you could do a count down clock on how much time they have left in wrap state.