TapiLine.cpp.svn-base
上传用户:c1686688
上传日期:2015-06-15
资源大小:73k
文件大小:19k
源码类别:

TAPI编程

开发平台:

Visual C++

  1. // TapiLine.cpp: implementation of the CTapiLine class.
  2. // Author: T.Yogaramanan
  3. // Include this header if you use any part of the code from this file 
  4. /////////////////////////////////////////////////////////////////////////////
  5. #include "stdafx.h"
  6. #include "TAPISample.h"
  7. #include "TapiLine.h"
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char THIS_FILE[]=__FILE__;
  11. #define new DEBUG_NEW
  12. #endif
  13. //////////////////////////////////////////////////////////////////////
  14. // Construction/Destruction
  15. //////////////////////////////////////////////////////////////////////
  16. CTapiLine::CTapiLine()
  17. {
  18. m_hEventFromThread = NULL;
  19. m_hLineMsgThread = NULL;   // TAPI Event monitoring thread.
  20. m_bStopLineEventThread = true; 
  21. m_lEventThreadResult = 0; 
  22. m_dwLineMsg= 0;
  23. m_nDevID = 0;
  24. m_hLineApp = NULL;
  25. m_hLine = NULL;
  26. m_hCall = NULL;
  27. m_bConnected = false;
  28. }
  29. CTapiLine::~CTapiLine()
  30. {
  31. Close();
  32. }
  33. // if nMode = 0 then it is data/fax calls
  34. //    nMode = 1 then it is data/fax/voice calls
  35. int CTapiLine::Open(int nMode)
  36. {
  37. LINEINITIALIZEEXPARAMS stInitParams;
  38. LINEDEVCAPS *lpDevCaps =NULL;
  39. LONG lRet;
  40. DWORD dwMediaMode;
  41. DWORD dwNumDevs =0;
  42. DWORD dwTAPIVer =TAPI_CURRENT_VERSION;;
  43. DWORD dwTmpVer =0;
  44. LINEEXTENSIONID stExtID;
  45. if(!nMode)
  46. dwMediaMode = LINEMEDIAMODE_DATAMODEM; // data/fax this should be
  47. else
  48. dwMediaMode = LINEMEDIAMODE_AUTOMATEDVOICE;// for voice this should be
  49. memset(&stInitParams, 0, sizeof(LINEINITIALIZEEXPARAMS));
  50. // set the options...
  51. stInitParams.dwTotalSize = sizeof(LINEINITIALIZEEXPARAMS);
  52. stInitParams.dwOptions = LINEINITIALIZEEXOPTION_USEEVENT;
  53. // Initialize TAPI.
  54. lRet = lineInitializeEx(&m_hLineApp, NULL, NULL, "CallAnswer", &dwNumDevs, &dwTAPIVer, &stInitParams);
  55. if(lRet)  //error
  56. return lRet;
  57. // Got the event handle...
  58. m_hLineEvent = stInitParams.Handles.hEvent;
  59. m_nDevID = -1;
  60. // go through the device list and select the appropriate device to transfer voice
  61. for(int i=0;i<dwNumDevs;i++)
  62. {
  63. lRet = lineNegotiateAPIVersion(m_hLineApp, i, dwTAPIVer, dwTAPIVer, &dwTmpVer, &stExtID);
  64. if(lRet != 0)
  65. continue;
  66. lpDevCaps = (LINEDEVCAPS *)malloc(sizeof(LINEDEVCAPS)+1024);// Allocate a little extra memory...
  67. memset(lpDevCaps, 0, sizeof(LINEDEVCAPS)+1024);
  68. lpDevCaps->dwTotalSize = sizeof(LINEDEVCAPS)+1024;
  69. lRet = lineGetDevCaps(m_hLineApp, i, dwTmpVer, 0, lpDevCaps);
  70. if(lRet)  //error
  71. {
  72. free(lpDevCaps);
  73. lpDevCaps=NULL;
  74. continue;
  75. }
  76. char *szText = ((char*)lpDevCaps) + lpDevCaps->dwLineNameOffset;// FOR DEBUGGING
  77. // for more refer LINEMEDIAMODE_ Constants in MSDN
  78. if(lpDevCaps->dwMediaModes & dwMediaMode) 
  79. {
  80. free(lpDevCaps);
  81. m_nDevID = i;
  82. break;
  83. }
  84. free(lpDevCaps);
  85. }
  86. if(m_nDevID < 0)
  87. return LINEERR_BADDEVICEID; // no device available
  88. // Open the line...
  89. lRet = lineOpen(m_hLineApp, m_nDevID, &m_hLine, dwTAPIVer, 0x00000000, 1,LINECALLPRIVILEGE_OWNER,dwMediaMode,NULL);
  90. if(lRet)
  91. {
  92. lineShutdown(m_hLineApp);
  93. return lRet;
  94. }
  95. // We want to be notified for everything
  96. lRet = lineSetStatusMessages(m_hLine, 0x1ffffff, 0);
  97. if(lRet)
  98. {
  99. lineShutdown(m_hLineApp);
  100. return lRet;
  101. }
  102. m_bStopLineEventThread = false;
  103. m_hLineMsgThread = CreateThread(NULL,NULL,LineEventThread,this,NULL,0);
  104. m_hEventFromThread = CreateEvent(NULL,0,0,NULL);
  105. return 0;
  106. }
  107. int CTapiLine::Close()
  108. {
  109. LINECALLSTATUS stLineStatus;
  110. LONG lRet;
  111. if(m_hCall)  // Call might be in progress...
  112. {
  113. memset(&stLineStatus, 0, sizeof(LINECALLSTATUS));
  114. lRet = lineGetCallStatus(m_hCall, &stLineStatus); 
  115. // Technically, lineGetCallStatus returns more info than 
  116. // there is in the structure.  Since we don't care about it,
  117. // We just go on our merry way...
  118. if(!lRet) // If it didn't fail, there's at least a call that needs to be droped.
  119. lineDrop(m_hCall, NULL, 0);
  120. }
  121. m_hCall = NULL;
  122. if(m_hLine)
  123. lineClose(m_hLine);
  124. m_hLine = NULL;
  125. if(m_hLineMsgThread)
  126. {
  127. m_bStopLineEventThread = true;  // stop the event waiting thread
  128. WaitForSingleObject(m_hLineMsgThread, INFINITE); // Wait for it to comit suicide..
  129. CloseHandle(m_hLineMsgThread);
  130. CloseHandle(m_hEventFromThread);
  131. }
  132. if(m_hLineApp)
  133. lineShutdown(m_hLineApp);
  134. m_hLineApp = NULL;
  135. m_hLineMsgThread = NULL;
  136. m_hEventFromThread = NULL;
  137. m_hLineMsgThread = NULL;
  138. m_lEventThreadResult = 0; 
  139. m_dwLineMsg= 0;
  140. m_nDevID = -1;
  141. m_bConnected= false;
  142. return 0;
  143. }
  144. int CTapiLine::GetIncomingCall()
  145. {
  146. long lRet;
  147. // set the ring b4 receiving the call
  148. lRet = lineSetNumRings(m_hLine,0,5);
  149. if(lRet)
  150. return lRet;
  151. // Now we wait for notification.
  152. switch(WaitForSingleObject(m_hEventFromThread, INFINITE))
  153. {
  154. case WAIT_OBJECT_0:
  155. if(m_dwLineMsg == LINECALLSTATE_OFFERING)
  156. {
  157. lRet = lineAnswer(m_hCall, NULL, 0);
  158. lRet = (lRet>0)?0:lRet;
  159. if(lRet)
  160. Close();
  161. return lRet;
  162. }
  163. break;
  164. case WAIT_TIMEOUT:
  165. return ERROR_TIMEOUT;
  166. };
  167. return 0xffffffff; // unknown error
  168. }
  169. int CTapiLine::PickupIncomingCall()
  170. {
  171. long lRet;
  172. lRet = linePickup(m_hLine,0,&m_hCall,NULL,NULL);
  173. return (lRet>=0)?0:lRet;
  174. }
  175. int CTapiLine::MakeOutgoingCall(const char *szAddress)
  176. {
  177. long lRet;
  178. LPLINECALLPARAMS lpCallParams;
  179. lpCallParams = (LPLINECALLPARAMS)malloc(sizeof(LINECALLPARAMS)+1024);
  180. memset(lpCallParams,0,sizeof(LINECALLPARAMS)+1024);
  181. lpCallParams->dwTotalSize = sizeof(LINECALLPARAMS)+1024;
  182.     // This is where we configure the line for DATAMODEM usage.
  183.     lpCallParams->dwBearerMode = LINEBEARERMODE_VOICE;
  184.     lpCallParams->dwMediaMode  = LINEMEDIAMODE_DATAMODEM;
  185.     // This specifies that we want to use only IDLE calls and
  186.     // don't want to cut into a call that might not be IDLE (ie, in use).
  187.     lpCallParams->dwCallParamFlags = LINECALLPARAMFLAGS_IDLE;
  188.                                     
  189.     // if there are multiple addresses on line, use first anyway.
  190.     // It will take a more complex application than a simple tty app
  191.     // to use multiple addresses on a line anyway.
  192.     lpCallParams->dwAddressMode = LINEADDRESSMODE_ADDRESSID;
  193.     lpCallParams->dwAddressID = 0;
  194.     // Address we are dialing.
  195.     lpCallParams->dwDisplayableAddressOffset = sizeof(LINECALLPARAMS);
  196.     lpCallParams->dwDisplayableAddressSize = strlen(szAddress);
  197.     strcpy((LPSTR)lpCallParams+sizeof(LINECALLPARAMS), szAddress);
  198. lRet = lineMakeCall(m_hLine, &m_hCall, szAddress, 0, lpCallParams);
  199. return (lRet>=0)?0:lRet;
  200. }
  201. //Author: Ramanan.T
  202. HANDLE CTapiLine::GetHandle(const char *szClassType, long *lError)
  203. {
  204. if(!m_bConnected)
  205. {
  206. *lError = ERROR_DEVICE_NOT_CONNECTED;
  207. return NULL;
  208. }
  209. VARSTRING *pvarStrDevID = (VARSTRING *)malloc(sizeof(VARSTRING)+255);
  210. memset(pvarStrDevID,0,sizeof(VARSTRING)+255);
  211. pvarStrDevID->dwTotalSize = sizeof(VARSTRING)+255;
  212. long lRet = lineGetID(m_hLine,0,m_hCall,LINECALLSELECT_LINE,pvarStrDevID,szClassType);
  213. if(lRet)
  214. {
  215. *lError = lRet;
  216. return NULL;
  217. }
  218. *lError = 0;
  219. return *((LPHANDLE)((char *)pvarStrDevID + pvarStrDevID->dwStringOffset));
  220. }
  221. //Author: Ramanan.T
  222. DWORD WINAPI CTapiLine::LineEventThread(LPVOID lpVoid)
  223. {
  224. CTapiLine *pcTapiLine = (CTapiLine *)lpVoid;
  225. long lRet;
  226. LINEMESSAGE stLineMsg;
  227. LINECALLINFO *lpCallInfo;
  228. while(!pcTapiLine->m_bStopLineEventThread)
  229. {
  230. // Get a TAPI event if available, wait for 10ms just enough to give up quontum
  231. switch(WaitForSingleObject(pcTapiLine->m_hLineEvent, 10))
  232. {
  233. case WAIT_OBJECT_0:
  234. //TAPI's got something
  235. if ((lRet = lineGetMessage(pcTapiLine->m_hLineApp, &stLineMsg, 0)) != 0)
  236. {
  237. pcTapiLine->m_lEventThreadResult = lRet;
  238. return lRet;
  239. }
  240. // Process the retruned msg
  241. switch (stLineMsg.dwMessageID)
  242. {
  243. case LINE_REPLY: // Sent after lineMakeCall or lineDrop
  244. pcTapiLine->m_lEventThreadResult = (LONG)stLineMsg.dwParam2;
  245. break;
  246. case LINE_CALLSTATE:  // Sent after change of call state
  247. switch (stLineMsg.dwParam1)
  248. {
  249. case LINECALLSTATE_OFFERING: //Incoming call is offering.
  250. //  Get the call handle
  251. pcTapiLine->m_hCall = (HCALL)stLineMsg.hDevice;
  252. pcTapiLine->m_dwLineMsg = LINECALLSTATE_OFFERING;
  253. SetEvent(pcTapiLine->m_hEventFromThread);
  254. break;
  255. case LINECALLSTATE_IDLE:
  256. lineDrop(pcTapiLine->m_hCall, NULL, 0);
  257. pcTapiLine->m_hCall = NULL;
  258. break;
  259. case LINECALLSTATE_CONNECTED:
  260. if(stLineMsg.dwCallbackInstance == 1)
  261. {
  262. pcTapiLine->m_dwLineMsg = LINECALLSTATE_CONNECTED;
  263. SetEvent(pcTapiLine->m_hEventFromThread);
  264. pcTapiLine->m_bConnected = true;
  265. }
  266. break;
  267. case LINECALLSTATE_DISCONNECTED:
  268. switch (stLineMsg.dwParam2) 
  269. {// currently these r not handled separately
  270. case LINEDISCONNECTMODE_NORMAL:
  271. case LINEDISCONNECTMODE_UNKNOWN:
  272. case LINEDISCONNECTMODE_REJECT:
  273. case LINEDISCONNECTMODE_PICKUP:
  274. case LINEDISCONNECTMODE_FORWARDED:
  275. case LINEDISCONNECTMODE_BUSY:
  276. case LINEDISCONNECTMODE_NOANSWER:
  277. case LINEDISCONNECTMODE_BADADDRESS:
  278. case LINEDISCONNECTMODE_UNREACHABLE:
  279. case LINEDISCONNECTMODE_CONGESTION:
  280. case LINEDISCONNECTMODE_INCOMPATIBLE:
  281. case LINEDISCONNECTMODE_UNAVAIL:
  282. case LINEDISCONNECTMODE_NODIALTONE:
  283. default:
  284. // Got disconnected, so drop the call
  285. lineDrop((HCALL)stLineMsg.hDevice, NULL, 0);
  286. pcTapiLine->m_bConnected = false;
  287. break;
  288. }
  289. break;
  290. default:
  291. break;
  292. }
  293. break;
  294. case LINE_CALLINFO: //  Call Info is available
  295. if(stLineMsg.dwParam1 == LINECALLINFOSTATE_CALLID)
  296. {  //Caller ID became available.
  297. lpCallInfo = (LINECALLINFO *)malloc(sizeof(LINECALLINFO)+1000);
  298. memset(lpCallInfo, 0, sizeof(LINECALLINFO)+1024);
  299. lpCallInfo->dwTotalSize = sizeof(LINECALLINFO)+1024;
  300. lineGetCallInfo(pcTapiLine->m_hCall, lpCallInfo);
  301. if (lpCallInfo->dwTotalSize < lpCallInfo->dwNeededSize)
  302. {
  303. lpCallInfo = (LINECALLINFO *)realloc(lpCallInfo, lpCallInfo->dwNeededSize);
  304. lineGetCallInfo(pcTapiLine->m_hCall, lpCallInfo);
  305. }
  306. break;
  307. default:
  308. break;
  309. };
  310. break;
  311. case WAIT_TIMEOUT:
  312. break;;
  313. default:
  314. continue;
  315. };
  316. }
  317. return 0;
  318. }
  319. //Author: Ramanan.T
  320. void CTapiLine::GetErrorString(int nError, char *&szErrText)
  321. {
  322. szErrText = (char*)malloc(255);
  323. switch(nError)
  324. {
  325. case LINEERR_ALLOCATED:
  326. strcpy(szErrText,"LINEERR_ALLOCATED");
  327. break;
  328. case LINEERR_BADDEVICEID:
  329. strcpy(szErrText,"LINEERR_BADDEVICEID");
  330. break;
  331. case LINEERR_BEARERMODEUNAVAIL:
  332. strcpy(szErrText,"LINEERR_BEARERMODEUNAVAIL");
  333. break;
  334. case LINEERR_CALLUNAVAIL:
  335. strcpy(szErrText,"LINEERR_CALLUNAVAIL");
  336. break;
  337. case LINEERR_COMPLETIONOVERRUN:
  338. strcpy(szErrText,"LINEERR_COMPLETIONOVERRUN");
  339. break;
  340. case LINEERR_CONFERENCEFULL:
  341. strcpy(szErrText,"LINEERR_CONFERENCEFULL");
  342. break;
  343. case LINEERR_DIALBILLING:
  344. strcpy(szErrText,"LINEERR_DIALBILLING");
  345. break;
  346. case LINEERR_DIALDIALTONE:
  347. strcpy(szErrText,"LINEERR_DIALDIALTONE");
  348. break;
  349. case LINEERR_DIALPROMPT:
  350. strcpy(szErrText,"LINEERR_DIALPROMPT");
  351. break;
  352. case LINEERR_DIALQUIET:
  353. strcpy(szErrText,"LINEERR_DIALQUIET");
  354. break;
  355. case LINEERR_INCOMPATIBLEAPIVERSION:
  356. strcpy(szErrText,"LINEERR_INCOMPATIBLEAPIVERSION");
  357. break;
  358. case LINEERR_INCOMPATIBLEEXTVERSION:
  359. strcpy(szErrText,"LINEERR_INCOMPATIBLEEXTVERSION");
  360. break;          
  361. case LINEERR_INIFILECORRUPT:
  362. strcpy(szErrText,"LINEERR_INIFILECORRUPT");
  363. break;                  
  364. case LINEERR_INUSE:
  365. strcpy(szErrText,"LINEERR_INUSE");
  366. break;                           
  367. case LINEERR_INVALADDRESS:
  368. strcpy(szErrText,"LINEERR_INVALADDRESS");
  369. break;                    
  370. case LINEERR_INVALADDRESSID:
  371. strcpy(szErrText,"LINEERR_INVALADDRESSID");
  372. break;                  
  373. case LINEERR_INVALADDRESSMODE:
  374. strcpy(szErrText,"LINEERR_INVALADDRESSMODE");
  375. break;                
  376. case LINEERR_INVALADDRESSSTATE:
  377. strcpy(szErrText,"LINEERR_INVALADDRESSSTATE");
  378. break;               
  379. case LINEERR_INVALAPPHANDLE:
  380. strcpy(szErrText,"LINEERR_INVALAPPHANDLE");
  381. break;                  
  382. case LINEERR_INVALAPPNAME:
  383. strcpy(szErrText,"LINEERR_INVALAPPNAME");
  384. break;                    
  385. case LINEERR_INVALBEARERMODE:
  386. strcpy(szErrText,"LINEERR_INVALBEARERMODE");
  387. break;                 
  388. case LINEERR_INVALCALLCOMPLMODE:
  389. strcpy(szErrText,"LINEERR_INVALCALLCOMPLMODE");
  390. break;              
  391. case LINEERR_INVALCALLHANDLE:
  392. strcpy(szErrText,"LINEERR_INVALCALLHANDLE");
  393. break;                 
  394. case LINEERR_INVALCALLPARAMS:
  395. strcpy(szErrText,"LINEERR_INVALCALLPARAMS");
  396. break;                 
  397. case LINEERR_INVALCALLPRIVILEGE:
  398. strcpy(szErrText,"LINEERR_INVALCALLPRIVILEGE");
  399. break;              
  400. case LINEERR_INVALCALLSELECT:
  401. strcpy(szErrText,"LINEERR_INVALCALLSELECT");
  402. break;                 
  403. case LINEERR_INVALCALLSTATE:
  404. strcpy(szErrText,"LINEERR_INVALCALLSTATE");
  405. break;                  
  406. case LINEERR_INVALCALLSTATELIST:
  407. strcpy(szErrText,"LINEERR_INVALCALLSTATELIST");
  408. break;              
  409. case LINEERR_INVALCARD:
  410. strcpy(szErrText,"LINEERR_INVALCARD");
  411. break;                       
  412. case LINEERR_INVALCOMPLETIONID:
  413. strcpy(szErrText,"LINEERR_INVALCOMPLETIONID");
  414. break;               
  415. case LINEERR_INVALCONFCALLHANDLE:
  416. strcpy(szErrText,"LINEERR_INVALCONFCALLHANDLE");
  417. break;             
  418. case LINEERR_INVALCONSULTCALLHANDLE:
  419. strcpy(szErrText,"LINEERR_INVALCONSULTCALLHANDLE");
  420. break;          
  421. case LINEERR_INVALCOUNTRYCODE:
  422. strcpy(szErrText,"LINEERR_INVALCOUNTRYCODE");
  423. break;                
  424. case LINEERR_INVALDEVICECLASS:
  425. strcpy(szErrText,"LINEERR_INVALDEVICECLASS");
  426. break;                
  427. case LINEERR_INVALDEVICEHANDLE:
  428. strcpy(szErrText,"LINEERR_INVALDEVICEHANDLE");
  429. break;               
  430. case LINEERR_INVALDIALPARAMS:
  431. strcpy(szErrText,"LINEERR_INVALDIALPARAMS");
  432. break;                 
  433. case LINEERR_INVALDIGITLIST:
  434. strcpy(szErrText,"LINEERR_INVALDIGITLIST");
  435. break;                  
  436. case LINEERR_INVALDIGITMODE:
  437. strcpy(szErrText,"LINEERR_INVALDIGITMODE");
  438. break;                  
  439. case LINEERR_INVALDIGITS:
  440. strcpy(szErrText,"LINEERR_INVALDIGITS");
  441. break;                    
  442. case LINEERR_INVALEXTVERSION:
  443. strcpy(szErrText,"LINEERR_INVALEXTVERSION");
  444. break;                 
  445. case LINEERR_INVALGROUPID:
  446. strcpy(szErrText,"LINEERR_INVALGROUPID");
  447. break;                    
  448. case LINEERR_INVALLINEHANDLE:
  449. strcpy(szErrText,"LINEERR_INVALLINEHANDLE");
  450. break;                
  451. case LINEERR_INVALLINESTATE:
  452. strcpy(szErrText,"LINEERR_INVALLINESTATE");
  453. break;                  
  454. case LINEERR_INVALLOCATION:
  455. strcpy(szErrText,"LINEERR_INVALLOCATION");
  456. break;                   
  457. case LINEERR_INVALMEDIALIST:
  458. strcpy(szErrText,"LINEERR_INVALMEDIALIST");
  459. break;                  
  460. case LINEERR_INVALMEDIAMODE:
  461. strcpy(szErrText,"LINEERR_INVALMEDIAMODE");
  462. break;                  
  463. case LINEERR_INVALMESSAGEID:
  464. strcpy(szErrText,"LINEERR_INVALMESSAGEID");
  465. break;                  
  466. case LINEERR_INVALPARAM:
  467. strcpy(szErrText,"LINEERR_INVALPARAM");
  468. break;                      
  469. case LINEERR_INVALPARKID:
  470. strcpy(szErrText,"LINEERR_INVALPARKID");
  471. break;                     
  472. case LINEERR_INVALPARKMODE:
  473. strcpy(szErrText,"LINEERR_INVALPARKMODE");
  474. break;                   
  475. case LINEERR_INVALPOINTER:
  476. strcpy(szErrText,"LINEERR_INVALPOINTER");
  477. break;                    
  478. case LINEERR_INVALPRIVSELECT:
  479. strcpy(szErrText,"LINEERR_INVALPRIVSELECT");
  480. break;                 
  481. case LINEERR_INVALRATE:
  482. strcpy(szErrText,"LINEERR_INVALRATE");
  483. break;                       
  484. case LINEERR_INVALREQUESTMODE:
  485. strcpy(szErrText,"LINEERR_INVALREQUESTMODE");
  486. break;                
  487. case LINEERR_INVALTERMINALID:
  488. strcpy(szErrText,"LINEERR_INVALTERMINALID");
  489. break;                 
  490. case LINEERR_INVALTERMINALMODE:
  491. strcpy(szErrText,"LINEERR_INVALTERMINALMODE");
  492. break;               
  493. case LINEERR_INVALTIMEOUT:
  494. strcpy(szErrText,"LINEERR_INVALTIMEOUT");
  495. break;                    
  496. case LINEERR_INVALTONE:
  497. strcpy(szErrText,"LINEERR_INVALTONE");
  498. break;                       
  499. case LINEERR_INVALTONELIST:
  500. strcpy(szErrText,"LINEERR_INVALTONELIST");
  501. break;                   
  502. case LINEERR_INVALTONEMODE:
  503. strcpy(szErrText,"LINEERR_INVALTONEMODE");
  504. break;                   
  505. case LINEERR_INVALTRANSFERMODE:
  506. strcpy(szErrText,"LINEERR_INVALTRANSFERMODE");
  507. break;               
  508. case LINEERR_LINEMAPPERFAILED:
  509. strcpy(szErrText,"LINEERR_LINEMAPPERFAILED");
  510. break;                
  511. case LINEERR_NOCONFERENCE:
  512. strcpy(szErrText,"LINEERR_NOCONFERENCE");
  513. break;                    
  514. case LINEERR_NODEVICE:
  515. strcpy(szErrText,"LINEERR_NODEVICE");
  516. break;                        
  517. case LINEERR_NODRIVER:
  518. strcpy(szErrText,"LINEERR_NODRIVER");
  519. break;                        
  520. case LINEERR_NOMEM:
  521. strcpy(szErrText,"LINEERR_NOMEM");
  522. break;                           
  523. case LINEERR_NOREQUEST:
  524. strcpy(szErrText,"LINEERR_NOREQUEST");
  525. break;                       
  526. case LINEERR_NOTOWNER:
  527. strcpy(szErrText,"LINEERR_NOTOWNER");
  528. break;                        
  529. case LINEERR_NOTREGISTERED:
  530. strcpy(szErrText,"LINEERR_NOTREGISTERED");
  531. break;                   
  532. case LINEERR_OPERATIONFAILED:
  533. strcpy(szErrText,"LINEERR_OPERATIONFAILED");
  534. break;                 
  535. case LINEERR_OPERATIONUNAVAIL:
  536. strcpy(szErrText,"LINEERR_OPERATIONUNAVAIL");
  537. break;                
  538. case LINEERR_RATEUNAVAIL:
  539. strcpy(szErrText,"LINEERR_RATEUNAVAIL");
  540. break;                     
  541. case LINEERR_RESOURCEUNAVAIL:
  542. strcpy(szErrText,"LINEERR_RESOURCEUNAVAIL");
  543. break;                 
  544. case LINEERR_REQUESTOVERRUN:
  545. strcpy(szErrText,"LINEERR_REQUESTOVERRUN");
  546. break;                  
  547. case LINEERR_STRUCTURETOOSMALL:
  548. strcpy(szErrText,"LINEERR_STRUCTURETOOSMALL");
  549. break;               
  550. case LINEERR_TARGETNOTFOUND:
  551. strcpy(szErrText,"LINEERR_TARGETNOTFOUND");
  552. break;                  
  553. case LINEERR_TARGETSELF:
  554. strcpy(szErrText,"LINEERR_TARGETSELF");
  555. break;                      
  556. case LINEERR_UNINITIALIZED:
  557. strcpy(szErrText,"LINEERR_UNINITIALIZED");
  558. break;                   
  559. case LINEERR_USERUSERINFOTOOBIG:
  560. strcpy(szErrText,"LINEERR_USERUSERINFOTOOBIG");
  561. break;           
  562. case LINEERR_REINIT:
  563. strcpy(szErrText,"LINEERR_REINIT");
  564. break;
  565. case LINEERR_ADDRESSBLOCKED:
  566. strcpy(szErrText,"LINEERR_ADDRESSBLOCKED");
  567. break;
  568. case LINEERR_BILLINGREJECTED:
  569. strcpy(szErrText,"LINEERR_BILLINGREJECTED");
  570. break;
  571. case LINEERR_INVALFEATURE:
  572. strcpy(szErrText,"LINEERR_INVALFEATURE");
  573. break;
  574. case LINEERR_NOMULTIPLEINSTANCE:
  575. strcpy(szErrText,"LINEERR_NOMULTIPLEINSTANCE");
  576. break;
  577. case LINEERR_INVALAGENTID:
  578. strcpy(szErrText,"LINEERR_INVALAGENTID");
  579. break;
  580. case LINEERR_INVALAGENTGROUP:
  581. strcpy(szErrText,"LINEERR_INVALAGENTGROUP");
  582. break;
  583. case LINEERR_INVALPASSWORD:
  584. strcpy(szErrText,"LINEERR_INVALPASSWORD");
  585. break;
  586. case LINEERR_INVALAGENTSTATE:
  587. strcpy(szErrText,"LINEERR_INVALAGENTSTATE");
  588. break;
  589. case LINEERR_INVALAGENTACTIVITY:
  590. strcpy(szErrText,"LINEERR_INVALAGENTACTIVITY");
  591. break;
  592. case LINEERR_DIALVOICEDETECT:
  593. strcpy(szErrText,"LINEERR_DIALVOICEDETECT");
  594. break;
  595. default:
  596. free(szErrText);
  597. FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,NULL,nError,0,(LPTSTR)&szErrText,0,NULL);
  598. };
  599. }