Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ITBasicCallControl

267 views
Skip to first unread message

Hem

unread,
Aug 2, 2005, 5:50:38 AM8/2/05
to
Hi,

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.

Andreas Marschall [MVP TAPI]

unread,
Aug 2, 2005, 5:59:43 AM8/2/05
to
"Hem" <hamel...@gmail.com> schrieb im Newsbeitrag
news:1122976238.7...@g49g2000cwa.googlegroups.com...

> I'm attempting to answer a call.
>
> The information on MSDN suggests that I should be able to cast
> ITCallInfo into ITBasicCallControl.
>
> 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.

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.

Hem

unread,
Aug 2, 2005, 6:23:11 AM8/2/05
to
Andreas,

Yes, I have set fOwner to true, and also fMonitor to true. The invalid
cast exception is still occurring?

Andreas Marschall [MVP TAPI]

unread,
Aug 2, 2005, 6:48:35 AM8/2/05
to
"Hem" <hamel...@gmail.com> schrieb im Newsbeitrag
news:1122978191....@g47g2000cwa.googlegroups.com...

> 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

Hem

unread,
Aug 2, 2005, 7:33:36 AM8/2/05
to
Andreas,

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?

Matthias Moetje

unread,
Aug 2, 2005, 7:41:03 AM8/2/05
to
Hem,

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...

Andreas Marschall [MVP TAPI]

unread,
Aug 2, 2005, 8:16:10 AM8/2/05
to
"Hem" <hamel...@gmail.com> schrieb im Newsbeitrag
news:1122982416.0...@g44g2000cwa.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.

Hem

unread,
Aug 2, 2005, 9:08:48 AM8/2/05
to
Andreas,

ITBasicCallControl is not listed. The list contains the following:

ITCallInfo
ITCallInfo2
ITLegacyCallMediaControl
ITLegacyCallMediaControl2
IUnknown

Andreas Marschall [MVP TAPI]

unread,
Aug 2, 2005, 9:43:55 AM8/2/05
to
"Hem" <hamel...@gmail.com> schrieb im Newsbeitrag
news:1122988128.5...@g14g2000cwa.googlegroups.com...

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?

Hem

unread,
Aug 2, 2005, 10:31:55 AM8/2/05
to
Andreas,

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.

Hem

unread,
Aug 2, 2005, 11:04:02 AM8/2/05
to
Andrea,

I've just used the etDialAnswer application by www.exceletel, and this
works fine. It has complete control of the incoming call.

Andreas Marschall [MVP TAPI]

unread,
Aug 2, 2005, 11:25:50 AM8/2/05
to
"Hem" <hamel...@gmail.com> schrieb im Newsbeitrag
news:1122993115....@g47g2000cwa.googlegroups.com...

> 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.

Hem,
did you lineOpen with dwPrivs = _MONITOR | _OWNER ?
You may want to try to lineSetCallPrivilege(_OWNER).

Hem

unread,
Aug 2, 2005, 12:06:50 PM8/2/05
to
Andreas,

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.

Andreas Marschall [MVP TAPI]

unread,
Aug 2, 2005, 12:36:12 PM8/2/05
to
"Hem" <hamel...@gmail.com> wrote in message
news:1122998810.8...@g49g2000cwa.googlegroups.com...

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 ?

--

Hem

unread,
Aug 2, 2005, 1:25:01 PM8/2/05
to
Andreas,

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

unread,
Aug 2, 2005, 1:24:46 PM8/2/05
to

Andreas Marschall [MVP TAPI]

unread,
Aug 2, 2005, 1:53:37 PM8/2/05
to
"Hem" <hamel...@gmail.com> schrieb im Newsbeitrag
news:1123003501.1...@g44g2000cwa.googlegroups.com...

> 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.

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

Matthias Moetje

unread,
Aug 2, 2005, 3:15:14 PM8/2/05
to
Hem,

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...

samarkhan

unread,
Aug 6, 2008, 11:43:01 PM8/6/08
to
i m also facing the same problem.if you have find the soloution then kindly
inform me
thanks.

url:http://www.ureader.com/msg/1481567.aspx

0 new messages