Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / January 2005

Tip: Looking for answers? Try searching our database.

problem with ITCallInfo.CallState when dialing to a phone.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nadav - 26 Jan 2005 09:47 GMT
Hi Everybody,
I've started to learn TAPI and I'm trying to dial to a phone
(eventually I wan't to send a voice message to a phone, but right now I
can't even dial properly).
I'm using C# & visual studio 2003,and I imported the TAPI3 com object
(TAPI3Lib) into my project.

This is the code I use to dial:

namespace test_TAPI3
{
    public class dummy
    {
        public dummy()
        {
        }

        TAPI3Lib.TAPI tapi=null;
        //string reqID=null;

        public void dial(string num) {
            try {
                tapi=new TAPI3Lib.TAPIClass();
                tapi.Initialize();
                object x=tapi.Addresses;
                TAPI3Lib.ITCollection col=tapi.Addresses as TAPI3Lib.ITCollection;

                TAPI3Lib.ITAddress _addr=null;
                foreach(TAPI3Lib.ITAddress addr in col) {
                    //MessageBox.Show(addr.AddressName);
                    if (addr.AddressName.IndexOf("ESS")!=-1) {
                        _addr=addr;
                        break;
                    }
                }

                tapi.Event+=new
TAPI3Lib.ITTAPIDispatchEventNotification_EventEventHandler(eventH);
                tapi.EventFilter=(int)TAPI3Lib.TAPI_EVENT.TE_CALLSTATE;

                TAPI3Lib.ITBasicCallControl call=
_addr.CreateCall(num,TAPI3Lib.TapiConstants.LINEADDRESSTYPE_PHONENUMBER,TAPI3Lib.TapiConstants.TAPIMEDIATYPE_AUDIO);

                call.Connect(false);

                while (true) {
                    Application.DoEvents();
                    TAPI3Lib.ITCallInfo cinfo=call as TAPI3Lib.ITCallInfo ;
                    if (cinfo!=null) {
                        if (cinfo.CallState==TAPI3Lib.CALL_STATE.CS_DISCONNECTED) {
                            break;
                        }
                    }
                    System.Threading.Thread.Sleep(10);
                }
                if (call!=null) {
                    call.Disconnect(TAPI3Lib.DISCONNECT_CODE.DC_NORMAL);
                }

            } catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            } finally {
                if (tapi!=null) {
                    tapi.Shutdown();
                    tapi=null;
                }
            }
        }

        public void eventH( TAPI3Lib.TAPI_EVENT ev, object o) {
            TAPI3Lib.ITCallStateEvent e=o as TAPI3Lib.ITCallStateEvent;
            if (e!=null) {
                MessageBox.Show(string.Format("{0}:{1}:{2}",ev,e.State,e.Cause));
            }
        }

    }
}

What happens is that the program DOES dial the phone.
However, there is something strange with the CallState property of the call
object.
When I call the phone I get event with:
    e.State=CS_INPROGRESS
(and the phone start ringing)
And then, BEFORE I pick up the phone I get another event with:
    e.State=CS_CONNECTED
When I answer the phone and put down the handset, I don't get any event
and the call CallState stays CS_CONNECTED.
What I'm I doing wrong?

