Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
calls
#1
would it be possible to make phone calls using qm? any way..
#2
google for TAPI
I cannot help, never used TAPI functions, and cannot test
#3
ok i have the TAPI dll but how would this be possible to implement into qm?
would i need to load the typlib? load the dll?
any help would be much appreciated. thanks
#4
You don't need dlls or typelibs. Read TAPI reference in MSDN library and use the functions.

Also Windows has TAPI type library. It should be simpler to use but I don't know where documented.
Macro
Code:
Copy      Help
typelib TAPI3Lib {21D6D480-A88B-11D0-83DD-00AA003CCABD} 1.0
TAPI3Lib.RequestMakeCall r._create
r.MakeCall("123456789" "qm" "test" "")
;don't know if something like this will work

Or automate Windows Phone Dialer application.
Macro
Code:
Copy      Help
run "dialer.exe"
;...

At first run dialer.exe and configure everything and make sure you can make phone calls with it. It uses TAPI too.
#5
ok first i tryed using it manually, no sucess.
couldnt even get a dial tone hooking phone to computer, or using microphone.
#6
I found this while searching the internet it is vb code. Not sure if this could be any help but i've been trying everything i can find on this TAPI and nothing is working.

thanks...

----------------------------------------------------------------------------------

'Filename: DialerGlobal.vb
'Desc: Extends Inheritable Dialer Class with TAPI Methods
'Date: 10/24/2007
'Auth: John T. M DATAMODEM Dialer Project
'
'
'Description:
' Class to implement call handeling using DATAMODEM DTMF Device.
' Detects modem as DATAMODEM.
'
'Dependancies:
' To Do - Implement SIP Session Initiation Protocol for PBX (VoIP) Functionality.
' IP telephony signaling protocol used to establish, modify and terminate VOIP telephone calls.
' SIP was developed by the IETF and published as RFC 3261 http://tools.ietf.org/html/rfc3261
'
' Implements TAPI 3.x Class Members - TAPI3Lib
'
'
' References:
' ms-help://MS.PSDKSVR2003SP1.1033/tapi/tapi3/tapi_quick_start.htm

Imports TAPI3Lib
Public Class Dialer

Private TAPI3 As TAPI ' TAPI 3.x Class
Public TAPIException As Exception ' TAPI Errors encountered during execution
Public TAPIExceptionMessage As String ' TAPI Exception Message
Public TAPI3Initalized As Boolean ' TAPI 3 Initalized state
Private TAPIAddress As ITAddress ' Address of Supported Media Type
Public TAPIAddressName As String ' TAPIAddress.AddressName
Public TAPIDataModemAddress As ITAddress ' Address of Data Modem Device
Private TAPICollAddresses As ITCollection ' Collection of Media Type Addresses
Private TAPIMediaSupport As ITMediaSupport
Private TAPIAddressCapabilities As ITAddressCapabilities ' Capabilities of Device
Private TAPICallControl As ITBasicCallControl ' Call Control Object
Private TAPICallState As CALL_STATE ' TAPI Call State for active call
Private TAPICallStateTimer As System.Timers.Timer ' TAPICall State Timer
Public TAPICallInfo As ITCallInfo ' Information about calls
Private TAPICalls As ITCollection ' Maintains Collection of calls
Private TAPICallTerminal As ITTerminal ' Call Terminals Object
Private TAPITerminalSupport As ITTerminalSupport2 ' Terminal Support Object
Public CallAddressState As ADDRESS_STATE ' State of ITAddress object
Public DATA_MODEM_DEVICE As Boolean ' Call Device (ITAddress DATAMODEM) available
Public MEDIA_SUPPORT_AUDIO As Boolean ' Call Device Supports Audio
Public MEDIA_SUPPORT_VIDEO As Boolean ' Call Device Supports Video
Public DTMFH323Support As Boolean ' Call Device Support DTMF Streams.
Private WithEvents TAPIWithEvents As TAPI ' TAPI Event Handler
Private TAPIRegistrationToken As Integer ' Handle for event registration
Private fOwner As Boolean, fMonitor As Boolean ' Registration options RegisterCallNotifications
Private lMediaTypes As Integer, lCallbackInstance As Integer
' Call event notifications and constants
Const CallEvents As TAPI_EVENT = _
TAPI_EVENT.TE_CALLMEDIA _
Or TAPI_EVENT.TE_CALLSTATE _
Or TAPI_EVENT.TE_CALLNOTIFICATION _
Or TAPI_EVENT.TE_TONEEVENT _
Or TAPI_EVENT.TE_DIGITEVENT

Const LINEADDRESSTYPE_PHONENUMBER = 1 ' Standard Phone Number
Const LINEADDRESSTYPE_IPADDRESS = 16 ' Standard TCP/IP Address IPV4

