cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
701
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Antonio Sedano on 11-04-2013 12:02:14 PM
Hi everybody. I am newbie in TSP Media driver. We are trying to do a simple application in C++ where we do a call between a Ctiport and a Cisco Ip Phone, using TAPI library. We do the call,to answer the call and to hung up the call without problems.  All functions, in  ciscortplib.dll, return OK , but when we use EpStreamWrite function (to transmit a wave), this return true, and in the callback function does not return error, but we do not listen anything in the cisco ip phone. The waves tested have been built: 8KHz 8bit 8000 sample rate, and 8KHz 16bit 8000 sample rate. These are the steps we follow: lRet = lineInitializeEx(&m_hLineApp,0, 0,NULL,&dwNumDevs,&dwTAPIVer,&stInitParams); hinsDLL = LoadLibrary(L"ciscortplib.dll"); EpInitDefault = (initDefault)GetProcAddress(hinsDLL,"_EpApiInitDefault"); LONG lRet = lineNegotiateAPIVersion(m_hLineApp,dwDevice,TAPILOWVERSION, TAPIHIVERSION, &dwTmpVer, &stExtID); lRet = lineGetDevCaps(m_hLineApp, dwDevice, dwTmpVer, 0, pDevCaps); bool bInitDefault = EpInitDefault((PRTPLIBTRACE)WriteTrace); lRet = lineOpen(m_hLineApp,dwDevice,&lphLine,dwTmpVer,0,NULL,dwPriv,dwMediaMode,&lcpCallParams); lRet = lineMakeCall(lphLine,&hCall,sNumber,0, 0); EpInit = (init)GetProcAddress(hinsDLL,"_EpApiInit"); bool binit = EpInit((PRTPLIBTRACE)WriteTrace,21100,500,0,0)); hResult = lineDevSpecific(lphLine,0,hCall,pParams,sizeof(TCHAR)*10); EpOpenId = (OpenById)GetProcAddress(hinsDLL,"_EpOpenById"); hdOpen = EpOpenId(dwDeviceId,Both,0); //(PRTPENDPOINTCALLBACK)EndPointCallback0);//both options have the same result. hdGSH = EpGetStreamHandle(hdOpen,STREAM_TYPE_AUDIO,ToNwk); errno_t  bSopen = _sopen_s(&iFile,"C:\\Users\\user\\Desktop\\TspMediaDriverMfc\\Debug\\Test.wav",_O_BINARY,_SH_DENYNO,_S_IREAD|_S_IWRITE); bool bSW = EpStreamWrite(hdGSH,sFile,iFileSize);//,(PVOID)"1");//,(PRTPENDPOINTCALLBACK)EndPointCallback2);//the three options have the same result. Sleep(10000); bool bStrmStop = EpStreamStop(hdGSH); bool bClose = EpClose(hdOpen); LONG lRet = lineClose(lphLine); lRet = lineShutdown(m_hLineApp); EpApiClose();   If each function return OK why do we listen nothing? Any idea?  Thanks in advance.  

Subject: RE: TSP Media Driver CUCM 8.5
Replied by: Davide Cocchi on 12-04-2013 01:57:36 AM
Hi Antonio,
 
you need to wait for status messages as described in documentation before open the Ep.
 
See the "Typical TAPI Application Message Flow" under Media driver section of TAPI Developers Guide for Cisco Unified Communications Manager Release 8.5(1)
 
Bye, D.

Subject: RE: TSP Media Driver CUCM 8.5
Replied by: Antonio Sedano on 15-04-2013 02:12:09 AM
Davide Cocchi:
Hi Antonio,
 
you need to wait for status messages as described in documentation before open the Ep.
 
See the "Typical TAPI Application Message Flow" under Media driver section of TAPI Developers Guide for Cisco Unified Communications Manager Release 8.5(1)
 
Bye, D.

 
Hi Davide. 
 
First of all, thank you for your answer, but, although we have followed the "Typical TAPI Application Message Flow" of Media Driver section of TAPI, from the  first moment, we do not get to listen the  wave in the cisco ip phone device.
 
Maybe, the problem is in the call to the Tapi function lineDevSpecific, we are no sure of the fourth parameter.
 
LONG WINAPI lineDevSpecific(HLINE hLine, DWORD dwAddressID, HCALL hCall, LPVOID lpParams, DWORD dwSize);
 
The LPVOID parameter, we are putting is a TCHAR pParams[10] and we have tested with the values 8,0,0,0,0,0,0,0,0,0 and the values 9,6,0,0,0,0,0,0,0,0. We found this values in Internet.
 
We do not know where we can found a table with the different values that this parameter can have. We have checked all the  Developers Guide for Cisco Unified Communications Manager Release 8.5(1). 
 
This is the function where we have the problem. Everything works fine, when we call to this method, we have a call between a ctiport and a cisco ip phone. 
 