Thanks
Nadav
Andreas Marschall [MVP TAPI] - 26 Jan 2005 14:49 GMT
> I've started to learn TAPI and I'm trying to dial to a phone
> (eventually I wan't to send a voice message to a phone, but right now I
[quoted text clipped - 13 lines]
> and the call CallState stays CS_CONNECTED.
> What I'm I doing wrong?

Nadav,
I presume you are using a voice modem with UniModem.TSP?

There is a limitation for voice modems: their hardware doesn't have proper
call progression detection capabilities in vocie mode, i.e. they simply don't
detect when the outgoing call has been answered, so UniModem.TSP is generating
a _CONNECTED blindly after the dialling is complete.

Signature

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.

Nadav - 27 Jan 2005 06:15 GMT
> Nadav,
> I presume you are using a voice modem with UniModem.TSP?
Yes,  the address.ServiceProviderName="unimdm.tsp".

> There is a limitation for voice modems: their hardware doesn't have proper
> call progression detection capabilities in vocie mode, i.e. they simply don't
> detect when the outgoing call has been answered, so UniModem.TSP is generating
> a _CONNECTED blindly after the dialling is complete.
Then how do you use this kind of modem?
I mean, if you can't detect if you got answered or disconnected before you
finished sending the message I can't see what you can do with it.

I checked a TAPI toolkit called CT Messanger that allows you to send a voice
message to a phone and i does seem to recogonize when the phone is answered,
it does not start playing the message under you answer the phone.

Thanks Nadav
Nadav
Andreas Marschall [MVP TAPI] - 27 Jan 2005 08:40 GMT
> > I presume you are using a voice modem with UniModem.TSP?
> Yes,  the address.ServiceProviderName="unimdm.tsp".
[quoted text clipped - 4 lines]
> > a _CONNECTED blindly after the dialling is complete.
> Then how do you use this kind of modem?

Nadav,
I haven't recommended to use voice modems.
You may want to look for advanced telephony hardware with better call
progression detection.

> I mean, if you can't detect if you got answered or disconnected before you
> finished sending the message I can't see what you can do with it.

What is this new "disconnected" issue about?
Who says that there is no disconnect detection?
Disconnect is signalled by the CO (e.g. fast busy tone, voltage/curreent drop
etc.).

> I checked a TAPI toolkit called CT Messanger that allows you to send a voice
> message to a phone and i does seem to recogonize when the phone is answered,
> it does not start playing the message under you answer the phone.

Please provide a link for reference.
Maybe this toolkit does additional media stream analysis to detect whether the
call has been actually answered.

Here is another approach with voice modems:
- after _CONNECTED start playing a wave file _repeatedly_ saying something
like "press '1' to continiue"
- monitor DTMF digits to detect the '1' if pressed
- if you detected the '1' then you know that a human answered the call (but
this of course only a sufficient condition not a necessary one).

Signature

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.

Nadav - 27 Jan 2005 09:11 GMT
> Nadav,
> I haven't recommended to use voice modems.
> You may want to look for advanced telephony hardware with better call
> progression detection.
I'm afraid that's not an option. This application will be installed on the
client(s) computer
and the client will NOT pay for advanced telephony hardware (which I assume
is a lot more expensive than a voice modem).

> What is this new "disconnected" issue about?
> Who says that there is no disconnect detection?
> Disconnect is signalled by the CO (e.g. fast busy tone, voltage/curreent drop
> etc.).
The code that I included in my first message does NOT detect when I answer
the phone
and it does NOT detect when I put down the phone handset.
It just stays in CS_CONNECTED state.

Nadav
Andreas Marschall [MVP TAPI] - 27 Jan 2005 10:14 GMT
> > You may want to look for advanced telephony hardware with better call
> > progression detection.
> I'm afraid that's not an option. This application will be installed on the
> client(s) computer
> and the client will NOT pay for advanced telephony hardware (which I assume
> is a lot more expensive than a voice modem).

Yes they are (much) more expensive than voice modems, but also more capable...

> > What is this new "disconnected" issue about?
> > Who says that there is no disconnect detection?
[quoted text clipped - 4 lines]
> and it does NOT detect when I put down the phone handset.
> It just stays in CS_CONNECTED state.

Sure it does not! I haven't said that it does, have I?

You seem to have ignored my questions about your "disconnected" issue and the
reference link, and my statement about media stream analysis and the other
approach with voice modems?!

Signature

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.

Nadav - 28 Jan 2005 05:29 GMT
Hi Andreas,

> You seem to have ignored my questions about your "disconnected" issue and the
> reference link, and my statement about media stream analysis and the other
> approach with voice modems?!
It looks like our company will use the CT Messanger toolkit (
http://www.mintcomponents.com/products_ctm.htm) so the voice modem problems
it don't matter.
I just find it irritating that such basic functionality does not work!
Rhett Gong [MSFT] - 27 Jan 2005 10:21 GMT
Hi Nadav,
As Andreas pointed out,  there are some limitations. The primary one is the
fact that Unimodem thinks of almost all voice modems as uni-directional and
*not* bi-directional. This means that you can only play or record, but not
both. This is because many modems really are only uni-directional and
Microsoft is not testing modems for bi-directional capability. There are
just
too many modems. We leave this up to the modem manufacturer to do. So the
default settings for most modems is to be unidirectional unless the modem
manufacturer turns on bi-directional support in the modem.INF file. But
AFAIK, very few manufacturers have actually done this.

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
-mhd - 27 Jan 2005 15:26 GMT
>I checked a TAPI toolkit called CT Messanger that allows you to send a voice
>message to a phone and i does seem to recogonize when the phone is answered,
>it does not start playing the message under you answer the phone.

It contains code that makes up for Unimodem shortcomings so TAPI is
not being for call progress detection.

-mhd

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.