Public Enum MEDIA_TYPE As Integer ' TAPIConstants.TAPIMEDIATYPE_ Constants
AUDIO = 8 ' &H0008
DATAMODEM = 16 ' &H0010
G3FAX = 32 ' &H0020
VIDEO = 32768 ' &H8000
AUDIOVIDEO = 32776 ' &H8008
End Enum

Public Enum LINEDIGIT_MODE As Integer ' TAPIConstants.LINEDIGITMODE_ Constants
LINEDIGITMODE_PULSE = 1
LINEDIGITMODE_DTMF = 2
LINEDIGITMODE_DTMFEND = 4
End Enum

' Initialize TAPI 3.x Class, Must call Shutdown() when finished
Public Sub Initialize()
If Not TAPI3Initalized Then ' TAPI Objects Not Initialized
TAPI3 = New TAPI ' Create the new TAPI Object
TAPIException = Nothing
TAPIExceptionMessage = Nothing
TAPICallTerminal = Nothing
TAPICallControl = Nothing
TAPITerminalSupport = Nothing
TAPICalls = Nothing
TAPI3.Initialize() ' Initalize TAPI Instance
TAPIRegistrationToken = 0 ' Null Registration
DATA_MODEM_DEVICE = False ' Selected Call device available.
MEDIA_SUPPORT_AUDIO = False
MEDIA_SUPPORT_VIDEO = False
TAPICollAddresses = TAPI3.Addresses ' Addresses to Enumerate into collection.
TAPICallState = CALL_STATE.CS_DISCONNECTED ' Default Call State is Disconnected.

' Select default call Notifications for TAPI
fOwner = False ' Application Owns incomming calls
fMonitor = True ' Application Monitors calls.
lMediaTypes = MEDIA_TYPE.DATAMODEM ' Default Media type handled by Dialer.
lCallbackInstance = 1

TAPIDataModemAddress = FindMediaType(MEDIA_TYPE.DATAMODEM) ' Select Defualt DTMF Modem Device

' Set ITTAPIEventNotification::Event interface
TAPI3.EventFilter = CallEvents ' Set TAPI Call Event Notifications
TAPIWithEvents = TAPI3 ' Register the outgoing events.

If Not TAPIDataModemAddress Is Nothing Then ' Data Modem Support ..?
SetITAddress(TAPIDataModemAddress) ' Set Data Modem as active TAPIAddress (ITAddress)
TAPI3Initalized = True ' TAPI Initalized
TAPI3.SetApplicationPriority(Application.ProductName, lMediaTypes, True) ' Application is DATAMODEM GOD
TAPICallStateTimer = New System.Timers.Timer ' New Call Timer
AddHandler TAPICallStateTimer.Elapsed, AddressOf TAPICallStateTimerElapsed
TAPICallStateTimer.Interval = 10000 ' 10 Second Call Interval Timer
TAPICallStateTimer.Stop()
' MakeCall("###-###-####") ' Debugging application only
End If

End If

End Sub

'Find address that supports the desired type Media Type (nMedia).
'Returns ITAddress (Usable Address) of requested Media Type (TapiConstants) on Success.
Public Function FindMediaType(ByVal nMedia As MEDIA_TYPE) As ITAddress
Dim tAddressIndex As Integer ' Address Index of Supported Media type
Dim TAPIoAddress As Object ' Usable Address Object
TAPIAddress = Nothing ' Set to Invalid Address

For tAddressIndex = 1 To TAPICollAddresses.Count
TAPIoAddress = TAPICollAddresses.Item(tAddressIndex)
TAPIMediaSupport = TAPIoAddress

If TAPIMediaSupport.QueryMediaType(nMedia) Then
TAPIAddress = TAPIoAddress
lMediaTypes = TAPIMediaSupport.MediaTypes ' Media Types supported by this address.
Exit For ' Set Current Address to requested TAPICollAddresses.Item(tAddressIndex)
End If
Next

TAPIoAddress = Nothing ' Set to Invalid Address
TAPIMediaSupport = Nothing ' Destroy Object

Return TAPIAddress
End Function

' Set device address active for selected call device returned by FindMediaType.
' Device is DTMF compatible and can generate and monitor tones.
Private Function SetITAddress(ByVal xITAddress As ITAddress) As Boolean
Dim DeviceAvailable = False
DATA_MODEM_DEVICE = False
MEDIA_SUPPORT_VIDEO = False
MEDIA_SUPPORT_AUDIO = False
lMediaTypes = 0

CallAddressState = xITAddress.State