void CTspMediaDriverMfcDlg:nBnClickedBtSendwave()
{
 
LONG lRet;
    varStrDevID.dwTotalSize = 1052;
lRet = lineGetID(lphLine,0,0,LINECALLSELECT_LINE,&varStrDevID,L"ciscowave/out");
dwDeviceId = ((DWORD *) (((BYTE *) &varStrDevID) + varStrDevID.dwStringOffset))[0];
hinsDLL = LoadLibrary(L"ciscortplib.dll");//debe de estar en System32
EpInit = NULL;
EpInit = (init)GetProcAddress(hinsDLL,"_EpApiInit");
if(!EpInit((PRTPLIBTRACE)EscribirTrace,21100,500,0,0))//los dos últimos parámetros van por defecto, en caso de errores revisarlos.
{
this->m_edit1.SetWindowTextW(L"Error al hacer _EpApiInit con los parámetros finales por defecto.");
}
 
Sleep(10000);
DWORD dwSize =  0x398;//dato encontrado en un foro que decía que se pusiese esto para que funcionase fino.
TCHAR pParams[10];
memset(pParams,0,sizeof(TCHAR)*10);
pParams[0]=8;
pParams[1]=0;
 
hResult = lineDevSpecific(lphLine,0,hCall,pParams,sizeof(TCHAR)*10);
if(hResult<0)//error
{
CString sTrace;
char trace[100];
sprintf_s(trace,100, "Error %x",lRet);
sTrace = trace;
this->m_edit1.SetWindowTextW(sTrace);
}
Sleep(10000);
EpOpenId = (OpenById)GetProcAddress(hinsDLL,"_EpOpenById");
hdOpen = EpOpenId(dwDeviceId,Both,0);//(PRTPENDPOINTCALLBACK)EndPointCallback0);
hdGSH = EpGetStreamHandle(hdOpen,STREAM_TYPE_AUDIO,ToNwk);
 
lineGenerateDigits(hCall,LINEDIGITMODE_DTMF,L"1234567890",0);
 
Sleep(2000);
 
bool bss2 = EpStreamStart(hdGSH);      //(PRTPENDPOINTCALLBACK)EndPointCallback1);
 
     WAVEFORMATEX wfex;
bool bSCIG = EpStreamCodecInGet(hdGSH,&wfex);
 
int iFile=-5;
  errno_t  bSopen = _sopen_s(&iFile,"C:\\Users\\asedano\\Desktop\\TspMediaDriverMfc\\Debug\\WelcomeDefaultGN.wav",_O_BINARY,_SH_DENYNO,_S_IREAD|_S_IWRITE);
 
     memset(sFile,0,iFileSize+1);
int iReadResult = _read(iFile,sFile,iFileSize);
    
     bool bSW = EpStreamWrite(hdGSH,sFile,iFileSize);//,(PVOID)"1");//,(PRTPENDPOINTCALLBACK)EndPointCallback2); 
            //bSW is true but we do not listen anything in the cisco ip phone. When we have tested with the callback function, the dwerror  parameter is 0(no error), but if we put this callback function, we have an error of access violation).
 
Sleep(10000);
bool bStrmStop = EpStreamStop(hdGSH);
bool bClose = EpClose(hdOpen);
FreeLibrary(hinsDLL);
}
 
Any idea???
Thanks.
 
 

Subject: RE: TSP Media Driver CUCM 8.5
Replied by: Davide Cocchi on 15-04-2013 03:37:43 AM
I don't know why it doesn't work, but why you don't use the header files and the lib provided from cisco? The implementation using files provided is simpler...
 
You can find these files in Cisco tsp install directory (for example: "C:\Program Files (x86)\Cisco" and subfolder "RtpLib")

Subject: RE: TSP Media Driver CUCM 8.5
Replied by: Antonio Sedano on 15-04-2013 04:14:56 AM
We are doing it, we are using the .lib and the headers, but we had problems with some functions, which did not work when we loaded only statically the ciscortplib.lib. Functions as EpApiInitDefault or EpOpenById do not work us if we use the headers and the .lib, we had linked problems.
We read in a ppt, found in internet, that we had to load dynamically ciscortplib.dll to use the methods with callback functions, and it was true, for example, the previos two methods started working without problem. But we discovered, not all methods, with callback functions, need to be loaded dynamically.
In any case, I have the same problem if I statically  use EpStreamWrite or dinamically _EpWrite .
 

Subject: RE: TSP Media Driver CUCM 8.5
Replied by: Davide Cocchi on 15-04-2013 04:21:18 AM
If you look at the other discussion, i posted my sample code... I link the library statically and i use callbacks without any problem...

Subject: RE: TSP Media Driver CUCM 8.5
Replied by: Antonio Sedano on 15-04-2013 06:37:53 AM
I am seeing your code and reviewing mine. 
I will tell you if we get some advance. 
Thank you.

Subject: RE: TSP Media Driver CUCM 8.5
Replied by: Antonio Sedano on 16-04-2013 01:07:15 AM
Hi Davide.
Please, do you mind telling me how you declare the EndPointCBK function? 
Thanks a lot.

Subject: RE: TSP Media Driver CUCM 8.5
Replied by: Antonio Sedano on 16-04-2013 04:19:37 AM
Hello everybody.
 
We have solved the problem. This was not in the code, which is working fine. The problem was in the computer where we were doing the tests. The computer has two IPs and the initialization with the CUCM was being done for the first one and the audio was going out through the second one, so el CUCM couldn't play the wave in the cisco device.
 
When we have disabled the second IP, everything started working fine.
 
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links