I'm attempting to answer a call.
The information on MSDN suggests that I should be able to cast
ITCallInfo into ITBasicCallControl.
==================
public void AnswerCall()
{
TAPI3Lib.IEnumCall calls =
(TAPI3Lib.IEnumCall)this.tapiAddress.EnumerateCalls();
try
{
uint arg = 0;
TAPI3Lib.ITCallInfo callInfo;
calls.Next(1, out callInfo, ref arg);
TAPI3Lib.ITBasicCallControl call =
(TAPI3Lib.ITBasicCallControl)callInfo;
call.Answer();
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
}
==================
This code results in an error saying that the specified cast is
invalid. Can anyone please help? I've also tried to do the same thing
when receiving call notification, but the same error occurs.
Thanks.
Hem,
did you ::RegisterCallNotifications() with fOwner = VARIANT_TRUE ?
You must be owner of the call to be able to answer it.
--
Best Regards
Andreas Marschall
Microsoft MVP for TAPI / Windows SDK
TAPI / TSP Developer and Tester
http://www.I-B-A-M.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm
* Please post all messages and replies to the newsgroup so all may
* benefit from the discussion. Private mail is usually not replied to.
* This posting is provided "AS IS" with no warranties, and confers no rights.
Yes, I have set fOwner to true, and also fMonitor to true. The invalid
cast exception is still occurring?
Hem,
you may want to explicitely QueryInterface for ITBasicCallControll.
Does answering the call work with TAPI Browser TB3x ?
Please post a TB3x.log.
See my TAPI and TSPI FAQ:
Q: Where can I download TAPI Browser ?
http://www.i-b-a-m.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm#_Q:_Where_can
Q: Is there a user guide available for TAPI Browser TB3x ?
http://www.i-b-a-m.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm#_Q:_Is_there_2
Using the TAPI Browser, I am able to receive the call event
notification and retrieve ITCallInfo.
>From this point, how do I access the ITBasicCallControll and answer the
call?
this problem has been reported before with .NET.
Regarding TAPI and .NET see KB article
"841712 - Telephony Application Programming Interface
(TAPI) functionality is not supported from managed code".
http://support.microsoft.com/?id=841712
Best regards,
Matthias Moetje
-------------------------------------
TERASENS GmbH
Ackermannstraße 3
80797 München
-------------------------------------
Fon: +49 89 143370-0
Fax: +49 89 143370-22
e-mail: moetje at terasens dot de
www: www.terasens.de
-------------------------------------
"Hem" <hamel...@gmail.com> wrote in message
news:1122978191....@g47g2000cwa.googlegroups.com...
Hem,
right click on the ITCallInfo_x object in the middle pane and select
QueryInterface from the context menu.
Then select ITBasicCallControll and press OK.
ITBasicCallControl is not listed. The list contains the following:
ITCallInfo
ITCallInfo2
ITLegacyCallMediaControl
ITLegacyCallMediaControl2
IUnknown
Hem,
this clearly indicates that this app has _no_ owner privs on that call
(regardless whether you requested it at ::RegisterCallNotifications).
You can check this with ITCallInfo::get_Privilege().
This is the case when another app has requested owner privs before.
Is there any other TAPI app running?
You may want to check with TB20:
- lineInitializeEx()
- lineOpen()
- lineGetLineDevStatus()
- returned is a LINEDEVSTATUS struct followed by an APPINFO array
- how many APPINFO[] enries do you get ?
- what ModuleFilename / FriendlyName do they have ?
- it should be at least: TB20.EXE / Tapi Browser and TB3x.EXE / TAPI3 (if
registered for call notifications at that time)
Please post the TB20.log.
Btw. what device / TSP are you using?
You're right. I've checked priveleges and the only thing I get back is
monitor.
No other application is running that is using the TSP.
The TSP is a 1st Party extension of Panasonic's 3rd party TSP for KXTDA
PBX range.
I've checked the specs of the TSP and call control (answer) is indeed
supported.
I've also followed your recommendation and checked it with the TAPI 2
Browser. This only shows the TAPI 2 Browser connected to the TSP. I've
checked the priveleges here as well, and once again, only monitor
priveleges are registered.
I'm about to test some third party apps that connect to the TSP, to see
whether they can correctly handle call control.
I've just used the etDialAnswer application by www.exceletel, and this
works fine. It has complete control of the incoming call.
Hem,
did you lineOpen with dwPrivs = _MONITOR | _OWNER ?
You may want to try to lineSetCallPrivilege(_OWNER).
The third party TAPI client proves that I'm doing something wrong.
It's strange that eventhough requesting owner privileges, only monitor
privileges are applied. Would I be doing something wrong here?
this.callNotificationToken =
this.tapiObject.RegisterCallNotifications(this.tapiAddress, true,
true, TapiConstants.TAPIMEDIATYPE_AUDIO, 0);
I shall keep on investigating. Thank you for your input.
Hem, you are welcome.
You want to provide a lCallbackInstance other than 0.
From MSDN about this Parameter:
[in] Callback instance to be used by the TAPI 3 DLL. Can be the gulAdvise
value returned by IConnectionPoint::Advise during registration of the
ITTAPIEventNotification outgoing interface.
Btw. what about my question regarding your TB20 test:
> > did you lineOpen with dwPrivs = _MONITOR | _OWNER ?
--
The reason why I was placing a 0 for the callbackinstance is because I
am developing in C#. Hence, I believe that event information is handled
by the implementation of the ITTAPIEventNotification interface, and
assigning a delegate.
I have read the KB article regarding no tapi3 support using managed
code because of the way garbage collection is handled, so I will
attempt to create a TAPI client in Delphi.
I will at the same time use the TAPI 2 Browser to quickly test your
suggestion.
Thank you once again. I hope to try the above first thing in the
morning.
Hem,
You may want to take a look at Helen Warn's C# wrapper for TAPI2.
See my TAPI and TSPI FAQ:
Q: Are there any .NET wrappers for TAPI2 available ?
http://www.i-b-a-m.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm#_Q:_Are_there_4
I looked at our code, it uses
Counter + 1
as the callback instance value. Counter starts from 0,
so the + 1 was probably added because it fails with 0.
Just replace the 0 with 1. As long as you don't implement
the event notification mechanism in C# this should not
create any problems, because one of the problems in .NET
is as follows:
- in the TAPI3 event handler objects are provided by
TAPI3 to the client application.
- These objects are expected to exist only during the
event procedure. Applications should not call ::AddRef on
these objects. (see TAPI3 documentation)
- Though the .NET interop or runtime _does_ call ::AddRef
and it even doesn't call ::Release due to delayed garbage
collection
This can cause lockup problems and results in calls not being
deallocated
Best regards,
Matthias Moetje
-------------------------------------
TERASENS GmbH
Ackermannstraße 3
80797 München
-------------------------------------
Fon: +49 89 143370-0
Fax: +49 89 143370-22
e-mail: moetje at terasens dot de
www: www.terasens.de
-------------------------------------
"Hem" <hamel...@gmail.com> wrote in message
news:1123003501.1...@g44g2000cwa.googlegroups.com...