Hi Rob,
When you use the High-level call management feature of Spokes, and you have inserted a call into Spokes call state (via IncomingCall/OutgoingCall/CallAnswered functions), if user presses "Talk" button to terminate the call, Spokes does several things:
- It throws away it's record of that call
- It closes the audio link to device (wireless products)
- It notifies your app via "CallStateChanged" Session Manager Event (CallEnded event)
If at this point you didn't want to end the call (call was still active in your softphone), a workaround to automatically reopen the audio link to device would:
- Open a call with Spokes with the same "callid" as was just ended
Below is some C# code based on the that in order to test your scenario I added a check box called "preventcalltoterminatewithtalkbuttonChkBox".
- When this check boxed is checked it re-opens the call that was ended with "Talk" button of headset
- The DoReopenCall marshalls the call to Spokes "OutgoingCall" function back onto the GUI thread - this is needed otherwise the OutgoingCall fails.
This is a workaround to be able to reopen the link. It has a problem that if call was previously Incoming direction, the reopened call will show Outgoing direction in the Spokes event, but with same internal "callid".
However, this may not be a problem as your softphone itself will generally know the call direction without Spokes needing to tell it.
I saw from your recent post that you have overcome the problem by just listening for button press only.
The only slight caution I would give on this approach is:
- Our Savi 700 Series product (multi-line device) will pass "Talk" button press events when you are doing call control of Desk phone line or Mobile line. You need to ensure these events don't inadvertently control your softphone line!
Let us know how you get on or if you have further questions!
Thanks,
Lewis
void spokes_CallEnded(object sender, CallEndedArgs e) { LogMessage(MethodInfo.GetCurrentMethod().Name, ">>> User has ended call, call id: " + e.CallId); // if this was My Softphone's call then terminate the audio link to headset if (e.CallId > 0 && e.CallSource.CompareTo(APP_NAME) == 0) { // DEMO - try "re-activating" the call to cover // the scenario where the user is NOT allowed to end the call! if (preventcalltoterminatewithtalkbuttonChkBox.Checked) { DoReopenCall(e.CallId); // reopen SAME call id! } else { m_dummyspeechaudio.SpeakAsyncCancelAll(); m_spokes.SetMute(false); //m_spokes.ConnectAudioLinkToDevice(false); } } else LogMessage(MethodInfo.GetCurrentMethod().Name, ">>> Ignoring spurious call event, call id: " + e.CallId + ", call source = " + e.CallSource); } private void DoReopenCall(int callid) { if (pcLineActiveBtn.InvokeRequired) { StartReopenCallTimerCallback d = new StartReopenCallTimerCallback(DoReopenCall); this.Invoke(d, new object[] { callid }); } else { m_spokes.OutgoingCall(callid); // reopen same call id that was closed! } }