|
When I run this program I get this message : "no address selected" so how to set address. And what is the adress a phone or a port number to find phone?
|
|
|
|
|
Hi everybody.
The initialization works fine and gives me the name of the telephone back. But then the console is closing and the app quits. Where in the code can i say, that the app has to wait for events? Do i have to use a loop? Thanx for your help.
|
|
|
|
|
Hi everybody,
I know that bishoy changed to C.. and it's been a long time since 2005 - but I have a major issue to answer an incomming call by using bishoy code.
You noticed how to drop an incomming call - but this code isn't working too.
I googled a lot and found some C.. Code - but I am not a C-Coder
I have no idea to deal with this problem an I hope that someone could help me?
Thanks
Florian
|
|
|
|
|
Hello,
Thank you for this code !!
it helps understanding TAPI ...
I've tried this code in vb.net on a windows 8 environnement.
I'm developping with Visual Studio 2012.
We have Avaya IP office as telephony devices.
With this code, I'm able to make a call (oAdress.CreateCall)
But when I receving a call, it seems that no event is raized !
I would like to get the caller's number to retrive the contact in a sql database
Has anybody an idea ?
thank you for your help ...
edit:
Maybe an idea:
At the begining of the code, the folowing instructions give me an error:
' creating a new instance to first initialize TAPI
' before attaching the events
Dim m_TAPI As New TAPIClass
error: Impossible d'incorporer le type interop 'TAPIClass'. Utilisez l'interface applicable à la place. in english: impossible to embed TAPICLASS interop type. Use applicable interdface instead.
I have to do this instead:
' creating a new instance to first initialize TAPI
' before attaching the events
Dim m_TAPI As New TAPI
modified 1-Jul-13 4:43am.
|
|
|
|
|
Hello there, I'm sorry I cannot help as much because its been 7 years since I visited TAPI, I am even coding in C# now and does not code in VB.net anymore.
my guess (it could be wrong) is that you need to reference a new version of TAPI or something has changed in TAPI in windows8 !?
"Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
|
Hello Bishoy,
well, as C# coder, i hope you can help me with a VB Problem
I use your code and want to answer an incomming call ... but it doesn't work.
I tried to use your code on:
Case CALL_STATE.CS_OFFERING
' a call is offering so if you dont want it then pass it ...
But I only get exceptions. I tried a lot ... but now I need some idea :9
Thanks a lot
Greez Florian
|
|
|
|
|
it helps me a lot in understanding TAPI...
|
|
|
|
|
Code doesn't work for receiving calls, few if any of the comments are answered
|
|
|
|
|
Not working, poor programming.
|
|
|
|
|
Hi
I am ashkna jamialahmadi. I need help about programming telephon.
I want answer the phone and diconnect and after accept the phon if press any key I know which key pressed.
how can write in C# or vb.net.
I glad to you if you help me. befor tanks for reading and if you put time for meeage.
|
|
|
|
|
I am Hector i am a System Engineer from Mexico, I have developed a few systems and my English isn´t to good, so I´ll trie to explain myself te best I can.
I need your help related in telephony.
I saw an article form you in
http://www.codeproject.com
and I am interested in developing a new system which be used in a business, this system will be a call center software.
We already have a PABX, and we need to make phone calla using our pc desktops, but we need to limit phone numbers, and manege all the phone calls, so the employes don't dail any phone call that hasn't anything related with work. ande many things like that.
I would like you can help me,
Hector
|
|
|
|
|
hello ,
i am buling simple answer machine with TAPI3 ,Julmar Tapi wrapper,
but when i try to Transfer or BlindTransfer or hold the active call it gives an error :
This method is not supported.
help me please i am in Force Majeure an the time of my project is elapsed!
|
|
|
|
|
Hi folks,
after going through several sources (most of them outdated and for other languages like C++) I was successful in creating a small app in Visual Basic 2008 to get the phone number of an incomming call.
It needs a simple form and a small class (I used some of Bishoy's example code):
Public Class Form1
Dim WithEvents globalTAPI As namespace_tapi.vbtapi
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
globalTAPI.ShutDown()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim localTAPI As New namespace_tapi.vbtapi
Dim strTapiProvider As String
strTapiProvider = localTAPI.Initialize()
If strTapiProvider <> "Initializing failed" Then
globalTAPI = localTAPI
Else
MsgBox("TAPI INIT failed")
End If
localTAPI = Nothing
End Sub
Private Sub globalTAPI_IncommingCall(ByVal strCallerID As Object) Handles globalTAPI.IncommingCall
MsgBox(strCallerID)
End Sub
End Class
Imports TAPI3Lib
Namespace namespace_tapi
Public Class vbtapi
Private WithEvents gobjTapi As TAPI3Lib.TAPI
Private gobjAddress As ITAddress
Private glngToken As Long
Private Const MediaAudio As Integer = 8
Private Const TAPI3_ALL_TAPI_EVENTS = TAPI_EVENT.TE_CALLNOTIFICATION
Public Function Initialize() As String
Dim TAPI As New TAPIClass
Dim MediaTypes As Integer
TAPI.Initialize()
gobjTapi = TAPI
TAPI = Nothing
Dim AddressCollection As ITCollection = gobjTapi.Addresses()
For Each Address As ITAddress In AddressCollection
If Address.State = ADDRESS_STATE.AS_INSERVICE Then
' next line just qualifies a specific TAPI provider
If Address.AddressName = "AVM TAPI Services for FRITZ!Box" Then
Dim MediaSupport As ITMediaSupport = Address
MediaTypes = MediaSupport.MediaTypes
MediaSupport = Nothing
If MediaTypes And MediaAudio = MediaAudio Then
gobjAddress = Address
Exit For
End If
End If
End If
Next
If Not gobjAddress Is Nothing Then
gobjTapi.EventFilter = TAPI3_ALL_TAPI_EVENTS
glngToken = gobjTapi.RegisterCallNotifications(gobjAddress, True, True, MediaAudio, 1)
Initialize = gobjAddress.AddressName
Else
Initialize = "Initializing failed"
End If
End Function
Private Sub gobjTapi_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) Handles gobjTapi.Event
Select Case TapiEvent
Case TAPI_EVENT.TE_CALLNOTIFICATION 'Call Notification Arrived
Dim CallNotificationEvent As ITCallNotificationEvent
CallNotificationEvent = CType(pEvent, ITCallNotificationEvent)
Debug.Print(CallNotificationEvent.Call.CallInfoString(CALLINFO_STRING.CIS_CALLERIDNUMBER))
RaiseEvent IncommingCall(CallNotificationEvent.Call.CallInfoString(CALLINFO_STRING.CIS_CALLERIDNUMBER))
End Select
End Sub
Public Sub ShutDown()
gobjTapi.UnregisterNotifications(glngToken)
gobjAddress = Nothing
glngToken = Nothing
gobjTapi.Shutdown()
End Sub
Public Event IncommingCall(ByVal strCallerID)
End Class
End Namespace
Of course ..... this is just a simple example of what I have tried.
Hope it helps a little.
Tom
modified on Wednesday, March 31, 2010 6:21 AM
|
|
|
|
|
I can't seem to get this working. Always says "TAPI INIT failed"
|
|
|
|
|
Hi Tom,
I am trying to implement an ANSWER of an incomming call ... but I cant't get it working and there are no examples on the internet.
My Codebase is Bishoys Code - I tried to Drop an incomming call with his code example, but this is not working.
Can you help me out?
Thanks & Greez
Florian
|
|
|
|
|
|
it was not developed for vb.net 2008, be fair "Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
About 20 years ... since Microsoft introduced WOSA (Windows Open Service Architecture) including TAPI.
Since then there is no single fully implemeted OCX or something similar available.
Since then developers searching the internet for just one single working sample code in VB.
THIS sample here (by Bishoy Ghaly) ... I put my hope on.
In VB 2008 the code is running (after some little modifications) but no event is fired.
Does Microsoft know how many weeks a developer has to invest to get a simply app (like showing a callerID) up and running?
If this will ever work on this extremely bad documented API?
I dont know what to do know and if there is a single example for a working TAPI project (written in Visual Basic 2008/.NET 3.5), please let me know and I will be thankful for the rest of my life.
Cheers
Tom
|
|
|
|
|
Hi Tom, I can feel your frustration, however you should know that TAPI was not designed to be used from .net or managed stack, it is best to use it from old VB or even C++ if possible if you need to use most of its features.
the main reason for this is that .net creates an Interop for TAPI ocx that cannot support some of COM features and its deep polymorphism.
if you used my sample code here as basis for your implementation, maybe I can help you if you have specific questions or need help in performing specific task, simply post your questions here or you can find my on skype with id="bghaly""Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
Bishoy,
thanks for your note.
Here is my code .... everything is working fine but no event is fired:
First a little form:
Public Class Form2
Private WithEvents TAPI As Klassendesign.itsTAPI
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myTAPI As New Klassendesign.itsTAPI
TAPI = myTAPI
End Sub
Private Sub TAPI_tapiEvent(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) Handles TAPI.tapiEvent
Stop
End Sub
End Class
And then my class
Imports TAPI3Lib
Namespace Klassendesign
Public Class itsTAPI
Private Const MediaAudio As Integer = 8
Private Const MediaModem As Integer = 16
Private Const MediaFax As Integer = 32
Private Const MediaVideo As Integer = 32768
Private WithEvents oTAPI As TAPI3Lib.TAPI ' will hold our TAPI object
Private oAddress As ITAddress ' will hold our selected address (you can hold many address in an array)
Private RegCookie As Integer
Private Const TAPI3_ALL_TAPI_EVENTS = _
TAPI_EVENT.TE_ACDGROUP Or _
TAPI_EVENT.TE_ADDRESS Or _
TAPI_EVENT.TE_AGENT Or _
TAPI_EVENT.TE_AGENTHANDLER Or _
TAPI_EVENT.TE_AGENTSESSION Or _
TAPI_EVENT.TE_CALLHUB Or _
TAPI_EVENT.TE_CALLINFOCHANGE Or _
TAPI_EVENT.TE_CALLMEDIA Or _
TAPI_EVENT.TE_CALLNOTIFICATION Or _
TAPI_EVENT.TE_CALLSTATE Or _
TAPI_EVENT.TE_DIGITEVENT Or _
TAPI_EVENT.TE_GENERATEEVENT Or _
TAPI_EVENT.TE_PRIVATE Or _
TAPI_EVENT.TE_QOSEVENT Or _
TAPI_EVENT.TE_QUEUE Or _
TAPI_EVENT.TE_REQUEST Or _
TAPI_EVENT.TE_TAPIOBJECT
Sub New()
Try
' creating a new instance to first initialize TAPI befor attaching the events
Dim m_TAPI As New TAPIClass
' a variable to hold supported media types for the address
Dim MediaTypes As Integer
' initializing TAPI
m_TAPI.Initialize()
' attaching event sink
oTAPI = m_TAPI
' getting red of the private instance as we have another global instance (oTAPI)
m_TAPI = Nothing
Dim AddressCollection As ITCollection = oTAPI.Addresses()
For Each Address As ITAddress In AddressCollection ' looping through address collection
'(following line just take my wanted tapi provider)
If Address.AddressName = "AVM TAPI Services for FRITZ!Box" Then
If Address.State = ADDRESS_STATE.AS_INSERVICE Then ' checking if address is working
Dim MediaSupport As ITMediaSupport = Address ' extracting meida support interface from the address
MediaTypes = MediaSupport.MediaTypes ' extracting media types supporting
MediaSupport = Nothing ' dispose of the object
'If (MediaTypes And MediaModem) = MediaModem Then
' the address is a data Modem
If (MediaTypes And MediaAudio) = MediaAudio Then
' Select the address since it supports Audio and is a FAX/Modem
oAddress = Address ' select this address
MsgBox("we have selected this address: " + oAddress.AddressName) ' show the selected address name
Exit For
' End If
End If
End If
End If
Next Address
If Not (oAddress Is Nothing) Then
' registering notifications for the selected address
RegCookie = oTAPI.RegisterCallNotifications(oAddress, True, False, MediaTypes, 1)
' Note: this registration can be done on as many adresses as you want
' we will not receive notifications unless we spacify which type of events we are interested in
oTAPI.EventFilter = TAPI3_ALL_TAPI_EVENTS
Else
MsgBox("no address selected")
End If
Catch ex As Exception
MsgBox("Error occured:" & vbCrLf & ex.Message, MsgBoxStyle.Critical, "VBCITY.VBTAPI")
End Try
' by now we are done for the initialization and registration and the events should fire
' Note: you must dispose of tapi befor you destroy the class and i will leave this for now
End Sub
Private Sub oTAPI_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) Handles oTAPI.Event
' making a thread to asynchronosly process the event
Dim thAsyncCall As System.Threading.Thread
RaiseEvent tapiEvent(TapiEvent, pEvent)
Select Case TapiEvent
Case TAPI_EVENT.TE_CALLNOTIFICATION 'Call Notification Arrived
' assigning our sub's delegate to the thread
thAsyncCall = New Threading.Thread(AddressOf CallNotificationEvent)
'passing the variable for the thread
CallNotificationObject = CType(pEvent, ITCallNotificationEvent)
' starting the thread
thAsyncCall.Start()
Case TAPI_EVENT.TE_CALLSTATE 'Call State Changes
' assigning our sub's delegate to the thread
thAsyncCall = New Threading.Thread(AddressOf CallStateEvent)
'passing the variable for the thread
CallStateObject = CType(pEvent, ITCallStateEvent)
' starting the thread
thAsyncCall.Start()
Case TAPI_EVENT.TE_CALLINFOCHANGE 'Call Info Changes
' assigning our sub's delegate to the thread
thAsyncCall = New Threading.Thread(AddressOf CallInfoEvent)
'passing the variable for the thread
CallInfoObject = CType(pEvent, ITCallInfoChangeEvent)
' starting the thread
thAsyncCall.Start()
End Select
End Sub
Private CallNotificationObject As ITCallNotificationEvent
Private Sub CallNotificationEvent()
' here we should check to see various notifications of new and ended calls
Select Case CallNotificationObject.Event
Case CALL_NOTIFICATION_EVENT.CNE_MONITOR
' the notification is for a monitored call
Case CALL_NOTIFICATION_EVENT.CNE_OWNER
' the notification is for an owned call
End Select
End Sub
Private CallStateObject As ITCallStateEvent
Private Sub CallStateEvent()
' here we should check to see call state and handle connects and disconnects
Select Case CallStateObject.State
Case CALL_STATE.CS_IDLE
Case CALL_STATE.CS_INPROGRESS
Case CALL_STATE.CS_OFFERING
' a call is offering so if you dont want it then pass it
' the code to pass the call is the following
'Dim CallControl As ITBasicCallControl = CallStateObject.Call
'CallControl.HandoffIndirect (CallStateObject.Call.CallInfoLong(CALLINFO_LONG.CIL_MEDIATYPESAVAILABLE)
Case CALL_STATE.CS_CONNECTED
' call is connected
Case CALL_STATE.CS_QUEUED
' call is beeing queued
Case CALL_STATE.CS_HOLD
' call is on hold
Case CALL_STATE.CS_DISCONNECTED
' call is disconnected
End Select
End Sub
Private CallInfoObject As ITCallInfoChangeEvent
Private Sub CallInfoEvent()
' here you can extract information from the call
'the code to extract the caller ID
' >>> put the following code in a try block and swallow the exception if it gives errors
Dim CallerID As String
CallerID = CallInfoObject.Call.CallInfoString(CALLINFO_STRING.CIS_CALLERIDNAME)
End Sub
Public Event tapiEvent(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object)
End Class
End Namespace
|
|
|
|
|
Hi
I need your guidance to implement this using VB.NET. Appreciate your time, I will add your ID in my skype and send the details. Thanks a lot. OppsVen
|
|
|
|
|
I have this code and I am able to initiate or tigger a call in the built in dialer.exe of windows xp. To initiate a call Im using the IP address of my PC and H323 line as address. I just would like to modify this code (Im developing using web application in vb.net) to be able to retrieve the status of the call if disconnected, in progress, answered, etc and display it in a label. Im new in tapi coding and having a hard time understanding how it works. Really need help. thanks.
Imports TAPI3Lib
Partial Public Class _Default
Inherits System.Web.UI.Page
Private WithEvents oTAPI As TAPI3Lib.TAPI
Private ia As ITAddress() = New TAPI3Lib.ITAddress(9) {}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim m_TAPI As New TAPIClass
m_TAPI.Initialize()
oTAPI = m_TAPI
m_TAPI = Nothing
Dim AddressCollection As ITCollection = oTAPI.Addresses()
DropDownList1.Items.Add("Select Option")
For i = 1 To AddressCollection.Count
Dim ln As ITAddress
ln = AddressCollection.Item(i)
ia(i) = ln
DropDownList1.Items.Add(ln.AddressName)
Next
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim ln As TAPI3Lib.ITAddress = Nothing
Dim bcc As ITBasicCallControl
ln = ia(DropDownList1.SelectedIndex)
Try
bcc = ln.CreateCall(TextBox1.Text, TapiConstants.LINEADDRESSTYPE_IPADDRESS, TapiConstants.TAPIMEDIATYPE_AUDIO)
bcc.Connect(False)
' not quite sure what to do with this placed comments
'oTAPI.EventFilter = (TAPI_EVENT.TE_CALLNOTIFICATION Or TAPI_EVENT.TE_CALLSTATE Or TAPI_EVENT.TE_CALLINFOCHANGE)
'Label1.Text = oTAPI.EventFilter
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
End Class
|
|
|
|
|
|
Hi Bishoy,
I am working mobile application, which will block call. I have code to block outgoing call but it is having one ring delay.
can we write code to block outgoing call without any notification and one ring delay.
Thanks in advance.
I am prashant working with Aurasoft Technologies solution Pvt. Ltd.
Prashant.
|
|
|
|