Tapi

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 ?
we47126Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
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
we47126Author Commented:
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
we47126Author Commented:
Edited text of question
0
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

we47126Author Commented:
Adjusted points to 80
0
edtmihuCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
we47126Author Commented:
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
edtmihuCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.