Guaranteed way to associate speech recognition result with an utterance? - c#

I'm using Microsoft's C# API for the Cognitive Services (Project Oxford) Bing Speech Recognition service. Specifically, I am using Microsoft.ProjectOxford.SpeechRecognition-x64 version 0.4.10.2.
I send audio to the DataRecognitionClient using the SendAudio and EndAudio methods, and wait for the final set of recognition hypotheses via the OnResponseReceived event. The issue I'm running into is that it's easily possible to have more than one oustanding recognition request, and the SpeechResponseEventArgs object passed to the OnResponseReceived handler doesn't contain any information telling me which request it is a response for.
Here's an example that has actually happened to me many times:
Person says something, call it utterance A, and I send it via SendAudio and then call EndAudio when they are done talking.
While still waiting to get the OnResponseReceived event for utterance A, the person says something else, call it utterance B. Again I send it via SendAudio and then call EndAudio when they're done talking. I still haven't gotten an OnResponseReceived event.
I finally get my first OnResponseReceived event.
I get a second OnResponseReceived event.
How can I correctly associate the responses with the utterances?
Is there an ordering guarantee such that if I send utterance A and then B, I will always get the response for utterance A first? I haven't seen that guarantee in the documentation.

Since all the requests are asyc requests there is no guarantee that A will always come after B. The best approach I would recommend is to create a pool of recognitionclients and use one for every recognition and manage the dependency,

Related

Best way to implement Twilio conference timeout? (Second participant never picks up)

We are using Twilio's conference call for creating calls between 2 or more parties.
https://www.twilio.com/docs/voice/tutorials/how-to-create-conference-calls
When a caller(A) calls Twilio number a conference is created on the server using C# Rest API and we then add the caller(A) to a conference. Using the conference statuscallback when caller(A) joins conference we then call other parties using the Conference.ParticipantResource.Create() method and a foreach loop to call a group of people whos role is labeled ADMIN (Could be from 1 to 9 parties) with a timeout of 30 seconds and a statuscallback.
How do I determine if no one answers the call via statuscallback after say 35 seconds?
I would like to send caller(A) to a voicemail if no one picks up. But the problem Im have is that the callback fires after each called ADMIN dont answer or rejects the call. I know this is by design but Im curious to know how to know when all callers (Admins) didnt pick up the call and send original caller to voicemail. And if one admin picks up to stop calling other admins.
Hopefully someone can help. Thanks in advance.
Hi Twilio Evangelist here,
Sorry that you're having trouble building the conference line in a way that suits your needs. Twilio does not have a feature that will maintain the state of different callers being added to a conference line.
I would suggest the following.
Create a collection that represents the list of your admins (and the application should have a way to update a single admin's state for when they've been contacted).
As you go about contacting the admins, you'll want to update state as the app attempts to reach them. This way you can respond to a person picking up the phone or alternatively redirecting to voicemail accordingly within your code. This will also make it easy to know when your code has attempted to call everyone.
If no one picks up, then you'll be able to redirect your original caller accordingly by modifying their call in-progress (which you can do with this tutorial here).
Let me know if you run into any issues.

c# Should I use a service or just poll the database

I don't know too much about services so if I am trying to do something they are not intended for please forgive me.
I am trying to wright dispatching software for a family member. They plan on starting with 3 or 4 dispatchers but it may scale in the future. I need the software to constantly (every 5 or 10 seconds at the very least) check and see if a new unhandled call has been placed when not in a call or if they are in a call see if another dispatcher updated the call (due to a call in with additional information).
Which option would be better for the above scenario
A) Have a table in a database that tracks updates to calls/ new calls and poll it every 5 - 10 seconds from every instance of the software.
B) Have a service running on the machine that has the database and have that service take care of all SQL. Create an instance of each call in the service and then just ask the service if there are any changes or unhandled call.
If B, is it possible to create a delegate in the service that the software on another (networked) machine can subscribe to? If so where might I find information on doing that, I could not find anything on google.
This is kind to broad.
However, you can use the following
DB Trigger to watch for inserts ect, then do and fabulous db stuff when triggered.
Create a Windows Service that polls, thats not a problem at all.
You could even self host a WCF server with a Duplex Contract that other software subscribes to, you could then send notifications ect via that channel.
or use SignalR for notification which would work just fine in this situation as well, and is a 5 minute job to get working.
Though, there is lots of approaches here, You really need to do some research to find what suits you most
Solution B is better.
If B, is it possible to create a delegate in the service that the
software on another (networked) machine can subscribe to? If so where
might I find information on doing that, I could not find anything on
google.
It depends on your need and project type.
You can use SignalR in ASP.Net
If you work with sockets you can keep connection alive and store client context in a list and notify theme

