Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/TAPI/mdxTapi
This example is the version from Sat, 5th Aug 2016.
Project "mdxTapi.xojo_binary_project"
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control FieldNumber Inherits TextField
ControlInstance FieldNumber Inherits TextField
End Control
Control ButtonHangup Inherits PushButton
ControlInstance ButtonHangup Inherits PushButton
EventHandler Sub Action()
If mCall <> Nil Then mCall.Disconnect(TAPICallControlMBS.DisconnectModeNormal)
End EventHandler
End Control
Control ButtonCall Inherits PushButton
ControlInstance ButtonCall Inherits PushButton
EventHandler Sub Action()
mCall = mAddress.CreateCall(FieldNumber.Text, ITAddressMBS.LineAddressTypePhoneNumber, ITAddressMBS.MediaTypeAudio)
If mCall = Nil Then
Log "Error: Failed to create call"
Return
End If
mCall.Connect(FieldSync.Value)
Dim LastError As Integer = mCall.Lasterror
Dim LastErrorMessage As String = mCall.LasterrorMessage
If FieldSync.Value Then
If LastError > 0 Or LastErrorMessage <> "" Then Log "Error (Sync) " + CStr(LastError) + ": " + LastErrorMessage
End If
End EventHandler
End Control
Control FieldSync Inherits CheckBox
ControlInstance FieldSync Inherits CheckBox
End Control
Control ButtonClear Inherits PushButton
ControlInstance ButtonClear Inherits PushButton
EventHandler Sub Action()
List.DeleteAllRows
End EventHandler
End Control
EventHandler Sub Open()
mTapi = new mdxTapi
dim addresses() as ITAddressMBS = mtapi.Addresses
for each a as ITAddressMBS in Addresses
If mAddress = Nil Then mAddress = a
log a.AddressName+" ("+a.ServiceProviderName+"): "+a.DialableAddress
next
mTapi.ListenOnAllAddresses
End EventHandler
Property Private mAddress As ITAddressMBS
Property Private mCall As TAPICallControlMBS
Property Private mTapi As mdxTapi
End Class
Class mdxTapi Inherits TAPIMBS
EventHandler Sub CallStateChanged(CallInfo as ITCallInfoMBS)
Select Case CallInfo.State
Case CallInfo.StateIdle
Log "StateIdle"
Case CallInfo.StateInProgress
Log "StateInProgress"
Case CallInfo.StateConnected
Log "StateConnected"
Case CallInfo.StateDisconnected
Log "StateDisconnected"
Case CallInfo.StateOffering
Log "StateOffering"
Case CallInfo.StateHold
Log "StateHold"
Case CallInfo.StateQueued
Log "StateQueued"
End Select
End EventHandler
EventHandler Sub IncomingCall(CallInfo as ITCallInfoMBS, BasicCallControl as TAPICallControlMBS)
Log CallInfo.CallerIDNumber
End EventHandler
End Class
Module modTapi
Sub Log(info as String)
Window1.list.AddRow info
window1.list.ListIndex = window1.list.LastIndex
End Sub
End Module
End Project
The items on this page are in the following plugins: MBS Win Plugin.