neu
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
Imports System.ComponentModel
|
||||
Imports sipdotnet
|
||||
Imports System.ComponentModel
|
||||
Imports System.Text
|
||||
Imports TAPI3Lib
|
||||
Imports Bria_API_CSharp_SampleApp
|
||||
Imports Bria_API_CSharp_SampleApp.BriaPhoneRemoteControl
|
||||
Imports Bria_API_CSharp_SampleApp.CallHistoryView
|
||||
|
||||
Public Class frmTapi
|
||||
|
||||
@@ -14,6 +18,11 @@ Public Class frmTapi
|
||||
Private oAddress As ITAddress
|
||||
Private RegCookie As Integer
|
||||
|
||||
|
||||
Dim briaAPI As BriaAPI
|
||||
Private phoneLines As PhoneLine() = New PhoneLine(5) {}
|
||||
|
||||
|
||||
Sub New()
|
||||
Try
|
||||
InitializeComponent()
|
||||
@@ -249,6 +258,20 @@ Public Class frmTapi
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
Sub makeVideoCallBRIA(PhoneNumber As String)
|
||||
Try
|
||||
|
||||
Dim connected = True
|
||||
If connected Then
|
||||
|
||||
briaAPI.RequestPlaceCall(PhoneNumber, Bria_API_CSharp_SampleApp.BriaAPI.CallTypes.video)
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Sub makeVideoCall2(PhoneNumber As String)
|
||||
@@ -554,8 +577,8 @@ Public Class frmTapi
|
||||
Dim HookPttInfo = -1
|
||||
Dim ReadHook = PlathosysApiWrapper.Plathosys.ReadHookAndPTT(HookPttInfo)
|
||||
|
||||
Console.WriteLine($"ReadHook? {ReadHook}")
|
||||
Console.WriteLine($"HookPttInfo? {HookPttInfo}")
|
||||
' Console.WriteLine($"ReadHook? {ReadHook}")
|
||||
' Console.WriteLine($"HookPttInfo? {HookPttInfo}")
|
||||
|
||||
'Dim HookAndPTTState = PlathosysApiWrapper.Plathosys.InitHookAndPTTState()
|
||||
'Console.WriteLine($"HookAndPTTState? {HookAndPTTState}")
|
||||
@@ -570,10 +593,12 @@ Public Class frmTapi
|
||||
'picCallState.BackgroundImage = Nothing
|
||||
'picCallState.Image = My.Resources._call
|
||||
lblCallState.Text = "Anruf wird gestartet..."
|
||||
Dim PhoneNumber As String = "00436644178557"
|
||||
Dim PhoneNumber As String = "800" '"00436644178557"
|
||||
' Dim PhoneNumber As String = "147"
|
||||
makePhoneCall(PhoneNumber)
|
||||
' MsgBox("PICKUP!!!")
|
||||
'makePhoneCall(PhoneNumber)
|
||||
endCall()
|
||||
makeVideoCallBRIA(PhoneNumber)
|
||||
|
||||
End If
|
||||
Case Else
|
||||
If STATE = "PICKUP" Then
|
||||
@@ -583,7 +608,12 @@ Public Class frmTapi
|
||||
'picCallState.BackgroundImage = My.Resources.PLATHOSYS
|
||||
'picCallState.Image = Nothing
|
||||
lblCallState.Text = "Bitte heben Sie den Höhrer ab, um den Anruf zu starten."
|
||||
CURRENTCALL.Disconnect(DISCONNECT_CODE.DC_NORMAL)
|
||||
'CURRENTCALL.Disconnect(DISCONNECT_CODE.DC_NORMAL)
|
||||
endCall()
|
||||
|
||||
|
||||
|
||||
'briaAPI.Stop()
|
||||
' MsgBox("PICKUP DOWN!!!")
|
||||
End If
|
||||
End Select
|
||||
@@ -593,9 +623,104 @@ Public Class frmTapi
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub endCall()
|
||||
Try
|
||||
' briaAPI.
|
||||
For Each phoneLine As PhoneLine In phoneLines
|
||||
|
||||
If (phoneLine IsNot Nothing) Then
|
||||
MsgBox(phoneLine.Id)
|
||||
|
||||
briaAPI.RequestEndCall(phoneLine.Id)
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub frmTapi_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
'allFunc()
|
||||
Timer.Enabled = True
|
||||
'SipLinphone()
|
||||
|
||||
Try
|
||||
briaAPI = New Bria_API_CSharp_SampleApp.BriaAPI()
|
||||
|
||||
briaAPI.Start()
|
||||
'AddHandler briaAPI.OnCallStatus, AddressOf OnCallOptionsStatus(Me, aes As BriaAPI.CallOptionsStatusEventArgs)
|
||||
'AddHandler briaAPI.OnCallStatus, AddressOf MainThread_OnCallStatus(New BriaAPI.CallStatusEventArgs)
|
||||
' AddHandler briaAPI.OnCallOptionsStatus, AddressOf OnCallStatus
|
||||
AddHandler briaAPI.OnCallStatus, AddressOf OnCallStatus
|
||||
|
||||
' briaAPI.OnCallOptionsStatus += New EventHandler(Of BriaAPI.CallOptionsStatusEventArgs)(OnCallOptionsStatus)
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Delegate Sub OnCallStatusDelegate() ' As OnCallOptionsStatusDelegateEv
|
||||
|
||||
Private Event OnCallStatusDelegateEv(ByVal args As BriaAPI.CallStatusEventArgs)
|
||||
|
||||
'Private Delegate Sub OnCallOptionsStatus() As OnCallOptionsStatusDelegate
|
||||
'Private Event OnCallOptionsStatusDelegate(ByVal args As BriaAPI.CallStatusEventArgs)
|
||||
|
||||
'Private Delegate void OnCallOptionsStatusDelegate(BriaAPI.CallOptionsStatusEventArgs args);
|
||||
' Private OnCallOptionsStatusDelegate onCallOptionsStatusDelegate;
|
||||
|
||||
Private Sub OnCallStatus(ByVal sender As Object, ByVal args As BriaAPI.CallStatusEventArgs)
|
||||
Dim lineInUse As Boolean() = New Boolean(5) {}
|
||||
Dim callList As List(Of BriaAPI.[Call]) = args.CallList
|
||||
|
||||
|
||||
phoneLines = New PhoneLine(5) {}
|
||||
|
||||
Dim cnt = 0
|
||||
|
||||
For Each [call] As BriaAPI.[Call] In callList
|
||||
Dim existingCall As Boolean = False
|
||||
Dim phoneLine As PhoneLine = Nothing
|
||||
Dim newPhoneLine As PhoneLine = New PhoneLine([call].CallId)
|
||||
|
||||
|
||||
phoneLines(cnt) = newPhoneLine
|
||||
|
||||
|
||||
|
||||
phoneLine.HoldState = [call].HoldState
|
||||
|
||||
For Each participant As BriaAPI.CallParticipant In [call].ParticipantList
|
||||
Dim remoteParty As RemoteParty = New RemoteParty()
|
||||
remoteParty.Number = participant.Number
|
||||
remoteParty.DisplayName = participant.DisplayName
|
||||
remoteParty.TimeInitiated = participant.TimeInitiated
|
||||
remoteParty.State = participant.CallState
|
||||
phoneLine.RemoteParties.Add(remoteParty)
|
||||
|
||||
If (phoneLine.RemoteParties.Count = 1) AndAlso (remoteParty.State = BriaAPI.CallStates.Ringing) Then
|
||||
phoneLine.IsRinging = True
|
||||
Else
|
||||
phoneLine.IsRinging = False
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
For i As Integer = 0 To 6 - 1
|
||||
|
||||
If lineInUse(i) = False Then
|
||||
phoneLines(i) = Nothing
|
||||
End If
|
||||
Next
|
||||
|
||||
UpdateCallStates()
|
||||
End Sub
|
||||
|
||||
Private Sub lblClose_Click(sender As Object, e As EventArgs) Handles lblClose.Click
|
||||
@@ -611,4 +736,71 @@ Public Class frmTapi
|
||||
lblClose.BackColor = Panel2.BackColor
|
||||
lblClose.ForeColor = Panel2.BackColor
|
||||
End Sub
|
||||
|
||||
'Private Sub SurroundingSub()
|
||||
' Dim callee As Address = Factory.Instance.CreateAddress("sip:janedoe@sip.example.org")
|
||||
' Dim callParams As CallParams = Core.CreateCallParams(Nothing)
|
||||
' callParams.MediaEncryption = MediaEncryption.SRTP
|
||||
' callParams.VideoEnabled = True
|
||||
' Dim [call] As [Call] = Core.InviteAddressWithParams(callee, callParams)
|
||||
' [call].Listener.OnStateChanged += Function(ByVal delegateCall As [Call], ByVal state As CallState, ByVal message As String)
|
||||
|
||||
' Select Case state
|
||||
' Case CallState.Connected
|
||||
' loggingService.Message("Call is connected")
|
||||
' Case Else
|
||||
' loggingService.Message("Call is " & state.ToString())
|
||||
' End Select
|
||||
' End Function
|
||||
'End Sub
|
||||
|
||||
'Sub SipLinphone()
|
||||
' Dim account As Account = New Account("0p6ou3lEGC", "WarT4jO5Us", "sip:verag.3cx.at")
|
||||
' Dim phone As Phone = New Phone(account)
|
||||
' AddHandler phone.PhoneConnectedEvent, Sub()
|
||||
' Console.WriteLine("Phone connected. Calling...")
|
||||
' ' phone.MakeCallAndRecord("phonenumber", "/tmp/filename.wav")
|
||||
' phone.MakeCall("phonenumber")
|
||||
' End Sub
|
||||
' AddHandler phone.CallActiveEvent, Sub()
|
||||
' Console.WriteLine("Answered. Call is active!")
|
||||
' End Sub
|
||||
' AddHandler phone.CallCompletedEvent, Sub()
|
||||
' Console.WriteLine("Completed.")
|
||||
' End Sub
|
||||
' AddHandler phone.PhoneConnectedEvent, Sub()
|
||||
' Console.WriteLine("Connected.")
|
||||
' End Sub
|
||||
' AddHandler phone.PhoneDisconnectedEvent, Sub()
|
||||
' Console.WriteLine("Disonnected.")
|
||||
' End Sub
|
||||
' Console.WriteLine("Go....")
|
||||
|
||||
|
||||
|
||||
' phone.Connect() ' // connecting
|
||||
|
||||
' Console.WriteLine(phone.CurrentConnectState)
|
||||
' 'phone.MakeCall("800")
|
||||
' 'Console.ReadLine()
|
||||
' 'phone.Disconnect() ' // terminate all calls And disconnect
|
||||
'End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateCallStates()
|
||||
'Dim active1 As Boolean = UpdatePhoneLine(Me.PhoneLine1Status_Text, Me.PhoneLine1Hold_Button, Me.PhoneLine1Resume_Button, Me.PhoneLine1End_Button, phoneLines(0))
|
||||
'Dim active2 As Boolean = UpdatePhoneLine(Me.PhoneLine2Status_Text, Me.PhoneLine2Hold_Button, Me.PhoneLine2Resume_Button, Me.PhoneLine2End_Button, phoneLines(1))
|
||||
'Dim active3 As Boolean = UpdatePhoneLine(Me.PhoneLine3Status_Text, Me.PhoneLine3Hold_Button, Me.PhoneLine3Resume_Button, Me.PhoneLine3End_Button, phoneLines(2))
|
||||
'Dim active4 As Boolean = UpdatePhoneLine(Me.PhoneLine4Status_Text, Me.PhoneLine4Hold_Button, Me.PhoneLine4Resume_Button, Me.PhoneLine4End_Button, phoneLines(3))
|
||||
'Dim active5 As Boolean = UpdatePhoneLine(Me.PhoneLine5Status_Text, Me.PhoneLine5Hold_Button, Me.PhoneLine5Resume_Button, Me.PhoneLine5End_Button, phoneLines(4))
|
||||
'Dim active6 As Boolean = UpdatePhoneLine(Me.PhoneLine6Status_Text, Me.PhoneLine6Hold_Button, Me.PhoneLine6Resume_Button, Me.PhoneLine6End_Button, phoneLines(5))
|
||||
'm_IsActiveOnThePhone = active1 OrElse active2 OrElse active3 OrElse active4 OrElse active5 OrElse active6
|
||||
'UpdatePhoneState()
|
||||
Me.Update()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user