HangUp not working ..

Feb 5, 2011 at 7:22 PM

Hello

I have windows Service for TTS Services. Now I have the problem the hangup is not working.

Call the connection.hangup but nothing happens.. Very Strange

 

A Other question is have you an idea why the .net speech not working in a windows server ? It comes the expection Argumentnotfound "source"

 

Regards

 

Private Sub ConnectionStateChange(ByVal sender As Object, ByVal e As Mommosoft.Capi.ConnectionEventArgs) Handles mCapi.ConnectionStatusChanged
        Try
            mLogger.Info("Connection State Changed" & e.Connection.Status)
            If e.Connection IsNot Nothing AndAlso e.Connection.Status = ConnectionStatus.Connected Then
                '                Dim s As New SpeechSynthesizer()
                's.SetOutputToAudioStream(memStream, New SpeechAudioFormatInfo(EncodingFormat.ALaw, 8000, 8, 1, 8000, 1, _
                'Nothing))
                's.SetOutputToWaveFile("C:\\TEMP\\test.wav", New SpeechAudioFormatInfo(EncodingFormat.ALaw, 8000, 8, 1, 8000, 1, _
                'Nothing))
                's.
                's.Speak("dies ist ein test")
                's.SetOutputToDefaultAudioDevice()


                'Dim stream As New ConnectionStream(e.Connection)
                'Dim s As New SpeechSynthesizer()
                'Using memStream As New MemoryStream()
                's.SetOutputToAudioStream(memStream, New SpeechAudioFormatInfo(EncodingFormat.ALaw, 8000, 8, 1, 8000, 1, _
                ' Nothing))
                's.Speak("dies ist ein test")
                'memStream.Seek(0, SeekOrigin.Begin)

                'Using writer As New ConnectionWriter(stream)
                'writer.Reverse = True
                'writer.Write(memStream)
                'End Using
                'End Using

                Dim wavFile As String
                wavFile = GenerateSpeek("Willkommen beim ")
                Dim stream As New ConnectionStream(e.Connection)
                Using fs As FileStream = File.OpenRead(wavFile)
                    Using writer As New ConnectionWriter(stream)
                        writer.Write(fs)
                    End Using
                End Using

                Dim fi As New FileInfo(wavFile)
                fi.Delete()

                mLogger.Info("HangUp ")
                e.Connection.HangUp()
                e.Connection.Dispose()
            End If
        Catch ex As Exception
            ThrowsException(ex, True, "")
        End Try
    End Sub

Coordinator
Feb 5, 2011 at 9:35 PM
Hi,

It is because you call hangup in the state change event.
Regards
Mihail


From: theneon2011 <notifications@codeplex.com>
Reply-To: <CAPI@discussions.codeplex.com>
Date: 5 Feb 2011 11:22:59 -0800
To: Mihail Stefanov <michail@mommosoft.com>
Subject: HangUp not working .. [CAPI:244792]

From: theneon2011

Hello

I have windows Service for TTS Services. Now I have the problem the hangup is not working.

Call the connection.hangup but nothing happens.. Very Strange

A Other question is have you an idea why the .net speech not working in a windows server ? It comes the expection Argumentnotfound "source"

Regards

Private Sub ConnectionStateChange(ByVal sender As Object, ByVal e As Mommosoft.Capi.ConnectionEventArgs) Handles mCapi.ConnectionStatusChanged
Try
mLogger.Info("Connection State Changed" & e.Connection.Status)
If e.Connection IsNot Nothing AndAlso e.Connection.Status = ConnectionStatus.Connected Then
' Dim s As New SpeechSynthesizer()
's.SetOutputToAudioStream(memStream, New SpeechAudioFormatInfo(EncodingFormat.ALaw, 8000, 8, 1, 8000, 1, _
'Nothing))
's.SetOutputToWaveFile("C:\\TEMP\\test.wav", New SpeechAudioFormatInfo(EncodingFormat.ALaw, 8000, 8, 1, 8000, 1, _
'Nothing))
's.
's.Speak("dies ist ein test")
's.SetOutputToDefaultAudioDevice()


'Dim stream As New ConnectionStream(e.Connection)
'Dim s As New SpeechSynthesizer()
'Using memStream As New MemoryStream()
's.SetOutputToAudioStream(memStream, New SpeechAudioFormatInfo(EncodingFormat.ALaw, 8000, 8, 1, 8000, 1, _
' Nothing))
's.Speak("dies ist ein test")
'memStream.Seek(0, SeekOrigin.Begin)

'Using writer As New ConnectionWriter(stream)
'writer.Reverse = True
'writer.Write(memStream)
'End Using
'End Using

Dim wavFile As String
wavFile = GenerateSpeek("Willkommen beim ")
Dim stream As New ConnectionStream(e.Connection)
Using fs As FileStream = File.OpenRead(wavFile)
Using writer As New ConnectionWriter(stream)
writer.Write(fs)
End Using
End Using

Dim fi As New FileInfo(wavFile)
fi.Delete()

mLogger.Info("HangUp ")
e.Connection.HangUp()
e.Connection.Dispose()
End If
Catch ex As Exception
ThrowsException(ex, True, "")
End Try
End Sub

Feb 6, 2011 at 4:03 PM

Thanks for your fast answer.

 

And where should I do the hangup ? It should play the wav and then immediate hangup.

Is a separate Thread for hangup a solution ?

Coordinator
Feb 6, 2011 at 9:29 PM
You call it in a new thread or use one from thread pool.

Regards
Mihail

On 06.02.2011, at 18:03, "theneon2011"<notifications@codeplex.com> wrote:

From: theneon2011

Thanks for your fast answer.

And where should I do the hangup ? It should play the wav and then immediate hangup.

Is a separate Thread for hangup a solution ?

Feb 13, 2011 at 11:09 AM

One last questions .

 

How long does the capi.net ring ? F.e. my programm should allways ring 3 times and after that is should exit my thread.

Can I set a global property for this ? Or exist a event for the ring ?

 

Regards

Coordinator
Feb 13, 2011 at 11:35 AM

Hi,

There is no restriction from capi.net how long(or number) to ring , so you can implement it via counting them and when 3th ring come to hang up.

In the event you can start new thread to hang up when moment come (3th ring in your case).

Regards

Mihail

P.S.

Did you handle your first problem?

From: theneon2011 [email removed]
Sent: Sunday, February 13, 2011 1:09 PM
To: michail@mommosoft.com
Subject: Re: HangUp not working .. [CAPI:244792]

From: theneon2011

One last questions .

How long does the capi.net ring ? F.e. my programm should allways ring 3 times and after that is should exit my thread.

Can I set a global property for this ? Or exist a event for the ring ?

Regards

Feb 13, 2011 at 5:57 PM

Yes the first problem is solved . And how can I count the ring ?

I say  mConnection = mCapiController.Connect(String.Empty, number, CIPServices.Telephony, B1Protocol.HDLC64BFN, B2Protocol.Transparent, B3Protocol.Transparent)

and then I waiting

on then

   Private Sub ConnectionStateChange(ByVal sender As Object, ByVal e As Mommosoft.Capi.ConnectionEventArgs) Handles mCapi.ConnectionStatusChanged

  If e.Connection IsNot Nothing AndAlso e.Connection.Status = ConnectionStatus.Connected Then

where can I count the rings ?

 

Regards