ShoreTel Call Recording using TAPI 2 WAV
|
|
Dear All,
I am trying to do call recording on ShoreTel 9.2 Build 14.41.1108.0 and need help. lineDevSpecific(...) works fine and return positive number but getting the LINEERR_INVALCALLHANDLE in dwParam2 of corresponding LINE_REPLY, below is the source code.
class CRecordData
{
public:
_bstr_t m_strTargetDN;
_bstr_t m_strSipCallID;
_bstr_t m_strRecDestDN;
_bstr_t m_strRecMailBox;
bool bStart;
};
CRecordData cRecData;
CRecordData* pRecordData;
LPSTLINERECORD pRecordReq;
BYTE* pBuffer;
DWORD dwSize;
And after receving the event of STLINECALLSTATE_CONNECTED_FAREND_ANSWERED, I am sending call recordrequest in lineDevSpecific as below.
hCallHandle = (HCALL)oLineMessage.hDevice;
status = lineSetCallPrivilege(hCallHandle, LINECALLPRIVILEGE_OWNER);
if(status) _tprinf(_T("lineSetCallPrivilege didn't set call privileges to owner."));
LPTSTR szCallId = _T("359A8559-6457-48a7-A600-DBF18973D2B1");
TCHAR CallId[33];
StrCpy(CallId, szCallId);
cRecData.bStart = true;
cRecData.m_strSipCallID = CallId;
cRecData.m_strTargetDN = L"753";
cRecData.m_strRecDestDN = L"114";
cRecData.m_strRecMailBox = L"";
pRecordData = &cRecData;
_bstr_t strRecParams ;
strRecParams = L"T=";
strRecParams = strRecParams + pRecordData->m_strTargetDN;
strRecParams = strRecParams + L";R=";
strRecParams = strRecParams + pRecordData->m_strRecDestDN;
strRecParams = strRecParams + L";CT=";
strRecParams = strRecParams + pRecordData->m_strRecMailBox;
strRecParams = strRecParams + L";";
DWORD dwSize = sizeof(*pRecordReq) + (strRecParams.length() + 1) * sizeof(WCHAR);
pBuffer = (BYTE*) malloc(dwSize);
pRecordReq = (LPSTLINERECORD) pBuffer;
pRecordReq->dwFunction = STLINE_RECORD;
*((GUID*)&pRecordReq->extensionID) = __uuidof(STLINERECORD);
pRecordReq->bStart = pRecordData->bStart;
if (strRecParams.length())
{
pRecordReq->dwRecordParamsSize = (strRecParams.length() + 1) * sizeof(WCHAR);
pRecordReq->dwRecordParamsOffset = sizeof(*pRecordReq);
::wcscpy((LPWSTR)(pBuffer + pRecordReq->dwRecordParamsOffset), strRecParams);
}
if(pRecordData->m_strSipCallID.length() > 0)
{
if (UuidFromString(pRecordData->m_strSipCallID,&(pRecordReq->guidCallID)) != RPC_S_OK)
{
_tprintf(_T("Call Record: Error parsing the Sip CallID to GUI\r\n"));
free(pBuffer);
}
}
lDeviceStatus = lineDevSpecific (hLineChannel, 0, hCallHandle, (LPVOID) pRecordReq, dwSize);
if(lDeviceStatus > 0)
_tprintf(_T("StartRecording request successfully sent to ShoreTel PBX."));
TAPI function lineDevSpecific(...) is working good and returns positive number but corresponding LINE_REPLY is giving the LINEERR_INVALCALLHANDLE in dwParam2.
Thanks for your help.
Regards,
Mudassir Saeed
|