Hangup when complete message was transfered

Apr 14, 2015 at 10:25 AM
Hi, we are using Capi.Net to send alarm messages of our SCADA system to specific phone numbers.

So what we want to do is:
  1. Call the phone number
  2. Read out the alarm message (can be several sentences) when we are connected and then
  3. hang up immediately when the complete alarm message was read out.
Currently our problem is that we hang up too early.

My question now is:
How can we know that the message was completely read out?

Below you can see the corresponding part of our code:
            //Connection c was correctly established --> we are in ConnectionStatusChanged event and state is Connected!!!

            var stream = new ConnectionStream(c);

            using (var memStream = new MemoryStream())
            {
                _speak.SetOutputToAudioStream(memStream, new SpeechAudioFormatInfo(EncodingFormat.ALaw, 8000, 8, 1, 8000, 1, null));                    

                _speak.Speak(... our alarm message ...);

                memStream.Seek(0, SeekOrigin.Begin);

                using (var writer = new ConnectionWriter(stream))
                {
                    writer.Reverse = true;
                    writer.Write(memStream);                                 
                }
            }                                

            //Now we hang up (too early) in a separate thread