-
September 28th, 2010, 02:13 PM
#1
TAPI Incoming Call Issues...
hello guys...im writing a small TAPI app which, if I call to landline number, should show some msg but it does not. Code looks fine...here is the code
Code:
void WINAPI TapiInitialize() {
LPLINEDEVCAPS lineDevCaps = NULL;
lineDevCaps = (LPLINEDEVCAPS)LocalAlloc(LPTR, 4096);
//create the event first..
EventReply = CreateEvent(NULL,FALSE,FALSE,NULL);
//clear the structure before the usage
memset(&LineInitializeExParams,0,sizeof(LINEINITIALIZEEXPARAMS));
//populate the options
LineInitializeExParams.dwTotalSize = sizeof(LINEINITIALIZEEXPARAMS);
LineInitializeExParams.dwOptions = LINEINITIALIZEEXOPTION_USEEVENT;
//call the LineInitializeEx function
result = lineInitializeEx(&lineApp,NULL,(LINECALLBACK)lineCallbackFunc,NULL,&numDevs,&tapiVersion,NULL);
if (result!=0)
printf("TAPI could't be Initialized");
else printf("\n\nTAPI Initialized..");
num = numDevs;
printf("\nNumber of lines available to this app: %d",(LPWSTR)num);
for (DWORD devID=0; devID<num; devID++){
//negotiating api version
result = ::lineNegotiateAPIVersion(lineApp,devID,API_EARLY_VERSION,API_CURRENT_VERSION,&tapiVersion,0);
isOK = TRUE;
dwSize = sizeof(LINEDEVCAPS);
do{
lineDevCaps = (LPLINEDEVCAPS) new BYTE[dwSize];
lineDevCaps->dwTotalSize = dwSize;
result = ::lineGetDevCaps(lineApp,devID,tapiVersion,0,lineDevCaps);
if(0!=result && LINEERR_STRUCTURETOOSMALL!=result){
printf("\nLine#%d: Error...",devID);
delete lineDevCaps;
isOK = FALSE;
break;
}
if (lineDevCaps->dwNeededSize<= lineDevCaps->dwTotalSize)
break;
if (devID==0)
printf("\nReallocating new size: %lu", lineDevCaps->dwNeededSize);
dwSize = lineDevCaps->dwNeededSize;
//delete lineDevCaps;
//lineDevCaps = NULL;
}while (1);
}
//opening a line
result = lineOpen(lineApp,0,&hLine,tapiVersion,0,0,LINECALLPRIVILEGE_MONITOR|LINECALLPRIVILEGE_OWNER,LINEMEDIAMODE_DATAMODEM,NULL);
if(result!=0)
printf("\n\nLINE could't be Opened...");
else
printf("\n\nLINE Opened...");
result = lineSetStatusMessages(hLine,0x1ffffff,0);
if(result==0)
printf("\n\nLine status set...");
else printf("\nError: Line status not set...");
}
VOID CALLBACK lineCallbackFunc(DWORD hDevice,DWORD dwMsg, DWORD Param1, DWORD Param2, DWORD Param3) {
//printf("\nIncomg Line...");
switch(dwMsg){
case LINE_CALLSTATE:
{
switch(Param1){
case LINECALLSTATE_OFFERING:
case LINECALLSTATE_ACCEPTED:
if(Param1==LINECALLSTATE_OFFERING)
printf("\nLINECALLSTATE_OFFERING");
else if(Param1==LINECALLSTATE_ACCEPTED)
printf("\nLINECALLSTATE_ACCEPTED");
break;
}
}
break;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|