If CallAddressState = ADDRESS_STATE.AS_INSERVICE Then
TAPIAddress = Nothing ' Release Address Object
TAPIAddress = xITAddress ' Set Active device address.
TAPIAddressName = TAPIAddress.AddressName ' Set Active address name for selected device.
TAPIMediaSupport = TAPIAddress ' Detect Media Support Type for selected address.
TAPIAddressCapabilities = TAPIAddress ' Set Address Capabilities.
TAPICalls = TAPIAddress.Calls ' Get collection of ITCallInfo pointers for specified address.

' Determine type of media supported by selected device.
If TAPIMediaSupport.QueryMediaType(MEDIA_TYPE.DATAMODEM) Then DATA_MODEM_DEVICE = True

If TAPIMediaSupport.QueryMediaType(MEDIA_TYPE.AUDIOVIDEO) Then
MEDIA_SUPPORT_VIDEO = True
MEDIA_SUPPORT_AUDIO = True
Else
If TAPIMediaSupport.QueryMediaType(MEDIA_TYPE.AUDIO) Then MEDIA_SUPPORT_AUDIO = True
If TAPIMediaSupport.QueryMediaType(MEDIA_TYPE.VIDEO) Then MEDIA_SUPPORT_VIDEO = True
End If

' Set lMediaTypes Supported for this address.
If DATA_MODEM_DEVICE Then lMediaTypes = MEDIA_TYPE.DATAMODEM
If Not DATA_MODEM_DEVICE Then lMediaTypes = TAPIMediaSupport.MediaTypes

' If device supports incomming calls register.
If TAPIRegistrationToken Then TAPI3.UnregisterNotifications(TAPIRegistrationToken)

Try ' Register Call Notification for DATAMMODEM Device.
TAPIRegistrationToken = TAPI3.RegisterCallNotifications(xITAddress, fMonitor, _
fOwner, lMediaTypes, lCallbackInstance)
DeviceAvailable = True ' Set Device Available.
Catch ex As Exception ' Incomming calls not supported by interface.
TAPIException = ex
TAPIExceptionMessage = ex.Message
End Try

End If

TAPIMediaSupport = Nothing ' Disreguard Objects.
TAPIAddressCapabilities = Nothing

Return DeviceAvailable
End Function

' Create a new Call Control Object and associate with xITAddress (use default Modem device)
Private Function SetCallControl(ByVal phNumber As String) As Boolean
Dim nControlState As Boolean = False
'TAPICallTerminal = Nothing
TAPICallControl = Nothing
TAPICallInfo = Nothing

' Device available and ITAddress is DTMF enabled.
If phNumber.Length >= 8 And Not TAPIAddress Is Nothing Then ' Valid phone number.

' Create a new Call Control Object for this call.
TAPICallControl = TAPIAddress.CreateCall(phNumber, _
LINEADDRESSTYPE_PHONENUMBER, lMediaTypes)

If Not TAPICallControl Is Nothing Then ' Set Tapi Call Control and Information.

TAPICallInfo = TAPICallControl ' Set Call Information
TAPICallState = TAPICallInfo.CallState ' Get Call State information

' Try ' Is terminal support available does an MSP exist for this address ?
' TAPITerminalSupport = TAPIAddress ' Terminal Support Object
' TAPICallTerminal = TAPITerminalSupport.GetDefaultStaticTerminal( _
' lMediaTypes, TERMINAL_DIRECTION.TD_CAPTURE)

' Catch ex As System.Exception ' Terminal Support Not available for this device.
' TAPIException = ex
' TAPIExceptionMessage = ex.Message
' End Try

If TAPICallState = CALL_STATE.CS_IDLE Then nControlState = True
End If
End If

Return nControlState
End Function

' Place a new Call to PhoneNumber, Returns True on Success
' Sets Call Control using default Data Modem device.
' If the call is synchronous, this method will not return until
' the call is in the connected state or fails.
Public Function MakeCall(ByVal phNumber As String) As Boolean
Dim nControlState As Boolean = False

If Not TAPI3Initalized Then Initialize() ' Initalize TAPI 3

If DATA_MODEM_DEVICE Then ' Modem Device is ready.
If SetCallControl(phNumber) Then
Try ' Try to place the call syncronusly
TAPICallControl.Connect(False) ' Place call and return asyncronusly.
TAPICallState = TAPICallInfo.CallState ' Set Call State information for active connection.
nControlState = True ' Call was placed.

Catch ex As Exception ' Call Failed
TAPIException = ex
TAPIExceptionMessage = ex.Message
Shutdown() ' Stop TAPI3
End Try
End If
End If


Return nControlState
End Function

