Solved

Tapi

Posted on 1997-04-21
7
473 Views
Last Modified: 2006-11-17
I'm building a Tapi application.  
When a call comes in, tapi sends a message to the application (a line_callState message). How do i know when tapi sent such a message ? Is there a procedure started at that time ?
0
Comment
Question by:we47126
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1162870
You can download an example code from Microsoft web site:
http://www.microsoft.com/WIN32DEV/NETWRK/CTA2669B.ZIP
The example creates the CTapiConnection class. It provides an easy way to initialize TAPI, connect, and make a voice-based telephone call.

0
 

Author Comment

by:we47126
ID: 1162871
First of all I should have mentioned that I'm using Borland c++ 5 and not visual C (the example was for visual c)
Second, is is an example to make a call.  I still don't know haw to receive a call or recognise the button the caller pressed.

0
 

Author Comment

by:we47126
ID: 1162872
Edited text of question
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:we47126
ID: 1162873
Adjusted points to 80
0
 
LVL 1

Accepted Solution

by:
edtmihu earned 80 total points
ID: 1162874
look at the function lineInitialize(...)
One of the params is a callback-function, where Tapi
sends you notofications.
You also need to call lineOpen(..) in order to get any events of incoming calls.

0
 

Author Comment

by:we47126
ID: 1162875
Why isn't mthis working :
...
lReturn = lineInitialize(&hLineApp, hInstance, lineCallbackFunc,
      szAppName, &dwNumDevs)
