I am automating the use of USSD to make a callback call. In my network if you dial *00*number# , the phone does not make a voice call but issues a USSD request which results in a callback connection. the process is:

1. I detect the outgoing call made by the user
2. I hang up the call
3. I make the USSD call using key emulation - sending key events to the phone application (dialing using CTelephony is not an option is it is not really a voice call)

I send the key events using the following standard code:

Code:
void CVoIPEngine::SendPhoneKey(const TUint aCode,const TInt iScanCode)
{
	TWsEvent event;

	event.SetTimeNow();
	event.Key()->iModifiers = 0;
	event.Key()->iRepeats = 0;

	event.Key()->iCode = aCode;
	event.Key()->iScanCode = iScanCode;


	event.SetType(EEventKeyDown);
	iWsSession->SendEventToWindowGroup( iPhoneWindowID, event );

	event.SetType(EEventKey);
	iWsSession->SendEventToWindowGroup( iPhoneWindowID, event );


	event.SetType(EEventKeyUp);
	iWsSession->SendEventToWindowGroup( iPhoneWindowID, event );

}
I use the above function to send a key stroke to clear the numbers on the display, followed by one key stroke for each digit, followed by an emulation of the green button to dial.

the problem :
1. if the user makes the call by entering the numbers manually (as opposed to phone book or call log use), the first and last key strokes reach take effect (clearing the digits and making a call), but the key strokes that are supposed to put digits on the screen do nothing.

2. if the user makes the call from the call log (e.g. dialed numbers), no key strokes reach the phone application.

sorry about the long post and apreciate any help.

Tal