[pjsip] Third Party Integration

朱能杰 znj at bbkav.com
Thu Aug 20 20:55:23 EDT 2009


I have ever integrated the GIPS VE to my sip phone, but I do not use pjsip, I use  exOsip, but I think they are the same. Below is the partial of the key code, FYI:

 int iAuthResult = GIPSVE_Authenticate(szAuthValue, strlen(szAuthValue));
 if(iAuthResult != 0)
 {
  iAuthResult = GIPSVE_GetLastError();
  AfxMessageBox(ErroCodeToString("Authenticate", iAuthResult));
  return -1;
 }
 else
 {
  /* 
     You must first call GIPSVE_GIPSVE_Authenticate with a valid password.
  */
  int iInitResult = GIPSVE_Init();
  if(iInitResult != 0)
  {
   iInitResult = GIPSVE_GetLastError();
   AfxMessageBox(ErroCodeToString("Init", iInitResult));
   return -1;
  }
 }


int CGIPSVoiceEngine::StartSound(int iPayLoadType, int iLocalAudioPort, char* szRemoteAudioIp, int iRemoteAudioPort)
{
 if(m_iGIPSChannelId >= 0)
 {
  return 0;
 }
 int iRet = 0;
 m_iGIPSChannelId = GIPSVE_CreateChannel();
 if(m_iGIPSChannelId == -1)
 {
  return -1;
 }
 
 //µÃµ½payloadtype
 int iCodecCount = GIPSVE_GetNofCodecs();
 for(int j = 0; j < iCodecCount; j++)
 {
  iRet = GIPSVE_GetCodec(j, &m_CodecInst);
  iRet = GIPSVE_GetLastError();
  //TRACE("type: %d, name: %s, freq:%d, channels:%d, pacsize:%d, rate: %d \n", inst.pltype, inst.plname, inst.plfreq,
  // inst.channels, inst.pacsize, inst.rate);
  if(m_CodecInst.pltype == iPayLoadType)
  {
   break;
  }
 }
 if(j >= iCodecCount)
 {
  GIPSVE_DeleteChannel(m_iGIPSChannelId);
  m_iGIPSChannelId = -1;
  return -1;
 }

 iRet = GIPSVE_SetSendCodec(m_iGIPSChannelId, &m_CodecInst);
 iRet = GIPSVE_GetLastError();
 m_pSocketRTP = new CVoiceEngineDatagramSocket(this, m_iGIPSChannelId,
  TYPE_AUDIO_RTP, iRemoteAudioPort, szRemoteAudioIp, iLocalAudioPort, NULL);

 m_pSocketRTCP = new CVoiceEngineDatagramSocket(this, m_iGIPSChannelId,
  TYPE_AUDIO_RTCP, iRemoteAudioPort + 1, szRemoteAudioIp, iLocalAudioPort + 1, NULL);

 m_pTransport = new CVoiceEngineSocketAdapter();
 m_pTransport->SetSockets(m_pSocketRTP, m_pSocketRTCP);

 iRet = GIPSVE_SetSendTransport(m_iGIPSChannelId, *m_pTransport);
 iRet = GIPSVE_GetLastError();
 m_pTask = new CVoiceEngineTask();
 m_pTask->SetSockets(m_pSocketRTP, m_pSocketRTCP);
 m_pTask->StartTask();

 iRet = GIPSVE_StartSend(m_iGIPSChannelId);
 iRet = GIPSVE_GetLastError();
 iRet = GIPSVE_StartPlayout(m_iGIPSChannelId);
 iRet = GIPSVE_GetLastError();

 iRet = GIPSVE_SetDTMFPayloadType(m_iGIPSChannelId, 101);
 iRet = GIPSVE_GetLastError();
 return 0;
}

int CGIPSVoiceEngine::StopSound()  
{
 if(m_iGIPSChannelId < 0)
 {
  return 0;
 }
 GIPSVE_StopSend(m_iGIPSChannelId);
 GIPSVE_StopPlayout(m_iGIPSChannelId);

 m_pTask->StopTask();
 m_pSocketRTP->Close();
 m_pSocketRTCP->Close();

 delete m_pSocketRTP;
 delete m_pSocketRTCP;
 delete m_pTask;
 delete m_pTransport;
 
 GIPSVE_DeleteChannel(m_iGIPSChannelId);

 m_iGIPSChannelId = -1;
 
 return 0;
}
  ----- Original Message ----- 
  From: Haripriya A R 
  To: pjsip at lists.pjsip.org 
  Sent: Thursday, August 20, 2009 7:55 PM
  Subject: [pjsip] Third Party Integration


  Hi all,

  Can you please help me how to proceed for third party GIPS Voice engine integration….

   

  Thanks in Advance.

   



------------------------------------------------------------------------------


  _______________________________________________
  Visit our blog: http://blog.pjsip.org

  pjsip mailing list
  pjsip at lists.pjsip.org
  http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

  ----- Original Message ----- 
  From: Haripriya A R 
  To: pjsip at lists.pjsip.org 
  Sent: Thursday, August 20, 2009 7:55 PM
  Subject: [pjsip] Third Party Integration


  Hi all,

  Can you please help me how to proceed for third party GIPS Voice engine integration….

   

  Thanks in Advance.

   



------------------------------------------------------------------------------


  _______________________________________________
  Visit our blog: http://blog.pjsip.org

  pjsip mailing list
  pjsip at lists.pjsip.org
  http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090821/04bacd26/attachment.html>


More information about the pjsip mailing list