1 pièce(s) jointe(s)
gestion d'événement pour une API ATAPI
Bonjour, je dois actuellement développer une application pour passer un appel, et récupérer le DTMF si la personne a décroché.
j'ai trouvé une API plutôt bien faite et documenté ! ATAPI https://atapi.codeplex.com
J'ai fait un programme pour appeler, il fonctionne mais le souci c'est au niveau de la detection d'événements je ne sais pas exactement comment faire .
Je detecte bien les évènements "CALL_STATE"
-> Dialing
-> Proceding
-> Connected
-> Disconnected
mais j'aimerais bien avoir d'autres événements comme, détecter les numéros tapés par l'appelé (je suppose* DigitDetectedEventArgs) , la tonalité (*ToneDetectedEventArgs)
Voila mon code si vous pouviez m'expliquer et/ou me rediriger :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
Imports JulMar.Atapi
Module Module1
Dim WithEvents myTAPI As JulMar.Atapi.TapiManager
Sub Main()
myTAPI = New TapiManager("MonApp")
If Not myTAPI.Initialize Then
Console.WriteLine("TAPI-Initialize failed")
Exit Sub
Else
Dim lines As TapiLine() = myTAPI.Lines
Dim line As TapiLine = Nothing
For Each l As TapiLine In lines
Try
l.Monitor()
If l.IsOpen Then
Console.WriteLine(l.Name)
line = l
End If
Exit For
Catch ex As Exception
' Console.WriteLine(ex.ToString)
End Try
Next
Try
line.MakeCall("0684021147")
Console.ReadLine()
line.Close()
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
End If
'--- Wait here ---
Console.ReadLine()
'--- Exit TAPI ---
myTAPI.Shutdown()
End Sub
Private Sub DtmfRecognizer_DigitDetected(ByVal sender As Object, ByVal e As DigitDetectedEventArgs)
Console.WriteLine(e.Digit.ToString)
End Sub
Private Sub OnNewCall(ByVal sender As Object, ByVal e As NewCallEventArgs) Handles myTAPI.NewCall
Console.WriteLine("(New-Call) Caller: " & e.Call.CallerId.ToString() & " | Called: " & e.Call.CalledId)
'e.Call.Answer()
End Sub
Private Sub OnCallInfoChange(ByVal sender As Object, ByVal e As CallInfoChangeEventArgs) Handles myTAPI.CallInfoChanged
Console.WriteLine("CallInfo: " & e.Change.ToString() & " - " & e.Call.ToString())
End Sub
Private Sub OnCallStateChanged(ByVal sender As Object, ByVal e As CallStateEventArgs) Handles myTAPI.CallStateChanged
Console.WriteLine("CALLSTATE: " & e.CallState.ToString() & " - " & e.Call.ToString() & " - " & e.MediaModes.ToString())
'e.Call.Drop()
End Sub
Private Sub OnRinging(ByVal sender As Object, ByVal e As RingEventArgs) Handles myTAPI.LineRinging
Console.WriteLine("ringing: " & e.RingCount & " - " & e.RingerStyle)
End Sub
Private Sub OnChanged(ByVal sender As Object, ByVal e As LineInfoChangeEventArgs) Handles myTAPI.LineChanged
Console.WriteLine("changed: " & e.Change.ToString & " - ")
End Sub
End Module |
Ainsi que la doc fournie avec. :)
Pièce jointe 166752
Merci
Pierre-Mike