Reject Call

  • Thread starter Thread starter Vivek Waghmare
  • Start date Start date
You can use the SNAPI to listen for incoming call events, then you can
simulate pressing the end call button to reject the call
 
Hi ALL

Im using MS Windows 5.0 SDK, I have created a sample application, in which i
want to reject a call on a specific condition. In order to catch the
incoming call i have written code like this.

public partial class Form1 : Form

{

Microsoft.WindowsMobile.Telephony.Phone m_Phone = null;

Microsoft.WindowsMobile.Status.SystemState m_State = null;

public Form1()

{

InitializeComponent();

m_Phone = new Microsoft.WindowsMobile.Telephony.Phone();

m_State = new
Microsoft.WindowsMobile.Status.SystemState(Microsoft.WindowsMobile.Status.SystemProperty.PhoneIncomingCall);

m_State.Changed += new
Microsoft.WindowsMobile.Status.ChangeEventHandler(m_State_Changed);

}

void m_State_Changed(object sender,
Microsoft.WindowsMobile.Status.ChangeEventArgs args)

{

// Reject Call for specific condition

}

}



but in the m_State_Changed i am not able to find a way to end the call
programatically.

In one got any idea



Thanks

VKey
 
Try if this will work...

[DllImport("coredll.dll")]
static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int
dwExtraInfo);

const int KEYEVENTF_KEYPRESS = 0x0000;
const int KEYEVENTF_KEYUP = 0x0002;

void SendKey(Keys key) {
keybd_event((byte)key, 0, KEYEVENTF_KEYPRESS, 0); // key press
keybd_event((byte)key, 0, KEYEVENTF_KEYUP, 0); // key release
(KEYEVENTF_KEYUP)
}

void EndCall() {
SendKey(Keys.F4);
}

Call EndCall() in your reject call logic...
 
Back
Top