Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8746 lines
203 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. callint.cpp
  5. Abstract:
  6. Implements all the methods on call interfaces.
  7. Author:
  8. mquinton - 9/4/98
  9. Notes:
  10. Revision History:
  11. --*/
  12. #include "stdafx.h"
  13. HRESULT mapTAPIErrorCode(long lErrorCode);
  14. HRESULT
  15. MakeBufferFromVariant(
  16. VARIANT var,
  17. DWORD * pdwSize,
  18. BYTE ** ppBuffer
  19. );
  20. HRESULT
  21. FillVariantFromBuffer(
  22. DWORD dw,
  23. BYTE * pBuffer,
  24. VARIANT * pVar
  25. );
  26. ///////////////////////////////////////////////////////////////////////////////
  27. //
  28. // BSTRFromUnalingedData
  29. //
  30. // this is a helper function that takes unalinged data and returns a BSTR
  31. // allocated around it
  32. //
  33. BSTR BSTRFromUnalingedData( IN BYTE *pbUnalignedData,
  34. IN DWORD dwDataSize)
  35. {
  36. LOG((TL_TRACE, "BSTRFromUnalingedData - enter"));
  37. BSTR bstrResult = NULL;
  38. #ifdef _WIN64
  39. //
  40. // allocate aligned memory big enough to fit our string data
  41. //
  42. DWORD dwOleCharArraySize = ( (dwDataSize) / ( sizeof(OLECHAR) / sizeof(BYTE) ) ) + 1;
  43. LOG((TL_TRACE,
  44. "BSTRFromUnalingedData - allocating aligned memory of size[%ld]", dwOleCharArraySize));
  45. OLECHAR *pbAlignedData = new OLECHAR[dwOleCharArraySize];
  46. if (NULL == pbAlignedData)
  47. {
  48. LOG((TL_ERROR, "BSTRFromUnalingedData - failed to allocate aligned memory"));
  49. return NULL;
  50. }
  51. _ASSERTE( (dwOleCharArraySize/sizeof(OLECHAR) ) >= dwDataSize );
  52. //
  53. // copy data to the aligned memory
  54. //
  55. CopyMemory( (BYTE*)(pbAlignedData ),
  56. (BYTE*)pbUnalignedData,
  57. dwDataSize );
  58. //
  59. // allocate bstr from the aligned data
  60. //
  61. bstrResult = SysAllocString(pbAlignedData);
  62. //
  63. // no longer need the allocated buffer
  64. //
  65. delete pbAlignedData;
  66. pbAlignedData = NULL;
  67. #else
  68. bstrResult = SysAllocString((PWSTR)pbUnalignedData);
  69. #endif
  70. LOG((TL_TRACE, "BSTRFromUnalingedData - exit. bstrResult[%p]", bstrResult));
  71. return bstrResult;
  72. }
  73. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  74. //
  75. // Finish
  76. //
  77. // this method is used to finish a two step call operation
  78. // (conference or transfer)
  79. //
  80. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  81. HRESULT
  82. STDMETHODCALLTYPE
  83. CCall::Finish(
  84. FINISH_MODE finishMode
  85. )
  86. {
  87. HRESULT hr = S_OK;
  88. CCall * pConferenceControllerCall = NULL;
  89. HCALL hConfContCall;
  90. HCALL hRelatedCall;
  91. CCallHub * pRelatedCallHub = NULL;
  92. ITAddress * pAddress;
  93. CAddress * pCAddress;
  94. LOG((TL_TRACE, "Finish - enter"));
  95. //
  96. // are we a tranfer?
  97. //
  98. if (m_dwCallFlags & CALLFLAG_TRANSFCONSULT)
  99. {
  100. if( ( FM_ASCONFERENCE != finishMode ) && ( FM_ASTRANSFER != finishMode ) )
  101. {
  102. hr = E_INVALIDARG;
  103. LOG((TL_ERROR, "Wrong value passed for finish mode" ));
  104. }
  105. else
  106. {
  107. T3CALL t3ConfCall;
  108. //
  109. // get the related calls hCall
  110. //
  111. hRelatedCall = m_pRelatedCall->GetHCall();
  112. //
  113. // Finish a Transfer
  114. //
  115. Lock();
  116. hr = LineCompleteTransfer(
  117. hRelatedCall,
  118. m_t3Call.hCall,
  119. ( FM_ASCONFERENCE == finishMode )?&t3ConfCall:NULL,
  120. ( FM_ASCONFERENCE == finishMode )?
  121. LINETRANSFERMODE_CONFERENCE:LINETRANSFERMODE_TRANSFER
  122. );
  123. Unlock();
  124. if ( SUCCEEDED(hr) )
  125. {
  126. // wait for async reply
  127. hr = WaitForReply( hr );
  128. if ( SUCCEEDED(hr) )
  129. {
  130. Lock();
  131. // Reset Transfer - Consultation Flag
  132. m_dwCallFlags &= ~CALLFLAG_TRANSFCONSULT;
  133. Unlock();
  134. }
  135. else
  136. {
  137. LOG((TL_ERROR, "Finish - LineCompleteTransfer failed async" ));
  138. }
  139. }
  140. else // LineCompleteTransfer failed
  141. {
  142. LOG((TL_ERROR, "Finish - LineCompleteTransferr failed" ));
  143. }
  144. if( FM_ASCONFERENCE == finishMode )
  145. {
  146. //
  147. // Store the confcontroller in the callhub object
  148. //
  149. Lock();
  150. pRelatedCallHub = m_pRelatedCall->GetCallHub();
  151. m_pRelatedCall->get_Address( &pAddress );
  152. pCAddress = dynamic_cast<CAddress *>(pAddress);
  153. if(pRelatedCallHub != NULL)
  154. {
  155. pRelatedCallHub->CreateConferenceControllerCall(
  156. t3ConfCall.hCall,
  157. pCAddress
  158. );
  159. }
  160. else
  161. {
  162. LOG((TL_INFO, "CreateConference - No CallHub"));
  163. }
  164. Unlock();
  165. }
  166. // Finished with relatedCall
  167. ResetRelatedCall();
  168. }
  169. }
  170. //
  171. // are we a conference?
  172. //
  173. else if (m_dwCallFlags & CALLFLAG_CONFCONSULT)
  174. {
  175. if( FM_ASCONFERENCE != finishMode )
  176. {
  177. hr = E_INVALIDARG;
  178. LOG((TL_ERROR, "A conference can't be finished as a transfer" ));
  179. }
  180. else
  181. {
  182. // Finish a Conference
  183. //
  184. // get the related calls callhub
  185. //
  186. pRelatedCallHub = m_pRelatedCall->GetCallHub();
  187. if (pRelatedCallHub != NULL)
  188. {
  189. //
  190. // Get the conference controller handle from the callhub
  191. //
  192. pConferenceControllerCall = pRelatedCallHub->GetConferenceControllerCall();
  193. if (pConferenceControllerCall != NULL)
  194. {
  195. hConfContCall = pConferenceControllerCall->GetHCall();
  196. //
  197. // Finished with relatedCall
  198. //
  199. ResetRelatedCall();
  200. Lock();
  201. hr = LineAddToConference(
  202. hConfContCall,
  203. m_t3Call.hCall
  204. );
  205. Unlock();
  206. if ( SUCCEEDED(hr) )
  207. {
  208. // wait for async reply
  209. hr = WaitForReply( hr );
  210. if ( SUCCEEDED(hr) )
  211. {
  212. //
  213. // Reset Conference - Consultation Flag
  214. //
  215. Lock();
  216. m_dwCallFlags &= ~CALLFLAG_CONFCONSULT;
  217. Unlock();
  218. }
  219. else
  220. {
  221. LOG((TL_ERROR, "Finish - LineAddToConference failed async" ));
  222. }
  223. }
  224. else // LineAddToConference failed
  225. {
  226. LOG((TL_ERROR, "Finish - LineAddToConference failed" ));
  227. }
  228. }
  229. else // GetConferenceControllerCall failed
  230. {
  231. LOG((TL_ERROR, "Finish - GetConferenceControllerCall failed" ));
  232. }
  233. }
  234. else // GetCallHub failed
  235. {
  236. LOG((TL_ERROR, "Finish - GetCallHub failed" ));
  237. }
  238. }
  239. }
  240. else // Not flagged as transfer OR conference !!!!
  241. {
  242. LOG((TL_ERROR, "Finish - Not flagged as transfer OR conference"));
  243. hr = TAPI_E_INVALCALLSTATE;
  244. }
  245. LOG((TL_TRACE,hr, "Finish - exit"));
  246. return hr;
  247. }
  248. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  249. //
  250. // RemoveFromConference
  251. //
  252. // this method is called to remove this call from a conference
  253. //
  254. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  255. HRESULT
  256. STDMETHODCALLTYPE
  257. CCall::RemoveFromConference(void)
  258. {
  259. HRESULT hr = S_OK;
  260. LOG((TL_TRACE, "RemoveFromConference - enter"));
  261. Lock();
  262. hr = LineRemoveFromConference( m_t3Call.hCall );
  263. Unlock();
  264. if ( SUCCEEDED(hr) )
  265. {
  266. // wait for async reply
  267. hr = WaitForReply( hr );
  268. if ( SUCCEEDED(hr) )
  269. {
  270. // OK
  271. }
  272. else
  273. {
  274. LOG((TL_ERROR, "RemoveFromConference - LineRemoveFromConference failed async" ));
  275. }
  276. }
  277. else // LineAddToConference failed
  278. {
  279. LOG((TL_ERROR, "RemoveFromConference - LineRemoveFromConference failed" ));
  280. }
  281. LOG((TL_TRACE, hr, "RemoveFromConference - exit"));
  282. return hr;
  283. }
  284. // ITCallInfo methods
  285. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  286. //
  287. // get_Address
  288. //
  289. // retrieves the address object
  290. //
  291. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  292. HRESULT
  293. STDMETHODCALLTYPE
  294. CCall::get_Address(
  295. ITAddress ** ppAddress
  296. )
  297. {
  298. HRESULT hr = S_OK;
  299. LOG((TL_TRACE, "get_Address - enter"));
  300. LOG((TL_TRACE, " ppAddress ---> %p", ppAddress ));
  301. if ( TAPIIsBadWritePtr( ppAddress, sizeof( ITAddress * ) ) )
  302. {
  303. LOG((TL_ERROR, "get_Address - invalid pointer"));
  304. return E_POINTER;
  305. }
  306. //
  307. // gets correct interface
  308. // and addrefs
  309. //
  310. hr = m_pAddress->QueryInterface(
  311. IID_ITAddress,
  312. (void **)ppAddress
  313. );
  314. LOG((TL_TRACE, "get_Address - exit - return %lx", hr ));
  315. return hr;
  316. }
  317. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  318. //
  319. // get_CallState
  320. //
  321. // retrieves the current callstate
  322. //
  323. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  324. HRESULT
  325. STDMETHODCALLTYPE
  326. CCall::get_CallState(
  327. CALL_STATE * pCallState
  328. )
  329. {
  330. LOG((TL_TRACE, "get_CallState - enter"));
  331. LOG((TL_TRACE, " pCallState ---> %p", pCallState ));
  332. if ( TAPIIsBadWritePtr( pCallState, sizeof( CALL_STATE ) ) )
  333. {
  334. LOG((TL_ERROR, "get_CallState - invalid pointer"));
  335. return E_POINTER;
  336. }
  337. Lock();
  338. *pCallState = m_CallState;
  339. Unlock();
  340. LOG((TL_TRACE, "get_CallState - exit - return success" ));
  341. return S_OK;
  342. }
  343. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  344. //
  345. // get_Privilege
  346. //
  347. // get the privilege
  348. //
  349. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  350. HRESULT
  351. STDMETHODCALLTYPE
  352. CCall::get_Privilege(
  353. CALL_PRIVILEGE * pPrivilege
  354. )
  355. {
  356. LOG((TL_TRACE, "get_Privilege - enter"));
  357. LOG((TL_TRACE, " pPrivilege ---> %p", pPrivilege ));
  358. if ( TAPIIsBadWritePtr( pPrivilege, sizeof( CALL_PRIVILEGE ) ) )
  359. {
  360. LOG((TL_ERROR, "get_Privilege - bad pointer"));
  361. return E_POINTER;
  362. }
  363. Lock();
  364. *pPrivilege = m_CallPrivilege;
  365. Unlock();
  366. LOG((TL_TRACE, "get_Privilege - exit - return SUCCESS" ));
  367. return S_OK;
  368. }
  369. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  370. //
  371. // get_MediaTypesAvailable
  372. //
  373. // gets the media types on the call.
  374. //
  375. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  376. #ifdef NEWCALLINFO
  377. HRESULT
  378. #else
  379. STDMETHODIMP
  380. #endif
  381. CCall::get_MediaTypesAvailable(
  382. long * plMediaTypesAvail
  383. )
  384. {
  385. LOG((TL_TRACE, "get_MediaTypesAvailable enter"));
  386. LOG((TL_TRACE, " plMediaTypesAvail ------->%p", plMediaTypesAvail ));
  387. //
  388. // check pointer
  389. //
  390. if ( TAPIIsBadWritePtr( plMediaTypesAvail, sizeof(long) ) )
  391. {
  392. LOG((TL_ERROR, "get_MediaTypesAvailable - bad pointer"));
  393. return E_POINTER;
  394. }
  395. Lock();
  396. DWORD dwHold = 0;
  397. //
  398. // ask address for types
  399. //
  400. if (ISHOULDUSECALLPARAMS())
  401. {
  402. dwHold = m_pAddress->GetMediaModes();
  403. }
  404. //
  405. // or types currently on call
  406. //
  407. else
  408. {
  409. if ( SUCCEEDED(RefreshCallInfo()) )
  410. {
  411. dwHold = m_pCallInfo->dwMediaMode;
  412. }
  413. else
  414. {
  415. dwHold = m_pAddress->GetMediaModes();
  416. }
  417. }
  418. //
  419. // fix up tapi2 media modes
  420. //
  421. if (dwHold & AUDIOMEDIAMODES)
  422. {
  423. dwHold |= LINEMEDIAMODE_AUTOMATEDVOICE;
  424. }
  425. dwHold &= ALLMEDIAMODES;
  426. *plMediaTypesAvail = dwHold;
  427. Unlock();
  428. return S_OK;
  429. }
  430. // ITBasicCallControl methods
  431. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  432. //
  433. // Connect
  434. //
  435. // connect the call - call linemakecall
  436. //
  437. // bsync tells tapi if it should wait for the call to get to connected
  438. // or not before returning.
  439. //
  440. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  441. HRESULT
  442. STDMETHODCALLTYPE
  443. CCall::Connect(
  444. VARIANT_BOOL bSync
  445. )
  446. {
  447. HRESULT hr = S_OK;
  448. HANDLE hEvent;
  449. HCALL hCall;
  450. LOG((TL_TRACE, "Connect - enter" ));
  451. LOG((TL_TRACE, " bSync ---> %d", bSync ));
  452. Lock();
  453. if (m_CallState != CS_IDLE)
  454. {
  455. Unlock();
  456. LOG((TL_ERROR,"Connect - call is not in IDLE state - cannot call connect"));
  457. return TAPI_E_INVALCALLSTATE;
  458. }
  459. //
  460. // get an hline to use
  461. //
  462. hr = m_pAddress->FindOrOpenALine(
  463. m_dwMediaMode,
  464. &m_pAddressLine
  465. );
  466. if (S_OK != hr)
  467. {
  468. Unlock();
  469. LOG((TL_ERROR,
  470. "Connect - FindOrOpenALine failed - %lx",
  471. hr
  472. ));
  473. return hr;
  474. }
  475. //
  476. // set up the callparams structure
  477. //
  478. FinishCallParams();
  479. //
  480. // make the call
  481. //
  482. hr = LineMakeCall(
  483. &(m_pAddressLine->t3Line),
  484. &hCall,
  485. m_szDestAddress,
  486. m_dwCountryCode,
  487. m_pCallParams
  488. );
  489. if (((LONG)hr) > 0)
  490. {
  491. if (bSync)
  492. {
  493. //
  494. // this must be created inside the same
  495. // Lock() as the call to tapisrv
  496. // otherwise, the connected message
  497. // may appear before the event
  498. // exists
  499. //
  500. hEvent = CreateConnectedEvent();
  501. }
  502. //
  503. // wait for an async reply
  504. //
  505. Unlock();
  506. hr = WaitForReply( hr );
  507. Lock();
  508. }
  509. if ( S_OK != hr )
  510. {
  511. HRESULT hr2;
  512. LOG((TL_ERROR, "Connect - LineMakeCall failed - %lx", hr ));
  513. ClearConnectedEvent();
  514. // post an event in the callback thread for LINE_CALLSTATE
  515. hr2 = CCallStateEvent::FireEvent(
  516. (ITCallInfo *)this,
  517. CS_DISCONNECTED,
  518. CEC_DISCONNECT_BADADDRESS, /*there should be something called CEC_DISCONNECT_BADADDRESSTYPE*/
  519. m_pAddress->GetTapi(),
  520. NULL
  521. );
  522. if (!SUCCEEDED(hr2))
  523. {
  524. LOG((TL_ERROR, "CallStateEvent - fire event failed %lx", hr));
  525. }
  526. m_CallState = CS_DISCONNECTED;
  527. m_pAddress->MaybeCloseALine( &m_pAddressLine );
  528. //
  529. // Go through the phones and call our event hooks
  530. //
  531. ITPhone * pPhone;
  532. CPhone * pCPhone;
  533. int iPhoneCount;
  534. PhoneArray PhoneArray;
  535. //
  536. // Get a copy of the phone array from tapi. This copy will contain
  537. // references to all the phone objects.
  538. //
  539. m_pAddress->GetTapi()->GetPhoneArray( &PhoneArray );
  540. //
  541. // Unlock before we mess with the phone objects, otherwise we risk deadlock
  542. // if a phone object would try to access call methods.
  543. //
  544. Unlock();
  545. for(iPhoneCount = 0; iPhoneCount < PhoneArray.GetSize(); iPhoneCount++)
  546. {
  547. pPhone = PhoneArray[iPhoneCount];
  548. pCPhone = dynamic_cast<CPhone *>(pPhone);
  549. pCPhone->Automation_CallState( (ITCallInfo *)this, CS_DISCONNECTED, CEC_DISCONNECT_BADADDRESS );
  550. }
  551. //
  552. // Release all the phone objects.
  553. //
  554. PhoneArray.Shutdown();
  555. }
  556. else //hr is S_OK
  557. {
  558. FinishSettingUpCall( hCall );
  559. Unlock();
  560. if (bSync)
  561. {
  562. return SyncWait( hEvent );
  563. }
  564. LOG((TL_TRACE, "Connect - exit - return SUCCESS"));
  565. }
  566. return hr;
  567. }
  568. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  569. //
  570. // Answer
  571. //
  572. // Answer an offering call.
  573. //
  574. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  575. HRESULT
  576. STDMETHODCALLTYPE
  577. CCall::Answer(
  578. void
  579. )
  580. {
  581. HRESULT hr;
  582. LOG((TL_TRACE, "Answer - enter" ));
  583. Lock();
  584. //
  585. // make sure we are in the correct call state
  586. //
  587. if (CS_OFFERING != m_CallState)
  588. {
  589. LOG((TL_ERROR, "Answer - call not in offering state" ));
  590. Unlock();
  591. return TAPI_E_INVALCALLSTATE;
  592. }
  593. //
  594. // answer
  595. //
  596. hr = LineAnswer(
  597. m_t3Call.hCall
  598. );
  599. Unlock();
  600. if ( ((LONG)hr) < 0 )
  601. {
  602. LOG((TL_ERROR, "Answer - LineAnswer failed %lx", hr ));
  603. return hr;
  604. }
  605. //
  606. // wait for reply
  607. //
  608. hr = WaitForReply( hr );
  609. LOG((TL_TRACE, "Answer - exit - return %lx", hr ));
  610. return hr;
  611. }
  612. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  613. //
  614. // Disconnect
  615. //
  616. // called to disconnect the call
  617. // the disconnected_code is ignored
  618. //
  619. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  620. HRESULT
  621. STDMETHODCALLTYPE
  622. CCall::Disconnect(
  623. DISCONNECT_CODE code
  624. )
  625. {
  626. HRESULT hr = S_OK;
  627. LONG lResult;
  628. HCALL hCall, hAdditionalCall;
  629. LOG((TL_TRACE, "Disconnect - enter" ));
  630. LOG((TL_TRACE, " DisconnectCode ---> %d", code ));
  631. Lock();
  632. if (m_CallState == CS_IDLE)
  633. {
  634. Unlock();
  635. LOG((TL_ERROR, "Disconnect - invalid state"));
  636. return S_FALSE;
  637. }
  638. if (NULL == m_t3Call.hCall)
  639. {
  640. Unlock();
  641. LOG((TL_ERROR, "Disconnect - invalid hCall"));
  642. return S_FALSE;
  643. }
  644. hCall = m_t3Call.hCall;
  645. hAdditionalCall = m_hAdditionalCall;
  646. //
  647. // special case for wavemsp
  648. // tell it to stop streaming
  649. //
  650. if ( OnWaveMSPCall() )
  651. {
  652. StopWaveMSPStream();
  653. }
  654. Unlock();
  655. //
  656. // Check extra t3call used in conference legs
  657. //
  658. if (NULL != hAdditionalCall)
  659. {
  660. lResult = LineDrop(
  661. hAdditionalCall,
  662. NULL,
  663. 0
  664. );
  665. if ( lResult < 0 )
  666. {
  667. LOG((TL_ERROR, "Disconnect - AdditionalCall - LineDrop failed %lx", lResult ));
  668. }
  669. else
  670. {
  671. hr = WaitForReply( (DWORD) lResult );
  672. if (S_OK != hr)
  673. {
  674. LOG((TL_ERROR, "Disconnect - AdditionalCall - WaitForReply failed %lx", hr ));
  675. }
  676. }
  677. }
  678. lResult = LineDrop(
  679. hCall,
  680. NULL,
  681. 0
  682. );
  683. if ( lResult < 0 )
  684. {
  685. LOG((TL_ERROR, "Disconnect - LineDrop failed %lx", lResult ));
  686. return mapTAPIErrorCode( lResult );
  687. }
  688. hr = WaitForReply( (DWORD) lResult );
  689. if (S_OK != hr)
  690. {
  691. LOG((TL_ERROR, "Disconnect - WaitForReply failed %lx", hr ));
  692. return hr;
  693. }
  694. LOG((TL_TRACE, "Disconnect - exit - return %lx", hr ));
  695. return S_OK;
  696. }
  697. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  698. // Class : CCall
  699. // Interface : ITBasicCallControl
  700. // Method : Hold
  701. //
  702. // If bHold == TRUE, the call should be put on hold.
  703. // If bHold == FALSE, the call should unheld
  704. //
  705. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  706. HRESULT
  707. STDMETHODCALLTYPE
  708. CCall::Hold(
  709. VARIANT_BOOL bHold
  710. )
  711. {
  712. HRESULT hr = S_OK;
  713. HCALL hCall;
  714. LOG((TL_TRACE, "Hold - enter"));
  715. LOG((TL_TRACE, " bHold ---> %d", bHold));
  716. Lock();
  717. hCall = m_t3Call.hCall;
  718. Unlock();
  719. if ( NULL == hCall )
  720. {
  721. return TAPI_E_INVALCALLSTATE;
  722. }
  723. if (bHold)
  724. {
  725. hr = LineHold(hCall);
  726. if ( SUCCEEDED(hr) )
  727. {
  728. //
  729. // wait for async reply
  730. //
  731. hr = WaitForReply( hr );
  732. if ( FAILED(hr) )
  733. {
  734. LOG((TL_ERROR, "Hold - lineHold failed async" ));
  735. }
  736. }
  737. else // lineHold failed
  738. {
  739. LOG((TL_ERROR, "Hold - lineHold failed" ));
  740. }
  741. }
  742. else // want to unhold, so we should be held
  743. {
  744. hr = LineUnhold(hCall);
  745. if ( SUCCEEDED(hr) )
  746. {
  747. //
  748. // wait for async reply
  749. //
  750. hr = WaitForReply( hr );
  751. if ( FAILED(hr) )
  752. {
  753. LOG((TL_ERROR, "Hold - lineUnhold failed async" ));
  754. }
  755. }
  756. else // lineUnhold failed
  757. {
  758. LOG((TL_ERROR, "Hold - lineUnhold failed" ));
  759. }
  760. }
  761. LOG((TL_TRACE, hr, "Hold - exit"));
  762. return hr;
  763. }
  764. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  765. // Class : CCall
  766. // Interface : ITBasicCallControl
  767. // Method : Handoff
  768. //
  769. //
  770. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  771. HRESULT
  772. STDMETHODCALLTYPE
  773. CCall::HandoffDirect(
  774. BSTR pApplicationName
  775. )
  776. {
  777. HRESULT hr = S_OK;
  778. HCALL hCall;
  779. LOG((TL_TRACE, "HandoffDirect - enter"));
  780. LOG((TL_TRACE, " pApplicationName ---> %p", pApplicationName));
  781. if ( IsBadStringPtrW( pApplicationName, -1 ) )
  782. {
  783. LOG((TL_ERROR, "HandoffDirect - AppName pointer invalid"));
  784. return E_POINTER;
  785. }
  786. Lock();
  787. hCall = m_t3Call.hCall;
  788. Unlock();
  789. hr = LineHandoff(hCall, pApplicationName, 0);
  790. if (FAILED(hr))
  791. {
  792. LOG((TL_ERROR, "HandoffDirect - LineHandoff failed"));
  793. }
  794. LOG((TL_TRACE, hr, "HandoffDirect - exit"));
  795. return hr;
  796. }
  797. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  798. // Class : CCall
  799. // Interface : ITBasicCallControl
  800. // Method : Handoff
  801. //
  802. //
  803. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  804. HRESULT
  805. STDMETHODCALLTYPE
  806. CCall::HandoffIndirect(
  807. long lMediaType
  808. )
  809. {
  810. HRESULT hr = S_OK;
  811. DWORD dwMediaMode = 0;
  812. HCALL hCall;
  813. LOG((TL_TRACE, "HandoffIndirect - enter"));
  814. LOG((TL_TRACE, " lMediaType ---> %d", lMediaType));
  815. if (!(m_pAddress->GetMediaMode(
  816. lMediaType,
  817. &dwMediaMode
  818. ) ) )
  819. {
  820. LOG((TL_ERROR, "HandoffIndirect - invalid mediatype"));
  821. return E_INVALIDARG;
  822. }
  823. Lock();
  824. hCall = m_t3Call.hCall;
  825. Unlock();
  826. hr = LineHandoff(hCall, NULL, dwMediaMode);
  827. if (FAILED(hr))
  828. {
  829. LOG((TL_ERROR, "HandoffIndirect - LineHandoff failed"));
  830. }
  831. LOG((TL_TRACE, hr, "HandoffIndirect - exit"));
  832. return hr;
  833. }
  834. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  835. // Class : CCall
  836. // Interface : ITBasicCallControl
  837. // Method : Conference
  838. //
  839. //
  840. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  841. HRESULT
  842. STDMETHODCALLTYPE
  843. CCall::Conference(
  844. ITBasicCallControl * pCall,
  845. VARIANT_BOOL bSync
  846. )
  847. {
  848. HRESULT hr = S_OK;
  849. CCall * pConferenceControllerCall = NULL;
  850. CCall * pConsultationCall = NULL;
  851. LOG((TL_TRACE, "Conference - enter"));
  852. LOG((TL_TRACE, " pCall ---> %p", pCall));
  853. LOG((TL_TRACE, " bSync ---> %hd",bSync));
  854. if ( IsBadReadPtr( pCall, sizeof (ITBasicCallControl) ) )
  855. {
  856. LOG((TL_ERROR, "Conference - bad call pointer"));
  857. return E_POINTER;
  858. }
  859. //
  860. // Get CCall pointer to our consultation call object
  861. //
  862. pConsultationCall = dynamic_cast<CComObject<CCall>*>(pCall);
  863. if (pConsultationCall != NULL)
  864. {
  865. Lock();
  866. if (pConsultationCall->GetHCall() == GetHCall())
  867. {
  868. Unlock();
  869. hr = E_INVALIDARG;
  870. LOG((TL_INFO, "Conference - invalid Call pointer (same call & consult call)"));
  871. }
  872. else if (m_pCallHub != NULL)
  873. {
  874. //
  875. // Get the conference controller handle from the callhub
  876. //
  877. pConferenceControllerCall = m_pCallHub->GetConferenceControllerCall();
  878. Unlock();
  879. //
  880. // Do we have an existing Conference ??
  881. //
  882. if (pConferenceControllerCall == NULL)
  883. {
  884. //
  885. // No existing conference, so create one
  886. //
  887. hr = CreateConference(pConsultationCall, bSync );
  888. }
  889. else
  890. {
  891. //
  892. // Add to an existing conference
  893. //
  894. hr = AddToConference(pConsultationCall, bSync );
  895. }
  896. }
  897. else
  898. {
  899. Unlock();
  900. hr = E_UNEXPECTED;
  901. LOG((TL_INFO, "Conference - No Call Hub" ));
  902. }
  903. }
  904. else
  905. {
  906. hr = E_INVALIDARG;
  907. LOG((TL_INFO, "Conference - invalid Call pointer"));
  908. LOG((TL_ERROR, hr, "Conference - exit"));
  909. }
  910. return hr;
  911. }
  912. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  913. // Class : CCall
  914. // Interface : ITBasicCallControl
  915. // Method : Transfer
  916. //
  917. //
  918. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  919. HRESULT
  920. STDMETHODCALLTYPE
  921. CCall::Transfer(
  922. ITBasicCallControl * pCall,
  923. VARIANT_BOOL bSync
  924. )
  925. {
  926. HRESULT hr = S_OK;
  927. LPLINECALLSTATUS pCallStatus = NULL;
  928. CCall * pConsultationCall = NULL;
  929. DWORD dwCallFeatures;
  930. DWORD dwCallFeatures2;
  931. CALL_STATE consultationCallState = CS_IDLE;
  932. LOG((TL_TRACE, "Transfer - enter"));
  933. LOG((TL_TRACE, " pCall ---> %p", pCall));
  934. LOG((TL_TRACE, " bSync ---> %hd",bSync));
  935. try
  936. {
  937. //
  938. // Get CCall pointer to our consultation call object
  939. //
  940. pConsultationCall = dynamic_cast<CComObject<CCall>*>(pCall);
  941. if (pConsultationCall != NULL)
  942. {
  943. }
  944. else
  945. {
  946. hr = E_INVALIDARG;
  947. LOG((TL_INFO, "Transfer - invalid Call pointer"));
  948. LOG((TL_ERROR, hr, "Transfer - exit"));
  949. return(hr);
  950. }
  951. }
  952. catch(...)
  953. {
  954. hr = E_INVALIDARG;
  955. LOG((TL_INFO, "Transfer - invalid Call pointer"));
  956. LOG((TL_ERROR, hr, "Transfer - exit"));
  957. return(hr);
  958. }
  959. if (pConsultationCall->GetHCall() == GetHCall())
  960. {
  961. hr = E_INVALIDARG;
  962. LOG((TL_INFO, "Transfer - invalid Call pointer (same call & consult call)"));
  963. LOG((TL_ERROR, hr, "Transfer - exit"));
  964. return(hr);
  965. }
  966. // Pointer seems Ok, so carry on
  967. Lock();
  968. //
  969. // Get Call Status to determine what features we can use
  970. //
  971. hr = LineGetCallStatus( m_t3Call.hCall, &pCallStatus );
  972. if ( !SUCCEEDED(hr) )
  973. {
  974. LOG((TL_ERROR, "Transfer - LineGetCallStatus failed - %lx", hr));
  975. Unlock();
  976. return hr;
  977. }
  978. dwCallFeatures = pCallStatus->dwCallFeatures;
  979. if ( m_pAddress->GetAPIVersion() >= TAPI_VERSION2_0 )
  980. {
  981. dwCallFeatures2 = pCallStatus->dwCallFeatures2;
  982. }
  983. ClientFree( pCallStatus );
  984. #if CHECKCALLSTATUS
  985. if ( (dwCallFeatures & LINECALLFEATURE_SETUPTRANSFER) &&
  986. (dwCallFeatures & LINECALLFEATURE_COMPLETETRANSF) )
  987. {
  988. #endif
  989. //
  990. // we support it, so try the transfer
  991. // Can we do a one step transfer ???
  992. //
  993. if ( dwCallFeatures2 & LINECALLFEATURE2_ONESTEPTRANSFER )
  994. {
  995. Unlock();
  996. hr = OneStepTransfer(pConsultationCall, bSync);
  997. return hr;
  998. }
  999. HCALL hConsultationCall;
  1000. //
  1001. // Setup & dial the consultation Call
  1002. //
  1003. LOG((TL_INFO, "Transfer - Trying Two Step Transfer" ));
  1004. hr = LineSetupTransfer(
  1005. m_t3Call.hCall,
  1006. &hConsultationCall,
  1007. NULL
  1008. );
  1009. Unlock();
  1010. if ( SUCCEEDED(hr) )
  1011. {
  1012. //
  1013. // wait for async reply
  1014. //
  1015. hr = WaitForReply( hr );
  1016. if ( SUCCEEDED(hr) )
  1017. {
  1018. //
  1019. // we support it, so try the Conference
  1020. //
  1021. pConsultationCall->get_CallState (&consultationCallState);
  1022. if ( (consultationCallState == CS_CONNECTED) || (consultationCallState == CS_HOLD) )
  1023. {
  1024. //
  1025. // the existing call is in a connected stae so we just need to to do a finish()
  1026. // to call down to LineAddToConference()
  1027. //
  1028. pConsultationCall->SetRelatedCall(
  1029. this,
  1030. CALLFLAG_TRANSFCONSULT|CALLFLAG_CONSULTCALL
  1031. );
  1032. return S_OK;
  1033. }
  1034. LONG lCap;
  1035. LOG((TL_INFO, "Transfer - LineSetupTransfer completed OK"));
  1036. pConsultationCall->Lock();
  1037. pConsultationCall->FinishSettingUpCall( hConsultationCall );
  1038. pConsultationCall->Unlock();
  1039. hr = pConsultationCall->DialAsConsultationCall( this, dwCallFeatures, FALSE, bSync );
  1040. }
  1041. else // LineSetupTransfer async reply failed
  1042. {
  1043. LOG((TL_ERROR, "Transfer - LineSetupTransfer failed async" ));
  1044. }
  1045. }
  1046. else // LineSetupTransfer failed
  1047. {
  1048. LOG((TL_ERROR, "Transfer - LineSetupTransfer failed" ));
  1049. }
  1050. #if CHECKCALLSTATUS
  1051. }
  1052. else // don't support transfer features
  1053. {
  1054. LOG((TL_ERROR, "Transfer - LineGetCallStatus reports Transfer not supported"));
  1055. hr = E_FAIL;
  1056. }
  1057. #endif
  1058. LOG((TL_TRACE, hr, "Transfer - exit"));
  1059. return hr;
  1060. }
  1061. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1062. // Class : CCall
  1063. // Interface : ITBasicCallControl
  1064. // Method : BlindTransfer
  1065. //
  1066. //
  1067. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1068. HRESULT
  1069. STDMETHODCALLTYPE
  1070. CCall::BlindTransfer(
  1071. BSTR pDestAddress
  1072. )
  1073. {
  1074. HRESULT hr = S_OK;
  1075. DWORD dwCallFeatures;
  1076. LOG((TL_TRACE, "BlindTransfer - enter"));
  1077. LOG((TL_TRACE, " pDestAddress ---> %p", pDestAddress));
  1078. if ( IsBadStringPtrW( pDestAddress, -1 ) )
  1079. {
  1080. LOG((TL_ERROR, "BlindTransfer - bad pDestAddress"));
  1081. return E_POINTER;
  1082. }
  1083. Lock();
  1084. #if CHECKCALLSTATUS
  1085. LPLINECALLSTATUS pCallStatus = NULL;
  1086. hr = LineGetCallStatus(
  1087. m_t3Call.hCall,
  1088. &pCallStatus
  1089. );
  1090. if ( !SUCCEEDED(hr) )
  1091. {
  1092. LOG((TL_ERROR, "BlindTransfer - LineGetCallStatus failed - %lx", hr));
  1093. Unlock();
  1094. return hr;
  1095. }
  1096. dwCallFeatures = pCallStatus->dwCallFeatures;
  1097. ClientFree( pCallStatus );
  1098. if (!(dwCallFeatures & LINECALLFEATURE_BLINDTRANSFER ))
  1099. {
  1100. LOG((TL_ERROR, "BlindTransfer - not supported" ));
  1101. Unlock();
  1102. return E_FAIL;
  1103. }
  1104. #endif
  1105. // If the calls in the offering state we can't blindtransfer, so redirect.
  1106. if (m_CallState == CS_OFFERING)
  1107. {
  1108. hr = lineRedirectW(
  1109. m_t3Call.hCall,
  1110. pDestAddress,
  1111. m_dwCountryCode
  1112. );
  1113. }
  1114. else
  1115. {
  1116. //
  1117. // we support it, so try the transfer
  1118. //
  1119. hr = LineBlindTransfer(
  1120. m_t3Call.hCall,
  1121. pDestAddress,
  1122. m_dwCountryCode
  1123. );
  1124. }
  1125. Unlock();
  1126. if ( SUCCEEDED(hr) )
  1127. {
  1128. //
  1129. // wait for async reply
  1130. //
  1131. hr = WaitForReply( hr );
  1132. if ( FAILED(hr) )
  1133. {
  1134. LOG((TL_ERROR, "BlindTransfer - lineBlindTransfer failed async" ));
  1135. }
  1136. }
  1137. else // LineBlindTransfer failed
  1138. {
  1139. LOG((TL_ERROR, "BlindTransfer - lineBlindTransfer failed" ));
  1140. }
  1141. LOG((TL_TRACE, hr, "BlindTransfer - exit"));
  1142. return hr;
  1143. }
  1144. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1145. // Class : CCall
  1146. // Interface : ITBasicCallControl
  1147. // Method : Park
  1148. //
  1149. //
  1150. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1151. HRESULT
  1152. STDMETHODCALLTYPE
  1153. CCall::ParkDirect(
  1154. BSTR pParkAddress
  1155. )
  1156. {
  1157. HRESULT hr = S_OK;
  1158. HCALL hCall;
  1159. LOG((TL_TRACE, "ParkDirect - enter"));
  1160. if ( IsBadStringPtrW( pParkAddress, -1 ) )
  1161. {
  1162. LOG((TL_ERROR, "ParkDirect - bad pParkAddress"));
  1163. return E_POINTER;
  1164. }
  1165. Lock();
  1166. hCall = m_t3Call.hCall;
  1167. Unlock();
  1168. #if CHECKCALLSTATUS
  1169. LPLINECALLSTATUS pCallStatus = NULL;
  1170. hr = LineGetCallStatus( hCall, &pCallStatus );
  1171. if (!SUCCEEDED(hr))
  1172. {
  1173. LOG((TL_ERROR, "ParkDirect - LineGetCallStatus failed - %lx", hr));
  1174. return hr;
  1175. }
  1176. if (!(pCallStatus->dwCallFeatures & LINECALLFEATURE_PARK ))
  1177. {
  1178. LOG((TL_ERROR, "ParkDirect - this call doesn't support park"));
  1179. ClientFree( pCallStatus );
  1180. return E_FAIL;
  1181. }
  1182. ClientFree( pCallStatus );
  1183. #endif
  1184. hr = LinePark(
  1185. hCall,
  1186. LINEPARKMODE_DIRECTED,
  1187. pParkAddress,
  1188. NULL
  1189. );
  1190. if ( SUCCEEDED(hr) )
  1191. {
  1192. //
  1193. // wait for async reply
  1194. //
  1195. hr = WaitForReply( hr );
  1196. }
  1197. LOG((TL_TRACE, hr, "Park - exit"));
  1198. return hr;
  1199. }
  1200. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1201. // Class : CCall
  1202. // Interface : ITBasicCallControl
  1203. // Method : Park
  1204. //
  1205. //
  1206. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1207. HRESULT
  1208. STDMETHODCALLTYPE
  1209. CCall::ParkIndirect(
  1210. BSTR * ppNonDirAddress
  1211. )
  1212. {
  1213. HRESULT hr = S_OK;
  1214. LPVARSTRING pCallParkedAtThisAddress = NULL;
  1215. PWSTR pszParkedHere;
  1216. HCALL hCall;
  1217. LOG((TL_TRACE, "ParkIndirect - enter"));
  1218. if ( TAPIIsBadWritePtr( ppNonDirAddress, sizeof(BSTR) ) )
  1219. {
  1220. LOG((TL_ERROR, "Park - Bad return Pointer" ));
  1221. return E_POINTER;
  1222. }
  1223. Lock();
  1224. hCall = m_t3Call.hCall;
  1225. Unlock();
  1226. #if CHECKCALLSTATUS
  1227. LPLINECALLSTATUS pCallStatus = NULL;
  1228. hr = LineGetCallStatus( hCall, &pCallStatus );
  1229. if (!SUCCEEDED(hr))
  1230. {
  1231. LOG((TL_ERROR, "ParkDirect - LineGetCallStatus failed %lx",hr));
  1232. return hr;
  1233. }
  1234. if ( !(pCallStatus->dwCallFeatures & LINECALLFEATURE_PARK ))
  1235. {
  1236. LOG((TL_ERROR, "ParkIndirect - call doesn't support park"));
  1237. ClientFree( pCallStatus );
  1238. return E_FAIL;
  1239. }
  1240. ClientFree( pCallStatus );
  1241. #endif
  1242. //
  1243. // we support it, so try to park
  1244. //
  1245. hr = LinePark(
  1246. hCall,
  1247. LINEPARKMODE_NONDIRECTED,
  1248. NULL,
  1249. &pCallParkedAtThisAddress
  1250. );
  1251. if ( !SUCCEEDED(hr) )
  1252. {
  1253. LOG((TL_ERROR, "LineParkIndirect - failed sync - %lx", hr));
  1254. return hr;
  1255. }
  1256. //
  1257. // wait for async reply
  1258. //
  1259. hr = WaitForReply( hr );
  1260. if ( SUCCEEDED(hr) && (NULL != pCallParkedAtThisAddress) )
  1261. {
  1262. //
  1263. // Get the string from the VARSTRING structure
  1264. //
  1265. pszParkedHere = (PWSTR) ((BYTE*)(pCallParkedAtThisAddress) +
  1266. pCallParkedAtThisAddress->dwStringOffset);
  1267. *ppNonDirAddress = BSTRFromUnalingedData( (BYTE*)pszParkedHere,
  1268. pCallParkedAtThisAddress->dwStringSize);
  1269. if ( NULL == *ppNonDirAddress )
  1270. {
  1271. LOG((TL_ERROR, "ParkIndirect - BSTRFromUnalingedData Failed" ));
  1272. hr = E_OUTOFMEMORY;
  1273. }
  1274. ClientFree( pCallParkedAtThisAddress );
  1275. }
  1276. else // LinePark failed async
  1277. {
  1278. LOG((TL_ERROR, "ParkIndirect - LinePark failed async" ));
  1279. }
  1280. LOG((TL_TRACE, hr, "ParkIndirect - exit"));
  1281. return hr;
  1282. }
  1283. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1284. // Class : CCall
  1285. // Interface : ITBasicCallControl
  1286. // Method : SwapHold
  1287. //
  1288. //
  1289. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1290. HRESULT
  1291. STDMETHODCALLTYPE
  1292. CCall::SwapHold(ITBasicCallControl * pCall)
  1293. {
  1294. HRESULT hr = S_OK;
  1295. CCall *pHeldCall;
  1296. HCALL hHeldCall;
  1297. HCALL hCall;
  1298. CCall *pConfContCall;
  1299. ITCallHub *pCallHub;
  1300. LOG((TL_TRACE, "SwapHold - enter"));
  1301. try
  1302. {
  1303. //
  1304. // Get CCall pointer to our other call object
  1305. //
  1306. pHeldCall = dynamic_cast<CComObject<CCall>*>(pCall);
  1307. if (pHeldCall != NULL)
  1308. {
  1309. //
  1310. // Get held call objects T3CALL
  1311. //
  1312. hHeldCall = pHeldCall->GetHCall();
  1313. //
  1314. //If the call has a conference controller associated with it then
  1315. //the conference controller is swapheld instead of the call itself.
  1316. //
  1317. pConfContCall = pHeldCall->GetConfControlCall();
  1318. if (pConfContCall != NULL)
  1319. {
  1320. hHeldCall = pConfContCall->GetHCall();
  1321. }
  1322. }
  1323. else
  1324. {
  1325. hr = E_INVALIDARG;
  1326. LOG((TL_INFO, "SwapHold - invalid Call pointer"));
  1327. LOG((TL_ERROR, hr, "Transfer - exit"));
  1328. return(hr);
  1329. }
  1330. }
  1331. catch(...)
  1332. {
  1333. hr = E_INVALIDARG;
  1334. LOG((TL_INFO, "SwapHold - invalid Call pointer"));
  1335. LOG((TL_ERROR, hr, "Transfer - exit"));
  1336. return(hr);
  1337. }
  1338. //
  1339. //Get the swap call handle.
  1340. //Look for the conference controller call first.
  1341. //
  1342. pConfContCall = GetConfControlCall();
  1343. if (pConfContCall != NULL)
  1344. {
  1345. hCall = pConfContCall->GetHCall();
  1346. }
  1347. else
  1348. {
  1349. hCall = GetHCall();
  1350. }
  1351. //
  1352. // Pointer seems Ok, so carry on
  1353. //
  1354. #if CHECKCALLSTATUS
  1355. LPLINECALLSTATUS pCallStatus = NULL;
  1356. hr = LineGetCallStatus( hCall, &pCallStatus );
  1357. if ( !SUCCEEDED(hr) )
  1358. {
  1359. LOG((TL_ERROR, "SwapHold - LineGetCallStatus failed"));
  1360. }
  1361. if (pCallStatus->dwCallFeatures & LINECALLFEATURE_SWAPHOLD )
  1362. {
  1363. #endif
  1364. //
  1365. // we support it, so try to swap hold
  1366. //
  1367. hr = LineSwapHold(hCall, hHeldCall);
  1368. if ( SUCCEEDED(hr) )
  1369. {
  1370. //
  1371. // wait for async reply
  1372. //
  1373. hr = WaitForReply( hr );
  1374. if ( FAILED(hr) )
  1375. {
  1376. LOG((TL_ERROR, "SwapHold - LineSwapHold failed async" ));
  1377. }
  1378. }
  1379. else // LineSwapHold failed
  1380. {
  1381. LOG((TL_ERROR, "SwapHold - LineSwapHold failed" ));
  1382. }
  1383. #if CHECKCALLSTATUS
  1384. }
  1385. else // don't support LineSwapHold
  1386. {
  1387. LOG((TL_ERROR, "SwapHold - LineGetCallStatus reports LineSwapHold not supported"));
  1388. hr = E_FAIL;
  1389. }
  1390. ClientFree( pCallStatus );
  1391. #endif
  1392. LOG((TL_TRACE, hr, "SwapHold - exit"));
  1393. return hr;
  1394. }
  1395. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1396. // Class : CCall
  1397. // Interface : ITBasicCallControl
  1398. // Method : Unpark
  1399. //
  1400. //
  1401. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1402. STDMETHODIMP
  1403. CCall::Unpark()
  1404. {
  1405. HRESULT hr = E_FAIL;
  1406. HCALL hCall;
  1407. LOG((TL_TRACE, "Unpark - enter"));
  1408. Lock();
  1409. if (m_CallState != CS_IDLE)
  1410. {
  1411. Unlock();
  1412. LOG((TL_ERROR,"Unpark - call is not in IDLE state - cannot call Unpark"));
  1413. return TAPI_E_INVALCALLSTATE;
  1414. }
  1415. //
  1416. // Do we have a line open ?
  1417. //
  1418. if ( NULL == m_pAddressLine )
  1419. {
  1420. hr = m_pAddress->FindOrOpenALine(
  1421. m_dwMediaMode,
  1422. &m_pAddressLine
  1423. );
  1424. if ( FAILED(hr) )
  1425. {
  1426. Unlock();
  1427. LOG((TL_ERROR, "Unpark - couldn't open a line"));
  1428. LOG((TL_TRACE, hr, "Unpark - exit"));
  1429. return hr;
  1430. }
  1431. }
  1432. hr = LineUnpark(
  1433. m_pAddressLine->t3Line.hLine,
  1434. m_pAddress->GetAddressID(),
  1435. &hCall,
  1436. m_szDestAddress
  1437. );
  1438. Unlock();
  1439. //
  1440. // Check sync return
  1441. //
  1442. if ( SUCCEEDED(hr) )
  1443. {
  1444. // Wait for the async reply & map it's tapi2 code T3
  1445. hr = WaitForReply( hr );
  1446. if ( SUCCEEDED(hr) )
  1447. {
  1448. FinishSettingUpCall( hCall );
  1449. }
  1450. else // async reply failed
  1451. {
  1452. LOG((TL_ERROR, "Unpark - LineUnpark failed async"));
  1453. Lock();
  1454. m_pAddress->MaybeCloseALine( &m_pAddressLine );
  1455. Unlock();
  1456. }
  1457. }
  1458. else // LineUnpark failed
  1459. {
  1460. LOG((TL_ERROR, "Unpark - LineUnpark failed sync" ));
  1461. Lock();
  1462. m_pAddress->MaybeCloseALine( &m_pAddressLine );
  1463. Unlock();
  1464. }
  1465. LOG((TL_TRACE, hr, "Unpark - exit"));
  1466. return hr;
  1467. }
  1468. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1469. //
  1470. // get_CallHub
  1471. //
  1472. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1473. STDMETHODIMP
  1474. CCall::get_CallHub(
  1475. ITCallHub ** ppCallHub
  1476. )
  1477. {
  1478. HRESULT hr = S_OK;
  1479. LOG((TL_TRACE, "get_CallHub - enter"));
  1480. if ( TAPIIsBadWritePtr( ppCallHub, sizeof(ITCallHub *) ) )
  1481. {
  1482. LOG((TL_ERROR, "get_CallHub - bad pointer"));
  1483. return E_POINTER;
  1484. }
  1485. *ppCallHub = NULL;
  1486. //
  1487. // do we have a callhub yet?
  1488. //
  1489. Lock();
  1490. if (NULL == m_pCallHub)
  1491. {
  1492. hr = CheckAndCreateFakeCallHub();
  1493. }
  1494. if ( SUCCEEDED(hr) )
  1495. {
  1496. hr = m_pCallHub->QueryInterface(
  1497. IID_ITCallHub,
  1498. (void**)ppCallHub
  1499. );
  1500. }
  1501. Unlock();
  1502. LOG((TL_TRACE, "get_CallHub - exit - return %lx", hr));
  1503. return hr;
  1504. }
  1505. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1506. //
  1507. // Pickup
  1508. //
  1509. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1510. STDMETHODIMP
  1511. CCall::Pickup(
  1512. BSTR pGroupID
  1513. )
  1514. {
  1515. HRESULT hr = E_FAIL;
  1516. HCALL hCall;
  1517. LOG((TL_TRACE, "Pickup - enter"));
  1518. //
  1519. // Pickup should accept NULL value in pGroupID argument
  1520. //
  1521. if ( (pGroupID != NULL) && IsBadStringPtrW( pGroupID, -1 ) )
  1522. {
  1523. LOG((TL_TRACE, "Pickup - bad pGroupID"));
  1524. return E_POINTER;
  1525. }
  1526. Lock();
  1527. //
  1528. // If we already have a call handle, don't pickup this call as it will
  1529. // overwrite that handle
  1530. //
  1531. if ( NULL != m_t3Call.hCall )
  1532. {
  1533. Unlock();
  1534. LOG((TL_ERROR, "Pickup - we already have a call handle"));
  1535. LOG((TL_TRACE, hr, "Pickup - exit"));
  1536. return TAPI_E_INVALCALLSTATE;
  1537. }
  1538. //
  1539. // Do we have a line open ?
  1540. //
  1541. if ( NULL == m_pAddressLine )
  1542. {
  1543. hr = m_pAddress->FindOrOpenALine(
  1544. m_dwMediaMode,
  1545. &m_pAddressLine
  1546. );
  1547. if ( FAILED(hr) )
  1548. {
  1549. Unlock();
  1550. LOG((TL_ERROR, "Pickup - couldn't open a line"));
  1551. LOG((TL_TRACE, hr, "Pickup - exit"));
  1552. return hr;
  1553. }
  1554. }
  1555. hr = LinePickup(
  1556. m_pAddressLine->t3Line.hLine,
  1557. m_pAddress->GetAddressID(),
  1558. &hCall,
  1559. m_szDestAddress,
  1560. pGroupID
  1561. );
  1562. Unlock();
  1563. //
  1564. // Check sync return
  1565. //
  1566. if ( SUCCEEDED(hr) )
  1567. {
  1568. //
  1569. // wait for async reply
  1570. //
  1571. hr = WaitForReply( hr );
  1572. if ( SUCCEEDED(hr) )
  1573. {
  1574. FinishSettingUpCall( hCall );
  1575. //UpdateStateAndPrivilege();
  1576. }
  1577. else // async reply failed
  1578. {
  1579. LOG((TL_ERROR, "Pickup - LinePickup failed async"));
  1580. Lock();
  1581. m_pAddress->MaybeCloseALine( &m_pAddressLine );
  1582. Unlock();
  1583. }
  1584. }
  1585. else // LinePickup failed
  1586. {
  1587. LOG((TL_ERROR, "Pickup - LinePickup failed sync" ));
  1588. Lock();
  1589. m_pAddress->MaybeCloseALine( &m_pAddressLine );
  1590. Unlock();
  1591. }
  1592. LOG((TL_TRACE, hr, "Pickup - exit"));
  1593. return hr;
  1594. }
  1595. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1596. //
  1597. // Dial
  1598. //
  1599. // simply call LineDial
  1600. //
  1601. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1602. STDMETHODIMP
  1603. CCall::Dial( BSTR pDestAddress )
  1604. {
  1605. HRESULT hr;
  1606. LOG((TL_TRACE, "Dial - enter"));
  1607. LOG((TL_TRACE, "Dial - pDestAddress %ls", pDestAddress));
  1608. if ( IsBadStringPtrW( pDestAddress, -1 ) )
  1609. {
  1610. LOG((TL_ERROR, "Dial - bad pDestAddress"));
  1611. return E_POINTER;
  1612. }
  1613. Lock();
  1614. hr = LineDial(
  1615. m_t3Call.hCall,
  1616. pDestAddress,
  1617. m_dwCountryCode
  1618. );
  1619. Unlock();
  1620. if ( SUCCEEDED(hr) )
  1621. {
  1622. hr = WaitForReply( hr );
  1623. }
  1624. else
  1625. {
  1626. LOG((TL_ERROR, "Dial - fail sync - %lx", hr));
  1627. }
  1628. LOG((TL_TRACE, "Dial - exit - return %lx", hr));
  1629. return hr;
  1630. }
  1631. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1632. //
  1633. // get_AddressType
  1634. //
  1635. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1636. #ifndef NEWCALLINFO
  1637. STDMETHODIMP
  1638. CCall::get_AddressType(
  1639. long * plAddressType
  1640. )
  1641. {
  1642. HRESULT hr = S_OK;
  1643. DWORD dwAPI;
  1644. LOG((TL_TRACE, "get_AddressType - enter"));
  1645. if ( TAPIIsBadWritePtr( plAddressType, sizeof (long) ) )
  1646. {
  1647. LOG((TL_ERROR, "get_AddressType - bad pointer"));
  1648. return E_POINTER;
  1649. }
  1650. dwAPI = m_pAddress->GetAPIVersion();
  1651. if ( TAPI_VERSION3_0 > dwAPI )
  1652. {
  1653. *plAddressType = LINEADDRESSTYPE_PHONENUMBER;
  1654. LOG((TL_INFO, "get_AddressType - addresstype %lx", *plAddressType));
  1655. LOG((TL_TRACE, "get_AddressType - exit"));
  1656. return S_OK;
  1657. }
  1658. Lock();
  1659. if (ISHOULDUSECALLPARAMS())
  1660. {
  1661. *plAddressType = m_pCallParams->dwAddressType;
  1662. hr = S_OK;
  1663. }
  1664. else
  1665. {
  1666. hr = RefreshCallInfo();
  1667. if ( SUCCEEDED(hr) )
  1668. {
  1669. *plAddressType = m_pCallInfo->dwAddressType;
  1670. LOG((TL_INFO, "get_AddressType - addresstype %lx", m_pCallInfo->dwAddressType));
  1671. }
  1672. }
  1673. Unlock();
  1674. LOG((TL_TRACE, "get_AddressType - exit"));
  1675. return hr;
  1676. }
  1677. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1678. //
  1679. // put_AddressType
  1680. //
  1681. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1682. STDMETHODIMP
  1683. CCall::put_AddressType(long lType)
  1684. {
  1685. HRESULT hr = S_OK;
  1686. LOG((TL_TRACE, "put_AddressType - enter"));
  1687. Lock();
  1688. if ( ISHOULDUSECALLPARAMS() )
  1689. {
  1690. if( m_pAddress->GetAPIVersion() < TAPI_VERSION3_0 )
  1691. {
  1692. if ( LINEADDRESSTYPE_PHONENUMBER != lType )
  1693. {
  1694. LOG((TL_ERROR, "put_AddressType - tsp < ver 3.0 only support phonenumber"));
  1695. hr = E_INVALIDARG;
  1696. }
  1697. }
  1698. else
  1699. {
  1700. //
  1701. // address types get validate in tapisrv
  1702. // when callparams is used
  1703. //
  1704. m_pCallParams->dwAddressType = lType;
  1705. }
  1706. }
  1707. else
  1708. {
  1709. LOG((TL_ERROR, "put_AddressType - cannot save in this callstate"));
  1710. hr = TAPI_E_INVALCALLSTATE;
  1711. }
  1712. Unlock();
  1713. LOG((TL_TRACE, "put_AddressType - exit"));
  1714. return hr;
  1715. }
  1716. #endif
  1717. #ifdef NEWCALLINFO
  1718. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1719. //
  1720. //
  1721. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1722. HRESULT
  1723. CCall::get_CallerIDAddressType(long * plAddressType )
  1724. {
  1725. HRESULT hr = S_OK;
  1726. DWORD dwAPI;
  1727. LOG((TL_TRACE, "get_CallerIDAddressType - enter"));
  1728. if ( TAPIIsBadWritePtr( plAddressType, sizeof (long) ) )
  1729. {
  1730. LOG((TL_ERROR, "get_CallerIDAddressType - bad pointer"));
  1731. return E_POINTER;
  1732. }
  1733. dwAPI = m_pAddress->GetAPIVersion();
  1734. Lock();
  1735. if (ISHOULDUSECALLPARAMS())
  1736. {
  1737. LOG((TL_INFO, "get_CallerIDAddressType - invalid call state"));
  1738. hr = TAPI_E_INVALCALLSTATE;
  1739. }
  1740. else
  1741. {
  1742. hr = RefreshCallInfo();
  1743. if ( SUCCEEDED(hr) )
  1744. {
  1745. if ( m_pCallInfo->dwCallerIDFlags & LINECALLPARTYID_ADDRESS )
  1746. {
  1747. if ( TAPI_VERSION3_0 > dwAPI )
  1748. {
  1749. *plAddressType = LINEADDRESSTYPE_PHONENUMBER;
  1750. LOG((TL_INFO, "get_CallerIDAddressType - addresstype %lx", *plAddressType));
  1751. LOG((TL_TRACE, "get_CallerIDAddressType - exit"));
  1752. }
  1753. else
  1754. {
  1755. *plAddressType = m_pCallInfo->dwCallerIDAddressType;
  1756. LOG((TL_INFO, "get_CallerIDAddressType - addresstype %lx", m_pCallInfo->dwCallerIDAddressType));
  1757. }
  1758. hr = S_OK;
  1759. }
  1760. else
  1761. {
  1762. hr = E_FAIL;
  1763. }
  1764. }
  1765. }
  1766. Unlock();
  1767. LOG((TL_TRACE, "get_CallerIDAddressType - exit"));
  1768. return hr;
  1769. }
  1770. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1771. //
  1772. //
  1773. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1774. HRESULT
  1775. CCall::get_CalledIDAddressType(long * plAddressType )
  1776. {
  1777. HRESULT hr = S_OK;
  1778. DWORD dwAPI;
  1779. LOG((TL_TRACE, "get_CalledIDAddressType - enter"));
  1780. if ( TAPIIsBadWritePtr( plAddressType, sizeof (long) ) )
  1781. {
  1782. LOG((TL_ERROR, "get_CalledIDAddressType - bad pointer"));
  1783. return E_POINTER;
  1784. }
  1785. dwAPI = m_pAddress->GetAPIVersion();
  1786. Lock();
  1787. if (ISHOULDUSECALLPARAMS())
  1788. {
  1789. LOG((TL_INFO, "get_CalledIDAddressType - invalid call state"));
  1790. hr = TAPI_E_INVALCALLSTATE;
  1791. }
  1792. else
  1793. {
  1794. hr = RefreshCallInfo();
  1795. if ( SUCCEEDED(hr) )
  1796. {
  1797. if ( m_pCallInfo->dwCalledIDFlags & LINECALLPARTYID_ADDRESS )
  1798. {
  1799. if ( TAPI_VERSION3_0 > dwAPI )
  1800. {
  1801. *plAddressType = LINEADDRESSTYPE_PHONENUMBER;
  1802. LOG((TL_INFO, "get_CalledIDAddressType - addresstype %lx", *plAddressType));
  1803. LOG((TL_TRACE, "get_CalledIDAddressType - exit"));
  1804. }
  1805. else
  1806. {
  1807. *plAddressType = m_pCallInfo->dwCalledIDAddressType;
  1808. LOG((TL_INFO, "get_CalledIDAddressType - addresstype %lx", m_pCallInfo->dwCalledIDAddressType));
  1809. }
  1810. hr = S_OK;
  1811. }
  1812. else
  1813. {
  1814. hr = E_FAIL;
  1815. }
  1816. }
  1817. }
  1818. Unlock();
  1819. LOG((TL_TRACE, "get_CalledIDAddressType - exit"));
  1820. return hr;
  1821. }
  1822. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1823. //
  1824. //
  1825. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1826. HRESULT
  1827. CCall::get_ConnectedIDAddressType(long * plAddressType )
  1828. {
  1829. HRESULT hr = S_OK;
  1830. DWORD dwAPI;
  1831. LOG((TL_TRACE, "get_ConnectedIDAddressType - enter"));
  1832. if ( TAPIIsBadWritePtr( plAddressType, sizeof (long) ) )
  1833. {
  1834. LOG((TL_ERROR, "get_ConnectedIDAddressType - bad pointer"));
  1835. return E_POINTER;
  1836. }
  1837. dwAPI = m_pAddress->GetAPIVersion();
  1838. Lock();
  1839. if (ISHOULDUSECALLPARAMS())
  1840. {
  1841. LOG((TL_INFO, "get_ConnectedIDAddressType - invalid call state"));
  1842. hr = TAPI_E_INVALCALLSTATE;
  1843. }
  1844. else
  1845. {
  1846. hr = RefreshCallInfo();
  1847. if ( SUCCEEDED(hr) )
  1848. {
  1849. if ( m_pCallInfo->dwConnectedIDFlags & LINECALLPARTYID_ADDRESS )
  1850. {
  1851. if ( TAPI_VERSION3_0 > dwAPI )
  1852. {
  1853. *plAddressType = LINEADDRESSTYPE_PHONENUMBER;
  1854. LOG((TL_INFO, "get_ConnectedIDAddressType - addresstype %lx", *plAddressType));
  1855. LOG((TL_TRACE, "get_ConnectedIDAddressType - exit"));
  1856. }
  1857. else
  1858. {
  1859. *plAddressType = m_pCallInfo->dwConnectedIDAddressType;
  1860. LOG((TL_INFO, "get_ConnectedIDAddressType - addresstype %lx", m_pCallInfo->dwConnectedIDAddressType));
  1861. }
  1862. hr = S_OK;
  1863. }
  1864. else
  1865. {
  1866. hr = E_FAIL;
  1867. }
  1868. }
  1869. }
  1870. Unlock();
  1871. LOG((TL_TRACE, "get_ConnectedIDAddressType - exit"));
  1872. return hr;
  1873. }
  1874. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1875. //
  1876. //
  1877. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1878. HRESULT
  1879. CCall::get_RedirectionIDAddressType(long * plAddressType )
  1880. {
  1881. HRESULT hr = S_OK;
  1882. DWORD dwAPI;
  1883. LOG((TL_TRACE, "get_RedirectionIDAddressType - enter"));
  1884. if ( TAPIIsBadWritePtr( plAddressType, sizeof (long) ) )
  1885. {
  1886. LOG((TL_ERROR, "get_RedirectionIDAddressType - bad pointer"));
  1887. return E_POINTER;
  1888. }
  1889. dwAPI = m_pAddress->GetAPIVersion();
  1890. Lock();
  1891. if (ISHOULDUSECALLPARAMS())
  1892. {
  1893. LOG((TL_INFO, "get_RedirectionIDAddressType - invalid call state"));
  1894. hr = TAPI_E_INVALCALLSTATE;
  1895. }
  1896. else
  1897. {
  1898. hr = RefreshCallInfo();
  1899. if ( SUCCEEDED(hr) )
  1900. {
  1901. if ( m_pCallInfo->dwRedirectionIDFlags & LINECALLPARTYID_ADDRESS )
  1902. {
  1903. if ( TAPI_VERSION3_0 > dwAPI )
  1904. {
  1905. *plAddressType = LINEADDRESSTYPE_PHONENUMBER;
  1906. LOG((TL_INFO, "get_RedirectionIDAddressType - addresstype %lx", *plAddressType));
  1907. LOG((TL_TRACE, "get_RedirectionIDAddressType - exit"));
  1908. }
  1909. else
  1910. {
  1911. *plAddressType = m_pCallInfo->dwRedirectionIDAddressType;
  1912. LOG((TL_INFO, "get_RedirectionIDAddressType - addresstype %lx", m_pCallInfo->dwRedirectionIDAddressType));
  1913. }
  1914. hr = S_OK;
  1915. }
  1916. else
  1917. {
  1918. hr = E_FAIL;
  1919. }
  1920. }
  1921. }
  1922. Unlock();
  1923. LOG((TL_TRACE, "get_RedirectionIDAddressType - exit"));
  1924. return hr;
  1925. }
  1926. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1927. //
  1928. //
  1929. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1930. HRESULT
  1931. CCall::get_RedirectingIDAddressType(long * plAddressType )
  1932. {
  1933. HRESULT hr = S_OK;
  1934. DWORD dwAPI;
  1935. LOG((TL_TRACE, "get_RedirectingIDAddressType - enter"));
  1936. if ( TAPIIsBadWritePtr( plAddressType, sizeof (long) ) )
  1937. {
  1938. LOG((TL_ERROR, "get_RedirectingIDAddressType - bad pointer"));
  1939. return E_POINTER;
  1940. }
  1941. dwAPI = m_pAddress->GetAPIVersion();
  1942. Lock();
  1943. if (ISHOULDUSECALLPARAMS())
  1944. {
  1945. LOG((TL_INFO, "get_RedirectingIDAddressType - invalid call state"));
  1946. hr = TAPI_E_INVALCALLSTATE;
  1947. }
  1948. else
  1949. {
  1950. hr = RefreshCallInfo();
  1951. if ( SUCCEEDED(hr) )
  1952. {
  1953. if ( m_pCallInfo->dwRedirectingIDFlags & LINECALLPARTYID_ADDRESS )
  1954. {
  1955. if ( TAPI_VERSION3_0 > dwAPI )
  1956. {
  1957. *plAddressType = LINEADDRESSTYPE_PHONENUMBER;
  1958. LOG((TL_INFO, "get_RedirectingIDAddressType - addresstype %lx", *plAddressType));
  1959. LOG((TL_TRACE, "get_RedirectingIDAddressType - exit"));
  1960. }
  1961. else
  1962. {
  1963. *plAddressType = m_pCallInfo->dwRedirectingIDAddressType;
  1964. LOG((TL_INFO, "get_RedirectingIDAddressType - addresstype %lx", m_pCallInfo->dwRedirectingIDAddressType));
  1965. }
  1966. hr = S_OK;
  1967. }
  1968. else
  1969. {
  1970. hr = E_FAIL;
  1971. }
  1972. }
  1973. }
  1974. Unlock();
  1975. LOG((TL_TRACE, "get_RedirectingIDAddressType - exit"));
  1976. return hr;
  1977. }
  1978. #endif
  1979. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1980. //
  1981. // get_BearerMode
  1982. //
  1983. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  1984. #ifdef NEWCALLINFO
  1985. HRESULT
  1986. #else
  1987. STDMETHODIMP
  1988. #endif
  1989. CCall::get_BearerMode(long * plBearerMode)
  1990. {
  1991. LOG((TL_TRACE, "get_BearerMode - enter"));
  1992. if ( TAPIIsBadWritePtr( plBearerMode, sizeof(long) ) )
  1993. {
  1994. LOG((TL_ERROR, "get_BearerMode - bad pointer"));
  1995. return E_POINTER;
  1996. }
  1997. Lock();
  1998. HRESULT hr = S_OK;
  1999. if ( ISHOULDUSECALLPARAMS() )
  2000. {
  2001. *plBearerMode = m_pCallParams->dwBearerMode;
  2002. }
  2003. else
  2004. {
  2005. hr = RefreshCallInfo();
  2006. if ( SUCCEEDED(hr) )
  2007. {
  2008. *plBearerMode = m_pCallInfo->dwBearerMode;
  2009. }
  2010. else
  2011. {
  2012. LOG((TL_TRACE, "get_BearerMode - not available"));
  2013. }
  2014. }
  2015. Unlock();
  2016. LOG((TL_TRACE, "get_BearerMode - exit"));
  2017. return hr;
  2018. }
  2019. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2020. //
  2021. // put_BearerMode
  2022. //
  2023. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2024. #ifdef NEWCALLINFO
  2025. HRESULT
  2026. #else
  2027. STDMETHODIMP
  2028. #endif
  2029. CCall::put_BearerMode(long lBearerMode)
  2030. {
  2031. HRESULT hr = S_OK;
  2032. HCALL hCall;
  2033. long lMinRate = 0;
  2034. long lMaxRate = 0;
  2035. LOG((TL_TRACE, "put_BearerMode - enter"));
  2036. Lock();
  2037. if ( ISHOULDUSECALLPARAMS() )
  2038. {
  2039. //
  2040. // type is checked in tapisrv
  2041. //
  2042. m_pCallParams->dwBearerMode = lBearerMode;
  2043. Unlock();
  2044. }
  2045. else // call in progress ( not idle)
  2046. {
  2047. hCall = m_t3Call.hCall;
  2048. Unlock();
  2049. get_MinRate(&lMinRate);
  2050. get_MaxRate(&lMaxRate);
  2051. hr = LineSetCallParams(hCall,
  2052. lBearerMode,
  2053. lMinRate,
  2054. lMaxRate,
  2055. NULL
  2056. );
  2057. if ( SUCCEEDED(hr) )
  2058. {
  2059. hr = WaitForReply( hr );
  2060. if ( FAILED(hr) )
  2061. {
  2062. LOG((TL_ERROR, "put_BearerMode - failed async"));
  2063. }
  2064. }
  2065. else
  2066. {
  2067. LOG((TL_ERROR, "put_BearerMode - failed sync"));
  2068. }
  2069. }
  2070. LOG((TL_TRACE, hr, "put_BearerMode - exit"));
  2071. return hr;
  2072. }
  2073. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2074. //
  2075. // get_Origin
  2076. //
  2077. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2078. #ifdef NEWCALLINFO
  2079. HRESULT
  2080. #else
  2081. STDMETHODIMP
  2082. #endif
  2083. CCall::get_Origin(long * plOrigin )
  2084. {
  2085. HRESULT hr = S_OK;
  2086. LOG((TL_TRACE, "get_Origin - enter"));
  2087. if (TAPIIsBadWritePtr(plOrigin, sizeof(long) ) )
  2088. {
  2089. LOG((TL_ERROR, "get_Origin - bad pointer"));
  2090. return E_POINTER;
  2091. }
  2092. Lock();
  2093. hr = RefreshCallInfo();
  2094. if (!SUCCEEDED(hr))
  2095. {
  2096. LOG((TL_ERROR, "get_Origin - RefreshCallInfo failed - %lx", hr));
  2097. }
  2098. else
  2099. {
  2100. *plOrigin = m_pCallInfo->dwOrigin;
  2101. }
  2102. Unlock();
  2103. LOG((TL_TRACE, "get_Origin - exit"));
  2104. return hr;
  2105. }
  2106. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2107. //
  2108. // get_Reason
  2109. //
  2110. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2111. #ifdef NEWCALLINFO
  2112. HRESULT
  2113. #else
  2114. STDMETHODIMP
  2115. #endif
  2116. CCall::get_Reason(long * plReason )
  2117. {
  2118. HRESULT hr = S_OK;
  2119. LOG((TL_TRACE, "get_Reason - enter"));
  2120. if ( TAPIIsBadWritePtr( plReason , sizeof( plReason ) ) )
  2121. {
  2122. LOG((TL_ERROR, "get_Reason - bad pointer"));
  2123. return E_POINTER;
  2124. }
  2125. Lock();
  2126. hr = RefreshCallInfo();
  2127. if ( SUCCEEDED(hr) )
  2128. {
  2129. *plReason = m_pCallInfo->dwReason;
  2130. }
  2131. else
  2132. {
  2133. LOG((TL_ERROR, "get_Reason - linegetcallinfo failed - %lx", hr));
  2134. }
  2135. LOG((TL_TRACE, "get_Reason - exit"));
  2136. Unlock();
  2137. return hr;
  2138. }
  2139. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2140. //
  2141. // get_CallerIDName
  2142. //
  2143. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2144. #ifdef NEWCALLINFO
  2145. HRESULT
  2146. #else
  2147. STDMETHODIMP
  2148. #endif
  2149. CCall::get_CallerIDName(BSTR * ppCallerIDName )
  2150. {
  2151. HRESULT hr = S_OK;
  2152. LOG((TL_TRACE, "get_CallerIDName - enter"));
  2153. //
  2154. // validate pointer
  2155. //
  2156. if ( TAPIIsBadWritePtr( ppCallerIDName, sizeof(BSTR) ) )
  2157. {
  2158. LOG((TL_ERROR, "get_CallerIDName - bad pointer"));
  2159. return E_POINTER;
  2160. }
  2161. *ppCallerIDName = NULL;
  2162. Lock();
  2163. hr = RefreshCallInfo();
  2164. if ( !SUCCEEDED(hr) )
  2165. {
  2166. LOG((TL_ERROR, "get_CallerIDName - could not get callinfo"));
  2167. Unlock();
  2168. return hr;
  2169. }
  2170. //
  2171. // if info is available
  2172. //
  2173. if ( m_pCallInfo->dwCallerIDFlags & LINECALLPARTYID_NAME )
  2174. {
  2175. //
  2176. // return it
  2177. //
  2178. *ppCallerIDName = BSTRFromUnalingedData(
  2179. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwCallerIDNameOffset),
  2180. m_pCallInfo->dwCallerIDNameSize);
  2181. if ( NULL == *ppCallerIDName )
  2182. {
  2183. LOG((TL_ERROR, "get_CallerIDName - out of memory"));
  2184. Unlock();
  2185. return E_OUTOFMEMORY;
  2186. }
  2187. }
  2188. else
  2189. {
  2190. LOG((TL_INFO, "get_CallerIDName - no info avail"));
  2191. Unlock();
  2192. return E_FAIL;
  2193. }
  2194. Unlock();
  2195. LOG((TL_TRACE, "get_CallerIDName - exit"));
  2196. return hr;
  2197. }
  2198. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2199. //
  2200. // get_CallerIDNumber
  2201. //
  2202. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2203. #ifdef NEWCALLINFO
  2204. HRESULT
  2205. #else
  2206. STDMETHODIMP
  2207. #endif
  2208. CCall::get_CallerIDNumber(BSTR * ppCallerIDNumber )
  2209. {
  2210. HRESULT hr = S_OK;
  2211. LOG((TL_TRACE, "get_CallerIDNumber - enter"));
  2212. //
  2213. // validate pointer
  2214. //
  2215. if ( TAPIIsBadWritePtr( ppCallerIDNumber, sizeof(BSTR) ) )
  2216. {
  2217. LOG((TL_ERROR, "get_CallerIDNumber - bad pointer"));
  2218. return E_POINTER;
  2219. }
  2220. *ppCallerIDNumber = NULL;
  2221. Lock();
  2222. hr = RefreshCallInfo();
  2223. if ( !SUCCEEDED(hr) )
  2224. {
  2225. LOG((TL_ERROR, "get_CallerIDNumber - could not get callinfo"));
  2226. Unlock();
  2227. return hr;
  2228. }
  2229. //
  2230. // if info is available
  2231. //
  2232. if ( m_pCallInfo->dwCallerIDFlags & LINECALLPARTYID_ADDRESS )
  2233. {
  2234. //
  2235. // return it
  2236. //
  2237. *ppCallerIDNumber = BSTRFromUnalingedData(
  2238. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwCallerIDOffset),
  2239. m_pCallInfo->dwCallerIDSize);
  2240. if ( NULL == *ppCallerIDNumber )
  2241. {
  2242. LOG((TL_ERROR, "get_CallerIDNumber - out of memory"));
  2243. Unlock();
  2244. return E_OUTOFMEMORY;
  2245. }
  2246. }
  2247. else
  2248. {
  2249. LOG((TL_INFO, "get_CallerIDNumber - no info avail"));
  2250. Unlock();
  2251. return E_FAIL;
  2252. }
  2253. Unlock();
  2254. LOG((TL_TRACE, "get_CallerIDNumber - exit"));
  2255. return hr;
  2256. }
  2257. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2258. //
  2259. // get_CalledIDName
  2260. //
  2261. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2262. #ifdef NEWCALLINFO
  2263. HRESULT
  2264. #else
  2265. STDMETHODIMP
  2266. #endif
  2267. CCall::get_CalledIDName(BSTR * ppCalledIDName )
  2268. {
  2269. HRESULT hr = S_OK;
  2270. LOG((TL_TRACE, "get_CalledIDName - enter"));
  2271. //
  2272. // validate pointer
  2273. //
  2274. if ( TAPIIsBadWritePtr( ppCalledIDName, sizeof(BSTR) ) )
  2275. {
  2276. LOG((TL_ERROR, "get_CalledIDName - bad pointer"));
  2277. return E_POINTER;
  2278. }
  2279. *ppCalledIDName = NULL;
  2280. Lock();
  2281. hr = RefreshCallInfo();
  2282. if ( !SUCCEEDED(hr) )
  2283. {
  2284. LOG((TL_ERROR, "get_CalledIDName - could not get callinfo"));
  2285. Unlock();
  2286. return hr;
  2287. }
  2288. //
  2289. // if info is available
  2290. //
  2291. if ( m_pCallInfo->dwCalledIDFlags & LINECALLPARTYID_NAME )
  2292. {
  2293. //
  2294. // return it
  2295. //
  2296. *ppCalledIDName = BSTRFromUnalingedData(
  2297. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwCalledIDNameOffset),
  2298. m_pCallInfo->dwCalledIDNameSize );
  2299. if ( NULL == *ppCalledIDName )
  2300. {
  2301. LOG((TL_ERROR, "get_CalledIDName - out of memory"));
  2302. Unlock();
  2303. return E_OUTOFMEMORY;
  2304. }
  2305. }
  2306. else
  2307. {
  2308. LOG((TL_INFO, "get_CalledIDName - no info avail"));
  2309. Unlock();
  2310. return E_FAIL;
  2311. }
  2312. Unlock();
  2313. LOG((TL_TRACE, "get_CalledIDName - exit"));
  2314. return hr;
  2315. }
  2316. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2317. //
  2318. // get_CalledIDNumber
  2319. //
  2320. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2321. #ifdef NEWCALLINFO
  2322. HRESULT
  2323. #else
  2324. STDMETHODIMP
  2325. #endif
  2326. CCall::get_CalledIDNumber(BSTR * ppCalledIDNumber )
  2327. {
  2328. HRESULT hr = S_OK;
  2329. LOG((TL_TRACE, "get_CalledIDNumber - enter"));
  2330. //
  2331. // validate pointer
  2332. //
  2333. if ( TAPIIsBadWritePtr( ppCalledIDNumber, sizeof(BSTR) ) )
  2334. {
  2335. LOG((TL_ERROR, "get_CalledIDNumber - bad pointer"));
  2336. return E_POINTER;
  2337. }
  2338. *ppCalledIDNumber = NULL;
  2339. Lock();
  2340. hr = RefreshCallInfo();
  2341. if ( !SUCCEEDED(hr) )
  2342. {
  2343. LOG((TL_ERROR, "get_CalledIDNumber - could not get callinfo"));
  2344. Unlock();
  2345. return hr;
  2346. }
  2347. //
  2348. // if info is available
  2349. //
  2350. if ( m_pCallInfo->dwCalledIDFlags & LINECALLPARTYID_ADDRESS )
  2351. {
  2352. //
  2353. // return it
  2354. //
  2355. *ppCalledIDNumber = BSTRFromUnalingedData(
  2356. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwCalledIDOffset),
  2357. m_pCallInfo->dwCalledIDSize);
  2358. if ( NULL == *ppCalledIDNumber )
  2359. {
  2360. LOG((TL_ERROR, "get_CalledIDNumber - out of memory"));
  2361. Unlock();
  2362. return E_OUTOFMEMORY;
  2363. }
  2364. }
  2365. else
  2366. {
  2367. LOG((TL_INFO, "get_CalledIDNumber - no info avail"));
  2368. Unlock();
  2369. return E_FAIL;
  2370. }
  2371. Unlock();
  2372. LOG((TL_TRACE, "get_CalledIDNumber - exit"));
  2373. return hr;
  2374. }
  2375. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2376. //
  2377. // get_ConnectedIDName
  2378. //
  2379. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2380. #ifdef NEWCALLINFO
  2381. HRESULT
  2382. #else
  2383. STDMETHODIMP
  2384. #endif
  2385. CCall::get_ConnectedIDName(BSTR * ppConnectedIDName )
  2386. {
  2387. HRESULT hr = S_OK;
  2388. LOG((TL_TRACE, "get_ConnectedIDName - enter"));
  2389. //
  2390. // validate pointer
  2391. //
  2392. if ( TAPIIsBadWritePtr( ppConnectedIDName, sizeof(BSTR) ) )
  2393. {
  2394. LOG((TL_ERROR, "get_ConnectedIDName - bad pointer"));
  2395. return E_POINTER;
  2396. }
  2397. *ppConnectedIDName = NULL;
  2398. Lock();
  2399. hr = RefreshCallInfo();
  2400. if ( !SUCCEEDED(hr) )
  2401. {
  2402. LOG((TL_ERROR, "get_ConnectedIDName - could not get callinfo"));
  2403. Unlock();
  2404. return hr;
  2405. }
  2406. //
  2407. // if info is available
  2408. //
  2409. if ( m_pCallInfo->dwConnectedIDFlags & LINECALLPARTYID_NAME )
  2410. {
  2411. //
  2412. // return it
  2413. //
  2414. *ppConnectedIDName = BSTRFromUnalingedData(
  2415. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwConnectedIDNameOffset),
  2416. m_pCallInfo->dwConnectedIDNameSize );
  2417. if ( NULL == *ppConnectedIDName )
  2418. {
  2419. LOG((TL_ERROR, "get_ConnectedIDName - out of memory"));
  2420. Unlock();
  2421. return E_OUTOFMEMORY;
  2422. }
  2423. }
  2424. else
  2425. {
  2426. LOG((TL_INFO, "get_ConnectedIDName - no info avail"));
  2427. Unlock();
  2428. return E_FAIL;
  2429. }
  2430. Unlock();
  2431. LOG((TL_TRACE, "get_ConnectedIDName - exit"));
  2432. return hr;
  2433. }
  2434. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2435. //
  2436. // get_ConnectedIDNumber
  2437. //
  2438. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2439. #ifdef NEWCALLINFO
  2440. HRESULT
  2441. #else
  2442. STDMETHODIMP
  2443. #endif
  2444. CCall::get_ConnectedIDNumber(BSTR * ppConnectedIDNumber )
  2445. {
  2446. HRESULT hr = S_OK;
  2447. LOG((TL_TRACE, "get_ConnectedIDNumber - enter"));
  2448. //
  2449. // validate pointer
  2450. //
  2451. if ( TAPIIsBadWritePtr( ppConnectedIDNumber, sizeof(BSTR) ) )
  2452. {
  2453. LOG((TL_ERROR, "get_ConnectedIDNumber - bad pointer"));
  2454. return E_POINTER;
  2455. }
  2456. *ppConnectedIDNumber = NULL;
  2457. Lock();
  2458. hr = RefreshCallInfo();
  2459. if ( !SUCCEEDED(hr) )
  2460. {
  2461. LOG((TL_ERROR, "get_ConnectedIDNumber - could not get callinfo"));
  2462. Unlock();
  2463. return hr;
  2464. }
  2465. //
  2466. // if info is available
  2467. //
  2468. if ( m_pCallInfo->dwConnectedIDFlags & LINECALLPARTYID_ADDRESS )
  2469. {
  2470. //
  2471. // return it
  2472. //
  2473. *ppConnectedIDNumber = BSTRFromUnalingedData(
  2474. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwConnectedIDOffset),
  2475. m_pCallInfo->dwConnectedIDSize );
  2476. if ( NULL == *ppConnectedIDNumber )
  2477. {
  2478. LOG((TL_ERROR, "get_ConnectedIDNumber - out of memory"));
  2479. Unlock();
  2480. return E_OUTOFMEMORY;
  2481. }
  2482. }
  2483. else
  2484. {
  2485. LOG((TL_INFO, "get_ConnectedIDNumber - no info avail"));
  2486. Unlock();
  2487. return E_FAIL;
  2488. }
  2489. Unlock();
  2490. LOG((TL_TRACE, "get_ConnectedIDNumber - exit"));
  2491. return hr;
  2492. }
  2493. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2494. //
  2495. // get_RedirectionIDName
  2496. //
  2497. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2498. #ifdef NEWCALLINFO
  2499. HRESULT
  2500. #else
  2501. STDMETHODIMP
  2502. #endif
  2503. CCall::get_RedirectionIDName(BSTR * ppRedirectionIDName )
  2504. {
  2505. HRESULT hr = S_OK;
  2506. LOG((TL_TRACE, "get_RedirectionIDName - enter"));
  2507. //
  2508. // validate pointer
  2509. //
  2510. if ( TAPIIsBadWritePtr( ppRedirectionIDName, sizeof(BSTR) ) )
  2511. {
  2512. LOG((TL_ERROR, "get_RedirectionIDName - bad pointer"));
  2513. return E_POINTER;
  2514. }
  2515. *ppRedirectionIDName = NULL;
  2516. Lock();
  2517. hr = RefreshCallInfo();
  2518. if ( !SUCCEEDED(hr) )
  2519. {
  2520. LOG((TL_ERROR, "get_RedirectionIDName - could not get callinfo"));
  2521. Unlock();
  2522. return hr;
  2523. }
  2524. //
  2525. // if info is available
  2526. //
  2527. if ( m_pCallInfo->dwRedirectionIDFlags & LINECALLPARTYID_NAME )
  2528. {
  2529. //
  2530. // return it
  2531. //
  2532. *ppRedirectionIDName = BSTRFromUnalingedData(
  2533. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwRedirectionIDNameOffset),
  2534. m_pCallInfo->dwRedirectionIDNameSize);
  2535. if ( NULL == *ppRedirectionIDName )
  2536. {
  2537. LOG((TL_ERROR, "get_RedirectionIDName - out of memory"));
  2538. Unlock();
  2539. return E_OUTOFMEMORY;
  2540. }
  2541. }
  2542. else
  2543. {
  2544. LOG((TL_INFO, "get_RedirectionIDName - no info avail"));
  2545. Unlock();
  2546. return E_FAIL;
  2547. }
  2548. Unlock();
  2549. LOG((TL_TRACE, "get_RedirectionIDName - exit"));
  2550. return hr;
  2551. }
  2552. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2553. //
  2554. // get_RedirectionIDNumber
  2555. //
  2556. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2557. #ifdef NEWCALLINFO
  2558. HRESULT
  2559. #else
  2560. STDMETHODIMP
  2561. #endif
  2562. CCall::get_RedirectionIDNumber(BSTR * ppRedirectionIDNumber )
  2563. {
  2564. HRESULT hr = S_OK;
  2565. LOG((TL_TRACE, "get_RedirectionIDNumber - enter"));
  2566. //
  2567. // validate pointer
  2568. //
  2569. if ( TAPIIsBadWritePtr( ppRedirectionIDNumber, sizeof(BSTR) ) )
  2570. {
  2571. LOG((TL_ERROR, "get_RedirectionIDNumber - bad pointer"));
  2572. return E_POINTER;
  2573. }
  2574. *ppRedirectionIDNumber = NULL;
  2575. Lock();
  2576. hr = RefreshCallInfo();
  2577. if ( !SUCCEEDED(hr) )
  2578. {
  2579. LOG((TL_ERROR, "get_RedirectionIDNumber - could not get callinfo"));
  2580. Unlock();
  2581. return hr;
  2582. }
  2583. //
  2584. // if info is available
  2585. //
  2586. if ( m_pCallInfo->dwRedirectionIDFlags & LINECALLPARTYID_ADDRESS )
  2587. {
  2588. //
  2589. // return it
  2590. //
  2591. *ppRedirectionIDNumber = BSTRFromUnalingedData(
  2592. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwRedirectionIDOffset),
  2593. m_pCallInfo->dwRedirectionIDSize);
  2594. if ( NULL == *ppRedirectionIDNumber )
  2595. {
  2596. LOG((TL_ERROR, "get_RedirectionIDNumber - out of memory"));
  2597. Unlock();
  2598. return E_OUTOFMEMORY;
  2599. }
  2600. }
  2601. else
  2602. {
  2603. LOG((TL_INFO, "get_RedirectionIDNumber - no info avail"));
  2604. Unlock();
  2605. return E_FAIL;
  2606. }
  2607. Unlock();
  2608. LOG((TL_TRACE, "get_RedirectionIDNumber - exit"));
  2609. return hr;
  2610. }
  2611. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2612. //
  2613. // get_RedirectingIDName
  2614. //
  2615. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2616. #ifdef NEWCALLINFO
  2617. HRESULT
  2618. #else
  2619. STDMETHODIMP
  2620. #endif
  2621. CCall::get_RedirectingIDName(BSTR * ppRedirectingIDName )
  2622. {
  2623. HRESULT hr = S_OK;
  2624. LOG((TL_TRACE, "get_RedirectingIDName - enter"));
  2625. //
  2626. // validate pointer
  2627. //
  2628. if ( TAPIIsBadWritePtr( ppRedirectingIDName, sizeof(BSTR) ) )
  2629. {
  2630. LOG((TL_ERROR, "get_RedirectingIDName - bad pointer"));
  2631. return E_POINTER;
  2632. }
  2633. *ppRedirectingIDName = NULL;
  2634. Lock();
  2635. hr = RefreshCallInfo();
  2636. if ( !SUCCEEDED(hr) )
  2637. {
  2638. LOG((TL_ERROR, "get_RedirectingIDName - could not get callinfo"));
  2639. Unlock();
  2640. return hr;
  2641. }
  2642. //
  2643. // if info is available
  2644. //
  2645. if ( m_pCallInfo->dwRedirectingIDFlags & LINECALLPARTYID_NAME )
  2646. {
  2647. //
  2648. // return it
  2649. //
  2650. *ppRedirectingIDName = BSTRFromUnalingedData(
  2651. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwRedirectingIDNameOffset),
  2652. m_pCallInfo->dwRedirectingIDNameSize);
  2653. if ( NULL == *ppRedirectingIDName )
  2654. {
  2655. LOG((TL_ERROR, "get_RedirectingIDName - out of memory"));
  2656. Unlock();
  2657. return E_OUTOFMEMORY;
  2658. }
  2659. }
  2660. else
  2661. {
  2662. LOG((TL_INFO, "get_RedirectingIDName - no info avail"));
  2663. Unlock();
  2664. return E_FAIL;
  2665. }
  2666. Unlock();
  2667. LOG((TL_TRACE, "get_RedirectingIDName - exit"));
  2668. return hr;
  2669. }
  2670. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2671. //
  2672. // get_RedirectingIDNumber
  2673. //
  2674. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2675. #ifdef NEWCALLINFO
  2676. HRESULT
  2677. #else
  2678. STDMETHODIMP
  2679. #endif
  2680. CCall::get_RedirectingIDNumber(BSTR * ppRedirectingIDNumber )
  2681. {
  2682. HRESULT hr = S_OK;
  2683. LOG((TL_TRACE, "get_RedirectingIDNumber - enter"));
  2684. //
  2685. // validate pointer
  2686. //
  2687. if ( TAPIIsBadWritePtr( ppRedirectingIDNumber, sizeof(BSTR) ) )
  2688. {
  2689. LOG((TL_ERROR, "get_RedirectingIDNumber - bad pointer"));
  2690. return E_POINTER;
  2691. }
  2692. *ppRedirectingIDNumber = NULL;
  2693. Lock();
  2694. hr = RefreshCallInfo();
  2695. if ( !SUCCEEDED(hr) )
  2696. {
  2697. LOG((TL_ERROR, "get_RedirectingIDNumber - could not get callinfo"));
  2698. Unlock();
  2699. return hr;
  2700. }
  2701. //
  2702. // if info is available
  2703. //
  2704. if ( m_pCallInfo->dwRedirectingIDFlags & LINECALLPARTYID_ADDRESS )
  2705. {
  2706. //
  2707. // return it
  2708. //
  2709. *ppRedirectingIDNumber = BSTRFromUnalingedData(
  2710. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwRedirectingIDOffset),
  2711. m_pCallInfo->dwRedirectingIDSize );
  2712. if ( NULL == *ppRedirectingIDNumber )
  2713. {
  2714. LOG((TL_ERROR, "get_RedirectingIDNumber - out of memory"));
  2715. Unlock();
  2716. return E_OUTOFMEMORY;
  2717. }
  2718. }
  2719. else
  2720. {
  2721. LOG((TL_INFO, "get_RedirectingIDNumber - no info avail"));
  2722. Unlock();
  2723. return E_FAIL;
  2724. }
  2725. Unlock();
  2726. LOG((TL_TRACE, "get_RedirectingIDNumber - exit"));
  2727. return hr;
  2728. }
  2729. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2730. //
  2731. // get_CalledPartyFriendlyName
  2732. //
  2733. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2734. #ifdef NEWCALLINFO
  2735. HRESULT
  2736. #else
  2737. STDMETHODIMP
  2738. #endif
  2739. CCall::get_CalledPartyFriendlyName(BSTR * ppCalledPartyFriendlyName )
  2740. {
  2741. HRESULT hr = S_OK;
  2742. LOG((TL_TRACE, "get_CalledPartyFriendlyName - enter"));
  2743. if ( TAPIIsBadWritePtr( ppCalledPartyFriendlyName, sizeof (BSTR) ) )
  2744. {
  2745. LOG((TL_ERROR, "get_CalledPartyFriendlyName - badpointer"));
  2746. return E_POINTER;
  2747. }
  2748. *ppCalledPartyFriendlyName = NULL;
  2749. Lock();
  2750. if ( ISHOULDUSECALLPARAMS() )
  2751. {
  2752. if ( 0 != m_pCallParams->dwCalledPartyOffset )
  2753. {
  2754. *ppCalledPartyFriendlyName = BSTRFromUnalingedData(
  2755. (((PBYTE)m_pCallParams) + m_pCallParams->dwCalledPartyOffset),
  2756. m_pCallParams->dwCalledPartySize );
  2757. if ( NULL == *ppCalledPartyFriendlyName )
  2758. {
  2759. Unlock();
  2760. LOG((TL_ERROR, "get_CalledPartyFriendlyName - out of memory 1"));
  2761. return E_OUTOFMEMORY;
  2762. }
  2763. Unlock();
  2764. return S_OK;
  2765. }
  2766. else
  2767. {
  2768. LOG((TL_ERROR, "get_CalledPartyFriendlyName - not available"));
  2769. Unlock();
  2770. return S_FALSE;
  2771. }
  2772. }
  2773. hr = RefreshCallInfo();
  2774. if ( !SUCCEEDED(hr) )
  2775. {
  2776. LOG((TL_ERROR, "get_CalledPartyFriendlyName - can't get callinfo - %lx", hr));
  2777. Unlock();
  2778. return hr;
  2779. }
  2780. if ( ( 0 != m_pCallInfo->dwCalledPartyOffset ) &&
  2781. ( 0 != m_pCallInfo->dwCalledPartySize ) )
  2782. {
  2783. //
  2784. // allocated bstr from the data
  2785. //
  2786. *ppCalledPartyFriendlyName = BSTRFromUnalingedData(
  2787. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwCalledPartyOffset),
  2788. m_pCallInfo->dwCalledPartySize);
  2789. if ( NULL == *ppCalledPartyFriendlyName )
  2790. {
  2791. LOG((TL_ERROR, "get_CalledPartyFriendlyName - out of memory"));
  2792. Unlock();
  2793. return E_OUTOFMEMORY;
  2794. }
  2795. }
  2796. else
  2797. {
  2798. LOG((TL_ERROR, "get_CalledPartyFriendlyName2 - not available"));
  2799. Unlock();
  2800. return S_FALSE;
  2801. }
  2802. Unlock();
  2803. LOG((TL_TRACE, "get_CalledPartyFriendlyName - exit"));
  2804. return hr;
  2805. }
  2806. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  2807. //
  2808. // put_CalledPartyFriendlyName
  2809. //
  2810. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  2811. #ifdef NEWCALLINFO
  2812. HRESULT
  2813. #else
  2814. STDMETHODIMP
  2815. #endif
  2816. CCall::put_CalledPartyFriendlyName(
  2817. BSTR pCalledPartyFriendlyName
  2818. )
  2819. {
  2820. HRESULT hr;
  2821. DWORD dw;
  2822. if ( IsBadStringPtrW( pCalledPartyFriendlyName, -1 ) )
  2823. {
  2824. LOG((TL_ERROR, "put_CalledPartyFriendlyName - bad pointer"));
  2825. return E_POINTER;
  2826. }
  2827. dw = ( lstrlenW( pCalledPartyFriendlyName ) + 1 ) * sizeof (WCHAR) ;
  2828. Lock();
  2829. if ( !ISHOULDUSECALLPARAMS() )
  2830. {
  2831. LOG((TL_ERROR, "put_CalledPartyFriendlyName - can only be called before connect"));
  2832. Unlock();
  2833. return TAPI_E_INVALCALLSTATE;
  2834. }
  2835. hr = ResizeCallParams( dw );
  2836. if ( !SUCCEEDED(hr) )
  2837. {
  2838. LOG((TL_ERROR, "put_CalledPartyFriendlyName - can't resize cp - %lx", hr));
  2839. Unlock();
  2840. return hr;
  2841. }
  2842. //
  2843. // copy string (as bytes to avoid alignment faults under 64 bit)
  2844. //
  2845. CopyMemory( (BYTE*) m_pCallParams + m_dwCallParamsUsedSize,
  2846. pCalledPartyFriendlyName,
  2847. dw );
  2848. m_pCallParams->dwCalledPartySize = dw;
  2849. m_pCallParams->dwCalledPartyOffset = m_dwCallParamsUsedSize;
  2850. m_dwCallParamsUsedSize += dw;
  2851. Unlock();
  2852. return S_OK;
  2853. }
  2854. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2855. //
  2856. // get_Comment
  2857. //
  2858. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2859. #ifdef NEWCALLINFO
  2860. HRESULT
  2861. #else
  2862. STDMETHODIMP
  2863. #endif
  2864. CCall::get_Comment( BSTR * ppComment )
  2865. {
  2866. HRESULT hr = S_OK;
  2867. LOG((TL_TRACE, "get_Comment - enter"));
  2868. if ( TAPIIsBadWritePtr( ppComment, sizeof (BSTR) ) )
  2869. {
  2870. LOG((TL_ERROR, "get_Comment - badpointer"));
  2871. return E_POINTER;
  2872. }
  2873. *ppComment = NULL;
  2874. Lock();
  2875. if ( ISHOULDUSECALLPARAMS() )
  2876. {
  2877. if ( 0 != m_pCallParams->dwCommentOffset )
  2878. {
  2879. *ppComment = BSTRFromUnalingedData(
  2880. (((LPBYTE)m_pCallParams) + m_pCallParams->dwCommentOffset),
  2881. m_pCallParams->dwCommentSize );
  2882. if ( NULL == *ppComment )
  2883. {
  2884. Unlock();
  2885. LOG((TL_ERROR, "get_Comment - out of memory 1"));
  2886. return E_OUTOFMEMORY;
  2887. }
  2888. Unlock();
  2889. return S_OK;
  2890. }
  2891. else
  2892. {
  2893. LOG((TL_ERROR, "get_Comment1 - not available"));
  2894. Unlock();
  2895. return S_FALSE;
  2896. }
  2897. }
  2898. hr = RefreshCallInfo();
  2899. if ( !SUCCEEDED(hr) )
  2900. {
  2901. LOG((TL_ERROR, "get_Comment - can't get callinfo - %lx", hr));
  2902. Unlock();
  2903. return hr;
  2904. }
  2905. if ( ( 0 != m_pCallInfo->dwCommentSize ) &&
  2906. ( 0 != m_pCallInfo->dwCommentOffset ) )
  2907. {
  2908. *ppComment = BSTRFromUnalingedData(
  2909. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwCommentOffset),
  2910. m_pCallInfo->dwCommentSize );
  2911. if ( NULL == *ppComment )
  2912. {
  2913. LOG((TL_ERROR, "get_Comment - out of memory"));
  2914. Unlock();
  2915. return E_OUTOFMEMORY;
  2916. }
  2917. }
  2918. else
  2919. {
  2920. LOG((TL_ERROR, "get_Comment - not available"));
  2921. Unlock();
  2922. return S_FALSE;
  2923. }
  2924. Unlock();
  2925. LOG((TL_TRACE, "get_Comment - exit"));
  2926. return hr;
  2927. }
  2928. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  2929. //
  2930. // put_Comment
  2931. //
  2932. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  2933. #ifdef NEWCALLINFO
  2934. HRESULT
  2935. #else
  2936. STDMETHODIMP
  2937. #endif
  2938. CCall::put_Comment( BSTR pComment )
  2939. {
  2940. HRESULT hr;
  2941. DWORD dw;
  2942. if ( IsBadStringPtrW( pComment, -1 ) )
  2943. {
  2944. LOG((TL_ERROR, "put_Comment - bad pointer"));
  2945. return E_POINTER;
  2946. }
  2947. dw = ( lstrlenW( pComment ) + 1 ) * sizeof (WCHAR) ;
  2948. Lock();
  2949. if ( !ISHOULDUSECALLPARAMS() )
  2950. {
  2951. LOG((TL_ERROR, "put_Comment - can only be called before connect"));
  2952. Unlock();
  2953. return TAPI_E_INVALCALLSTATE;
  2954. }
  2955. hr = ResizeCallParams( dw );
  2956. if ( !SUCCEEDED(hr) )
  2957. {
  2958. LOG((TL_ERROR, "put_Comment - can't resize cp - %lx", hr));
  2959. Unlock();
  2960. return hr;
  2961. }
  2962. //
  2963. // do a byte-wise copy to avoid alignment faults under 64 bit platform
  2964. //
  2965. CopyMemory( (BYTE*) m_pCallParams + m_dwCallParamsUsedSize,
  2966. pComment,
  2967. dw );
  2968. m_pCallParams->dwCommentSize = dw;
  2969. m_pCallParams->dwCommentOffset = m_dwCallParamsUsedSize;
  2970. m_dwCallParamsUsedSize += dw;
  2971. Unlock();
  2972. return S_OK;
  2973. }
  2974. #ifndef NEWCALLINFO
  2975. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2976. //
  2977. // GetUserUserInfoSize
  2978. //
  2979. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2980. STDMETHODIMP
  2981. CCall::GetUserUserInfoSize(long * plSize )
  2982. {
  2983. HRESULT hr = S_OK;
  2984. LOG((TL_TRACE, "get_UserUserInfoSize - enter"));
  2985. if ( TAPIIsBadWritePtr( plSize, sizeof( long ) ) )
  2986. {
  2987. LOG((TL_ERROR, "get_UserUserInfoSize - bad pointer"));
  2988. return E_POINTER;
  2989. }
  2990. Lock();
  2991. if ( ISHOULDUSECALLPARAMS() )
  2992. {
  2993. *plSize = m_pCallParams->dwUserUserInfoSize;
  2994. Unlock();
  2995. return S_OK;
  2996. }
  2997. hr = RefreshCallInfo();
  2998. if ( !SUCCEEDED(hr) )
  2999. {
  3000. LOG((TL_ERROR, "get_UserUserInfoSize - can't get callinfo - %lx", hr));
  3001. Unlock();
  3002. return hr;
  3003. }
  3004. *plSize = m_pCallInfo->dwUserUserInfoSize;
  3005. Unlock();
  3006. LOG((TL_TRACE, "get_UserUserInfoSize - exit"));
  3007. return hr;
  3008. }
  3009. #endif
  3010. #ifndef NEWCALLINFO
  3011. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3012. //
  3013. // GetUserUserInfo
  3014. //
  3015. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3016. STDMETHODIMP
  3017. CCall::GetUserUserInfo(
  3018. long lSize,
  3019. BYTE * pBuffer
  3020. )
  3021. {
  3022. HRESULT hr = S_OK;
  3023. LOG((TL_TRACE, "GetUserUserInfo - enter"));
  3024. if (lSize == 0)
  3025. {
  3026. LOG((TL_ERROR, "GetUserUserInfo - lSize = 0"));
  3027. return S_FALSE;
  3028. }
  3029. if (TAPIIsBadWritePtr( pBuffer, lSize ) )
  3030. {
  3031. LOG((TL_ERROR, "GetUserUserInfo - bad pointer"));
  3032. return E_POINTER;
  3033. }
  3034. Lock();
  3035. if ( ISHOULDUSECALLPARAMS() )
  3036. {
  3037. if ( 0 == m_pCallParams->dwUserUserInfoSize )
  3038. {
  3039. *pBuffer = NULL;
  3040. }
  3041. else
  3042. {
  3043. if ( lSize < m_pCallParams->dwUserUserInfoSize )
  3044. {
  3045. LOG((TL_ERROR, "GetUserUserInfo - lSize not big enough"));
  3046. Unlock();
  3047. return E_INVALIDARG;
  3048. }
  3049. CopyMemory(
  3050. pBuffer,
  3051. ((PBYTE)m_pCallParams) + m_pCallParams->dwUserUserInfoOffset,
  3052. m_pCallParams->dwUserUserInfoSize
  3053. );
  3054. }
  3055. Unlock();
  3056. return hr;
  3057. }
  3058. hr = RefreshCallInfo();
  3059. if (!SUCCEEDED(hr))
  3060. {
  3061. LOG((TL_ERROR, "GetUserUserInfo - can't get callinfo - %lx", hr));
  3062. Unlock();
  3063. return hr;
  3064. }
  3065. if ( lSize < m_pCallInfo->dwUserUserInfoSize )
  3066. {
  3067. Unlock();
  3068. LOG((TL_ERROR, "GetUserUserInfo - buffer not big enough"));
  3069. return E_INVALIDARG;
  3070. }
  3071. CopyMemory(
  3072. pBuffer,
  3073. ( (PBYTE)m_pCallInfo ) + m_pCallInfo->dwUserUserInfoOffset,
  3074. m_pCallInfo->dwUserUserInfoSize
  3075. );
  3076. Unlock();
  3077. LOG((TL_TRACE, "GetUserUserInfo - exit"));
  3078. return S_OK;
  3079. }
  3080. #endif
  3081. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3082. //
  3083. // GetUserUserInfo
  3084. //
  3085. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3086. #ifdef NEWCALLINFO
  3087. HRESULT
  3088. CCall::GetUserUserInfo(
  3089. DWORD * pdwSize,
  3090. BYTE ** ppBuffer
  3091. )
  3092. {
  3093. HRESULT hr = S_OK;
  3094. LOG((TL_TRACE, "GetUserUserInfo - enter"));
  3095. if (TAPIIsBadWritePtr(pdwSize, sizeof(DWORD)))
  3096. {
  3097. LOG((TL_ERROR, "GetUserUserInfo - bad size pointer"));
  3098. return E_POINTER;
  3099. }
  3100. if (TAPIIsBadWritePtr(ppBuffer,sizeof(BYTE*) ) )
  3101. {
  3102. LOG((TL_ERROR, "GetUserUserInfo - bad buffer pointer"));
  3103. return E_POINTER;
  3104. }
  3105. *ppBuffer = NULL;
  3106. *pdwSize = 0;
  3107. Lock();
  3108. if ( ISHOULDUSECALLPARAMS() )
  3109. {
  3110. if ( m_pCallParams->dwUserUserInfoSize != 0 )
  3111. {
  3112. BYTE * pTemp;
  3113. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallParams->dwUserUserInfoSize );
  3114. if ( NULL == pTemp )
  3115. {
  3116. LOG((TL_ERROR, "GetUserUserInfo - out of memory"));
  3117. hr = E_OUTOFMEMORY;
  3118. }
  3119. else
  3120. {
  3121. CopyMemory(
  3122. pTemp,
  3123. ((PBYTE)m_pCallParams) + m_pCallParams->dwUserUserInfoOffset,
  3124. m_pCallParams->dwUserUserInfoSize
  3125. );
  3126. *ppBuffer = pTemp;
  3127. *pdwSize = m_pCallParams->dwUserUserInfoSize;
  3128. }
  3129. }
  3130. Unlock();
  3131. return S_OK;
  3132. }
  3133. hr = RefreshCallInfo();
  3134. if (!SUCCEEDED(hr))
  3135. {
  3136. LOG((TL_ERROR, "GetUserUserInfo - can't get callinfo - %lx", hr));
  3137. Unlock();
  3138. return hr;
  3139. }
  3140. hr = S_OK;
  3141. if ( m_pCallInfo->dwUserUserInfoSize != 0 )
  3142. {
  3143. BYTE * pTemp;
  3144. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallInfo->dwUserUserInfoSize );
  3145. if ( NULL == pTemp )
  3146. {
  3147. LOG((TL_ERROR, "GetUserUserInfo - out of memory"));
  3148. hr = E_OUTOFMEMORY;
  3149. }
  3150. else
  3151. {
  3152. CopyMemory(
  3153. pTemp,
  3154. ( (PBYTE)m_pCallInfo ) + m_pCallInfo->dwUserUserInfoOffset,
  3155. m_pCallInfo->dwUserUserInfoSize
  3156. );
  3157. *ppBuffer = pTemp;
  3158. *pdwSize = m_pCallInfo->dwUserUserInfoSize;
  3159. }
  3160. }
  3161. Unlock();
  3162. LOG((TL_TRACE, "GetUserUserInfo - exit"));
  3163. return hr;
  3164. }
  3165. #endif
  3166. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3167. //
  3168. // SetUserUserInfo
  3169. //
  3170. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3171. #ifdef NEWCALLINFO
  3172. HRESULT
  3173. #else
  3174. STDMETHODIMP
  3175. #endif
  3176. CCall::SetUserUserInfo(
  3177. long lSize,
  3178. BYTE * pBuffer
  3179. )
  3180. {
  3181. HRESULT hr;
  3182. HCALL hCall;
  3183. CALL_STATE cs;
  3184. LOG((TL_TRACE, "SetUserUserInfo - enter"));
  3185. Lock();
  3186. cs = m_CallState;
  3187. hCall = m_t3Call.hCall;
  3188. if ( CS_IDLE != cs )
  3189. {
  3190. Unlock();
  3191. hr = SendUserUserInfo( hCall, lSize, pBuffer );
  3192. }
  3193. else
  3194. {
  3195. hr = SaveUserUserInfo( lSize, pBuffer );
  3196. Unlock();
  3197. }
  3198. LOG((TL_TRACE, "SetUserUserInfo - exit - return %lx", hr));
  3199. return hr;
  3200. }
  3201. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3202. //
  3203. // put_UserUserInfo
  3204. //
  3205. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3206. #ifdef NEWCALLINFO
  3207. HRESULT
  3208. #else
  3209. STDMETHODIMP
  3210. #endif
  3211. CCall::put_UserUserInfo( VARIANT UUI )
  3212. {
  3213. HRESULT hr;
  3214. DWORD dwSize;
  3215. PBYTE pBuffer;
  3216. LOG((TL_TRACE, "put_UserUserInfo - enter"));
  3217. hr = MakeBufferFromVariant(
  3218. UUI,
  3219. &dwSize,
  3220. &pBuffer
  3221. );
  3222. if (!SUCCEEDED(hr))
  3223. {
  3224. LOG((TL_ERROR, "put_UUI - MakeBuffer failed - %lx", hr));
  3225. return hr;
  3226. }
  3227. hr = SetUserUserInfo( dwSize, pBuffer );
  3228. ClientFree( pBuffer );
  3229. LOG((TL_TRACE, "put_UserUserInfo - exit - return %lx", hr));
  3230. return hr;
  3231. }
  3232. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3233. //
  3234. // get_UserUserInfo
  3235. //
  3236. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3237. #ifdef NEWCALLINFO
  3238. HRESULT
  3239. CCall::get_UserUserInfo( VARIANT * pUUI )
  3240. {
  3241. HRESULT hr;
  3242. DWORD dw = 0;
  3243. BYTE * pBuffer = NULL;
  3244. LOG((TL_TRACE, "get_UserUserInfo - enter"));
  3245. if ( TAPIIsBadWritePtr( pUUI, sizeof( VARIANT ) ) )
  3246. {
  3247. LOG((TL_ERROR, "get_UserUserInfo - bad pointer"));
  3248. return E_POINTER;
  3249. }
  3250. pUUI->vt = VT_EMPTY;
  3251. hr = GetUserUserInfo( &dw, &pBuffer );
  3252. if ( !SUCCEEDED(hr) )
  3253. {
  3254. LOG((TL_ERROR, "get_UUI - GetUUI failed %lx", hr));
  3255. ClientFree( pBuffer );
  3256. return hr;
  3257. }
  3258. hr = FillVariantFromBuffer( dw, pBuffer, pUUI );
  3259. if ( 0 != dw )
  3260. {
  3261. CoTaskMemFree( pBuffer );
  3262. }
  3263. LOG((TL_TRACE, "get_UserUserInfo - exit - return %lx", hr));
  3264. return hr;
  3265. }
  3266. #else
  3267. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3268. //
  3269. // get_UserUserInfo
  3270. //
  3271. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3272. STDMETHODIMP
  3273. CCall::get_UserUserInfo( VARIANT * pUUI )
  3274. {
  3275. HRESULT hr;
  3276. DWORD dw;
  3277. BYTE * pBuffer;
  3278. LOG((TL_TRACE, "get_UserUserInfo - enter"));
  3279. if ( TAPIIsBadWritePtr( pUUI, sizeof( VARIANT ) ) )
  3280. {
  3281. LOG((TL_ERROR, "get_UserUserInfo - bad pointer"));
  3282. return E_POINTER;
  3283. }
  3284. pUUI->vt = VT_EMPTY;
  3285. hr = GetUserUserInfoSize( (long *)&dw );
  3286. if ( !SUCCEEDED(hr) )
  3287. {
  3288. LOG((TL_TRACE, "get_UserUserInfo - GetUUISize failed %lx", hr));
  3289. return hr;
  3290. }
  3291. if ( 0 != dw )
  3292. {
  3293. pBuffer = (PBYTE)ClientAlloc( dw );
  3294. if ( NULL == pBuffer )
  3295. {
  3296. LOG((TL_ERROR, "get_useruserinfo - alloc failed"));
  3297. return E_OUTOFMEMORY;
  3298. }
  3299. hr = GetUserUserInfo( dw, pBuffer );
  3300. if ( !SUCCEEDED(hr) )
  3301. {
  3302. LOG((TL_ERROR, "get_UUI - GetUUI failed %lx", hr));
  3303. ClientFree( pBuffer );
  3304. return hr;
  3305. }
  3306. }
  3307. hr = FillVariantFromBuffer( dw, pBuffer, pUUI );
  3308. if ( 0 != dw )
  3309. {
  3310. ClientFree( pBuffer );
  3311. }
  3312. LOG((TL_TRACE, "get_UserUserInfo - exit - return %lx", hr));
  3313. return hr;
  3314. }
  3315. #endif
  3316. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3317. //
  3318. // ReleaseUserUserInfo
  3319. //
  3320. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3321. STDMETHODIMP
  3322. CCall::ReleaseUserUserInfo()
  3323. {
  3324. HRESULT hr;
  3325. HCALL hCall;
  3326. LOG((TL_TRACE, "ReleaseUserUserInfo - enter"));
  3327. Lock();
  3328. hCall = m_t3Call.hCall;
  3329. Unlock();
  3330. hr = LineReleaseUserUserInfo(
  3331. hCall
  3332. );
  3333. if (((LONG)hr) < 0)
  3334. {
  3335. LOG((TL_ERROR, "LineReleaseUserUserInfo failed - %lx", hr));
  3336. return hr;
  3337. }
  3338. hr = WaitForReply( hr );
  3339. LOG((TL_TRACE, "ReleaseUserUserInfo - exit"));
  3340. return hr;
  3341. }
  3342. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3343. //
  3344. // get_AppSpecific
  3345. //
  3346. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3347. #ifdef NEWCALLINFO
  3348. HRESULT
  3349. #else
  3350. STDMETHODIMP
  3351. #endif
  3352. CCall::get_AppSpecific(long * plAppSpecific )
  3353. {
  3354. HRESULT hr = S_OK;
  3355. LOG((TL_TRACE, "get_AppSpecific - enter"));
  3356. if ( TAPIIsBadWritePtr( plAppSpecific, sizeof( long ) ) )
  3357. {
  3358. LOG((TL_ERROR, "get_AppSpecific - bad pointer"));
  3359. return E_POINTER;
  3360. }
  3361. Lock();
  3362. hr = RefreshCallInfo();
  3363. if ( !SUCCEEDED(hr) )
  3364. {
  3365. Unlock();
  3366. LOG((TL_ERROR, "get_AppSpecific - can't get callinf - %lx", hr));
  3367. return hr;
  3368. }
  3369. *plAppSpecific = m_pCallInfo->dwAppSpecific;
  3370. Unlock();
  3371. LOG((TL_TRACE, "get_AppSpecific - exit"));
  3372. return S_OK;
  3373. }
  3374. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3375. //
  3376. // put_AppSpecific
  3377. //
  3378. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3379. #ifdef NEWCALLINFO
  3380. HRESULT
  3381. #else
  3382. STDMETHODIMP
  3383. #endif
  3384. CCall::put_AppSpecific( long lAppSpecific )
  3385. {
  3386. HRESULT hr = S_OK;
  3387. HCALL hCall;
  3388. LOG((TL_TRACE, "put_AppSpecific - enter"));
  3389. Lock();
  3390. //
  3391. // this can only be done if we own the call.
  3392. //
  3393. if (CP_OWNER != m_CallPrivilege)
  3394. {
  3395. Unlock();
  3396. LOG((TL_ERROR,
  3397. "put_AppSpecific - not call's owner. returning TAPI_E_NOTOWNER"));
  3398. return TAPI_E_NOTOWNER;
  3399. }
  3400. hCall = m_t3Call.hCall;
  3401. Unlock();
  3402. //
  3403. // we also need to have a call handle before we can linesetappspecific
  3404. //
  3405. if ( hCall != NULL )
  3406. {
  3407. hr = LineSetAppSpecific(
  3408. hCall,
  3409. lAppSpecific
  3410. );
  3411. }
  3412. else
  3413. {
  3414. LOG((TL_ERROR,
  3415. "put_AppSpecific - Can't set app specific until call is made"));
  3416. hr = TAPI_E_INVALCALLSTATE;
  3417. }
  3418. LOG((TL_TRACE, "put_AppSpecific - exit. hr = %lx", hr));
  3419. return hr;
  3420. }
  3421. #ifdef NEWCALLINFO
  3422. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3423. //
  3424. // GetDevSpecificBuffer
  3425. //
  3426. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3427. HRESULT
  3428. CCall::GetDevSpecificBuffer(
  3429. DWORD * pdwSize,
  3430. BYTE ** ppDevSpecificBuffer
  3431. )
  3432. {
  3433. HRESULT hr = S_OK;
  3434. LOG((TL_TRACE, "GetDevSpecificBuffer - enter"));
  3435. if (TAPIIsBadWritePtr( pdwSize, sizeof(DWORD) ) )
  3436. {
  3437. LOG((TL_ERROR, "GetDevSpecificBuffer - bad dword pointer"));
  3438. return E_POINTER;
  3439. }
  3440. if ( TAPIIsBadWritePtr ( ppDevSpecificBuffer, sizeof(BYTE*) ) )
  3441. {
  3442. LOG((TL_ERROR, "GetDevSpecificBuffer - bad pointer"));
  3443. return E_POINTER;
  3444. }
  3445. *pdwSize = 0;
  3446. *ppDevSpecificBuffer = NULL;
  3447. Lock();
  3448. if ( ISHOULDUSECALLPARAMS() )
  3449. {
  3450. if ( 0 != m_pCallParams->dwDevSpecificSize )
  3451. {
  3452. BYTE * pTemp;
  3453. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallParams->dwDevSpecificSize );
  3454. if ( NULL == pTemp )
  3455. {
  3456. LOG((TL_ERROR, "GetDevSpecificBuffer - out of memory"));
  3457. hr = E_OUTOFMEMORY;
  3458. }
  3459. else
  3460. {
  3461. CopyMemory(
  3462. pTemp,
  3463. ((PBYTE)m_pCallParams) + m_pCallParams->dwDevSpecificOffset,
  3464. m_pCallParams->dwDevSpecificSize
  3465. );
  3466. *ppDevSpecificBuffer = pTemp;
  3467. *pdwSize = m_pCallParams->dwDevSpecificSize;
  3468. }
  3469. }
  3470. Unlock();
  3471. return hr;
  3472. }
  3473. hr = RefreshCallInfo();
  3474. if ( !SUCCEEDED(hr) )
  3475. {
  3476. LOG((TL_ERROR, "GetDevSpecificBuffer - can't get callinf - %lx", hr));
  3477. Unlock();
  3478. return hr;
  3479. }
  3480. hr = S_OK;
  3481. if ( 0 != m_pCallInfo->dwDevSpecificSize )
  3482. {
  3483. BYTE * pTemp;
  3484. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallInfo->dwDevSpecificSize );
  3485. if ( NULL == pTemp )
  3486. {
  3487. LOG((TL_ERROR, "GetDevSpecificBuffer - out of memory"));
  3488. hr = E_OUTOFMEMORY;
  3489. }
  3490. else
  3491. {
  3492. CopyMemory(
  3493. pTemp,
  3494. ( (PBYTE) m_pCallInfo ) + m_pCallInfo->dwDevSpecificOffset,
  3495. m_pCallInfo->dwDevSpecificSize
  3496. );
  3497. *ppDevSpecificBuffer = pTemp;
  3498. *pdwSize = m_pCallInfo->dwDevSpecificSize;
  3499. }
  3500. }
  3501. Unlock();
  3502. LOG((TL_TRACE, "get_DevSpecificBuffer - exit"));
  3503. return hr;
  3504. }
  3505. #endif
  3506. #ifndef NEWCALLINFO
  3507. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3508. //
  3509. // GetDevSpecificBuffer
  3510. //
  3511. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3512. STDMETHODIMP
  3513. CCall::GetDevSpecificBuffer(
  3514. long lSize,
  3515. BYTE * pDevSpecificBuffer
  3516. )
  3517. {
  3518. HRESULT hr = S_OK;
  3519. LOG((TL_TRACE, "GetDevSpecificBuffer - enter"));
  3520. if (lSize == 0)
  3521. {
  3522. LOG((TL_ERROR, "GetDevSpecificBuffer - lSize = 0"));
  3523. return S_FALSE;
  3524. }
  3525. if ( TAPIIsBadWritePtr ( pDevSpecificBuffer, lSize ) )
  3526. {
  3527. LOG((TL_ERROR, "GetDevSpecificBuffer - bad pointer"));
  3528. return E_POINTER;
  3529. }
  3530. Lock();
  3531. if ( ISHOULDUSECALLPARAMS() )
  3532. {
  3533. if ( 0 != m_pCallParams->dwDevSpecificSize )
  3534. {
  3535. if ( lSize < m_pCallParams->dwDevSpecificSize )
  3536. {
  3537. LOG((TL_ERROR, "GetDevSpecificBuffer - too small"));
  3538. hr = E_INVALIDARG;
  3539. }
  3540. else
  3541. {
  3542. CopyMemory(
  3543. pDevSpecificBuffer,
  3544. ((PBYTE)m_pCallParams) + m_pCallParams->dwDevSpecificOffset,
  3545. m_pCallParams->dwDevSpecificSize
  3546. );
  3547. }
  3548. }
  3549. else
  3550. {
  3551. *pDevSpecificBuffer = 0;
  3552. }
  3553. Unlock();
  3554. return hr;
  3555. }
  3556. hr = RefreshCallInfo();
  3557. if ( !SUCCEEDED(hr) )
  3558. {
  3559. LOG((TL_ERROR, "GetDevSpecificBuffer - can't get callinf - %lx", hr));
  3560. Unlock();
  3561. return hr;
  3562. }
  3563. if ( m_pCallInfo->dwDevSpecificSize > lSize )
  3564. {
  3565. LOG((TL_ERROR, "get_DevSpecificBuffer - size not big enough "));
  3566. Unlock();
  3567. return E_INVALIDARG;
  3568. }
  3569. CopyMemory(
  3570. pDevSpecificBuffer,
  3571. ( (PBYTE) m_pCallInfo ) + m_pCallInfo->dwDevSpecificOffset,
  3572. m_pCallInfo->dwDevSpecificSize
  3573. );
  3574. Unlock();
  3575. LOG((TL_TRACE, "get_DevSpecificBuffer - exit"));
  3576. return S_OK;
  3577. }
  3578. #endif
  3579. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3580. //
  3581. // SetDevSpecificBuffer
  3582. //
  3583. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3584. #ifdef NEWCALLINFO
  3585. HRESULT
  3586. #else
  3587. STDMETHODIMP
  3588. #endif
  3589. CCall::SetDevSpecificBuffer(
  3590. long lSize,
  3591. BYTE * pBuffer
  3592. )
  3593. {
  3594. HRESULT hr = S_OK;
  3595. LOG((TL_TRACE, "SetDevSpecificBuffer - enter"));
  3596. if (IsBadReadPtr( pBuffer, lSize) )
  3597. {
  3598. LOG((TL_ERROR, "SetDevSpecificBuffer - bad pointer"));
  3599. return E_POINTER;
  3600. }
  3601. Lock();
  3602. if ( !ISHOULDUSECALLPARAMS() )
  3603. {
  3604. LOG((TL_ERROR, "SetDevSpecificBuffer - only when call is idle"));
  3605. Unlock();
  3606. return TAPI_E_INVALCALLSTATE;
  3607. }
  3608. hr = ResizeCallParams( lSize );
  3609. if ( !SUCCEEDED(hr) )
  3610. {
  3611. LOG((TL_ERROR, "SetDevSpecificBuffer - can't resize callparams - %lx", hr));
  3612. Unlock();
  3613. return hr;
  3614. }
  3615. CopyMemory(
  3616. ((LPBYTE)m_pCallParams) + m_dwCallParamsUsedSize,
  3617. pBuffer,
  3618. lSize
  3619. );
  3620. m_pCallParams->dwDevSpecificOffset = m_dwCallParamsUsedSize;
  3621. m_pCallParams->dwDevSpecificSize = lSize;
  3622. m_dwCallParamsUsedSize += lSize;
  3623. Unlock();
  3624. LOG((TL_TRACE, "SetDevSpecificBuffer - exit"));
  3625. return S_OK;
  3626. }
  3627. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3628. //
  3629. // get_DevSpecificBuffer
  3630. //
  3631. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3632. #ifdef NEWCALLINFO
  3633. HRESULT
  3634. CCall::get_DevSpecificBuffer( VARIANT * pBuffer )
  3635. {
  3636. HRESULT hr = S_OK;
  3637. BYTE * p;
  3638. DWORD dwSize = 0;
  3639. LOG((TL_TRACE, "get_DevSpecificBuffer - enter"));
  3640. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  3641. {
  3642. LOG((TL_ERROR, "get_DevSpecificBuffer - bad pointer"));
  3643. return E_POINTER;
  3644. }
  3645. pBuffer->vt = VT_EMPTY;
  3646. hr = GetDevSpecificBuffer(
  3647. &dwSize,
  3648. &p
  3649. );
  3650. if (!SUCCEEDED(hr))
  3651. {
  3652. LOG((TL_ERROR, "get_DevSpecificBuffer - GetDevSpecificBuffer failed - %lx", hr));
  3653. return hr;
  3654. }
  3655. hr = FillVariantFromBuffer(
  3656. dwSize,
  3657. p,
  3658. pBuffer
  3659. );
  3660. if ( 0 != dwSize )
  3661. {
  3662. CoTaskMemFree( p );
  3663. }
  3664. if ( !SUCCEEDED(hr) )
  3665. {
  3666. LOG((TL_ERROR, "get_DevSpecificBuffer - fillvariant failed -%lx", hr));
  3667. return hr;
  3668. }
  3669. LOG((TL_TRACE, "get_DevSpecificBuffer - exit"));
  3670. return S_OK;
  3671. }
  3672. #else
  3673. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3674. //
  3675. // get_DevSpecificBuffer
  3676. //
  3677. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3678. STDMETHODIMP
  3679. CCall::get_DevSpecificBuffer( VARIANT * pBuffer )
  3680. {
  3681. HRESULT hr = S_OK;
  3682. BYTE * p;
  3683. DWORD dwSize;
  3684. LOG((TL_TRACE, "get_DevSpecificBuffer - enter"));
  3685. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  3686. {
  3687. LOG((TL_ERROR, "get_DevSpecificBuffer - bad pointer"));
  3688. return E_POINTER;
  3689. }
  3690. pBuffer->vt = VT_EMPTY;
  3691. hr = GetDevSpecificBufferSize( (long*)&dwSize );
  3692. if (!SUCCEEDED(hr))
  3693. {
  3694. LOG((TL_ERROR, "get_DevSpecificBuffer - getsize failed"));
  3695. return hr;
  3696. }
  3697. if ( 0 != dwSize )
  3698. {
  3699. p = (PBYTE) ClientAlloc( dwSize );
  3700. if ( NULL == p )
  3701. {
  3702. LOG((TL_ERROR, "get_DevSpecificBuffer - alloc failed"));
  3703. return E_OUTOFMEMORY;
  3704. }
  3705. hr = GetDevSpecificBuffer(
  3706. dwSize,
  3707. p
  3708. );
  3709. if (!SUCCEEDED(hr))
  3710. {
  3711. LOG((TL_ERROR, "get_DevSpecificBuffer - GetDevSpecificBuffer failed - %lx", hr));
  3712. ClientFree( p );
  3713. return hr;
  3714. }
  3715. }
  3716. hr = FillVariantFromBuffer(
  3717. dwSize,
  3718. p,
  3719. pBuffer
  3720. );
  3721. if ( 0 != dwSize )
  3722. {
  3723. ClientFree( p );
  3724. }
  3725. if ( !SUCCEEDED(hr) )
  3726. {
  3727. LOG((TL_ERROR, "get_DevSpecificBuffer - fillvariant failed -%lx", hr));
  3728. return hr;
  3729. }
  3730. LOG((TL_TRACE, "get_DevSpecificBuffer - exit"));
  3731. return S_OK;
  3732. }
  3733. #endif
  3734. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3735. //
  3736. // put_DevSpecificBuffer
  3737. //
  3738. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3739. #ifdef NEWCALLINFO
  3740. HRESULT
  3741. #else
  3742. STDMETHODIMP
  3743. #endif
  3744. CCall::put_DevSpecificBuffer( VARIANT Buffer )
  3745. {
  3746. HRESULT hr = S_OK;
  3747. DWORD dwSize;
  3748. BYTE * pBuffer;
  3749. LOG((TL_TRACE, "put_DevSpecificBuffer - enter"));
  3750. hr = MakeBufferFromVariant(
  3751. Buffer,
  3752. &dwSize,
  3753. &pBuffer
  3754. );
  3755. if ( !SUCCEEDED(hr) )
  3756. {
  3757. LOG((TL_ERROR, "put_DevSpecificBuffer - can't make buffer - %lx", hr));
  3758. return hr;
  3759. }
  3760. hr = SetDevSpecificBuffer(
  3761. dwSize,
  3762. pBuffer
  3763. );
  3764. ClientFree( pBuffer );
  3765. if ( !SUCCEEDED(hr) )
  3766. {
  3767. LOG((TL_ERROR, "put_DevSpecificBuffer - Set failed - %lx", hr));
  3768. return hr;
  3769. }
  3770. LOG((TL_TRACE, "put_DevSpecificBuffer - exit"));
  3771. return S_OK;
  3772. }
  3773. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3774. //
  3775. // SetCallParamsFlags
  3776. //
  3777. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3778. #ifdef NEWCALLINFO
  3779. HRESULT
  3780. #else
  3781. STDMETHODIMP
  3782. #endif
  3783. CCall::SetCallParamsFlags( long lFlags )
  3784. {
  3785. HRESULT hr = S_OK;
  3786. LOG((TL_TRACE, "SetCallParamsFlags - enter"));
  3787. Lock();
  3788. if (ISHOULDUSECALLPARAMS())
  3789. {
  3790. //
  3791. // validation in tapisrv
  3792. //
  3793. m_pCallParams->dwCallParamFlags = lFlags;
  3794. }
  3795. else
  3796. {
  3797. LOG((TL_ERROR, "Can't set callparams flags"));
  3798. hr = TAPI_E_INVALCALLSTATE;
  3799. }
  3800. LOG((TL_TRACE, "SetCallParamsFlags - exit"));
  3801. Unlock();
  3802. return hr;
  3803. }
  3804. #ifdef NEWCALLINFO
  3805. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3806. //
  3807. // GetCallParamsFlags
  3808. //
  3809. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3810. HRESULT
  3811. CCall::GetCallParamsFlags( long * plFlags )
  3812. {
  3813. HRESULT hr = S_OK;
  3814. LOG((TL_TRACE, "GetCallParamsFlags - enter"));
  3815. if ( TAPIIsBadWritePtr( plFlags, sizeof (long) ) )
  3816. {
  3817. LOG((TL_ERROR, "GetCallParamsFlags - bad pointer"));
  3818. return E_POINTER;
  3819. }
  3820. Lock();
  3821. if (ISHOULDUSECALLPARAMS())
  3822. {
  3823. *plFlags = m_pCallParams->dwCallParamFlags;
  3824. }
  3825. else
  3826. {
  3827. hr = RefreshCallInfo();
  3828. if ( !SUCCEEDED(hr) )
  3829. {
  3830. LOG((TL_ERROR, "GetCallParamsFlags - can't get callinfo - %lx", hr));
  3831. Unlock();
  3832. return hr;
  3833. }
  3834. *plFlags = m_pCallInfo->dwCallParamFlags;
  3835. }
  3836. LOG((TL_TRACE, "GetCallParamsFlags - exit"));
  3837. Unlock();
  3838. return hr;
  3839. }
  3840. #endif
  3841. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3842. //
  3843. // put_DisplayableAddress
  3844. //
  3845. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3846. #ifdef NEWCALLINFO
  3847. HRESULT
  3848. #else
  3849. STDMETHODIMP
  3850. #endif
  3851. CCall::put_DisplayableAddress( BSTR pDisplayableAddress )
  3852. {
  3853. HRESULT hr = S_OK;
  3854. DWORD dwSize;
  3855. LOG((TL_TRACE, "put_DisplayableAddress - enter"));
  3856. if (IsBadStringPtrW( pDisplayableAddress, -1 ))
  3857. {
  3858. LOG((TL_ERROR, "put_DisplayableAddress - invalid pointer"));
  3859. return E_POINTER;
  3860. }
  3861. Lock();
  3862. if (!ISHOULDUSECALLPARAMS())
  3863. {
  3864. LOG((TL_ERROR, "Displayable address can only be set before call is made"));
  3865. Unlock();
  3866. return TAPI_E_INVALCALLSTATE;
  3867. }
  3868. dwSize = (lstrlenW( pDisplayableAddress ) + 1) * sizeof(WCHAR);
  3869. hr = ResizeCallParams( dwSize );
  3870. if ( !SUCCEEDED(hr) )
  3871. {
  3872. LOG((TL_ERROR, "put_DisplayableAddress - resize failed - %lx", hr));
  3873. Unlock();
  3874. return hr;
  3875. }
  3876. //
  3877. // do a byte-wise memory copy (byte-wise to avoid alignment faults under 64
  3878. // bit)
  3879. //
  3880. CopyMemory( (BYTE*) m_pCallParams + m_dwCallParamsUsedSize,
  3881. pDisplayableAddress,
  3882. dwSize );
  3883. m_pCallParams->dwDisplayableAddressSize = dwSize;
  3884. m_pCallParams->dwDisplayableAddressOffset = m_dwCallParamsUsedSize;
  3885. m_dwCallParamsUsedSize += dwSize;
  3886. Unlock();
  3887. LOG((TL_TRACE, "put_DisplayableAddress - exit"));
  3888. return S_OK;
  3889. }
  3890. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3891. //
  3892. // get_DisplayableAddress
  3893. //
  3894. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3895. #ifdef NEWCALLINFO
  3896. HRESULT
  3897. #else
  3898. STDMETHODIMP
  3899. #endif
  3900. CCall::get_DisplayableAddress( BSTR * ppDisplayableAddress )
  3901. {
  3902. HRESULT hr = S_OK;
  3903. LOG((TL_TRACE, "get_DisplayableAddress - enter"));
  3904. if ( TAPIIsBadWritePtr( ppDisplayableAddress, sizeof (BSTR) ) )
  3905. {
  3906. LOG((TL_ERROR, "get_DisplayableAddress - badpointer"));
  3907. return E_POINTER;
  3908. }
  3909. *ppDisplayableAddress = NULL;
  3910. Lock();
  3911. if ( ISHOULDUSECALLPARAMS() )
  3912. {
  3913. if ( 0 != m_pCallParams->dwDisplayableAddressOffset )
  3914. {
  3915. *ppDisplayableAddress = BSTRFromUnalingedData(
  3916. (((LPBYTE)m_pCallParams) + m_pCallParams->dwDisplayableAddressOffset),
  3917. m_pCallParams->dwDisplayableAddressSize
  3918. );
  3919. if ( NULL == *ppDisplayableAddress )
  3920. {
  3921. LOG((TL_ERROR, "get_DisplayableAddress - out of memory 1"));
  3922. hr = E_OUTOFMEMORY;
  3923. }
  3924. hr = S_OK;
  3925. }
  3926. else
  3927. {
  3928. *ppDisplayableAddress = NULL;
  3929. hr = S_FALSE;
  3930. }
  3931. Unlock();
  3932. return S_OK;
  3933. }
  3934. hr = RefreshCallInfo();
  3935. if ( !SUCCEEDED(hr) )
  3936. {
  3937. LOG((TL_ERROR, "get_DisplayableAddress - can't get callinfo - %lx", hr));
  3938. Unlock();
  3939. return hr;
  3940. }
  3941. if ( ( 0 != m_pCallInfo->dwDisplayableAddressSize ) &&
  3942. ( 0 != m_pCallInfo->dwDisplayableAddressOffset ) )
  3943. {
  3944. *ppDisplayableAddress = BSTRFromUnalingedData(
  3945. (((PBYTE)m_pCallInfo) + m_pCallInfo->dwDisplayableAddressOffset),
  3946. m_pCallInfo->dwDisplayableAddressSize
  3947. );
  3948. if ( NULL == *ppDisplayableAddress )
  3949. {
  3950. LOG((TL_ERROR, "get_DisplayableAddress - out of memory"));
  3951. Unlock();
  3952. return E_OUTOFMEMORY;
  3953. }
  3954. }
  3955. else
  3956. {
  3957. LOG((TL_ERROR, "get_DisplayableAddress - not available"));
  3958. Unlock();
  3959. return S_FALSE;
  3960. }
  3961. Unlock();
  3962. LOG((TL_TRACE, "get_DisplayableAddress - exit"));
  3963. return hr;
  3964. }
  3965. #ifdef NEWCALLINFO
  3966. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3967. //
  3968. // GetCallDataBuffer
  3969. //
  3970. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  3971. HRESULT
  3972. CCall::GetCallDataBuffer(
  3973. DWORD * pdwSize,
  3974. BYTE ** ppBuffer
  3975. )
  3976. {
  3977. HRESULT hr = S_OK;
  3978. LOG((TL_TRACE, "GetCallDataBuffer - enter"));
  3979. if (TAPIIsBadWritePtr(pdwSize, sizeof(DWORD)))
  3980. {
  3981. LOG((TL_ERROR, "GetCallDataBuffer - bad size pointer"));
  3982. return E_POINTER;
  3983. }
  3984. if (TAPIIsBadWritePtr(ppBuffer,sizeof(BYTE*) ) )
  3985. {
  3986. LOG((TL_ERROR, "GetCallDataBuffer - bad buffer pointer"));
  3987. return E_POINTER;
  3988. }
  3989. *ppBuffer = NULL;
  3990. *pdwSize = 0;
  3991. Lock();
  3992. DWORD dwVersionNumber = m_pAddress->GetAPIVersion();
  3993. if ( dwVersionNumber < TAPI_VERSION2_0 )
  3994. {
  3995. LOG((TL_ERROR,
  3996. "GetCallDataBuffer - version # [0x%lx] less than TAPI_VERSION2_0",
  3997. dwVersionNumber));
  3998. Unlock();
  3999. return TAPI_E_NOTSUPPORTED;
  4000. }
  4001. if ( ISHOULDUSECALLPARAMS() )
  4002. {
  4003. if ( m_pCallParams->dwCallDataSize != 0 )
  4004. {
  4005. BYTE * pTemp;
  4006. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallParams->dwCallDataSize );
  4007. if ( NULL == pTemp )
  4008. {
  4009. LOG((TL_ERROR, "GetCallDataBuffer - out of memory"));
  4010. hr = E_OUTOFMEMORY;
  4011. }
  4012. else
  4013. {
  4014. CopyMemory(
  4015. pTemp,
  4016. ((PBYTE)m_pCallParams) + m_pCallParams->dwCallDataOffset,
  4017. m_pCallParams->dwCallDataSize
  4018. );
  4019. *ppBuffer = pTemp;
  4020. *pdwSize = m_pCallParams->dwCallDataSize;
  4021. }
  4022. }
  4023. Unlock();
  4024. return hr;
  4025. }
  4026. hr = RefreshCallInfo();
  4027. if (!SUCCEEDED(hr))
  4028. {
  4029. LOG((TL_ERROR, "GetCallDataBuffer - can't get callinfo - %lx", hr));
  4030. Unlock();
  4031. return hr;
  4032. }
  4033. hr = S_OK;
  4034. if ( m_pCallInfo->dwCallDataSize != 0 )
  4035. {
  4036. BYTE * pTemp;
  4037. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallInfo->dwCallDataSize );
  4038. if ( NULL == pTemp )
  4039. {
  4040. LOG((TL_ERROR, "GetCallDataBuffer - out of memory"));
  4041. hr = E_OUTOFMEMORY;
  4042. }
  4043. else
  4044. {
  4045. CopyMemory(
  4046. pTemp,
  4047. ( (PBYTE)m_pCallInfo ) + m_pCallInfo->dwCallDataOffset,
  4048. m_pCallInfo->dwCallDataSize
  4049. );
  4050. *ppBuffer = pTemp;
  4051. *pdwSize = m_pCallInfo->dwCallDataSize;
  4052. }
  4053. }
  4054. Unlock();
  4055. LOG((TL_TRACE, "GetCallDataBuffer - exit"));
  4056. return hr;
  4057. }
  4058. #endif
  4059. #ifndef NEWCALLINFO
  4060. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4061. //
  4062. // GetCallDataBuffer
  4063. //
  4064. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4065. STDMETHODIMP
  4066. CCall::GetCallDataBuffer( long lSize, BYTE * pBuffer )
  4067. {
  4068. HRESULT hr = S_OK;
  4069. LOG((TL_TRACE, "GetCallDataBuffer - enter"));
  4070. if (lSize == 0)
  4071. {
  4072. LOG((TL_ERROR, "GetCallDataBuffer - lSize = 0"));
  4073. return S_FALSE;
  4074. }
  4075. if ( TAPIIsBadWritePtr ( pBuffer, lSize ) )
  4076. {
  4077. LOG((TL_ERROR, "GetCallDataBuffer - bad pointer"));
  4078. return E_POINTER;
  4079. }
  4080. Lock();
  4081. if ( m_pAddress->GetAPIVersion() < TAPI_VERSION2_0 )
  4082. {
  4083. Unlock();
  4084. return TAPI_E_NOTSUPPORTED;
  4085. }
  4086. if ( ISHOULDUSECALLPARAMS() )
  4087. {
  4088. if ( 0 != m_pCallParams->dwCallDataSize )
  4089. {
  4090. if ( lSize < m_pCallParams->dwCallDataSize )
  4091. {
  4092. LOG((TL_ERROR, "GetCallDataBuffer - too small"));
  4093. hr = E_INVALIDARG;
  4094. }
  4095. else
  4096. {
  4097. CopyMemory(
  4098. pBuffer,
  4099. ((PBYTE)m_pCallParams) + m_pCallParams->dwCallDataOffset,
  4100. m_pCallParams->dwCallDataSize
  4101. );
  4102. }
  4103. }
  4104. else
  4105. {
  4106. *pBuffer = 0;
  4107. }
  4108. Unlock();
  4109. return hr;
  4110. }
  4111. hr = RefreshCallInfo();
  4112. if ( !SUCCEEDED(hr) )
  4113. {
  4114. LOG((TL_ERROR, "GetCallDataBuffer - can't get callinf - %lx", hr));
  4115. Unlock();
  4116. return hr;
  4117. }
  4118. if ( m_pCallInfo->dwCallDataSize > lSize )
  4119. {
  4120. LOG((TL_ERROR, "GetCallDataBuffer - size not big enough "));
  4121. Unlock();
  4122. return E_INVALIDARG;
  4123. }
  4124. CopyMemory(
  4125. pBuffer,
  4126. ( (PBYTE) m_pCallInfo ) + m_pCallInfo->dwCallDataOffset,
  4127. m_pCallInfo->dwCallDataSize
  4128. );
  4129. Unlock();
  4130. LOG((TL_TRACE, "GetCallDataBuffer - exit"));
  4131. return S_OK;
  4132. }
  4133. #endif
  4134. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4135. //
  4136. // SetCallDataBuffer
  4137. //
  4138. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4139. #ifdef NEWCALLINFO
  4140. HRESULT
  4141. #else
  4142. STDMETHODIMP
  4143. #endif
  4144. CCall::SetCallDataBuffer( long lSize, BYTE * pBuffer )
  4145. {
  4146. HRESULT hr = S_OK;
  4147. HCALL hCall;
  4148. LOG((TL_TRACE, "SetCallDataBuffer - enter"));
  4149. if (IsBadReadPtr( pBuffer, lSize) )
  4150. {
  4151. LOG((TL_ERROR, "SetCallDataBuffer - bad pointer"));
  4152. return E_POINTER;
  4153. }
  4154. Lock();
  4155. if ( m_pAddress->GetAPIVersion() < TAPI_VERSION2_0 )
  4156. {
  4157. Unlock();
  4158. LOG((TL_ERROR, "SetCallDataBuffer - unsupported api version"));
  4159. return TAPI_E_NOTSUPPORTED;
  4160. }
  4161. if ( !ISHOULDUSECALLPARAMS() ) // call in progess (not idle)
  4162. {
  4163. hCall = m_t3Call.hCall;
  4164. Unlock();
  4165. hr = LineSetCallData(hCall,
  4166. pBuffer,
  4167. lSize
  4168. );
  4169. if ( SUCCEEDED(hr) )
  4170. {
  4171. hr = WaitForReply( hr );
  4172. if ( FAILED(hr) )
  4173. {
  4174. LOG((TL_ERROR, "SetCallDataBuffer - failed async"));
  4175. }
  4176. }
  4177. else
  4178. {
  4179. LOG((TL_ERROR, "SetCallDataBuffer - failed sync"));
  4180. }
  4181. LOG((TL_TRACE, "SetCallDataBuffer - exit"));
  4182. return hr;
  4183. }
  4184. hr = ResizeCallParams( lSize );
  4185. if ( !SUCCEEDED(hr) )
  4186. {
  4187. LOG((TL_ERROR, "SetCallDataBuffer - can't resize callparams - %lx", hr));
  4188. Unlock();
  4189. return hr;
  4190. }
  4191. CopyMemory(
  4192. ((LPBYTE)m_pCallParams) + m_dwCallParamsUsedSize,
  4193. pBuffer,
  4194. lSize
  4195. );
  4196. m_pCallParams->dwCallDataOffset = m_dwCallParamsUsedSize;
  4197. m_pCallParams->dwCallDataSize = lSize;
  4198. m_dwCallParamsUsedSize += lSize;
  4199. Unlock();
  4200. LOG((TL_TRACE, "SetCallDataBuffer - exit"));
  4201. return S_OK;
  4202. }
  4203. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4204. //
  4205. // get_CallDataBuffer
  4206. //
  4207. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4208. #ifdef NEWCALLINFO
  4209. HRESULT
  4210. CCall::get_CallDataBuffer( VARIANT * pBuffer )
  4211. {
  4212. HRESULT hr = S_OK;
  4213. BYTE * p;
  4214. DWORD dwSize = 0;
  4215. LOG((TL_TRACE, "get_CallDataBuffer - enter"));
  4216. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  4217. {
  4218. LOG((TL_ERROR, "get_CallDataBuffer - bad pointer"));
  4219. return E_POINTER;
  4220. }
  4221. pBuffer->vt = VT_EMPTY;
  4222. hr = GetCallDataBuffer(
  4223. &dwSize,
  4224. &p
  4225. );
  4226. if (!SUCCEEDED(hr))
  4227. {
  4228. LOG((TL_ERROR, "get_CallDataBuffer - failed - %lx", hr));
  4229. return hr;
  4230. }
  4231. hr = FillVariantFromBuffer(
  4232. dwSize,
  4233. p,
  4234. pBuffer
  4235. );
  4236. if ( 0 != dwSize )
  4237. {
  4238. CoTaskMemFree( p );
  4239. }
  4240. if ( !SUCCEEDED(hr) )
  4241. {
  4242. LOG((TL_ERROR, "get_CallDataBuffer - fillvariant failed -%lx", hr));
  4243. return hr;
  4244. }
  4245. LOG((TL_TRACE, "get_CallDataBuffer - exit"));
  4246. return S_OK;
  4247. }
  4248. #else
  4249. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4250. //
  4251. // get_CallDataBuffer
  4252. //
  4253. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4254. STDMETHODIMP
  4255. CCall::get_CallDataBuffer( VARIANT * pBuffer )
  4256. {
  4257. HRESULT hr = S_OK;
  4258. BYTE * p;
  4259. DWORD dwSize;
  4260. LOG((TL_TRACE, "get_CallDataBuffer - enter"));
  4261. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  4262. {
  4263. LOG((TL_ERROR, "get_CallDataBuffer - bad pointer"));
  4264. return E_POINTER;
  4265. }
  4266. pBuffer->vt = VT_EMPTY;
  4267. hr = GetCallDataBufferSize( (long*)&dwSize );
  4268. if (!SUCCEEDED(hr))
  4269. {
  4270. LOG((TL_ERROR, "get_CallDataBuffer - getsize failed"));
  4271. return hr;
  4272. }
  4273. if ( 0 != dwSize )
  4274. {
  4275. p = (PBYTE) ClientAlloc( dwSize );
  4276. if ( NULL == p )
  4277. {
  4278. LOG((TL_ERROR, "get_CallDataBuffer - alloc failed"));
  4279. return E_OUTOFMEMORY;
  4280. }
  4281. hr = GetCallDataBuffer(
  4282. dwSize,
  4283. p
  4284. );
  4285. if (!SUCCEEDED(hr))
  4286. {
  4287. LOG((TL_ERROR, "get_CallDataBuffer - failed - %lx", hr));
  4288. ClientFree( p );
  4289. return hr;
  4290. }
  4291. }
  4292. hr = FillVariantFromBuffer(
  4293. dwSize,
  4294. p,
  4295. pBuffer
  4296. );
  4297. if ( 0 != dwSize )
  4298. {
  4299. ClientFree( p );
  4300. }
  4301. if ( !SUCCEEDED(hr) )
  4302. {
  4303. LOG((TL_ERROR, "get_CallDataBuffer - fillvariant failed -%lx", hr));
  4304. return hr;
  4305. }
  4306. LOG((TL_TRACE, "get_CallDataBuffer - exit"));
  4307. return S_OK;
  4308. }
  4309. #endif
  4310. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4311. //
  4312. // put_CallDataBuffer
  4313. //
  4314. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4315. #ifdef NEWCALLINFO
  4316. HRESULT
  4317. #else
  4318. STDMETHODIMP
  4319. #endif
  4320. CCall::put_CallDataBuffer( VARIANT Buffer )
  4321. {
  4322. HRESULT hr = S_OK;
  4323. DWORD dwSize;
  4324. BYTE * pBuffer;
  4325. LOG((TL_TRACE, "put_CallDataBuffer - enter"));
  4326. hr = MakeBufferFromVariant(
  4327. Buffer,
  4328. &dwSize,
  4329. &pBuffer
  4330. );
  4331. if ( !SUCCEEDED(hr) )
  4332. {
  4333. LOG((TL_ERROR, "put_CallDataBuffer - can't make buffer - %lx", hr));
  4334. return hr;
  4335. }
  4336. hr = SetCallDataBuffer(
  4337. dwSize,
  4338. pBuffer
  4339. );
  4340. ClientFree( pBuffer );
  4341. if ( !SUCCEEDED(hr) )
  4342. {
  4343. LOG((TL_ERROR, "put_CallDataBuffer - Set failed - %lx", hr));
  4344. return hr;
  4345. }
  4346. LOG((TL_TRACE, "put_CallDataBuffer - exit"));
  4347. return S_OK;
  4348. }
  4349. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4350. //
  4351. // get_CallingPartyID
  4352. //
  4353. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4354. #ifdef NEWCALLINFO
  4355. HRESULT
  4356. #else
  4357. STDMETHODIMP
  4358. #endif
  4359. CCall::get_CallingPartyID( BSTR * ppCallingPartyID )
  4360. {
  4361. HRESULT hr = S_OK;
  4362. LOG((TL_TRACE, "get_CallingPartyID - enter"));
  4363. if ( TAPIIsBadWritePtr( ppCallingPartyID, sizeof (BSTR) ) )
  4364. {
  4365. LOG((TL_ERROR, "get_CallingPartyID - badpointer"));
  4366. return E_POINTER;
  4367. }
  4368. *ppCallingPartyID = NULL;
  4369. Lock();
  4370. if ( !ISHOULDUSECALLPARAMS() )
  4371. {
  4372. LOG((TL_ERROR, "get_CallingPartyID - call must be idle"));
  4373. Unlock();
  4374. return TAPI_E_INVALCALLSTATE;
  4375. }
  4376. if ( ( m_pAddress->GetAPIVersion() >= TAPI_VERSION2_0 ) && ( 0 != m_pCallParams->dwCallingPartyIDOffset ) )
  4377. {
  4378. *ppCallingPartyID = BSTRFromUnalingedData(
  4379. (((LPBYTE)m_pCallParams) + m_pCallParams->dwCallingPartyIDOffset),
  4380. m_pCallParams->dwCallingPartyIDSize );
  4381. if ( NULL == *ppCallingPartyID )
  4382. {
  4383. LOG((TL_ERROR, "get_CallingPartyID - out of memory 1"));
  4384. hr = E_OUTOFMEMORY;
  4385. }
  4386. else
  4387. {
  4388. hr = S_OK;
  4389. }
  4390. }
  4391. else
  4392. {
  4393. *ppCallingPartyID = NULL;
  4394. hr = S_OK;
  4395. }
  4396. Unlock();
  4397. return hr;
  4398. }
  4399. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4400. //
  4401. // put_CallingPartyID
  4402. //
  4403. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4404. #ifdef NEWCALLINFO
  4405. HRESULT
  4406. #else
  4407. STDMETHODIMP
  4408. #endif
  4409. CCall::put_CallingPartyID( BSTR pCallingPartyID )
  4410. {
  4411. HRESULT hr = S_OK;
  4412. DWORD dwSize;
  4413. LOG((TL_TRACE, "put_CallingPartyID - enter"));
  4414. if (IsBadStringPtrW( pCallingPartyID, -1 ))
  4415. {
  4416. LOG((TL_ERROR, "put_CallingPartyID - invalid pointer"));
  4417. return E_POINTER;
  4418. }
  4419. Lock();
  4420. if ( m_pAddress->GetAPIVersion() < TAPI_VERSION2_0 )
  4421. {
  4422. Unlock();
  4423. return TAPI_E_NOTSUPPORTED;
  4424. }
  4425. if (!ISHOULDUSECALLPARAMS())
  4426. {
  4427. LOG((TL_ERROR, "callingpartyid can only be set before call is made"));
  4428. Unlock();
  4429. return TAPI_E_INVALCALLSTATE;
  4430. }
  4431. dwSize = (lstrlenW( pCallingPartyID ) + 1) * sizeof(WCHAR);
  4432. hr = ResizeCallParams( dwSize );
  4433. if ( !SUCCEEDED(hr) )
  4434. {
  4435. LOG((TL_ERROR, "put_CallingPartyID - resize failed - %lx", hr));
  4436. Unlock();
  4437. return hr;
  4438. }
  4439. //
  4440. // do a byte-wise memory copy (byte-wise to avoid alignment faults under 64
  4441. // bit)
  4442. //
  4443. CopyMemory( (BYTE*) m_pCallParams + m_dwCallParamsUsedSize,
  4444. pCallingPartyID,
  4445. dwSize);
  4446. m_pCallParams->dwCallingPartyIDSize = dwSize;
  4447. m_pCallParams->dwCallingPartyIDOffset = m_dwCallParamsUsedSize;
  4448. m_dwCallParamsUsedSize += dwSize;
  4449. Unlock();
  4450. LOG((TL_TRACE, "put_CallingPartyID - exit"));
  4451. return S_OK;
  4452. }
  4453. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4454. //
  4455. // get_CallTreatment
  4456. //
  4457. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4458. #ifdef NEWCALLINFO
  4459. HRESULT
  4460. #else
  4461. STDMETHODIMP
  4462. #endif
  4463. CCall::get_CallTreatment( long * plTreatment )
  4464. {
  4465. HRESULT hr;
  4466. if ( TAPIIsBadWritePtr( plTreatment, sizeof(long) ) )
  4467. {
  4468. LOG((TL_ERROR, "get_CallTreatement - invalid pointer"));
  4469. return E_POINTER;
  4470. }
  4471. Lock();
  4472. if ( m_pAddress->GetAPIVersion() < TAPI_VERSION2_0 )
  4473. {
  4474. Unlock();
  4475. return TAPI_E_NOTSUPPORTED;
  4476. }
  4477. if ( CS_IDLE == m_CallState )
  4478. {
  4479. LOG((TL_ERROR, "get_CallTreatment - must be on call"));
  4480. Unlock();
  4481. return TAPI_E_INVALCALLSTATE;
  4482. }
  4483. hr = RefreshCallInfo();
  4484. if ( !SUCCEEDED(hr) )
  4485. {
  4486. LOG((TL_ERROR, "get_CallTreatment - can't get callinfo - %lx", hr));
  4487. Unlock();
  4488. return hr;
  4489. }
  4490. *plTreatment = m_pCallInfo->dwCallTreatment;
  4491. Unlock();
  4492. return S_OK;
  4493. }
  4494. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4495. //
  4496. // put_CallTreatment
  4497. //
  4498. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4499. #ifdef NEWCALLINFO
  4500. HRESULT
  4501. #else
  4502. STDMETHODIMP
  4503. #endif
  4504. CCall::put_CallTreatment( long lTreatment )
  4505. {
  4506. HRESULT hr = S_OK;
  4507. HCALL hCall;
  4508. LOG((TL_TRACE, "put_CallTreatment - enter"));
  4509. Lock();
  4510. if ( CS_IDLE == m_CallState )
  4511. {
  4512. LOG((TL_ERROR, "put_CallTreatment - must make call first"));
  4513. Unlock();
  4514. return TAPI_E_INVALCALLSTATE;
  4515. }
  4516. hCall = m_t3Call.hCall;
  4517. Unlock();
  4518. hr = LineSetCallTreatment(
  4519. hCall,
  4520. lTreatment
  4521. );
  4522. if (((LONG)hr) < 0)
  4523. {
  4524. LOG((TL_ERROR, "put_CallTreatment failed - %lx", hr));
  4525. return hr;
  4526. }
  4527. hr = WaitForReply( hr );
  4528. if ( !SUCCEEDED(hr) )
  4529. {
  4530. LOG((TL_ERROR, "put_CallTreatment - failed - %lx", hr));
  4531. }
  4532. LOG((TL_TRACE, "put_CallTreatment - exit"));
  4533. return hr;
  4534. }
  4535. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4536. //
  4537. // put_MinRate
  4538. //
  4539. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4540. #ifdef NEWCALLINFO
  4541. HRESULT
  4542. #else
  4543. STDMETHODIMP
  4544. #endif
  4545. CCall::put_MinRate(long lMinRate)
  4546. {
  4547. HRESULT hr;
  4548. LOG((TL_TRACE, "put_MinRate - enter"));
  4549. if (!(ISHOULDUSECALLPARAMS()))
  4550. {
  4551. LOG((TL_ERROR, "put_MinRate - invalid call state"));
  4552. return TAPI_E_INVALCALLSTATE;
  4553. }
  4554. m_pCallParams->dwMinRate = lMinRate;
  4555. m_dwMinRate = lMinRate;
  4556. LOG((TL_TRACE, "put_MinRate - exit"));
  4557. return S_OK;
  4558. }
  4559. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4560. //
  4561. // get_MinRate
  4562. //
  4563. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4564. #ifdef NEWCALLINFO
  4565. HRESULT
  4566. #else
  4567. STDMETHODIMP
  4568. #endif
  4569. CCall::get_MinRate(long * plMinRate)
  4570. {
  4571. HRESULT hr;
  4572. LOG((TL_TRACE, "get_MinRate - enter"));
  4573. if (TAPIIsBadWritePtr( plMinRate, sizeof( long ) ) )
  4574. {
  4575. LOG((TL_ERROR, "get_MinRate - bad pointer"));
  4576. return E_POINTER;
  4577. }
  4578. *plMinRate = m_dwMinRate;
  4579. LOG((TL_TRACE, "get_MinRate - exit"));
  4580. return S_OK;
  4581. }
  4582. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4583. //
  4584. // put_MaxRate
  4585. //
  4586. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4587. #ifdef NEWCALLINFO
  4588. HRESULT
  4589. #else
  4590. STDMETHODIMP
  4591. #endif
  4592. CCall::put_MaxRate(long lMaxRate)
  4593. {
  4594. HRESULT hr;
  4595. LOG((TL_TRACE, "put_MaxRate - enter"));
  4596. if (!(ISHOULDUSECALLPARAMS()))
  4597. {
  4598. LOG((TL_ERROR, "put_MaxRate - invalid call state"));
  4599. return TAPI_E_INVALCALLSTATE;
  4600. }
  4601. m_pCallParams->dwMaxRate = lMaxRate;
  4602. m_dwMaxRate = lMaxRate;
  4603. LOG((TL_TRACE, "put_MaxRate - exit"));
  4604. return S_OK;
  4605. }
  4606. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4607. //
  4608. // get_MaxRate
  4609. //
  4610. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4611. #ifdef NEWCALLINFO
  4612. HRESULT
  4613. #else
  4614. STDMETHODIMP
  4615. #endif
  4616. CCall::get_MaxRate(long * plMaxRate)
  4617. {
  4618. HRESULT hr;
  4619. if (TAPIIsBadWritePtr( plMaxRate, sizeof(long) ) )
  4620. {
  4621. LOG((TL_ERROR, "get_MaxRate - bad pointer"));
  4622. return E_POINTER;
  4623. }
  4624. LOG((TL_TRACE, "get_MaxRate - enter"));
  4625. *plMaxRate = m_dwMaxRate;
  4626. LOG((TL_TRACE, "get_MaxRate - exit"));
  4627. return S_OK;
  4628. }
  4629. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4630. //
  4631. // put_CountryCode
  4632. //
  4633. // simply save country code to be used if necessary in lineMakeCall
  4634. // and other places
  4635. //
  4636. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4637. #ifdef NEWCALLINFO
  4638. HRESULT
  4639. #else
  4640. STDMETHODIMP
  4641. #endif
  4642. CCall::put_CountryCode(long lCountryCode)
  4643. {
  4644. LOG((TL_TRACE, "put_CountryCode - enter"));
  4645. //
  4646. // simply save - will be validated if/when used
  4647. //
  4648. Lock();
  4649. m_dwCountryCode = (DWORD)lCountryCode;
  4650. Unlock();
  4651. LOG((TL_TRACE, "put_CountryCode - exit - success"));
  4652. return S_OK;
  4653. }
  4654. #ifdef NEWCALLINFO
  4655. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4656. //
  4657. // get_CountryCode
  4658. //
  4659. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4660. HRESULT
  4661. CCall::get_CountryCode(long * plCountryCode)
  4662. {
  4663. HRESULT hr;
  4664. if (TAPIIsBadWritePtr( plCountryCode, sizeof(long) ) )
  4665. {
  4666. LOG((TL_ERROR, "get_CountryCode - bad pointer"));
  4667. return E_POINTER;
  4668. }
  4669. LOG((TL_TRACE, "get_CountryCode - enter"));
  4670. *plCountryCode = m_dwCountryCode;
  4671. LOG((TL_TRACE, "get_CountryCode - exit"));
  4672. return S_OK;
  4673. }
  4674. #endif
  4675. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4676. //
  4677. // SetQOS
  4678. //
  4679. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4680. STDMETHODIMP
  4681. CCall::SetQOS(
  4682. long lMediaType,
  4683. QOS_SERVICE_LEVEL ServiceLevel
  4684. )
  4685. {
  4686. HRESULT hr = S_OK;
  4687. DWORD dwMediaMode;
  4688. if (!(m_pAddress->GetMediaMode(
  4689. lMediaType,
  4690. &dwMediaMode
  4691. ) ) )
  4692. {
  4693. LOG((TL_ERROR, "SetQOS - invalid pMediaType"));
  4694. return E_INVALIDARG;
  4695. }
  4696. Lock();
  4697. if (ISHOULDUSECALLPARAMS())
  4698. {
  4699. LINECALLQOSINFO * plci;
  4700. if ( m_pAddress->GetAPIVersion() < TAPI_VERSION2_0 )
  4701. {
  4702. Unlock();
  4703. return TAPI_E_NOTSUPPORTED;
  4704. }
  4705. if ( 0 != m_pCallParams->dwReceivingFlowspecSize )
  4706. {
  4707. DWORD dwCount;
  4708. DWORD dwSize;
  4709. LINECALLQOSINFO * plciOld;
  4710. plciOld = (LINECALLQOSINFO*)(((LPBYTE)m_pCallParams) +
  4711. m_pCallParams->dwReceivingFlowspecOffset);
  4712. dwSize = plciOld->dwTotalSize + sizeof(LINEQOSSERVICELEVEL);
  4713. ResizeCallParams( dwSize );
  4714. plci = (LINECALLQOSINFO*)(((LPBYTE)m_pCallParams) +
  4715. m_dwCallParamsUsedSize);
  4716. CopyMemory(
  4717. plci,
  4718. plciOld,
  4719. plciOld->dwTotalSize
  4720. );
  4721. dwCount = plci->SetQOSServiceLevel.dwNumServiceLevelEntries;
  4722. plci->SetQOSServiceLevel.LineQOSServiceLevel[dwCount].
  4723. dwMediaMode = dwMediaMode;
  4724. plci->SetQOSServiceLevel.LineQOSServiceLevel[dwCount].
  4725. dwQOSServiceLevel = ServiceLevel;
  4726. plci->SetQOSServiceLevel.dwNumServiceLevelEntries++;
  4727. m_dwCallParamsUsedSize += dwSize;
  4728. Unlock();
  4729. return S_OK;
  4730. }
  4731. else
  4732. {
  4733. ResizeCallParams( sizeof(LINECALLQOSINFO) );
  4734. plci = (LINECALLQOSINFO*)(((LPBYTE)m_pCallParams) +
  4735. m_dwCallParamsUsedSize);
  4736. m_pCallParams->dwReceivingFlowspecSize = sizeof( LINECALLQOSINFO );
  4737. m_pCallParams->dwReceivingFlowspecOffset = m_dwCallParamsUsedSize;
  4738. plci->dwKey = LINEQOSSTRUCT_KEY;
  4739. plci->dwTotalSize = sizeof(LINECALLQOSINFO);
  4740. plci->dwQOSRequestType = LINEQOSREQUESTTYPE_SERVICELEVEL;
  4741. plci->SetQOSServiceLevel.dwNumServiceLevelEntries = 1;
  4742. plci->SetQOSServiceLevel.LineQOSServiceLevel[0].
  4743. dwMediaMode = dwMediaMode;
  4744. plci->SetQOSServiceLevel.LineQOSServiceLevel[0].
  4745. dwQOSServiceLevel = ServiceLevel;
  4746. m_dwCallParamsUsedSize += sizeof(LINECALLQOSINFO);
  4747. Unlock();
  4748. return S_OK;
  4749. }
  4750. }
  4751. else
  4752. {
  4753. HCALL hCall;
  4754. hCall = m_t3Call.hCall;
  4755. Unlock();
  4756. hr = LineSetCallQualityOfService(
  4757. hCall,
  4758. ServiceLevel,
  4759. dwMediaMode
  4760. );
  4761. return hr;
  4762. }
  4763. return hr;
  4764. }
  4765. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4766. //
  4767. // get_CallId
  4768. //
  4769. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4770. #ifdef NEWCALLINFO
  4771. HRESULT
  4772. #else
  4773. STDMETHODIMP
  4774. #endif
  4775. CCall::get_CallId(long * plCallId )
  4776. {
  4777. HRESULT hr = S_OK;
  4778. LOG((TL_TRACE, "get_CallId - enter"));
  4779. if (TAPIIsBadWritePtr(plCallId, sizeof(long) ) )
  4780. {
  4781. LOG((TL_ERROR, "get_CallId - bad pointer"));
  4782. return E_POINTER;
  4783. }
  4784. Lock();
  4785. hr = RefreshCallInfo();
  4786. if (!SUCCEEDED(hr))
  4787. {
  4788. LOG((TL_ERROR, "get_CallId - RefreshCallInfo failed - %lx", hr));
  4789. }
  4790. else
  4791. {
  4792. *plCallId = m_pCallInfo->dwCallID;
  4793. }
  4794. Unlock();
  4795. LOG((TL_TRACE, "get_CallId - exit"));
  4796. return hr;
  4797. }
  4798. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4799. //
  4800. // get_RelatedCallId
  4801. //
  4802. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4803. #ifdef NEWCALLINFO
  4804. HRESULT
  4805. #else
  4806. STDMETHODIMP
  4807. #endif
  4808. CCall::get_RelatedCallId(long * plCallId )
  4809. {
  4810. HRESULT hr = S_OK;
  4811. LOG((TL_TRACE, "get_RelatedCallId - enter"));
  4812. if (TAPIIsBadWritePtr(plCallId, sizeof(long) ) )
  4813. {
  4814. LOG((TL_ERROR, "get_RelatedCallId - bad pointer"));
  4815. return E_POINTER;
  4816. }
  4817. Lock();
  4818. hr = RefreshCallInfo();
  4819. if (!SUCCEEDED(hr))
  4820. {
  4821. LOG((TL_ERROR, "get_RelatedCallId - RefreshCallInfo failed - %lx", hr));
  4822. }
  4823. else
  4824. {
  4825. *plCallId = m_pCallInfo->dwRelatedCallID;
  4826. }
  4827. Unlock();
  4828. LOG((TL_TRACE, "get_RelatedCallId - exit"));
  4829. return hr;
  4830. }
  4831. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4832. //
  4833. // get_CompletionId
  4834. //
  4835. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4836. #ifdef NEWCALLINFO
  4837. HRESULT
  4838. #else
  4839. STDMETHODIMP
  4840. #endif
  4841. CCall::get_CompletionId(long * plCompletionId )
  4842. {
  4843. HRESULT hr = S_OK;
  4844. LOG((TL_TRACE, "get_CompletionId - enter"));
  4845. if (TAPIIsBadWritePtr(plCompletionId, sizeof(long) ) )
  4846. {
  4847. LOG((TL_ERROR, "get_CompletionId - bad pointer"));
  4848. return E_POINTER;
  4849. }
  4850. Lock();
  4851. hr = RefreshCallInfo();
  4852. if (!SUCCEEDED(hr))
  4853. {
  4854. LOG((TL_ERROR, "get_CompletionId - RefreshCallInfo failed - %lx", hr));
  4855. }
  4856. else
  4857. {
  4858. *plCompletionId = m_pCallInfo->dwCompletionID;
  4859. }
  4860. Unlock();
  4861. LOG((TL_TRACE, "get_CompletionId - exit"));
  4862. return hr;
  4863. }
  4864. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4865. //
  4866. // get_NumberOfOwners
  4867. //
  4868. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4869. #ifdef NEWCALLINFO
  4870. HRESULT
  4871. #else
  4872. STDMETHODIMP
  4873. #endif
  4874. CCall::get_NumberOfOwners(long * plNumberOfOwners )
  4875. {
  4876. HRESULT hr = S_OK;
  4877. LOG((TL_TRACE, "get_NumberOfOwners - enter"));
  4878. if (TAPIIsBadWritePtr(plNumberOfOwners, sizeof(long) ) )
  4879. {
  4880. LOG((TL_ERROR, "get_NumberOfOwners - bad pointer"));
  4881. return E_POINTER;
  4882. }
  4883. Lock();
  4884. hr = RefreshCallInfo();
  4885. if (!SUCCEEDED(hr))
  4886. {
  4887. LOG((TL_ERROR, "get_NumberOfOwners - RefreshCallInfo failed - %lx", hr));
  4888. }
  4889. else
  4890. {
  4891. *plNumberOfOwners = m_pCallInfo->dwNumOwners;
  4892. }
  4893. Unlock();
  4894. LOG((TL_TRACE, "get_NumberOfOwners - exit"));
  4895. return hr;
  4896. }
  4897. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4898. //
  4899. // get_NumberOfMonitors
  4900. //
  4901. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4902. #ifdef NEWCALLINFO
  4903. HRESULT
  4904. #else
  4905. STDMETHODIMP
  4906. #endif
  4907. CCall::get_NumberOfMonitors(long * plNumberOfMonitors )
  4908. {
  4909. HRESULT hr = S_OK;
  4910. LOG((TL_TRACE, "get_NumberOfMonitors - enter"));
  4911. if (TAPIIsBadWritePtr(plNumberOfMonitors, sizeof(long) ) )
  4912. {
  4913. LOG((TL_ERROR, "get_NumberOfMonitors - bad pointer"));
  4914. return E_POINTER;
  4915. }
  4916. Lock();
  4917. hr = RefreshCallInfo();
  4918. if (!SUCCEEDED(hr))
  4919. {
  4920. LOG((TL_ERROR, "get_NumberOfMonitors - RefreshCallInfo failed - %lx", hr));
  4921. }
  4922. else
  4923. {
  4924. *plNumberOfMonitors = m_pCallInfo->dwNumMonitors;
  4925. }
  4926. Unlock();
  4927. LOG((TL_TRACE, "get_NumberOfMonitors - exit"));
  4928. return hr;
  4929. }
  4930. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4931. //
  4932. // get_NumberOfMonitors
  4933. //
  4934. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4935. #ifdef NEWCALLINFO
  4936. HRESULT
  4937. #else
  4938. STDMETHODIMP
  4939. #endif
  4940. CCall::get_Trunk(long * plTrunk )
  4941. {
  4942. HRESULT hr = S_OK;
  4943. LOG((TL_TRACE, "get_Trunk - enter"));
  4944. if (TAPIIsBadWritePtr(plTrunk, sizeof(long) ) )
  4945. {
  4946. LOG((TL_ERROR, "get_Trunk - bad pointer"));
  4947. return E_POINTER;
  4948. }
  4949. Lock();
  4950. hr = RefreshCallInfo();
  4951. if (!SUCCEEDED(hr))
  4952. {
  4953. LOG((TL_ERROR, "get_Trunk - RefreshCallInfo failed - %lx", hr));
  4954. }
  4955. else
  4956. {
  4957. *plTrunk = m_pCallInfo->dwTrunk;
  4958. }
  4959. Unlock();
  4960. LOG((TL_TRACE, "get_Trunk - exit"));
  4961. return hr;
  4962. }
  4963. #ifdef NEWCALLINFO
  4964. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4965. //
  4966. // GetHighLevelCompatibilityBuffer
  4967. //
  4968. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  4969. HRESULT
  4970. CCall::GetHighLevelCompatibilityBuffer(
  4971. DWORD * pdwSize,
  4972. BYTE ** ppBuffer
  4973. )
  4974. {
  4975. HRESULT hr = S_OK;
  4976. LOG((TL_TRACE, "GetHighLevelCompatibilityBuffer - enter"));
  4977. if (TAPIIsBadWritePtr(pdwSize, sizeof(DWORD)))
  4978. {
  4979. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - bad size pointer"));
  4980. return E_POINTER;
  4981. }
  4982. if (TAPIIsBadWritePtr(ppBuffer,sizeof(BYTE*) ) )
  4983. {
  4984. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - bad buffer pointer"));
  4985. return E_POINTER;
  4986. }
  4987. *ppBuffer = NULL;
  4988. *pdwSize = 0;
  4989. Lock();
  4990. if ( ISHOULDUSECALLPARAMS() )
  4991. {
  4992. if ( m_pCallParams->dwHighLevelCompSize != 0 )
  4993. {
  4994. BYTE * pTemp;
  4995. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallParams->dwHighLevelCompSize );
  4996. if ( NULL == pTemp )
  4997. {
  4998. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - out of memory"));
  4999. hr = E_OUTOFMEMORY;
  5000. }
  5001. else
  5002. {
  5003. CopyMemory(
  5004. pTemp,
  5005. ((PBYTE)m_pCallParams) + m_pCallParams->dwHighLevelCompOffset,
  5006. m_pCallParams->dwHighLevelCompSize
  5007. );
  5008. *ppBuffer = pTemp;
  5009. *pdwSize = m_pCallParams->dwHighLevelCompSize;
  5010. }
  5011. }
  5012. Unlock();
  5013. return hr;
  5014. }
  5015. hr = RefreshCallInfo();
  5016. if (!SUCCEEDED(hr))
  5017. {
  5018. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - can't get callinfo - %lx", hr));
  5019. Unlock();
  5020. return hr;
  5021. }
  5022. hr = S_OK;
  5023. if ( m_pCallInfo->dwHighLevelCompSize != 0 )
  5024. {
  5025. BYTE * pTemp;
  5026. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallInfo->dwHighLevelCompSize );
  5027. if ( NULL == pTemp )
  5028. {
  5029. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - out of memory"));
  5030. hr = E_OUTOFMEMORY;
  5031. }
  5032. else
  5033. {
  5034. CopyMemory(
  5035. pTemp,
  5036. ( (PBYTE)m_pCallInfo ) + m_pCallInfo->dwHighLevelCompOffset,
  5037. m_pCallInfo->dwHighLevelCompSize
  5038. );
  5039. *ppBuffer = pTemp;
  5040. *pdwSize = m_pCallInfo->dwHighLevelCompSize;
  5041. }
  5042. }
  5043. Unlock();
  5044. LOG((TL_TRACE, "GetHighLevelCompatibilityBuffer - exit"));
  5045. return hr;
  5046. }
  5047. #endif
  5048. #ifndef NEWCALLINFO
  5049. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5050. //
  5051. // GetHighLevelCompatibilityBuffer
  5052. //
  5053. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5054. STDMETHODIMP
  5055. CCall::GetHighLevelCompatibilityBuffer(
  5056. long lSize,
  5057. BYTE * pBuffer
  5058. )
  5059. {
  5060. HRESULT hr = S_OK;
  5061. LOG((TL_TRACE, "GetHighLevelCompatibilityBuffer - enter"));
  5062. if (lSize == 0)
  5063. {
  5064. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - lSize = 0"));
  5065. return S_FALSE;
  5066. }
  5067. if ( TAPIIsBadWritePtr ( pBuffer, lSize ) )
  5068. {
  5069. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - bad pointer"));
  5070. return E_POINTER;
  5071. }
  5072. Lock();
  5073. if ( ISHOULDUSECALLPARAMS() )
  5074. {
  5075. if ( 0 != m_pCallParams->dwHighLevelCompSize )
  5076. {
  5077. if ( lSize < m_pCallParams->dwHighLevelCompSize )
  5078. {
  5079. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - too small"));
  5080. hr = E_INVALIDARG;
  5081. }
  5082. else
  5083. {
  5084. CopyMemory(pBuffer,
  5085. ((PBYTE)m_pCallParams) + m_pCallParams->dwHighLevelCompOffset,
  5086. m_pCallParams->dwHighLevelCompSize
  5087. );
  5088. }
  5089. }
  5090. else
  5091. {
  5092. *pBuffer = 0;
  5093. }
  5094. }
  5095. else
  5096. {
  5097. hr = RefreshCallInfo();
  5098. if ( SUCCEEDED(hr) )
  5099. {
  5100. if ( m_pCallInfo->dwHighLevelCompSize > lSize )
  5101. {
  5102. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - size not big enough "));
  5103. return E_INVALIDARG;
  5104. }
  5105. else
  5106. {
  5107. CopyMemory(pBuffer,
  5108. ( (PBYTE) m_pCallInfo ) + m_pCallInfo->dwHighLevelCompOffset,
  5109. m_pCallInfo->dwHighLevelCompSize
  5110. );
  5111. }
  5112. }
  5113. else
  5114. {
  5115. LOG((TL_ERROR, "GetHighLevelCompatibilityBuffer - can't get callinfo - %lx", hr));
  5116. }
  5117. }
  5118. Unlock();
  5119. LOG((TL_TRACE, hr, "GetHighLevelCompatibilityBuffer - exit"));
  5120. return hr;
  5121. }
  5122. #endif
  5123. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5124. //
  5125. // SetHighLevelCompatibilityBuffer
  5126. //
  5127. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5128. #ifdef NEWCALLINFO
  5129. HRESULT
  5130. #else
  5131. STDMETHODIMP
  5132. #endif
  5133. CCall::SetHighLevelCompatibilityBuffer(
  5134. long lSize,
  5135. BYTE * pBuffer
  5136. )
  5137. {
  5138. HRESULT hr = S_OK;
  5139. LOG((TL_TRACE, "SetHighLevelCompatibilityBuffer - enter"));
  5140. if (IsBadReadPtr( pBuffer, lSize) )
  5141. {
  5142. LOG((TL_ERROR, "SetHighLevelCompatibilityBuffer - bad pointer"));
  5143. return E_POINTER;
  5144. }
  5145. Lock();
  5146. if ( !ISHOULDUSECALLPARAMS() )
  5147. {
  5148. LOG((TL_ERROR, "SetHighLevelCompatibilityBuffer - only when call is idle"));
  5149. hr = TAPI_E_INVALCALLSTATE;
  5150. }
  5151. else
  5152. {
  5153. hr = ResizeCallParams( lSize );
  5154. if ( SUCCEEDED(hr) )
  5155. {
  5156. CopyMemory(
  5157. ((LPBYTE)m_pCallParams) + m_dwCallParamsUsedSize,
  5158. pBuffer,
  5159. lSize
  5160. );
  5161. m_pCallParams->dwHighLevelCompOffset = m_dwCallParamsUsedSize;
  5162. m_pCallParams->dwHighLevelCompSize = lSize;
  5163. m_dwCallParamsUsedSize += lSize;
  5164. }
  5165. else
  5166. {
  5167. LOG((TL_ERROR, "SetHighLevelCompatibilityBuffer - can't resize callparams - %lx", hr));
  5168. }
  5169. }
  5170. Unlock();
  5171. LOG((TL_TRACE, hr, "SetHighLevelCompatibilityBuffer - exit"));
  5172. return hr;
  5173. }
  5174. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5175. //
  5176. // get_HighLevelCompatibilityBuffer
  5177. //
  5178. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5179. #ifdef NEWCALLINFO
  5180. HRESULT
  5181. CCall::get_HighLevelCompatibilityBuffer( VARIANT * pBuffer )
  5182. {
  5183. HRESULT hr = S_OK;
  5184. BYTE * p = NULL;
  5185. DWORD dwSize = 0;
  5186. LOG((TL_TRACE, "get_HighLevelCompatibilityBuffer - enter"));
  5187. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  5188. {
  5189. LOG((TL_ERROR, "get_HighLevelCompatibilityBuffer - bad pointer"));
  5190. return E_POINTER;
  5191. }
  5192. pBuffer->vt = VT_EMPTY;
  5193. hr = GetHighLevelCompatibilityBuffer(&dwSize, &p);
  5194. if (SUCCEEDED(hr))
  5195. {
  5196. hr = FillVariantFromBuffer(
  5197. dwSize,
  5198. p,
  5199. pBuffer
  5200. );
  5201. if ( !SUCCEEDED(hr) )
  5202. {
  5203. LOG((TL_ERROR, "get_HighLevelCompatibilityBuffer - fillvariant failed -%lx", hr));
  5204. }
  5205. }
  5206. if ( p != NULL )
  5207. {
  5208. CoTaskMemFree( p );
  5209. }
  5210. LOG((TL_TRACE, hr, "get_HighLevelCompatibilityBuffer - exit"));
  5211. return hr;
  5212. }
  5213. #else
  5214. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5215. //
  5216. // get_HighLevelCompatibilityBuffer
  5217. //
  5218. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5219. STDMETHODIMP
  5220. CCall::get_HighLevelCompatibilityBuffer( VARIANT * pBuffer )
  5221. {
  5222. HRESULT hr = S_OK;
  5223. BYTE * p;
  5224. DWORD dwSize = 0;
  5225. LOG((TL_TRACE, "get_HighLevelCompatibilityBuffer - enter"));
  5226. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  5227. {
  5228. LOG((TL_ERROR, "get_HighLevelCompatibilityBuffer - bad pointer"));
  5229. return E_POINTER;
  5230. }
  5231. pBuffer->vt = VT_EMPTY;
  5232. hr = GetHighLevelCompatibilityBufferSize( (long*)&dwSize );
  5233. if (SUCCEEDED(hr))
  5234. {
  5235. if ( 0 != dwSize )
  5236. {
  5237. p = (PBYTE) ClientAlloc( dwSize );
  5238. if ( p != NULL )
  5239. {
  5240. hr = GetHighLevelCompatibilityBuffer(dwSize, p);
  5241. if (SUCCEEDED(hr))
  5242. {
  5243. hr = FillVariantFromBuffer(
  5244. dwSize,
  5245. p,
  5246. pBuffer
  5247. );
  5248. if ( !SUCCEEDED(hr) )
  5249. {
  5250. LOG((TL_ERROR, "get_HighLevelCompatibilityBuffer - fillvariant failed -%lx", hr));
  5251. }
  5252. }
  5253. else
  5254. {
  5255. LOG((TL_ERROR, "get_HighLevelCompatibilityBuffer - GetHighLevelCompatibilityBuffer failed"));
  5256. }
  5257. }
  5258. else
  5259. {
  5260. LOG((TL_ERROR, "get_HighLevelCompatibilityBuffer - alloc failed"));
  5261. hr = E_OUTOFMEMORY;
  5262. }
  5263. }
  5264. else
  5265. {
  5266. LOG((TL_INFO, "get_HighLevelCompatibilityBuffer - dwSize = 0"));
  5267. }
  5268. }
  5269. else
  5270. {
  5271. LOG((TL_ERROR, "get_HighLevelCompatibilityBuffer - getsize failed"));
  5272. }
  5273. if ( p != NULL )
  5274. {
  5275. ClientFree( p );
  5276. }
  5277. LOG((TL_TRACE, hr, "get_HighLevelCompatibilityBuffer - exit"));
  5278. return hr;
  5279. }
  5280. #endif
  5281. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5282. //
  5283. // put_HighLevelCompatibilityBuffer
  5284. //
  5285. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5286. #ifdef NEWCALLINFO
  5287. HRESULT
  5288. #else
  5289. STDMETHODIMP
  5290. #endif
  5291. CCall::put_HighLevelCompatibilityBuffer( VARIANT Buffer )
  5292. {
  5293. HRESULT hr = S_OK;
  5294. DWORD dwSize;
  5295. BYTE * pBuffer;
  5296. LOG((TL_TRACE, "put_HighLevelCompatibilityBuffer - enter"));
  5297. hr = MakeBufferFromVariant(
  5298. Buffer,
  5299. &dwSize,
  5300. &pBuffer
  5301. );
  5302. if ( SUCCEEDED(hr) )
  5303. {
  5304. hr = SetHighLevelCompatibilityBuffer(
  5305. dwSize,
  5306. pBuffer
  5307. );
  5308. ClientFree( pBuffer );
  5309. if ( !SUCCEEDED(hr) )
  5310. {
  5311. LOG((TL_ERROR, "put_HighLevelCompatibilityBuffer - Set failed - %lx", hr));
  5312. return hr;
  5313. }
  5314. }
  5315. else
  5316. {
  5317. LOG((TL_ERROR, "put_HighLevelCompatibilityBuffer - can't make buffer - %lx", hr));
  5318. }
  5319. LOG((TL_TRACE, "put_HighLevelCompatibilityBuffer - exit"));
  5320. return S_OK;
  5321. }
  5322. #ifdef NEWCALLINFO
  5323. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5324. //
  5325. // GetLowLevelCompatibilityBuffer
  5326. //
  5327. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5328. HRESULT
  5329. CCall::GetLowLevelCompatibilityBuffer(
  5330. DWORD * pdwSize,
  5331. BYTE ** ppBuffer
  5332. )
  5333. {
  5334. HRESULT hr = S_OK;
  5335. LOG((TL_TRACE, "GetLowLevelCompatibilityBuffer - enter"));
  5336. if (TAPIIsBadWritePtr(pdwSize, sizeof(DWORD)))
  5337. {
  5338. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - bad size pointer"));
  5339. return E_POINTER;
  5340. }
  5341. if (TAPIIsBadWritePtr(ppBuffer,sizeof(BYTE*) ) )
  5342. {
  5343. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - bad buffer pointer"));
  5344. return E_POINTER;
  5345. }
  5346. *ppBuffer = NULL;
  5347. *pdwSize = 0;
  5348. Lock();
  5349. if ( ISHOULDUSECALLPARAMS() )
  5350. {
  5351. if ( m_pCallParams->dwLowLevelCompSize != 0 )
  5352. {
  5353. BYTE * pTemp;
  5354. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallParams->dwLowLevelCompSize );
  5355. if ( NULL == pTemp )
  5356. {
  5357. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - out of memory"));
  5358. hr = E_OUTOFMEMORY;
  5359. }
  5360. else
  5361. {
  5362. CopyMemory(
  5363. pTemp,
  5364. ((PBYTE)m_pCallParams) + m_pCallParams->dwLowLevelCompOffset,
  5365. m_pCallParams->dwLowLevelCompSize
  5366. );
  5367. *ppBuffer = pTemp;
  5368. *pdwSize = m_pCallParams->dwLowLevelCompSize;
  5369. }
  5370. }
  5371. Unlock();
  5372. return hr;
  5373. }
  5374. hr = RefreshCallInfo();
  5375. if (!SUCCEEDED(hr))
  5376. {
  5377. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - can't get callinfo - %lx", hr));
  5378. Unlock();
  5379. return hr;
  5380. }
  5381. hr = S_OK;
  5382. if ( m_pCallInfo->dwLowLevelCompSize != 0 )
  5383. {
  5384. BYTE * pTemp;
  5385. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallInfo->dwLowLevelCompSize );
  5386. if ( NULL == pTemp )
  5387. {
  5388. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - out of memory"));
  5389. hr = E_OUTOFMEMORY;
  5390. }
  5391. else
  5392. {
  5393. CopyMemory(
  5394. pTemp,
  5395. ( (PBYTE)m_pCallInfo ) + m_pCallInfo->dwLowLevelCompOffset,
  5396. m_pCallInfo->dwLowLevelCompSize
  5397. );
  5398. *ppBuffer = pTemp;
  5399. *pdwSize = m_pCallInfo->dwLowLevelCompSize;
  5400. }
  5401. }
  5402. Unlock();
  5403. LOG((TL_TRACE, "GetLowLevelCompatibilityBuffer - exit"));
  5404. return hr;
  5405. }
  5406. #endif
  5407. #ifndef NEWCALLINFO
  5408. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5409. //
  5410. // GetLowLevelCompatibilityBuffer
  5411. //
  5412. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5413. STDMETHODIMP
  5414. CCall::GetLowLevelCompatibilityBuffer(
  5415. long lSize,
  5416. BYTE * pBuffer
  5417. )
  5418. {
  5419. HRESULT hr = S_OK;
  5420. LOG((TL_TRACE, "GetLowLevelCompatibilityBuffer - enter"));
  5421. if (lSize == 0)
  5422. {
  5423. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - lSize = 0"));
  5424. return S_FALSE;
  5425. }
  5426. if ( TAPIIsBadWritePtr ( pBuffer, lSize ) )
  5427. {
  5428. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - bad pointer"));
  5429. return E_POINTER;
  5430. }
  5431. Lock();
  5432. if ( ISHOULDUSECALLPARAMS() )
  5433. {
  5434. if ( 0 != m_pCallParams->dwLowLevelCompSize )
  5435. {
  5436. if ( lSize < m_pCallParams->dwLowLevelCompSize )
  5437. {
  5438. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - too small"));
  5439. hr = E_INVALIDARG;
  5440. }
  5441. else
  5442. {
  5443. CopyMemory(pBuffer,
  5444. ((PBYTE)m_pCallParams) + m_pCallParams->dwLowLevelCompOffset,
  5445. m_pCallParams->dwLowLevelCompSize
  5446. );
  5447. }
  5448. }
  5449. else
  5450. {
  5451. *pBuffer = 0;
  5452. }
  5453. }
  5454. else
  5455. {
  5456. hr = RefreshCallInfo();
  5457. if ( SUCCEEDED(hr) )
  5458. {
  5459. if ( m_pCallInfo->dwLowLevelCompSize > lSize )
  5460. {
  5461. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - size not big enough "));
  5462. return E_INVALIDARG;
  5463. }
  5464. else
  5465. {
  5466. CopyMemory(pBuffer,
  5467. ( (PBYTE) m_pCallInfo ) + m_pCallInfo->dwLowLevelCompOffset,
  5468. m_pCallInfo->dwLowLevelCompSize
  5469. );
  5470. }
  5471. }
  5472. else
  5473. {
  5474. LOG((TL_ERROR, "GetLowLevelCompatibilityBuffer - can't get callinfo - %lx", hr));
  5475. }
  5476. }
  5477. Unlock();
  5478. LOG((TL_TRACE, hr, "GetLowLevelCompatibilityBuffer - exit"));
  5479. return hr;
  5480. }
  5481. #endif
  5482. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5483. //
  5484. // SetLowLevelCompatibilityBuffer
  5485. //
  5486. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5487. #ifdef NEWCALLINFO
  5488. HRESULT
  5489. #else
  5490. STDMETHODIMP
  5491. #endif
  5492. CCall::SetLowLevelCompatibilityBuffer(
  5493. long lSize,
  5494. BYTE * pBuffer
  5495. )
  5496. {
  5497. HRESULT hr = S_OK;
  5498. LOG((TL_TRACE, "SetLowLevelCompatibilityBuffer - enter"));
  5499. if (IsBadReadPtr( pBuffer, lSize) )
  5500. {
  5501. LOG((TL_ERROR, "SetLowLevelCompatibilityBuffer - bad pointer"));
  5502. return E_POINTER;
  5503. }
  5504. Lock();
  5505. if ( !ISHOULDUSECALLPARAMS() )
  5506. {
  5507. LOG((TL_ERROR, "SetLowLevelCompatibilityBuffer - only when call is idle"));
  5508. hr = TAPI_E_INVALCALLSTATE;
  5509. }
  5510. else
  5511. {
  5512. hr = ResizeCallParams( lSize );
  5513. if ( SUCCEEDED(hr) )
  5514. {
  5515. CopyMemory(
  5516. ((LPBYTE)m_pCallParams) + m_dwCallParamsUsedSize,
  5517. pBuffer,
  5518. lSize
  5519. );
  5520. m_pCallParams->dwLowLevelCompOffset = m_dwCallParamsUsedSize;
  5521. m_pCallParams->dwLowLevelCompSize = lSize;
  5522. m_dwCallParamsUsedSize += lSize;
  5523. }
  5524. else
  5525. {
  5526. LOG((TL_ERROR, "SetLowLevelCompatibilityBuffer - can't resize callparams - %lx", hr));
  5527. }
  5528. }
  5529. Unlock();
  5530. LOG((TL_TRACE, hr, "SetLowLevelCompatibilityBuffer - exit"));
  5531. return hr;
  5532. }
  5533. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5534. //
  5535. // get_LowLevelCompatibilityBuffer
  5536. //
  5537. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5538. #ifdef NEWCALLINFO
  5539. HRESULT
  5540. CCall::get_LowLevelCompatibilityBuffer( VARIANT * pBuffer )
  5541. {
  5542. HRESULT hr = S_OK;
  5543. BYTE * p = NULL;
  5544. DWORD dwSize = 0;
  5545. LOG((TL_TRACE, "get_LowLevelCompatibilityBuffer - enter"));
  5546. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  5547. {
  5548. LOG((TL_ERROR, "get_LowLevelCompatibilityBuffer - bad pointer"));
  5549. return E_POINTER;
  5550. }
  5551. pBuffer->vt = VT_EMPTY;
  5552. hr = GetLowLevelCompatibilityBuffer(&dwSize, &p);
  5553. if (SUCCEEDED(hr))
  5554. {
  5555. hr = FillVariantFromBuffer(
  5556. dwSize,
  5557. p,
  5558. pBuffer
  5559. );
  5560. if ( !SUCCEEDED(hr) )
  5561. {
  5562. LOG((TL_ERROR, "get_LowLevelCompatibilityBuffer - fillvariant failed -%lx", hr));
  5563. }
  5564. }
  5565. if ( p != NULL )
  5566. {
  5567. CoTaskMemFree( p );
  5568. }
  5569. LOG((TL_TRACE, hr, "get_LowLevelCompatibilityBuffer - exit"));
  5570. return hr;
  5571. }
  5572. #else
  5573. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5574. //
  5575. // get_LowLevelCompatibilityBuffer
  5576. //
  5577. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5578. STDMETHODIMP
  5579. CCall::get_LowLevelCompatibilityBuffer( VARIANT * pBuffer )
  5580. {
  5581. HRESULT hr = S_OK;
  5582. BYTE * p;
  5583. DWORD dwSize = 0;
  5584. LOG((TL_TRACE, "get_LowLevelCompatibilityBuffer - enter"));
  5585. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  5586. {
  5587. LOG((TL_ERROR, "get_LowLevelCompatibilityBuffer - bad pointer"));
  5588. return E_POINTER;
  5589. }
  5590. pBuffer->vt = VT_EMPTY;
  5591. hr = GetLowLevelCompatibilityBufferSize( (long*)&dwSize );
  5592. if (SUCCEEDED(hr))
  5593. {
  5594. if ( 0 != dwSize )
  5595. {
  5596. p = (PBYTE) ClientAlloc( dwSize );
  5597. if ( p != NULL )
  5598. {
  5599. hr = GetLowLevelCompatibilityBuffer(dwSize, p);
  5600. if (SUCCEEDED(hr))
  5601. {
  5602. hr = FillVariantFromBuffer(
  5603. dwSize,
  5604. p,
  5605. pBuffer
  5606. );
  5607. if ( !SUCCEEDED(hr) )
  5608. {
  5609. LOG((TL_ERROR, "get_LowLevelCompatibilityBuffer - fillvariant failed -%lx", hr));
  5610. }
  5611. }
  5612. else
  5613. {
  5614. LOG((TL_ERROR, "get_LowLevelCompatibilityBuffer - Get failed"));
  5615. }
  5616. }
  5617. else
  5618. {
  5619. LOG((TL_ERROR, "get_LowLevelCompatibilityBuffer - alloc failed"));
  5620. hr = E_OUTOFMEMORY;
  5621. }
  5622. }
  5623. else
  5624. {
  5625. LOG((TL_INFO, "get_LowLevelCompatibilityBuffer - dwSize = 0"));
  5626. }
  5627. }
  5628. else
  5629. {
  5630. LOG((TL_ERROR, "get_LowLevelCompatibilityBuffer - getsize failed"));
  5631. }
  5632. if ( p != NULL )
  5633. {
  5634. ClientFree( p );
  5635. }
  5636. LOG((TL_TRACE, hr, "get_LowLevelCompatibilityBuffer - exit"));
  5637. return hr;
  5638. }
  5639. #endif
  5640. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5641. //
  5642. // put_LowLevelCompatibilityBuffer
  5643. //
  5644. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5645. #ifdef NEWCALLINFO
  5646. HRESULT
  5647. #else
  5648. STDMETHODIMP
  5649. #endif
  5650. CCall::put_LowLevelCompatibilityBuffer( VARIANT Buffer )
  5651. {
  5652. HRESULT hr = S_OK;
  5653. DWORD dwSize;
  5654. BYTE * pBuffer;
  5655. LOG((TL_TRACE, "put_LowLevelCompatibilityBuffer - enter"));
  5656. hr = MakeBufferFromVariant(
  5657. Buffer,
  5658. &dwSize,
  5659. &pBuffer
  5660. );
  5661. if ( SUCCEEDED(hr) )
  5662. {
  5663. hr = SetLowLevelCompatibilityBuffer(
  5664. dwSize,
  5665. pBuffer
  5666. );
  5667. ClientFree( pBuffer );
  5668. if ( !SUCCEEDED(hr) )
  5669. {
  5670. LOG((TL_ERROR, "put_LowLevelCompatibilityBuffer - Set failed - %lx", hr));
  5671. return hr;
  5672. }
  5673. }
  5674. else
  5675. {
  5676. LOG((TL_ERROR, "put_LowLevelCompatibilityBuffer - can't make buffer - %lx", hr));
  5677. }
  5678. LOG((TL_TRACE, "put_LowLevelCompatibilityBuffer - exit"));
  5679. return S_OK;
  5680. }
  5681. #ifdef NEWCALLINFO
  5682. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5683. //
  5684. // GetChargingInfoBuffer
  5685. //
  5686. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5687. HRESULT
  5688. CCall::GetChargingInfoBuffer(
  5689. DWORD * pdwSize,
  5690. BYTE ** ppBuffer
  5691. )
  5692. {
  5693. HRESULT hr = S_OK;
  5694. LOG((TL_TRACE, "GetChargingInfoBuffer - enter"));
  5695. if (TAPIIsBadWritePtr(pdwSize, sizeof(DWORD)))
  5696. {
  5697. LOG((TL_ERROR, "GetChargingInfoBuffer - bad size pointer"));
  5698. return E_POINTER;
  5699. }
  5700. if (TAPIIsBadWritePtr(ppBuffer,sizeof(BYTE*) ) )
  5701. {
  5702. LOG((TL_ERROR, "GetChargingInfoBuffer - bad buffer pointer"));
  5703. return E_POINTER;
  5704. }
  5705. *ppBuffer = NULL;
  5706. *pdwSize = 0;
  5707. Lock();
  5708. hr = RefreshCallInfo();
  5709. if (!SUCCEEDED(hr))
  5710. {
  5711. LOG((TL_ERROR, "GetChargingInfoBuffer - can't get callinfo - %lx", hr));
  5712. Unlock();
  5713. return hr;
  5714. }
  5715. hr = S_OK;
  5716. if ( m_pCallInfo->dwChargingInfoSize != 0 )
  5717. {
  5718. BYTE * pTemp;
  5719. pTemp = (BYTE *)CoTaskMemAlloc( m_pCallInfo->dwChargingInfoSize );
  5720. if ( NULL == pTemp )
  5721. {
  5722. LOG((TL_ERROR, "GetChargingInfoBuffer - out of memory"));
  5723. hr = E_OUTOFMEMORY;
  5724. }
  5725. else
  5726. {
  5727. CopyMemory(
  5728. pTemp,
  5729. ( (PBYTE)m_pCallInfo ) + m_pCallInfo->dwChargingInfoOffset,
  5730. m_pCallInfo->dwChargingInfoSize
  5731. );
  5732. *ppBuffer = pTemp;
  5733. *pdwSize = m_pCallInfo->dwChargingInfoSize;
  5734. }
  5735. }
  5736. Unlock();
  5737. LOG((TL_TRACE, "GetChargingInfoBuffer - exit"));
  5738. return hr;
  5739. }
  5740. #endif
  5741. #ifndef NEWCALLINFO
  5742. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5743. //
  5744. // GetChargingInfoBuffer
  5745. //
  5746. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5747. STDMETHODIMP
  5748. CCall::GetChargingInfoBuffer(
  5749. long lSize,
  5750. BYTE * pBuffer
  5751. )
  5752. {
  5753. HRESULT hr = S_OK;
  5754. LOG((TL_TRACE, "GetChargingInfoBuffer - enter"));
  5755. if (lSize == 0)
  5756. {
  5757. LOG((TL_ERROR, "GetChargingInfoBuffer - lSize = 0"));
  5758. return S_FALSE;
  5759. }
  5760. if ( TAPIIsBadWritePtr ( pBuffer, lSize ) )
  5761. {
  5762. LOG((TL_ERROR, "GetChargingInfoBuffer - bad pointer"));
  5763. return E_POINTER;
  5764. }
  5765. Lock();
  5766. hr = RefreshCallInfo();
  5767. if ( SUCCEEDED(hr) )
  5768. {
  5769. if ( m_pCallInfo->dwChargingInfoSize > lSize )
  5770. {
  5771. LOG((TL_ERROR, "GetChargingInfoBuffer - size not big enough "));
  5772. return E_INVALIDARG;
  5773. }
  5774. else
  5775. {
  5776. CopyMemory(pBuffer,
  5777. ( (PBYTE) m_pCallInfo ) + m_pCallInfo->dwChargingInfoOffset,
  5778. m_pCallInfo->dwChargingInfoSize
  5779. );
  5780. }
  5781. }
  5782. else
  5783. {
  5784. LOG((TL_ERROR, "GetChargingInfoBuffer - can't get callinfo - %lx", hr));
  5785. }
  5786. Unlock();
  5787. LOG((TL_TRACE, hr, "GetChargingInfoBuffer - exit"));
  5788. return hr;
  5789. }
  5790. #endif
  5791. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5792. //
  5793. // get_ChargingInfoBuffer
  5794. //
  5795. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5796. #ifdef NEWCALLINFO
  5797. HRESULT
  5798. CCall::get_ChargingInfoBuffer( VARIANT * pBuffer )
  5799. {
  5800. HRESULT hr = S_OK;
  5801. BYTE * p = NULL;
  5802. DWORD dwSize = 0;
  5803. LOG((TL_TRACE, "get_ChargingInfoBuffer - enter"));
  5804. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  5805. {
  5806. LOG((TL_ERROR, "get_ChargingInfoBuffer - bad pointer"));
  5807. return E_POINTER;
  5808. }
  5809. pBuffer->vt = VT_EMPTY;
  5810. hr = GetChargingInfoBuffer(&dwSize, &p);
  5811. if (SUCCEEDED(hr))
  5812. {
  5813. hr = FillVariantFromBuffer(
  5814. dwSize,
  5815. p,
  5816. pBuffer
  5817. );
  5818. if ( !SUCCEEDED(hr) )
  5819. {
  5820. LOG((TL_ERROR, "get_ChargingInfoBuffer - fillvariant failed -%lx", hr));
  5821. }
  5822. }
  5823. if ( p != NULL )
  5824. {
  5825. CoTaskMemFree( p );
  5826. }
  5827. LOG((TL_TRACE, hr, "get_ChargingInfoBuffer - exit"));
  5828. return hr;
  5829. }
  5830. #else
  5831. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5832. //
  5833. // get_ChargingInfoBuffer
  5834. //
  5835. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  5836. STDMETHODIMP
  5837. CCall::get_ChargingInfoBuffer( VARIANT * pBuffer )
  5838. {
  5839. HRESULT hr = S_OK;
  5840. BYTE * p;
  5841. DWORD dwSize = 0;
  5842. LOG((TL_TRACE, "get_ChargingInfoBuffer - enter"));
  5843. if ( TAPIIsBadWritePtr( pBuffer, sizeof( VARIANT ) ) )
  5844. {
  5845. LOG((TL_ERROR, "get_ChargingInfoBuffer - bad pointer"));
  5846. return E_POINTER;
  5847. }
  5848. pBuffer->vt = VT_EMPTY;
  5849. hr = GetChargingInfoBufferSize( (long*)&dwSize );
  5850. if (SUCCEEDED(hr))
  5851. {
  5852. if ( 0 != dwSize )
  5853. {
  5854. p = (PBYTE) ClientAlloc( dwSize );
  5855. if ( p != NULL )
  5856. {
  5857. hr = GetChargingInfoBuffer(dwSize, p);
  5858. if (SUCCEEDED(hr))
  5859. {
  5860. hr = FillVariantFromBuffer(
  5861. dwSize,
  5862. p,
  5863. pBuffer
  5864. );
  5865. if ( !SUCCEEDED(hr) )
  5866. {
  5867. LOG((TL_ERROR, "get_ChargingInfoBuffer - fillvariant failed -%lx", hr));
  5868. }
  5869. }
  5870. else
  5871. {
  5872. LOG((TL_ERROR, "get_ChargingInfoBuffer - GetDevSpecificBuffer"));
  5873. }
  5874. }
  5875. else
  5876. {
  5877. LOG((TL_ERROR, "get_ChargingInfoBuffer - alloc failed"));
  5878. hr = E_OUTOFMEMORY;
  5879. }
  5880. }
  5881. else
  5882. {
  5883. LOG((TL_INFO, "get_ChargingInfoBuffer - dwSize = 0"));
  5884. }
  5885. }
  5886. else
  5887. {
  5888. LOG((TL_ERROR, "get_ChargingInfoBuffer - getsize failed"));
  5889. }
  5890. if ( p != NULL )
  5891. {
  5892. ClientFree( p );
  5893. }
  5894. LOG((TL_TRACE, hr, "get_ChargingInfoBuffer - exit"));
  5895. return hr;
  5896. }
  5897. #endif
  5898. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5899. //
  5900. // get_Rate
  5901. //
  5902. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5903. #ifdef NEWCALLINFO
  5904. HRESULT
  5905. #else
  5906. STDMETHODIMP
  5907. #endif
  5908. CCall::get_Rate(long * plRate )
  5909. {
  5910. HRESULT hr = S_OK;
  5911. LOG((TL_TRACE, "get_Rate - enter"));
  5912. if (TAPIIsBadWritePtr(plRate, sizeof(long) ) )
  5913. {
  5914. LOG((TL_ERROR, "get_Rate - bad pointer"));
  5915. return E_POINTER;
  5916. }
  5917. Lock();
  5918. hr = RefreshCallInfo();
  5919. if (!SUCCEEDED(hr))
  5920. {
  5921. LOG((TL_ERROR, "get_Rate - RefreshCallInfo failed - %lx", hr));
  5922. }
  5923. else
  5924. {
  5925. *plRate = m_pCallInfo->dwRate;
  5926. }
  5927. Unlock();
  5928. LOG((TL_TRACE, hr, "get_Rate - exit"));
  5929. return hr;
  5930. }
  5931. #ifdef NEWCALLINFO
  5932. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5933. //
  5934. //
  5935. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5936. STDMETHODIMP
  5937. CCall::get_CallInfoLong(
  5938. CALLINFO_LONG CallInfoLongType,
  5939. long * plCallInfoLongVal
  5940. )
  5941. {
  5942. HRESULT hr = E_FAIL;
  5943. LOG((TL_TRACE, "get_CallInfoLong - enter"));
  5944. switch( CallInfoLongType )
  5945. {
  5946. case CIL_MEDIATYPESAVAILABLE:
  5947. hr = get_MediaTypesAvailable( plCallInfoLongVal );
  5948. break;
  5949. case CIL_BEARERMODE:
  5950. hr = get_BearerMode( plCallInfoLongVal );
  5951. break;
  5952. case CIL_CALLERIDADDRESSTYPE:
  5953. hr = get_CallerIDAddressType( plCallInfoLongVal );
  5954. break;
  5955. case CIL_CALLEDIDADDRESSTYPE:
  5956. hr = get_CalledIDAddressType( plCallInfoLongVal );
  5957. break;
  5958. case CIL_CONNECTEDIDADDRESSTYPE:
  5959. hr = get_ConnectedIDAddressType( plCallInfoLongVal );
  5960. break;
  5961. case CIL_REDIRECTIONIDADDRESSTYPE:
  5962. hr = get_RedirectionIDAddressType( plCallInfoLongVal );
  5963. break;
  5964. case CIL_REDIRECTINGIDADDRESSTYPE:
  5965. hr = get_RedirectingIDAddressType( plCallInfoLongVal );
  5966. break;
  5967. case CIL_ORIGIN:
  5968. hr = get_Origin( plCallInfoLongVal );
  5969. break;
  5970. case CIL_REASON:
  5971. hr = get_Reason( plCallInfoLongVal );
  5972. break;
  5973. case CIL_APPSPECIFIC:
  5974. hr = get_AppSpecific( plCallInfoLongVal );
  5975. break;
  5976. case CIL_CALLTREATMENT:
  5977. hr = get_CallTreatment( plCallInfoLongVal );
  5978. break;
  5979. case CIL_MINRATE:
  5980. hr = get_MinRate( plCallInfoLongVal );
  5981. break;
  5982. case CIL_MAXRATE:
  5983. hr = get_MaxRate( plCallInfoLongVal );
  5984. break;
  5985. case CIL_CALLID:
  5986. hr = get_CallId( plCallInfoLongVal );
  5987. break;
  5988. case CIL_RELATEDCALLID:
  5989. hr = get_RelatedCallId( plCallInfoLongVal );
  5990. break;
  5991. case CIL_COMPLETIONID:
  5992. hr = get_CompletionId( plCallInfoLongVal );
  5993. break;
  5994. case CIL_NUMBEROFOWNERS:
  5995. hr = get_NumberOfOwners( plCallInfoLongVal );
  5996. break;
  5997. case CIL_NUMBEROFMONITORS:
  5998. hr = get_NumberOfMonitors( plCallInfoLongVal );
  5999. break;
  6000. case CIL_TRUNK:
  6001. hr = get_Trunk( plCallInfoLongVal );
  6002. break;
  6003. case CIL_RATE:
  6004. hr = get_Rate( plCallInfoLongVal );
  6005. break;
  6006. case CIL_COUNTRYCODE:
  6007. hr = get_CountryCode( plCallInfoLongVal );
  6008. break;
  6009. case CIL_CALLPARAMSFLAGS:
  6010. hr = GetCallParamsFlags( plCallInfoLongVal );
  6011. break;
  6012. case CIL_GENERATEDIGITDURATION:
  6013. hr = get_GenerateDigitDuration( plCallInfoLongVal );
  6014. break;
  6015. case CIL_MONITORDIGITMODES:
  6016. hr = get_MonitorDigitModes( plCallInfoLongVal );
  6017. break;
  6018. case CIL_MONITORMEDIAMODES:
  6019. hr = get_MonitorMediaModes( plCallInfoLongVal );
  6020. break;
  6021. default:
  6022. hr = E_INVALIDARG;
  6023. break;
  6024. }
  6025. LOG((TL_TRACE, "get_CallInfoLong - exit - return %lx", hr));
  6026. return hr;
  6027. }
  6028. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6029. //
  6030. //
  6031. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6032. STDMETHODIMP
  6033. CCall::put_CallInfoLong(
  6034. CALLINFO_LONG CallInfoLongType,
  6035. long lCallInfoLongVal
  6036. )
  6037. {
  6038. HRESULT hr = E_FAIL;
  6039. LOG((TL_TRACE, "put_CallInfoLong - enter"));
  6040. switch( CallInfoLongType )
  6041. {
  6042. case CIL_MEDIATYPESAVAILABLE:
  6043. LOG((TL_ERROR, "Cannot set MEDIATYPESAVAILABLE"));
  6044. hr = TAPI_E_NOTSUPPORTED;
  6045. break;
  6046. case CIL_BEARERMODE:
  6047. hr = put_BearerMode( lCallInfoLongVal );
  6048. break;
  6049. case CIL_CALLERIDADDRESSTYPE:
  6050. LOG((TL_ERROR, "Cannot set CALLERIDIADDRESSTYPE"));
  6051. hr = TAPI_E_NOTSUPPORTED;
  6052. break;
  6053. case CIL_CALLEDIDADDRESSTYPE:
  6054. LOG((TL_ERROR, "Cannot set CALLEDIDIADDRESSTYPE"));
  6055. hr = TAPI_E_NOTSUPPORTED;
  6056. break;
  6057. case CIL_CONNECTEDIDADDRESSTYPE:
  6058. LOG((TL_ERROR, "Cannot set CONNECTEDIDIADDRESSTYPE"));
  6059. hr = TAPI_E_NOTSUPPORTED;
  6060. break;
  6061. case CIL_REDIRECTIONIDADDRESSTYPE:
  6062. LOG((TL_ERROR, "Cannot set REDIRECTIONIDIADDRESSTYPE"));
  6063. hr = TAPI_E_NOTSUPPORTED;
  6064. break;
  6065. case CIL_REDIRECTINGIDADDRESSTYPE:
  6066. LOG((TL_ERROR, "Cannot set REDIRECTINGIDIADDRESSTYPE"));
  6067. hr = TAPI_E_NOTSUPPORTED;
  6068. break;
  6069. case CIL_ORIGIN:
  6070. LOG((TL_ERROR, "Cannot set ORIGIN"));
  6071. hr = TAPI_E_NOTSUPPORTED;
  6072. break;
  6073. case CIL_REASON:
  6074. LOG((TL_ERROR, "Cannot set REASON"));
  6075. hr = TAPI_E_NOTSUPPORTED;
  6076. break;
  6077. case CIL_APPSPECIFIC:
  6078. hr = put_AppSpecific( lCallInfoLongVal );
  6079. break;
  6080. case CIL_CALLTREATMENT:
  6081. hr = put_CallTreatment( lCallInfoLongVal );
  6082. break;
  6083. case CIL_MINRATE:
  6084. hr = put_MinRate( lCallInfoLongVal );
  6085. break;
  6086. case CIL_MAXRATE:
  6087. hr = put_MaxRate( lCallInfoLongVal );
  6088. break;
  6089. case CIL_CALLID:
  6090. LOG((TL_ERROR, "Cannot set CALLID"));
  6091. hr = TAPI_E_NOTSUPPORTED;
  6092. break;
  6093. case CIL_RELATEDCALLID:
  6094. LOG((TL_ERROR, "Cannot set RELATEDCALLID"));
  6095. hr = TAPI_E_NOTSUPPORTED;
  6096. break;
  6097. case CIL_COMPLETIONID:
  6098. LOG((TL_ERROR, "Cannot set COMPLETIONID"));
  6099. hr = TAPI_E_NOTSUPPORTED;
  6100. break;
  6101. case CIL_NUMBEROFOWNERS:
  6102. LOG((TL_ERROR, "Cannot set NUMBEROFOWNERS"));
  6103. hr = TAPI_E_NOTSUPPORTED;
  6104. break;
  6105. case CIL_NUMBEROFMONITORS:
  6106. LOG((TL_ERROR, "Cannot set NUMBEROFMONITORS"));
  6107. hr = TAPI_E_NOTSUPPORTED;
  6108. break;
  6109. case CIL_TRUNK:
  6110. LOG((TL_ERROR, "Cannot set TRUNK"));
  6111. hr = TAPI_E_NOTSUPPORTED;
  6112. break;
  6113. case CIL_RATE:
  6114. LOG((TL_ERROR, "Cannot set RATE"));
  6115. hr = TAPI_E_NOTSUPPORTED;
  6116. break;
  6117. case CIL_COUNTRYCODE:
  6118. hr = put_CountryCode( lCallInfoLongVal );
  6119. break;
  6120. case CIL_CALLPARAMSFLAGS:
  6121. hr = SetCallParamsFlags( lCallInfoLongVal );
  6122. break;
  6123. case CIL_GENERATEDIGITDURATION:
  6124. hr = put_GenerateDigitDuration( lCallInfoLongVal );
  6125. break;
  6126. case CIL_MONITORDIGITMODES:
  6127. LOG((TL_ERROR, "Cannot set MONITORDIGITMODES"));
  6128. hr = TAPI_E_NOTSUPPORTED;
  6129. break;
  6130. case CIL_MONITORMEDIAMODES:
  6131. LOG((TL_ERROR, "Cannot set MONITORMEDIAMODES"));
  6132. hr = TAPI_E_NOTSUPPORTED;
  6133. break;
  6134. default:
  6135. hr = E_INVALIDARG;
  6136. break;
  6137. }
  6138. LOG((TL_TRACE, "put_CallInfoLong - exit - return %lx", hr));
  6139. return hr;
  6140. }
  6141. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6142. //
  6143. //
  6144. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6145. STDMETHODIMP
  6146. CCall::get_CallInfoString(
  6147. CALLINFO_STRING CallInfoStringType,
  6148. BSTR * ppCallInfoString
  6149. )
  6150. {
  6151. HRESULT hr = E_FAIL;
  6152. LOG((TL_TRACE, "get_CallInfoString - enter"));
  6153. switch(CallInfoStringType)
  6154. {
  6155. case CIS_CALLERIDNAME:
  6156. hr = get_CallerIDName(ppCallInfoString);
  6157. break;
  6158. case CIS_CALLERIDNUMBER:
  6159. hr = get_CallerIDNumber(ppCallInfoString);
  6160. break;
  6161. case CIS_CALLEDIDNAME:
  6162. hr = get_CalledIDName(ppCallInfoString);
  6163. break;
  6164. case CIS_CALLEDIDNUMBER:
  6165. hr = get_CalledIDNumber(ppCallInfoString);
  6166. break;
  6167. case CIS_CONNECTEDIDNAME:
  6168. hr = get_ConnectedIDName(ppCallInfoString);
  6169. break;
  6170. case CIS_CONNECTEDIDNUMBER:
  6171. hr = get_ConnectedIDNumber(ppCallInfoString);
  6172. break;
  6173. case CIS_REDIRECTIONIDNAME:
  6174. hr = get_RedirectionIDName(ppCallInfoString);
  6175. break;
  6176. case CIS_REDIRECTIONIDNUMBER:
  6177. hr = get_RedirectionIDNumber(ppCallInfoString);
  6178. break;
  6179. case CIS_REDIRECTINGIDNAME:
  6180. hr = get_RedirectingIDName(ppCallInfoString);
  6181. break;
  6182. case CIS_REDIRECTINGIDNUMBER:
  6183. hr = get_RedirectingIDNumber(ppCallInfoString);
  6184. break;
  6185. case CIS_CALLEDPARTYFRIENDLYNAME:
  6186. hr = get_CalledPartyFriendlyName(ppCallInfoString);
  6187. break;
  6188. case CIS_COMMENT:
  6189. hr = get_Comment(ppCallInfoString);
  6190. break;
  6191. case CIS_DISPLAYABLEADDRESS:
  6192. hr = get_DisplayableAddress(ppCallInfoString);
  6193. break;
  6194. case CIS_CALLINGPARTYID:
  6195. hr = get_CallingPartyID(ppCallInfoString);
  6196. break;
  6197. default:
  6198. LOG((TL_ERROR, "get_CallInfoString - invalid type"));
  6199. hr = E_INVALIDARG;
  6200. break;
  6201. }
  6202. LOG((TL_TRACE, "get_CallInfoString - exit - return %lx", hr));
  6203. return hr;
  6204. }
  6205. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6206. //
  6207. //
  6208. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6209. STDMETHODIMP
  6210. CCall::put_CallInfoString(
  6211. CALLINFO_STRING CallInfoStringType,
  6212. BSTR pCallInfoString
  6213. )
  6214. {
  6215. HRESULT hr = E_FAIL;
  6216. LOG((TL_TRACE, "put_CallInfoString - enter"));
  6217. switch( CallInfoStringType )
  6218. {
  6219. case CIS_CALLERIDNAME:
  6220. case CIS_CALLERIDNUMBER:
  6221. case CIS_CALLEDIDNAME:
  6222. case CIS_CALLEDIDNUMBER:
  6223. case CIS_CONNECTEDIDNAME:
  6224. case CIS_CONNECTEDIDNUMBER:
  6225. case CIS_REDIRECTIONIDNAME:
  6226. case CIS_REDIRECTIONIDNUMBER:
  6227. case CIS_REDIRECTINGIDNAME:
  6228. case CIS_REDIRECTINGIDNUMBER:
  6229. LOG((TL_TRACE,"put_CallInfoString - unsupported CALLINFO_STRING constant - %lx", CallInfoStringType));
  6230. hr = TAPI_E_NOTSUPPORTED;
  6231. break;
  6232. case CIS_CALLEDPARTYFRIENDLYNAME:
  6233. hr = put_CalledPartyFriendlyName(pCallInfoString);
  6234. break;
  6235. case CIS_COMMENT:
  6236. hr = put_Comment(pCallInfoString);
  6237. break;
  6238. case CIS_DISPLAYABLEADDRESS:
  6239. hr = put_DisplayableAddress(pCallInfoString);
  6240. break;
  6241. case CIS_CALLINGPARTYID:
  6242. hr = put_CallingPartyID(pCallInfoString);
  6243. break;
  6244. default:
  6245. LOG((TL_ERROR, "put_CallInfoString - invalid type"));
  6246. hr = E_INVALIDARG;
  6247. break;
  6248. }
  6249. LOG((TL_TRACE, "put_CallInfoString - exit - return %lx", hr));
  6250. return hr;
  6251. }
  6252. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6253. //
  6254. //
  6255. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6256. STDMETHODIMP
  6257. CCall::get_CallInfoBuffer(
  6258. CALLINFO_BUFFER CallInfoBufferType,
  6259. VARIANT * ppCallInfoBuffer
  6260. )
  6261. {
  6262. HRESULT hr = E_FAIL;
  6263. LOG((TL_TRACE, "get_CallInfoBuffer - enter"));
  6264. switch( CallInfoBufferType )
  6265. {
  6266. case CIB_USERUSERINFO:
  6267. hr = get_UserUserInfo( ppCallInfoBuffer );
  6268. break;
  6269. case CIB_DEVSPECIFICBUFFER:
  6270. hr = get_DevSpecificBuffer( ppCallInfoBuffer );
  6271. break;
  6272. case CIB_CALLDATABUFFER:
  6273. hr = get_CallDataBuffer( ppCallInfoBuffer );
  6274. break;
  6275. case CIB_CHARGINGINFOBUFFER:
  6276. hr = get_ChargingInfoBuffer( ppCallInfoBuffer );
  6277. break;
  6278. case CIB_HIGHLEVELCOMPATIBILITYBUFFER:
  6279. hr = get_HighLevelCompatibilityBuffer( ppCallInfoBuffer );
  6280. break;
  6281. case CIB_LOWLEVELCOMPATIBILITYBUFFER:
  6282. hr = get_LowLevelCompatibilityBuffer( ppCallInfoBuffer );
  6283. break;
  6284. default:
  6285. LOG((TL_ERROR, "get_CallInfoBuffer - invalid type"));
  6286. hr = E_INVALIDARG;
  6287. }
  6288. LOG((TL_TRACE, "get_CallInfoBuffer - exit"));
  6289. return hr;
  6290. }
  6291. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6292. //
  6293. //
  6294. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6295. STDMETHODIMP
  6296. CCall::put_CallInfoBuffer(
  6297. CALLINFO_BUFFER CallInfoBufferType,
  6298. VARIANT pCallInfoBuffer
  6299. )
  6300. {
  6301. HRESULT hr = E_FAIL;
  6302. LOG((TL_TRACE, "put_CallInfoBuffer - enter"));
  6303. switch( CallInfoBufferType )
  6304. {
  6305. case CIB_USERUSERINFO:
  6306. hr = put_UserUserInfo( pCallInfoBuffer );
  6307. break;
  6308. case CIB_DEVSPECIFICBUFFER:
  6309. hr = put_DevSpecificBuffer( pCallInfoBuffer );
  6310. break;
  6311. case CIB_CALLDATABUFFER:
  6312. hr = put_CallDataBuffer( pCallInfoBuffer );
  6313. break;
  6314. case CIB_CHARGINGINFOBUFFER:
  6315. LOG((TL_ERROR, "put_CallInfoBuffer - CHARGINGINFOBUFFER not supported"));
  6316. hr = TAPI_E_NOTSUPPORTED;
  6317. break;
  6318. case CIB_HIGHLEVELCOMPATIBILITYBUFFER:
  6319. hr = put_HighLevelCompatibilityBuffer( pCallInfoBuffer );
  6320. break;
  6321. case CIB_LOWLEVELCOMPATIBILITYBUFFER:
  6322. hr = put_LowLevelCompatibilityBuffer( pCallInfoBuffer );
  6323. break;
  6324. default:
  6325. LOG((TL_ERROR, "put_CallInfoBuffer - invalid type"));
  6326. hr = E_INVALIDARG;
  6327. }
  6328. LOG((TL_TRACE, "put_CallInfoBuffer - exit"));
  6329. return hr;
  6330. }
  6331. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6332. //
  6333. //
  6334. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6335. STDMETHODIMP
  6336. CCall::GetCallInfoBuffer(
  6337. CALLINFO_BUFFER CallInfoBufferType,
  6338. DWORD * pdwSize,
  6339. BYTE ** ppCallInfoBuffer
  6340. )
  6341. {
  6342. HRESULT hr = E_FAIL;
  6343. LOG((TL_TRACE, "GetCallInfoBuffer - enter"));
  6344. switch( CallInfoBufferType )
  6345. {
  6346. case CIB_USERUSERINFO:
  6347. hr = GetUserUserInfo( pdwSize, ppCallInfoBuffer );
  6348. break;
  6349. case CIB_DEVSPECIFICBUFFER:
  6350. hr = GetDevSpecificBuffer( pdwSize, ppCallInfoBuffer );
  6351. break;
  6352. case CIB_CALLDATABUFFER:
  6353. hr = GetCallDataBuffer( pdwSize, ppCallInfoBuffer );
  6354. break;
  6355. case CIB_CHARGINGINFOBUFFER:
  6356. hr = GetChargingInfoBuffer( pdwSize, ppCallInfoBuffer );
  6357. break;
  6358. case CIB_HIGHLEVELCOMPATIBILITYBUFFER:
  6359. hr = GetHighLevelCompatibilityBuffer( pdwSize, ppCallInfoBuffer );
  6360. break;
  6361. case CIB_LOWLEVELCOMPATIBILITYBUFFER:
  6362. hr = GetLowLevelCompatibilityBuffer( pdwSize, ppCallInfoBuffer );
  6363. break;
  6364. default:
  6365. LOG((TL_ERROR, "GetCallInfoBuffer - invalid type"));
  6366. hr = E_INVALIDARG;
  6367. }
  6368. LOG((TL_TRACE, "GetCallInfoBuffer - exit"));
  6369. return hr;
  6370. }
  6371. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6372. //
  6373. //
  6374. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6375. STDMETHODIMP
  6376. CCall::SetCallInfoBuffer(
  6377. CALLINFO_BUFFER CallInfoBufferType,
  6378. DWORD dwSize,
  6379. BYTE * pCallInfoBuffer
  6380. )
  6381. {
  6382. HRESULT hr = E_FAIL;
  6383. LOG((TL_TRACE, "SetCallInfoBuffer - enter"));
  6384. switch( CallInfoBufferType )
  6385. {
  6386. case CIB_USERUSERINFO:
  6387. hr = SetUserUserInfo( dwSize, pCallInfoBuffer );
  6388. break;
  6389. case CIB_DEVSPECIFICBUFFER:
  6390. hr = SetDevSpecificBuffer( dwSize, pCallInfoBuffer );
  6391. break;
  6392. case CIB_CALLDATABUFFER:
  6393. hr = SetCallDataBuffer( dwSize, pCallInfoBuffer );
  6394. break;
  6395. case CIB_CHARGINGINFOBUFFER:
  6396. LOG((TL_ERROR, "SetCallInfoBuffer - CHARGINGINFOBUFFER not supported"));
  6397. hr = TAPI_E_NOTSUPPORTED;
  6398. break;
  6399. case CIB_HIGHLEVELCOMPATIBILITYBUFFER:
  6400. hr = SetHighLevelCompatibilityBuffer( dwSize, pCallInfoBuffer );
  6401. break;
  6402. case CIB_LOWLEVELCOMPATIBILITYBUFFER:
  6403. hr = SetLowLevelCompatibilityBuffer( dwSize, pCallInfoBuffer );
  6404. break;
  6405. default:
  6406. LOG((TL_ERROR, "SetCallInfoBuffer - invalid type"));
  6407. hr = E_INVALIDARG;
  6408. }
  6409. LOG((TL_TRACE, "SetCallInfoBuffer - exit"));
  6410. return hr;
  6411. }
  6412. #endif
  6413. #ifndef NEWCALLINFO
  6414. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6415. //
  6416. // GetDevSpecificSize
  6417. //
  6418. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6419. STDMETHODIMP
  6420. CCall::GetDevSpecificBufferSize(long * plDevSpecificSize )
  6421. {
  6422. HRESULT hr = S_OK;
  6423. LOG((TL_TRACE, "get_DevSpecificSize - enter"));
  6424. if ( TAPIIsBadWritePtr( plDevSpecificSize, sizeof(long) ) )
  6425. {
  6426. LOG((TL_ERROR, "get_DevSpecificSize - bad pointer"));
  6427. return E_POINTER;
  6428. }
  6429. Lock();
  6430. if ( ISHOULDUSECALLPARAMS() )
  6431. {
  6432. *plDevSpecificSize = m_pCallParams->dwDevSpecificSize;
  6433. Unlock();
  6434. return S_OK;
  6435. }
  6436. hr = RefreshCallInfo();
  6437. if ( !SUCCEEDED(hr) )
  6438. {
  6439. LOG((TL_ERROR, "get_DevSpecificSize - can't get callinfo - %lx", hr));
  6440. Unlock();
  6441. return hr;
  6442. }
  6443. *plDevSpecificSize = m_pCallInfo->dwDevSpecificSize;
  6444. Unlock();
  6445. LOG((TL_TRACE, "get_DevSpecificSize - exit"));
  6446. return S_OK;
  6447. }
  6448. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6449. //
  6450. // GetCallDataBufferSize
  6451. //
  6452. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6453. STDMETHODIMP
  6454. CCall::GetCallDataBufferSize( long * plSize )
  6455. {
  6456. HRESULT hr = S_OK;
  6457. LOG((TL_TRACE, "get_CallDataSize - enter"));
  6458. if ( TAPIIsBadWritePtr( plSize, sizeof(long) ) )
  6459. {
  6460. LOG((TL_ERROR, "get_CallDataSize - bad pointer"));
  6461. return E_POINTER;
  6462. }
  6463. Lock();
  6464. if ( m_pAddress->GetAPIVersion() < TAPI_VERSION2_0 )
  6465. {
  6466. Unlock();
  6467. return TAPI_E_NOTSUPPORTED;
  6468. }
  6469. if ( ISHOULDUSECALLPARAMS() )
  6470. {
  6471. *plSize = m_pCallParams->dwCallDataSize;
  6472. Unlock();
  6473. return S_OK;
  6474. }
  6475. hr = RefreshCallInfo();
  6476. if ( !SUCCEEDED(hr) )
  6477. {
  6478. LOG((TL_ERROR, "get_CallDataSize - can't get callinfo - %lx", hr));
  6479. Unlock();
  6480. return hr;
  6481. }
  6482. *plSize = m_pCallInfo->dwCallDataSize;
  6483. Unlock();
  6484. LOG((TL_TRACE, "get_CallDataSize - exit"));
  6485. return S_OK;
  6486. }
  6487. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6488. //
  6489. // GetHighLevelCompatibilityBufferSize
  6490. //
  6491. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6492. STDMETHODIMP
  6493. CCall::GetHighLevelCompatibilityBufferSize(long * plSize )
  6494. {
  6495. HRESULT hr = S_OK;
  6496. LOG((TL_TRACE, "GetHighLevelCompatibilityBufferSize - enter"));
  6497. if ( TAPIIsBadWritePtr( plSize, sizeof(long) ) )
  6498. {
  6499. LOG((TL_ERROR, "GetHighLevelCompatibilityBufferSize - bad pointer"));
  6500. return E_POINTER;
  6501. }
  6502. Lock();
  6503. if ( ISHOULDUSECALLPARAMS() )
  6504. {
  6505. *plSize = m_pCallParams->dwHighLevelCompSize;
  6506. hr = S_OK;
  6507. }
  6508. else
  6509. {
  6510. hr = RefreshCallInfo();
  6511. if ( SUCCEEDED(hr) )
  6512. {
  6513. *plSize = m_pCallInfo->dwHighLevelCompSize;
  6514. }
  6515. else
  6516. {
  6517. *plSize = 0;
  6518. LOG((TL_ERROR, "GetHighLevelCompatibilityBufferSize - can't get callinfo - %lx", hr));
  6519. }
  6520. }
  6521. Unlock();
  6522. LOG((TL_TRACE, hr, "GetHighLevelCompatibilityBufferSize - exit"));
  6523. return hr;
  6524. }
  6525. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6526. //
  6527. // GetLowLevelCompatibilityBufferSize
  6528. //
  6529. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6530. STDMETHODIMP
  6531. CCall::GetLowLevelCompatibilityBufferSize(long * plSize )
  6532. {
  6533. HRESULT hr = S_OK;
  6534. LOG((TL_TRACE, "GetLowLevelCompatibilityBufferSize - enter"));
  6535. if ( TAPIIsBadWritePtr( plSize, sizeof(long) ) )
  6536. {
  6537. LOG((TL_ERROR, "GetLowLevelCompatibilityBufferSize - bad pointer"));
  6538. return E_POINTER;
  6539. }
  6540. Lock();
  6541. if ( ISHOULDUSECALLPARAMS() )
  6542. {
  6543. *plSize = m_pCallParams->dwLowLevelCompSize;
  6544. hr = S_OK;
  6545. }
  6546. else
  6547. {
  6548. hr = RefreshCallInfo();
  6549. if ( SUCCEEDED(hr) )
  6550. {
  6551. *plSize = m_pCallInfo->dwLowLevelCompSize;
  6552. }
  6553. else
  6554. {
  6555. *plSize = 0;
  6556. LOG((TL_ERROR, "GetLowLevelCompatibilityBufferSize - can't get callinfo - %lx", hr));
  6557. }
  6558. }
  6559. Unlock();
  6560. LOG((TL_TRACE, hr, "GetLowLevelCompatibilityBufferSize - exit"));
  6561. return hr;
  6562. }
  6563. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6564. //
  6565. // GetChargingInfoBufferSize
  6566. //
  6567. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6568. STDMETHODIMP
  6569. CCall::GetChargingInfoBufferSize(long * plSize )
  6570. {
  6571. HRESULT hr = S_OK;
  6572. LOG((TL_TRACE, "GetChargingInfoBufferSize - enter"));
  6573. if ( TAPIIsBadWritePtr( plSize, sizeof(long) ) )
  6574. {
  6575. LOG((TL_ERROR, "GetChargingInfoBufferSize - bad pointer"));
  6576. return E_POINTER;
  6577. }
  6578. Lock();
  6579. hr = RefreshCallInfo();
  6580. if ( SUCCEEDED(hr) )
  6581. {
  6582. *plSize = m_pCallInfo->dwChargingInfoSize;
  6583. }
  6584. else
  6585. {
  6586. *plSize = 0;
  6587. LOG((TL_ERROR, "GetChargingInfoBufferSize - can't get callinfo - %lx", hr));
  6588. }
  6589. Unlock();
  6590. LOG((TL_TRACE, hr, "GetChargingInfoBufferSize - exit"));
  6591. return hr;
  6592. }
  6593. #endif
  6594. #ifdef NEWCALLINFO
  6595. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6596. //
  6597. // put_GenerateDigitDuration
  6598. //
  6599. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6600. HRESULT
  6601. CCall::put_GenerateDigitDuration( long lGenerateDigitDuration )
  6602. {
  6603. HRESULT hr = S_OK;
  6604. LOG((TL_TRACE, "put_GenerateDigitDuration - enter"));
  6605. Lock();
  6606. if (ISHOULDUSECALLPARAMS())
  6607. {
  6608. //
  6609. // validation in tapisrv
  6610. //
  6611. m_pCallParams->DialParams.dwDigitDuration = lGenerateDigitDuration;
  6612. }
  6613. else
  6614. {
  6615. LOG((TL_ERROR, "Can't set generate digit duration"));
  6616. hr = TAPI_E_INVALCALLSTATE;
  6617. }
  6618. LOG((TL_TRACE, "put_GenerateDigitDuration - exit"));
  6619. Unlock();
  6620. return hr;
  6621. }
  6622. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6623. //
  6624. // get_GenerateDigitDuration
  6625. //
  6626. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6627. HRESULT
  6628. CCall::get_GenerateDigitDuration( long * plGenerateDigitDuration )
  6629. {
  6630. HRESULT hr = S_OK;
  6631. LOG((TL_TRACE, "get_GenerateDigitDuration - enter"));
  6632. if ( TAPIIsBadWritePtr( plGenerateDigitDuration, sizeof (long) ) )
  6633. {
  6634. LOG((TL_ERROR, "get_GenerateDigitDuration - bad pointer"));
  6635. return E_POINTER;
  6636. }
  6637. Lock();
  6638. if (ISHOULDUSECALLPARAMS())
  6639. {
  6640. *plGenerateDigitDuration = m_pCallParams->DialParams.dwDigitDuration;
  6641. }
  6642. else
  6643. {
  6644. hr = RefreshCallInfo();
  6645. if ( !SUCCEEDED(hr) )
  6646. {
  6647. LOG((TL_ERROR, "get_GenerateDigitDuration - can't get callinfo - %lx", hr));
  6648. Unlock();
  6649. return hr;
  6650. }
  6651. *plGenerateDigitDuration = m_pCallInfo->DialParams.dwDigitDuration;
  6652. }
  6653. LOG((TL_TRACE, "get_GenerateDigitDuration - exit"));
  6654. Unlock();
  6655. return hr;
  6656. }
  6657. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6658. //
  6659. // get_MonitorDigitModes
  6660. //
  6661. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6662. HRESULT
  6663. CCall::get_MonitorDigitModes( long * plMonitorDigitModes )
  6664. {
  6665. HRESULT hr = S_OK;
  6666. LOG((TL_TRACE, "get_MonitorDigitModes - enter"));
  6667. if ( TAPIIsBadWritePtr( plMonitorDigitModes, sizeof (long) ) )
  6668. {
  6669. LOG((TL_ERROR, "get_MonitorDigitModes - bad pointer"));
  6670. return E_POINTER;
  6671. }
  6672. Lock();
  6673. if (ISHOULDUSECALLPARAMS())
  6674. {
  6675. LOG((TL_ERROR, "get_MonitorDigitModes - invalid call state"));
  6676. return TAPI_E_INVALCALLSTATE;
  6677. }
  6678. else
  6679. {
  6680. hr = RefreshCallInfo();
  6681. if ( !SUCCEEDED(hr) )
  6682. {
  6683. LOG((TL_ERROR, "get_MonitorDigitModes - can't get callinfo - %lx", hr));
  6684. Unlock();
  6685. return hr;
  6686. }
  6687. *plMonitorDigitModes = m_pCallInfo->dwMonitorDigitModes;
  6688. }
  6689. LOG((TL_TRACE, "get_MonitorDigitModes - exit"));
  6690. Unlock();
  6691. return hr;
  6692. }
  6693. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6694. //
  6695. // get_MonitorMediaModes
  6696. //
  6697. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  6698. HRESULT
  6699. CCall::get_MonitorMediaModes( long * plMonitorMediaModes )
  6700. {
  6701. HRESULT hr = S_OK;
  6702. LOG((TL_TRACE, "get_MonitorMediaModes - enter"));
  6703. if ( TAPIIsBadWritePtr( plMonitorMediaModes, sizeof (long) ) )
  6704. {
  6705. LOG((TL_ERROR, "get_MonitorMediaModes - bad pointer"));
  6706. return E_POINTER;
  6707. }
  6708. Lock();
  6709. if (ISHOULDUSECALLPARAMS())
  6710. {
  6711. LOG((TL_ERROR, "get_MonitorMediaModes - invalid call state"));
  6712. return TAPI_E_INVALCALLSTATE;
  6713. }
  6714. else
  6715. {
  6716. hr = RefreshCallInfo();
  6717. if ( !SUCCEEDED(hr) )
  6718. {
  6719. LOG((TL_ERROR, "get_MonitorMediaModes - can't get callinfo - %lx", hr));
  6720. Unlock();
  6721. return hr;
  6722. }
  6723. *plMonitorMediaModes = m_pCallInfo->dwMonitorMediaModes;
  6724. }
  6725. LOG((TL_TRACE, "get_MonitorMediaModes - exit"));
  6726. Unlock();
  6727. return hr;
  6728. }
  6729. #endif