TAPI TE_CALLINFOCHANGE never fires

I have been looking at TAPI, I can detect calls, make calls, answer/reject calls... however the only reason im even looking at it is to get the CallerID.
I know the hardware I am using works for CallerID as I have used other software to check before hand.
I have tired using the COM obeject directly, using JulMar's wrapper, and using TAPI 2.0 and I am yet to find a way that works.
From my understanding the callerID should come through via TE_CALLINFOCHANGE.
The problem is the event never fires, and the callerID is always blank on the other events.
Has anyone had success with this?
Thanks
May be the TSP doesn't send the message about a call info change, and the information never changes because it is present from the start of the lifetime of the call.
The call info is always present for a call and you can ask for it at any time. Just retreive it from the call, with ITCallInfo::get_CallInfoLong (lineGetCallInfo).

Windows Mobile 6 answer multiple calls

I develop a Windows Mobile 6 application where I have to manage multiple calls, using c++ TAPI (from C# using PInvoke).
The application works fine for a single call, but I do not know how to manage when I have an incoming call and I want to answer the second incoming call.
For example: I answer the first call with lineAnswer, I detect the second call and I want to accept it with lineAccept, then put the first call on hold lineHold and answer the second call with lineAnswer.
The problem is that I cannot manage at all the second call.
What steps (function calls) should I follow to manage 2 incoming calls?
Have you looked at the OpenNetCF.Telephony library? It's an open source C# wrapper around the TAPI functions, and it comes with a number of samples that show how to monitor and answer incoming calls. Maybe there are some pointers for you in there on how to handle your specific scenario.
I found myself the solution:
The command placed for the call is still lineAnswer but before, out application must be the owner of the call, so a I use lineSetCallPrivilege with the Owner value.

3rd party dll raising events

I use a third party dll to get some data from their servers. There is a void method that I call and then i subscribe to an event raised by the call to this method. The event raised returns the data through its parameters.
so,
call to : void getdata(id)
raises: void onReturn(object) --> which returns an object that has the data.
This WORKS everytime when there is a single call to getdata(id)
The problem is when i loop through the list of ids, and inside that loop call getdata(id) for that list, the corresponding events are not raised properly.
Say for a list of 10 ids, there are 10 calls to getdata(id) but only few onReturns are raised.
The returned object also returns the id that was passed to getdata(id) so I can match the data i sent and the data that i receive.
Is there a way to make sure that all events get listened to? So if I send 10 ids by getdata(id), I want to make sure that the 10 onReturns are processed.
And i'm using c#, .net 4.0
Thanks
If it's a third party DLL, there's no telling how they've implemented it. When you step through in Debug mode, do you get past the call to getData() before the onReturn() listener is called? If so, it might be using threads (or at least asynchronous listeners) internally, and calling multiple getData()s too close together might cause it to stomp on pending responses.
The only way I could think to try and get around this is to use multithreading yourself, e.g. with a Mutex that waits after the call to getData() and releases in the onReturn() event. This way you'd only have one outstanding request at a time, which seems to be the condition that works for you.
Edit: Have you talked to the third party vendor about this yet? I'm guessing their support isn't the best if you thought of us first, but it might be worth a shot.
Edit the second: When you say it gets data from their servers, does this mean it makes requests over the network? If those requests aren't encrypted, perhaps you could reverse engineer the protocol and make a new API for yourself instead of relying on a proven buggy black box.

Categories

Resources