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

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. /// 在这个事件上建立信号
  105. m_hEventFromThread = CreateEvent(NULL,0,0,NULL);
  106. return 0;
  107. }
  108. int CTapiLine::Close()
  109. {
  110. LINECALLSTATUS stLineStatus;
  111. LONG lRet;
  112. if(m_hCall)  // Call might be in progress...
  113. {
  114. memset(&stLineStatus, 0, sizeof(LINECALLSTATUS));
  115. lRet = lineGetCallStatus(m_hCall, &stLineStatus); 
  116. // Technically, lineGetCallStatus returns more info than 
  117. // there is in the structure.  Since we don't care about it,
  118. // We just go on our merry way...
  119. if(!lRet) // If it didn't fail, there's at least a call that needs to be droped.
  120. lineDrop(m_hCall, NULL, 0);
  121. }
  122. m_hCall = NULL;
  123. if(m_hLine)
  124. lineClose(m_hLine);
  125. m_hLine = NULL;
  126. if(m_hLineMsgThread)
  127. {
  128. m_bStopLineEventThread = true;  // stop the event waiting thread
  129. WaitForSingleObject(m_hLineMsgThread, INFINITE); // Wait for it to comit suicide..
  130. CloseHandle(m_hLineMsgThread);
  131. CloseHandle(m_hEventFromThread);
  132. }
  133. if(m_hLineApp)
  134. lineShutdown(m_hLineApp);
  135. m_hLineApp = NULL;
  136. m_hLineMsgThread = NULL;
  137. m_hEventFromThread = NULL;
  138. m_hLineMsgThread = NULL;
  139. m_lEventThreadResult = 0; 
  140. m_dwLineMsg= 0;
  141. m_nDevID = -1;
  142. m_bConnected= false;
  143. return 0;
  144. }
  145. int CTapiLine::GetIncomingCall()
  146. {
  147. long lRet;
  148. // set the ring b4 receiving the call
  149. lRet = lineSetNumRings(m_hLine,0,5);
  150. if(lRet)
  151. return lRet;
  152. // Now we wait for notification.
  153. switch(WaitForSingleObject(m_hEventFromThread, INFINITE))
  154. {
  155. case WAIT_OBJECT_0:
  156. if(m_dwLineMsg == LINECALLSTATE_OFFERING)
  157. {
  158. lRet = lineAnswer(m_hCall, NULL, 0);
  159. lRet = (lRet>0)?0:lRet;
  160. if(lRet)
  161. Close();
  162. return lRet;
  163. }
  164. break;
  165. case WAIT_TIMEOUT:
  166. return ERROR_TIMEOUT;
  167. };
  168. return 0xffffffff; // unknown error
  169. }
  170. int CTapiLine::PickupIncomingCall()
  171. {
  172. long lRet;
  173. lRet = linePickup(m_hLine,0,&m_hCall,NULL,NULL);
  174. return (lRet>=0)?0:lRet;
  175. }
  176. int CTapiLine::MakeOutgoingCall(const char *szAddress)
  177. {
  178. long lRet;
  179. LPLINECALLPARAMS lpCallParams;
  180. lpCallParams = (LPLINECALLPARAMS)malloc(sizeof(LINECALLPARAMS)+1024);
  181. memset(lpCallParams,0,sizeof(LINECALLPARAMS)+1024);
  182. lpCallParams->dwTotalSize = sizeof(LINECALLPARAMS)+1024;
  183.     // This is where we configure the line for DATAMODEM usage.
  184.     lpCallParams->dwBearerMode = LINEBEARERMODE_VOICE;
  185.     lpCallParams->dwMediaMode  = LINEMEDIAMODE_DATAMODEM;
  186.     // This specifies that we want to use only IDLE calls and
  187.     // don't want to cut into a call that might not be IDLE (ie, in use).
  188.     lpCallParams->dwCallParamFlags = LINECALLPARAMFLAGS_IDLE;
  189.                                     
  190.     // if there are multiple addresses on line, use first anyway.
  191.     // It will take a more complex application than a simple tty app
  192.     // to use multiple addresses on a line anyway.
  193.     lpCallParams->dwAddressMode = LINEADDRESSMODE_ADDRESSID;
  194.     lpCallParams->dwAddressID = 0;
  195.     // Address we are dialing.
  196.     lpCallParams->dwDisplayableAddressOffset = sizeof(LINECALLPARAMS);
  197.     lpCallParams->dwDisplayableAddressSize = strlen(szAddress);
  198.     strcpy((LPSTR)lpCallParams+sizeof(LINECALLPARAMS), szAddress);
  199. lRet = lineMakeCall(m_hLine, &m_hCall, szAddress, 0, lpCallParams);
  200. return (lRet>=0)?0:lRet;
  201. }
  202. //Author: Ramanan.T
  203. HANDLE CTapiLine::GetHandle(const char *szClassType, long *lError)
  204. {
  205. if(!m_bConnected)
  206. {
  207. *lError = ERROR_DEVICE_NOT_CONNECTED;
  208. return NULL;
  209. }
  210. VARSTRING *pvarStrDevID = (VARSTRING *)malloc(sizeof(VARSTRING)+255);
  211. memset(pvarStrDevID,0,sizeof(VARSTRING)+255);
  212. pvarStrDevID->dwTotalSize = sizeof(VARSTRING)+255;
  213. long lRet = lineGetID(m_hLine,0,m_hCall,LINECALLSELECT_LINE,pvarStrDevID,szClassType);
  214. if(lRet)
  215. {
  216. *lError = lRet;
  217. return NULL;
  218. }
  219. *lError = 0;
  220. return *((LPHANDLE)((char *)pvarStrDevID + pvarStrDevID->dwStringOffset));
  221. }
  222. //Author: Ramanan.T
  223. /// 这里有事件处理函数
  224. DWORD WINAPI CTapiLine::LineEventThread(LPVOID lpVoid)
  225. {
  226. CTapiLine *pcTapiLine = (CTapiLine *)lpVoid;
  227. long lRet;
  228. LINEMESSAGE stLineMsg;
  229. LINECALLINFO *lpCallInfo;
  230. while(!pcTapiLine->m_bStopLineEventThread)
  231. {
  232. // Get a TAPI event if available, wait for 10ms just enough to give up quontum
  233. switch(WaitForSingleObject(pcTapiLine->m_hLineEvent, 10))
  234. {
  235. case WAIT_OBJECT_0:
  236. //TAPI's got something
  237. if ((lRet = lineGetMessage(pcTapiLine->m_hLineApp, &stLineMsg, 0)) != 0)
  238. {
  239. pcTapiLine->m_lEventThreadResult = lRet;
  240. return lRet;
  241. }
  242. // Process the retruned msg
  243. switch (stLineMsg.dwMessageID)
  244. {
  245. case LINE_REPLY: // Sent after lineMakeCall or lineDrop
  246. pcTapiLine->m_lEventThreadResult = (LONG)stLineMsg.dwParam2;
  247. break;
  248. case LINE_CALLSTATE:  // Sent after change of call state
  249. switch (stLineMsg.dwParam1)
  250. {
  251. case LINECALLSTATE_OFFERING: //Incoming call is offering.
  252. //  Get the call handle
  253. pcTapiLine->m_hCall = (HCALL)stLineMsg.hDevice;
  254. ///  设置消息
  255. pcTapiLine->m_dwLineMsg = LINECALLSTATE_OFFERING;
  256. /// 设置事件
  257. SetEvent(pcTapiLine->m_hEventFromThread);
  258. break;
  259. case LINECALLSTATE_IDLE:
  260. lineDrop(pcTapiLine->m_hCall, NULL, 0);
  261. pcTapiLine->m_hCall = NULL;
  262. break;
  263. case LINECALLSTATE_CONNECTED:
  264. if(stLineMsg.dwCallbackInstance == 1)
  265. {
  266. pcTapiLine->m_dwLineMsg = LINECALLSTATE_CONNECTED;
  267. SetEvent(pcTapiLine->m_hEventFromThread);
  268. pcTapiLine->m_bConnected = true;
  269. }
  270. break;
  271. case LINECALLSTATE_DISCONNECTED:
  272. switch (stLineMsg.dwParam2) 
  273. {// currently these r not handled separately
  274. case LINEDISCONNECTMODE_NORMAL:
  275. case LINEDISCONNECTMODE_UNKNOWN:
  276. case LINEDISCONNECTMODE_REJECT:
  277. case LINEDISCONNECTMODE_PICKUP:
  278. case LINEDISCONNECTMODE_FORWARDED:
  279. case LINEDISCONNECTMODE_BUSY:
  280. case LINEDISCONNECTMODE_NOANSWER:
  281. case LINEDISCONNECTMODE_BADADDRESS:
  282. case LINEDISCONNECTMODE_UNREACHABLE:
  283. case LINEDISCONNECTMODE_CONGESTION:
  284. case LINEDISCONNECTMODE_INCOMPATIBLE:
  285. case LINEDISCONNECTMODE_UNAVAIL:
  286. case LINEDISCONNECTMODE_NODIALTONE:
  287. default:
  288. // Got disconnected, so drop the call
  289. lineDrop((HCALL)stLineMsg.hDevice, NULL, 0);
  290. pcTapiLine->m_bConnected = false;
  291. break;
  292. }
  293. break;
  294. default:
  295. break;
  296. }
  297. break;
  298. case LINE_CALLINFO: //  Call Info is available
  299. if(stLineMsg.dwParam1 == LINECALLINFOSTATE_CALLID)
  300. {  //Caller ID became available.
  301. lpCallInfo = (LINECALLINFO *)malloc(sizeof(LINECALLINFO)+1000);
  302. memset(lpCallInfo, 0, sizeof(LINECALLINFO)+1024);
  303. lpCallInfo->dwTotalSize = sizeof(LINECALLINFO)+1024;
  304. lineGetCallInfo(pcTapiLine->m_hCall, lpCallInfo);
  305. if (lpCallInfo->dwTotalSize < lpCallInfo->dwNeededSize)
  306. {
  307. lpCallInfo = (LINECALLINFO *)realloc(lpCallInfo, lpCallInfo->dwNeededSize);
  308. lineGetCallInfo(pcTapiLine->m_hCall, lpCallInfo);
  309. }
  310. break;
  311. default:
  312. break;
  313. };
  314. break;
  315. case WAIT_TIMEOUT:
  316. break;;
  317. default:
  318. continue;
  319. };
  320. }
  321. return 0;
  322. }
  323. //Author: Ramanan.T
  324. void CTapiLine::GetErrorString(int nError, char *&szErrText)
  325. {
  326. szErrText = (char*)malloc(255);
  327. switch(nError)
  328. {
  329. case LINEERR_ALLOCATED:
  330. strcpy(szErrText,"LINEERR_ALLOCATED");
  331. break;
  332. case LINEERR_BADDEVICEID:
  333. strcpy(szErrText,"LINEERR_BADDEVICEID");
  334. break;
  335. case LINEERR_BEARERMODEUNAVAIL:
  336. strcpy(szErrText,"LINEERR_BEARERMODEUNAVAIL");
  337. break;
  338. case LINEERR_CALLUNAVAIL:
  339. strcpy(szErrText,"LINEERR_CALLUNAVAIL");
  340. break;
  341. case LINEERR_COMPLETIONOVERRUN:
  342. strcpy(szErrText,"LINEERR_COMPLETIONOVERRUN");
  343. break;
  344. case LINEERR_CONFERENCEFULL:
  345. strcpy(szErrText,"LINEERR_CONFERENCEFULL");
  346. break;
  347. case LINEERR_DIALBILLING:
  348. strcpy(szErrText,"LINEERR_DIALBILLING");
  349. break;
  350. case LINEERR_DIALDIALTONE:
  351. strcpy(szErrText,"LINEERR_DIALDIALTONE");
  352. break;
  353. case LINEERR_DIALPROMPT:
  354. strcpy(szErrText,"LINEERR_DIALPROMPT");
  355. break;
  356. case LINEERR_DIALQUIET:
  357. strcpy(szErrText,"LINEERR_DIALQUIET");
  358. break;
  359. case LINEERR_INCOMPATIBLEAPIVERSION:
  360. strcpy(szErrText,"LINEERR_INCOMPATIBLEAPIVERSION");
  361. break;
  362. case LINEERR_INCOMPATIBLEEXTVERSION:
  363. strcpy(szErrText,"LINEERR_INCOMPATIBLEEXTVERSION");
  364. break;          
  365. case LINEERR_INIFILECORRUPT:
  366. strcpy(szErrText,"LINEERR_INIFILECORRUPT");
  367. break;                  
  368. case LINEERR_INUSE:
  369. strcpy(szErrText,"LINEERR_INUSE");
  370. break;                           
  371. case LINEERR_INVALADDRESS:
  372. strcpy(szErrText,"LINEERR_INVALADDRESS");
  373. break;                    
  374. case LINEERR_INVALADDRESSID:
  375. strcpy(szErrText,"LINEERR_INVALADDRESSID");
  376. break;                  
  377. case LINEERR_INVALADDRESSMODE:
  378. strcpy(szErrText,"LINEERR_INVALADDRESSMODE");
  379. break;                
  380. case LINEERR_INVALADDRESSSTATE:
  381. strcpy(szErrText,"LINEERR_INVALADDRESSSTATE");
  382. break;               
  383. case LINEERR_INVALAPPHANDLE:
  384. strcpy(szErrText,"LINEERR_INVALAPPHANDLE");
  385. break;                  
  386. case LINEERR_INVALAPPNAME:
  387. strcpy(szErrText,"LINEERR_INVALAPPNAME");
  388. break;                    
  389. case LINEERR_INVALBEARERMODE:
  390. strcpy(szErrText,"LINEERR_INVALBEARERMODE");
  391. break;                 
  392. case LINEERR_INVALCALLCOMPLMODE:
  393. strcpy(szErrText,"LINEERR_INVALCALLCOMPLMODE");
  394. break;              
  395. case LINEERR_INVALCALLHANDLE:
  396. strcpy(szErrText,"LINEERR_INVALCALLHANDLE");
  397. break;                 
  398. case LINEERR_INVALCALLPARAMS:
  399. strcpy(szErrText,"LINEERR_INVALCALLPARAMS");
  400. break;                 
  401. case LINEERR_INVALCALLPRIVILEGE:
  402. strcpy(szErrText,"LINEERR_INVALCALLPRIVILEGE");
  403. break;              
  404. case LINEERR_INVALCALLSELECT:
  405. strcpy(szErrText,"LINEERR_INVALCALLSELECT");
  406. break;                 
  407. case LINEERR_INVALCALLSTATE:
  408. strcpy(szErrText,"LINEERR_INVALCALLSTATE");
  409. break;                  
  410. case LINEERR_INVALCALLSTATELIST:
  411. strcpy(szErrText,"LINEERR_INVALCALLSTATELIST");
  412. break;              
  413. case LINEERR_INVALCARD:
  414. strcpy(szErrText,"LINEERR_INVALCARD");
  415. break;                       
  416. case LINEERR_INVALCOMPLETIONID:
  417. strcpy(szErrText,"LINEERR_INVALCOMPLETIONID");
  418. break;               
  419. case LINEERR_INVALCONFCALLHANDLE:
  420. strcpy(szErrText,"LINEERR_INVALCONFCALLHANDLE");
  421. break;             
  422. case LINEERR_INVALCONSULTCALLHANDLE:
  423. strcpy(szErrText,"LINEERR_INVALCONSULTCALLHANDLE");
  424. break;          
  425. case LINEERR_INVALCOUNTRYCODE:
  426. strcpy(szErrText,"LINEERR_INVALCOUNTRYCODE");
  427. break;                
  428. case LINEERR_INVALDEVICECLASS:
  429. strcpy(szErrText,"LINEERR_INVALDEVICECLASS");
  430. break;                
  431. case LINEERR_INVALDEVICEHANDLE:
  432. strcpy(szErrText,"LINEERR_INVALDEVICEHANDLE");
  433. break;               
  434. case LINEERR_INVALDIALPARAMS:
  435. strcpy(szErrText,"LINEERR_INVALDIALPARAMS");
  436. break;                 
  437. case LINEERR_INVALDIGITLIST:
  438. strcpy(szErrText,"LINEERR_INVALDIGITLIST");
  439. break;                  
  440. case LINEERR_INVALDIGITMODE:
  441. strcpy(szErrText,"LINEERR_INVALDIGITMODE");
  442. break;                  
  443. case LINEERR_INVALDIGITS:
  444. strcpy(szErrText,"LINEERR_INVALDIGITS");
  445. break;                    
  446. case LINEERR_INVALEXTVERSION:
  447. strcpy(szErrText,"LINEERR_INVALEXTVERSION");
  448. break;                 
  449. case LINEERR_INVALGROUPID:
  450. strcpy(szErrText,"LINEERR_INVALGROUPID");
  451. break;                    
  452. case LINEERR_INVALLINEHANDLE:
  453. strcpy(szErrText,"LINEERR_INVALLINEHANDLE");
  454. break;                
  455. case LINEERR_INVALLINESTATE:
  456. strcpy(szErrText,"LINEERR_INVALLINESTATE");
  457. break;                  
  458. case LINEERR_INVALLOCATION:
  459. strcpy(szErrText,"LINEERR_INVALLOCATION");
  460. break;                   
  461. case LINEERR_INVALMEDIALIST:
  462. strcpy(szErrText,"LINEERR_INVALMEDIALIST");
  463. break;                  
  464. case LINEERR_INVALMEDIAMODE:
  465. strcpy(szErrText,"LINEERR_INVALMEDIAMODE");
  466. break;                  
  467. case LINEERR_INVALMESSAGEID:
  468. strcpy(szErrText,"LINEERR_INVALMESSAGEID");
  469. break;                  
  470. case LINEERR_INVALPARAM:
  471. strcpy(szErrText,"LINEERR_INVALPARAM");
  472. break;                      
  473. case LINEERR_INVALPARKID:
  474. strcpy(szErrText,"LINEERR_INVALPARKID");
  475. break;                     
  476. case LINEERR_INVALPARKMODE:
  477. strcpy(szErrText,"LINEERR_INVALPARKMODE");
  478. break;                   
  479. case LINEERR_INVALPOINTER:
  480. strcpy(szErrText,"LINEERR_INVALPOINTER");
  481. break;                    
  482. case LINEERR_INVALPRIVSELECT:
  483. strcpy(szErrText,"LINEERR_INVALPRIVSELECT");
  484. break;                 
  485. case LINEERR_INVALRATE:
  486. strcpy(szErrText,"LINEERR_INVALRATE");
  487. break;                       
  488. case LINEERR_INVALREQUESTMODE:
  489. strcpy(szErrText,"LINEERR_INVALREQUESTMODE");
  490. break;                
  491. case LINEERR_INVALTERMINALID:
  492. strcpy(szErrText,"LINEERR_INVALTERMINALID");
  493. break;                 
  494. case LINEERR_INVALTERMINALMODE:
  495. strcpy(szErrText,"LINEERR_INVALTERMINALMODE");
  496. break;               
  497. case LINEERR_INVALTIMEOUT:
  498. strcpy(szErrText,"LINEERR_INVALTIMEOUT");
  499. break;                    
  500. case LINEERR_INVALTONE:
  501. strcpy(szErrText,"LINEERR_INVALTONE");
  502. break;                       
  503. case LINEERR_INVALTONELIST:
  504. strcpy(szErrText,"LINEERR_INVALTONELIST");
  505. break;                   
  506. case LINEERR_INVALTONEMODE:
  507. strcpy(szErrText,"LINEERR_INVALTONEMODE");
  508. break;                   
  509. case LINEERR_INVALTRANSFERMODE:
  510. strcpy(szErrText,"LINEERR_INVALTRANSFERMODE");
  511. break;               
  512. case LINEERR_LINEMAPPERFAILED:
  513. strcpy(szErrText,"LINEERR_LINEMAPPERFAILED");
  514. break;                
  515. case LINEERR_NOCONFERENCE:
  516. strcpy(szErrText,"LINEERR_NOCONFERENCE");
  517. break;                    
  518. case LINEERR_NODEVICE:
  519. strcpy(szErrText,"LINEERR_NODEVICE");
  520. break;                        
  521. case LINEERR_NODRIVER:
  522. strcpy(szErrText,"LINEERR_NODRIVER");
  523. break;                        
  524. case LINEERR_NOMEM:
  525. strcpy(szErrText,"LINEERR_NOMEM");
  526. break;                           
  527. case LINEERR_NOREQUEST:
  528. strcpy(szErrText,"LINEERR_NOREQUEST");
  529. break;                       
  530. case LINEERR_NOTOWNER:
  531. strcpy(szErrText,"LINEERR_NOTOWNER");
  532. break;                        
  533. case LINEERR_NOTREGISTERED:
  534. strcpy(szErrText,"LINEERR_NOTREGISTERED");
  535. break;                   
  536. case LINEERR_OPERATIONFAILED:
  537. strcpy(szErrText,"LINEERR_OPERATIONFAILED");
  538. break;                 
  539. case LINEERR_OPERATIONUNAVAIL:
  540. strcpy(szErrText,"LINEERR_OPERATIONUNAVAIL");
  541. break;                
  542. case LINEERR_RATEUNAVAIL:
  543. strcpy(szErrText,"LINEERR_RATEUNAVAIL");
  544. break;                     
  545. case LINEERR_RESOURCEUNAVAIL:
  546. strcpy(szErrText,"LINEERR_RESOURCEUNAVAIL");
  547. break;                 
  548. case LINEERR_REQUESTOVERRUN:
  549. strcpy(szErrText,"LINEERR_REQUESTOVERRUN");
  550. break;                  
  551. case LINEERR_STRUCTURETOOSMALL:
  552. strcpy(szErrText,"LINEERR_STRUCTURETOOSMALL");
  553. break;               
  554. case LINEERR_TARGETNOTFOUND:
  555. strcpy(szErrText,"LINEERR_TARGETNOTFOUND");
  556. break;                  
  557. case LINEERR_TARGETSELF:
  558. strcpy(szErrText,"LINEERR_TARGETSELF");
  559. break;                      
  560. case LINEERR_UNINITIALIZED:
  561. strcpy(szErrText,"LINEERR_UNINITIALIZED");
  562. break;                   
  563. case LINEERR_USERUSERINFOTOOBIG:
  564. strcpy(szErrText,"LINEERR_USERUSERINFOTOOBIG");
  565. break;           
  566. case LINEERR_REINIT:
  567. strcpy(szErrText,"LINEERR_REINIT");
  568. break;
  569. case LINEERR_ADDRESSBLOCKED:
  570. strcpy(szErrText,"LINEERR_ADDRESSBLOCKED");
  571. break;
  572. case LINEERR_BILLINGREJECTED:
  573. strcpy(szErrText,"LINEERR_BILLINGREJECTED");
  574. break;
  575. case LINEERR_INVALFEATURE:
  576. strcpy(szErrText,"LINEERR_INVALFEATURE");
  577. break;
  578. case LINEERR_NOMULTIPLEINSTANCE:
  579. strcpy(szErrText,"LINEERR_NOMULTIPLEINSTANCE");
  580. break;
  581. case LINEERR_INVALAGENTID:
  582. strcpy(szErrText,"LINEERR_INVALAGENTID");
  583. break;
  584. case LINEERR_INVALAGENTGROUP:
  585. strcpy(szErrText,"LINEERR_INVALAGENTGROUP");
  586. break;
  587. case LINEERR_INVALPASSWORD:
  588. strcpy(szErrText,"LINEERR_INVALPASSWORD");
  589. break;
  590. case LINEERR_INVALAGENTSTATE:
  591. strcpy(szErrText,"LINEERR_INVALAGENTSTATE");
  592. break;
  593. case LINEERR_INVALAGENTACTIVITY:
  594. strcpy(szErrText,"LINEERR_INVALAGENTACTIVITY");
  595. break;
  596. case LINEERR_DIALVOICEDETECT:
  597. strcpy(szErrText,"LINEERR_DIALVOICEDETECT");
  598. break;
  599. default:
  600. free(szErrText);
  601. FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,NULL,nError,0,(LPTSTR)&szErrText,0,NULL);
  602. };
  603. }