Voice is implemented as follows:- Your Modem registers total of 5 devices.The audio is sent through the serial port named "Huawei Mobile Connect - Application Interface".
Format of voice (in|out) data:
wFormatTag = WAVE_FORMAT_PCM;
nChannels = 1;
nSamplesPerSec = 8000;
nAvgBytesPerSec = 16000;
nBlockAlign = 2;
wBitsPerSample = 16;
cbSize = 0;
Block size of voice data in ReadFile or WriteFile operations (for COM port) must be set in 320 bytes. After each ReadFile must be WriteFile operation (in other choice buffers will be overflow and modem will restart after some time). Sample:
// BlockSize - size of buff for wave in|out operations (in my case 320*4 bytes)
while (!bAllRead) {
if (cInfo->hCom == INVALID_HANDLE_VALUE) {
SetVoiceClosed(cInfo);//exit from thread
return 0;
}
BOOL isRead = ReadFile(cInfo->hCom, cInfo->Header[counter].lpData + currBlocLength, 320, &nActualRead, &cInfo->o);
if (isRead || (GetLastError() == ERROR_IO_PENDING && GetOverlappedResult(cInfo->hCom, &cInfo->o, &nActualRead, TRUE))) {
if (nActualRead > 0) {
// обратка
nActualWrite = 0;
int nActualWriteAll = 0;
BOOL isWrite = WriteFile(cInfo->hCom, CurrBuffPtr + currBlocLength, nActualRead, &nActualWrite, &cInfo->oVoiceOut);
while (isWrite || (GetLastError() == ERROR_IO_PENDING && GetOverlappedResult(cInfo->hCom, &cInfo->oVoiceOut, &nActualWrite, TRUE))) {
nActualWriteAll += nActualWrite;
if (nActualWriteAll >= nActualRead)
break;
}
currBlocLength += nActualRead;
if (currBlocLength >= BlockSize)
bAllRead = true;
}
else {
Sleep(25);// wait for voice data (resync)
PurgeComm(cInfo->hCom, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR);
}
}
else {
bAllRead = true;// there are no active call
PurgeComm(cInfo->hCom, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR);
}
}
Something like that))). I do not find any useful info in Internet, so all that recommendation based on my experiments. I hope that was useful.
PS: I hope wave in|out operations will not be a problem for you.
PS2: Sorry for my English, I'm from Ukraine.