' Close all TAPI Sessions and Clean up objects
Public Sub Shutdown()
' Check for valid registration token
If TAPI3Initalized Then
If Not TAPICallInfo Is Nothing Then ' Is there an active call
If TAPICallInfo.CallState <> CALL_STATE.CS_DISCONNECTED Then TAPICallControl.Disconnect(DISCONNECT_CODE.DC_NORMAL)
TAPICallState = CALL_STATE.CS_DISCONNECTED
End If
If TAPIRegistrationToken Then TAPI3.UnregisterNotifications(TAPIRegistrationToken)
MEDIA_SUPPORT_AUDIO = False
MEDIA_SUPPORT_VIDEO = False
TAPICallInfo = Nothing
TAPICallTerminal = Nothing
TAPITerminalSupport = Nothing
TAPICallControl = Nothing
TAPIMediaSupport = Nothing
TAPIWithEvents = Nothing
TAPI3.Shutdown()
DATA_MODEM_DEVICE = False
TAPIDataModemAddress = Nothing
TAPIAddress = Nothing
TAPIAddressCapabilities = Nothing
TAPICollAddresses = Nothing
TAPICalls = Nothing
TAPI3Initalized = False
TAPIException = Nothing
TAPIExceptionMessage = Nothing
TAPIRegistrationToken = 0
TAPI3 = Nothing ' Release TAPI
End If
End Sub

Private Sub TAPIWithEvents_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) Handles TAPIWithEvents.Event
' TAPI Event Handler for TapiEvent use MakeCall with TAPICallControl.Connect(False) for asyncronus operation.
' If the call is asynchronous, the application will receive information about the call's progress through
' the ITCallNotificationEvent outgoing interface.

Select Case TapiEvent
Case TAPI_EVENT.TE_CALLSTATE ' Process Call State Events for active call (TAPICallState = TAPICallInfo.CallState)
Dim TAPICallStateEvent As ITCallStateEvent = pEvent
TAPICallState = TAPICallStateEvent.State ' Update Call State for TAPICallInfo.CallState
TAPICallInfo = TAPICallStateEvent.Call ' Update Call Information for this call.
TAPICallStateEvent = Nothing ' Discontinue object.

Select Case TAPICallState ' Process Call State for TAPICallInfo
Case CALL_STATE.CS_DISCONNECTED ' Call was Disconnected so release objects.
TAPICallStateTimer.Stop() ' Stop the Call State Timer

Case CALL_STATE.CS_INPROGRESS ' Call is in progress
TAPICallStateTimer.Start() ' Start the Call State Timer

Case CALL_STATE.CS_CONNECTED ' Call Was completed successfully
TAPICallControl.Disconnect(DISCONNECT_CODE.DC_NORMAL)


End Select

Case TAPI_EVENT.TE_CALLNOTIFICATION ' Process Incomming Call Here
Case TAPI_EVENT.TE_CALLMEDIA
Case TAPI_EVENT.TE_TONEEVENT
Case TAPI_EVENT.TE_DIGITEVENT

End Select


End Sub
' Handles TAPI Call State timing (Timer to set Max Call Duration)
Private Sub TAPICallStateTimerElapsed(ByVal sender As Object, ByVal e As Timers.ElapsedEventArgs)
TAPICallStateTimer.Stop() ' Process Call State for current call

Select Case TAPICallState ' Process Call State for TAPICallInfo

Case CALL_STATE.CS_INPROGRESS ' Call is in progress
TAPICallControl.Disconnect(DISCONNECT_CODE.DC_NORMAL)

Case CALL_STATE.CS_CONNECTED ' Call Was completed successfully
TAPICallControl.Disconnect(DISCONNECT_CODE.DC_NORMAL)
End Select
End Sub
End Class
#7
If cannot dial manually, TAPI codes also will not work. Because dialer.exe uses TAPI too.
#8
ok im still confused about how dialoer.exe works...

-do i need a phone plugged in?
-what kind of setup needs done?
#9
never used it, don't know
#10
I am interested in same thing... Any progress QM_Expert?

Stuart
#11
havent had time to really mess around with this, would be interested to find more info though.
#12
My work computer doesn't have a modem with a regular telephone jack - just an network card for ethernet. I have ordered a USB modem and will try to use it with the regular windows dialer.exe program. Will let you know.
Stuart
#13
I'm not exactly sure how to setup my computer to use dialer.exe.
Do i need a phone line coming in from the wall jack?
Or can i just plug a phone into the back of my computer in the modem with the telephone jack?
Thanks
#14
Gintaras Wrote:You don't need dlls or typelibs. Read TAPI reference in MSDN library and use the functions.

Also Windows has TAPI type library. It should be simpler to use but I don't know where documented.
Macro
Code:
Copy      Help
typelib TAPI3Lib {21D6D480-A88B-11D0-83DD-00AA003CCABD} 1.0
TAPI3Lib.RequestMakeCall r._create
r.MakeCall("123456789" "qm" "test" "")
;don't know if something like this will work

that works for me. Big Grin
pi


Forum Jump:


Users browsing this thread: 2 Guest(s)