示例#1
0
static void OpenDeviceOK(DeviceID_t *pDevice)
{ 
  list *current = NULL;
  int i;  
  
  if ((pDevice->m_s16DeviceMain == XMS_DEVMAIN_INTERFACE_CH) &&
      (pDevice->m_s16DeviceSub == XMS_DEVSUB_SS7_LINK))
  {
    if ((i = find(g_pLinkFirst, *pDevice, &current)) >= 0)
    {
      /*add lock*/
      if (current == NULL)
        if (ldebug_flag)
          printstr(NULL,"openDeviceOk find link=NULL\n");
          
      current->entry[i].m_dev.m_CallID = pDevice->m_CallID;
      
      if (ldebug_flag)
      {
        printstr(NULL,"open devType(%d,%d) dev(%d %d) callID(%d,%d)\n ", current->entry[i].m_dev.m_s16DeviceMain,
               current->entry[i].m_dev.m_s16DeviceSub, current->entry[i].m_dev.m_s8ModuleID, current->entry[i].m_dev.m_s16ChannelID, 
               current->entry[i].m_dev.m_CallID.m_s32FlowType, current->entry[i].m_dev.m_CallID.m_s32FlowChannel);        
      }
      /*leave lock*/
      XMS_ctsResetDevice(g_acsHandle, pDevice, NULL);
      XMS_ctsGetDevState(g_acsHandle, pDevice, NULL);     
    }   
  }   

  if (pDevice->m_s16DeviceMain == XMS_DEVMAIN_DIGITAL_PORT)
  {
    if ((i = find(g_pPcmFirst, *pDevice, &current)) >= 0)
    {
      /*add lock*/
      if (current == NULL)
        if (ldebug_flag)
          printstr(NULL,"openDeviceOk find pcm=NULL\n");
          
      current->entry[i].m_dev.m_CallID = pDevice->m_CallID;
      if (ldebug_flag)
      {
        printstr(NULL,"open devType(%d,%d) dev(%d %d) callID(%d,%d)\n ", current->entry[i].m_dev.m_s16DeviceMain,
               current->entry[i].m_dev.m_s16DeviceSub, current->entry[i].m_dev.m_s8ModuleID, 
               current->entry[i].m_dev.m_s16ChannelID, current->entry[i].m_dev.m_CallID.m_s32FlowType, 
               current->entry[i].m_dev.m_CallID.m_s32FlowChannel);        
      }
      /*leave lock*/
      XMS_ctsResetDevice(g_acsHandle, pDevice, NULL);
      XMS_ctsGetDevState(g_acsHandle, pDevice, NULL);   
    } 
  }
}
示例#2
0
void	OpenDeviceOK ( DeviceID_t *pDevice )
{
	VOIP_STRUCT	*pOneVOIP;

	if (pDevice == NULL)
		return;

	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_BOARD )
	{
		AllDeviceRes[pDevice->m_s8ModuleID].deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation
	}

	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_VOIP )
	{
		pOneVOIP = &M_OneVOIP(*pDevice);

		pOneVOIP->deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation
	
		// init this Device: VOIP
		InitVOIPChannel ( pOneVOIP );

		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );	

		// modify the count
		g_iTotalVOIPOpened ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVOIPOpened ++;

		DrawCount_VOIP ( pDevice->m_s8ModuleID  );
	}

	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_VOICE )
	{
		M_OneVoice(*pDevice).deviceID.m_CallID = pDevice->m_CallID;		// this is very important

		// init this Device: Voice
		M_OneVoice(*pDevice).State = VOC_FREE;

		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );

		// modify the count
		g_iTotalVoiceOpened ++;
		g_iTotalVoiceFree ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVocOpened ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVocFreeNum ++;

		DrawCount_Voc ( pDevice->m_s8ModuleID );
	}
}
示例#3
0
void	OpenDeviceOK ( DeviceID_t *pDevice )
{
	TRUNK_STRUCT *	pOneTrunk;
	VOICE_STRUCT *	pOneVoice;	
	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_INTERFACE_CH )
	{
		pOneTrunk = &AllDeviceRes[(*pDevice).m_s8ModuleID].pTrunk[(*pDevice).m_s16ChannelID];
		
		pOneTrunk->deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation
		
		// init this Device: Trunk
		pOneTrunk->State = TRK_FREE;
		pOneTrunk->CallerCode[0]=0;
		pOneTrunk->CalledCode[0]=0;	
		memset ( &pOneTrunk->VocDevID, 0, sizeof(DeviceID_t) );		// 0: didn't alloc Voc Device
			
		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );
		
		pdlg->m_ListTrunk.SetItemText ( pOneTrunk->iSeqID, 3, GetString_LineState(pOneTrunk->iLineState) ); 
		
		if (pOneTrunk->deviceID.m_s16DeviceSub == XMS_DEVSUB_ANALOG_USER)
		{
			pdlg->m_ListTrunk.SetItemText ( pOneTrunk->iSeqID, 4, GetString_TrunkState(pOneTrunk) ); 
		}

		AllDeviceRes[pDevice->m_s8ModuleID].lTrunkOpened ++;		
	}
	
	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_VOICE )
	{
		pOneVoice = &AllDeviceRes[(*pDevice).m_s8ModuleID].pVoice[(*pDevice).m_s16ChannelID];
		pOneVoice->deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation

		// init this Device: Voice
		pOneVoice->State = VOC_FREE;
		
		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );	
	
		AllDeviceRes[pDevice->m_s8ModuleID].lVocOpened ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVocFreeNum ++;	
	}

}