...
lReturn = lineOpen(hLineApp, 0,&hLine, dwApiVersion, 0,0,LINECALLPRIVILEGE_MONITOR,0,0);
...
void CALLBACK lineCallbackFunc(
    DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance,
    DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
{
      cout << "A message is received !";
... }

And how can I make my program wait for a call ? If it does nothing it just closes !
0
 
LVL 1

Expert Comment

by:edtmihu
ID: 1162876
This is how I do it.
Works with BC4.53 and BC5.01.

bool TTapi::Start( LPCSTR appName )
{
.
. Declare variables
.
      if ( ( _lpfnLineCallback = (LINECALLBACK) MakeProcInstance( (FARPROC) lineCallbackFunc, hInst() ) ) == NULL )
            {
            return( false );
            }
      lRet = lineInitialize( &_hLineApp, hInst(), _lpfnLineCallback, appName, _dwNumDevs );
      if ( lRet < 0 )
            {
            return( false );
            }
      lineRegisterRequestRecipient( hLineApp(), (DWORD)this, LINEREQUESTMODE_MAKECALL, true );
      // fill lineCapsList with LineCaps object
      for ( dwDeviceId = 0; dwDeviceId < _dwNumDevs; dwDeviceId++ )
            {
            TRACE("LineDevice = " << dwDeviceId );
            LONG lRet;
            HLINE hLine;
            DWORD dwEXTVersion = 0;
            LINEEXTENSIONID extensionID;
            bool mdExt, claraExt, maryExt;
            TRACE("lineNegotiateAPIVersion");
            lRet = lineNegotiateAPIVersion( _hLineApp, dwDeviceId, SupportAPILowVersion(), SupportAPIHighVersion(), _dwAPIVersion, &extensionID );
            if ( lRet < 0 )
                  {
                  return( false );
                  }
            mdExt                  = isMD110Ext(      extensionID );
            claraExt      = isClaraExt(      extensionID );
            maryExt            = isMaryExt(      extensionID );
            if ( mdExt || claraExt || maryExt )
                  {
                  lRet = lineNegotiateExtVersion( _hLineApp, dwDeviceId, _dwAPIVersion, SupportExtLowVersion(), SupportExtHighVersion(), &dwEXTVersion );
                  if ( lRet < 0 )
                        {
                        dwEXTVersion = 0;
                        return( false );
                        }
                  }
            else
                  {
                  dwEXTVersion = 0;
                  }
            if ( mdExt || claraExt )
                  {
                  lRet = lineOpen( _hLineApp, dwDeviceId, (LPHLINE) &hLine, _dwAPIVersion, dwEXTVersion, (DWORD) this, LINECALLPRIVILEGE_MONITOR | LINECALLPRIVILEGE_OWNER, LINEMEDIAMODE_INTERACTIVEVOICE, 0 );
                  }
            else
                  {
                  lRet = lineOpen( _hLineApp, dwDeviceId, (LPHLINE) &hLine, _dwAPIVersion, 0, (DWORD) this, LINECALLPRIVILEGE_MONITOR | LINECALLPRIVILEGE_OWNER, LINEMEDIAMODE_INTERACTIVEVOICE, 0 );
                  if ( lRet < 0 )
                        {
                        TRACE("First lineOpen failed with error = " << lRet );
                        // Unimodem can not open line with owner priviliege
                        lRet = lineOpen( _hLineApp, dwDeviceId, (LPHLINE) &hLine, _dwAPIVersion, 0, (DWORD) this, LINECALLPRIVILEGE_MONITOR, LINEMEDIAMODE_INTERACTIVEVOICE, 0 );
                        }
                  if ( lRet < 0 )
                        {
                        TRACE( "Second lineOpen failed with error = " << lRet );
                        continue;                        // just skip this line device, it's not voice
                        }
                  }
            if ( lRet < 0 )
                  {
                  return( false );
                  }
            // fill lineList with LineDev object
            LineDevice::LineTypeEnum lineType = mdExt ? LineDevice::ltMD110 : claraExt ? LineDevice::ltClaraBGS : maryExt ? LineDevice::ltMary :LineDevice::ltUnknown;
            LineDevice * pLineDevice;
            if ( lineType == LineDevice::ltMary )
                  {
                  pLineDevice = new LineDeviceMary( hLine, dwDeviceId, _dwAPIVersion, dwEXTVersion, extensionID, lineType );
                  }
            pLineDevice = new LineDevice( hLine, dwDeviceId, _dwAPIVersion, dwEXTVersion, extensionID, lineType );
            // get line device capabilities
            LineCaps lineCaps( _hLineApp, pLineDevice );
            lineCaps.capability();
            if ( mdExt || claraExt )
                  {
                  SwitchInfo( lineCaps.switchInfo() );
                  getMsgDivTextStrings( lineCaps );
                  }
            pLineDevice->SetLineName( lineCaps.lineName() );
            pLineDevice->SetPPId( lineCaps.PPId() );
            lineList().AddAtTail( pLineDevice );
            if ( pLineDevice->GetLineType() == LineDevice::ltMD110 )
                  {
                  LineDevice::SetMD110Line( pLineDevice );
                  StrStream str;
                  IniFile ini( IniFileTelephone );
                  DWORD dw = lineCaps.PPId() >> 16;
                  str << "Provider" << dw << ends;
                  setDefaultTimeout( ini.read( str.str(), EntryTimeoutASYNC, (unsigned int) 5000 ) );
                  }
            if ( pLineDevice->GetLineType() == LineDevice::ltClaraBGS )
                  {
                  LineDevice::SetClaraLine( pLineDevice );
                  }
            TRACE("Before if ( !FillAddresses( pLineDevice, &lineCaps ) )");
            if ( !FillAddresses( pLineDevice, &lineCaps ) )
                  {
                  return( false );
                  }
            lineSetStatusMessages(      hLine,
                                                                                    LINEDEVSTATE_OTHER |
                                                                                    LINEDEVSTATE_RINGING |
                                                                                    LINEDEVSTATE_CONNECTED |
                                                                                    LINEDEVSTATE_DISCONNECTED |
                                                                                    LINEDEVSTATE_MSGWAITON |
                                                                                    LINEDEVSTATE_MSGWAITOFF |
                                                                                    LINEDEVSTATE_INSERVICE |
                                                                                    LINEDEVSTATE_OUTOFSERVICE |
                                                                                    LINEDEVSTATE_MAINTENANCE |
                                                                                    LINEDEVSTATE_OPEN |
                                                                                    LINEDEVSTATE_CLOSE |
                                                                                    LINEDEVSTATE_NUMCALLS |
                                                                                    LINEDEVSTATE_NUMCOMPLETIONS |
                                                                                    LINEDEVSTATE_TERMINALS |
                                                                                    LINEDEVSTATE_ROAMMODE |
                                                                                    LINEDEVSTATE_BATTERY |
                                                                                    LINEDEVSTATE_SIGNAL |
                                                                                    LINEDEVSTATE_DEVSPECIFIC |
                                                                                    LINEDEVSTATE_REINIT |
                                                                                    LINEDEVSTATE_LOCK,
                                                                                    LINEADDRESSSTATE_OTHER |
                                                                                    LINEADDRESSSTATE_DEVSPECIFIC |
                                                                                    LINEADDRESSSTATE_INUSEZERO |
                                                                                    LINEADDRESSSTATE_INUSEONE |
                                                                                    LINEADDRESSSTATE_INUSEMANY |
                                                                                    LINEADDRESSSTATE_NUMCALLS |
                                                                                    LINEADDRESSSTATE_FORWARD |
                                                                                    LINEADDRESSSTATE_TERMINALS );
            checkLineStatus( pLineDevice );
            }
      _killTimer = new KillOCTimer( this, 500 );
      return true;
}


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question