void PhoneCall_CallStateChanged(object sender, VoIPEventArgs <CallState> e) { switch (e.Item) { case CallState.InCall: OnNotifyAction(string.Format("Caller '{0}' is in '{1}' menu.", PhoneCall.OtherParty, currentMenu.Name)); currentMenu.StartIntroduction(); break; case CallState.Completed: OnNotifyAction(string.Format("{0} hanged up the call.", PhoneCall.OtherParty)); currentMenu.StopIntroduction(); Close(); break; case CallState.Error: case CallState.Rejected: case CallState.Cancelled: case CallState.Busy: Close(); break; case CallState.Transferring: OnNotifyAction(string.Format("{0} call is transfering.", PhoneCall.OtherParty)); break; } }
void currentMenu_StepIntoMenu(object sender, VoIPEventArgs <IVRMenuElementBase> e) { repeatTimer.Stop(); if (e.Item == null)//If event param is null it's indicates the exit command, close the call. { PhoneCall.HangUp(); Close(); return; } UnSubscribeCurrentMenuEvents(); currentMenu = e.Item; OnNotifyAction(string.Format("Caller '{0}' is in '{1}' menu.", PhoneCall.OtherParty, currentMenu.Name)); SubscribeCurrentMenuEvents(); currentMenu.StartIntroduction(); }