예제 #1
0
void	InitVOIPChannel ( VOIP_STRUCT *pOneVOIP )
{
	Change_State ( pOneVOIP, VOIP_FREE );

	pOneVOIP->iCalleePort = 0;
	pOneVOIP->iCallerPort = 0;
	pOneVOIP->iProtocol = 0;

	memset(pOneVOIP->CallerAddr, 0, sizeof(pOneVOIP->CallerAddr));
	memset(pOneVOIP->CallerUserID, 0, sizeof(pOneVOIP->CallerUserID));
	
	memset(pOneVOIP->CalleeAddr, 0, sizeof(pOneVOIP->CalleeAddr));
	memset(pOneVOIP->CalleeUserID, 0, sizeof(pOneVOIP->CalleeUserID));

	memset(pOneVOIP->CallerNum, 0, sizeof(pOneVOIP->CallerNum));
	memset(pOneVOIP->CalleeNum, 0, sizeof(pOneVOIP->CalleeNum));


	My_InitDtmfBuf ( pOneVOIP );
	DrawMain_DTMF ( pOneVOIP );

	memset ( &pOneVOIP->VocDevID, 0, sizeof(DeviceID_t));		// -1表示还没有分配Voc Device
//	memset ( &pOneVOIP->LinkDevID, 0, sizeof(DeviceID_t));
	DrawMain_VocInfo ( pOneVOIP );
}
예제 #2
0
void __fastcall TLevWrt::ppbLockClick(TObject *Sender)
{
if ((pushedPanel != NULL) || (pushedPanel->Caption != "")
|| (pushedPanel->Caption == "cell")
|| (pushedPanel->Caption.Pos(compPanelLab) != NULL))
{
if (pushedPanel->Color == clWhite)
{
Change_State(pushedPanel, pushedPanel->Caption, clBlack);
pushedPanel->Font->Color = clWhite;
modified = true;
} else
if (pushedPanel->Color == clBlack)
Change_State(pushedPanel, pushedPanel->Caption, clWhite);
}
}
예제 #3
0
void __fastcall TLevWrt::ppbSunPartClick(TObject *Sender)
{
if (pushedPanel != NULL)
{
Change_State(pushedPanel, compPanelLab + IntToStr(sunnum), clWhite);
Make_Objects(NULL);
}
}
예제 #4
0
void VOIPWork ( VOIP_STRUCT *pOneVOIP, Acs_Evt_t *pAcsEvt )
{
	Acs_CallControl_Data   *pCallControl = NULL;
	VoIPCallPrivate_t      *voipCallPrivate = NULL;
	DeviceID_t				FreeVocDeviceID;
	char					FileName[256];
	char                    chTmpFilePath[256] = "";

	if (pOneVOIP == NULL || pAcsEvt == NULL)
		return;

	if ( pAcsEvt->m_s32EventType == XMS_EVT_CLEARCALL )	/*拆线事件*/
	{
		if (cfg_iVoiceCheck == 1)
		{
			StopPlayFile(&pOneVOIP->VocDevID);
			
			//删除录音文件
			GetFilePathName(pOneVOIP, chTmpFilePath);
			sprintf(FileName, "%s\\DemoRec.%0003d", chTmpFilePath, pOneVOIP->iSeqID);
			DeleteFile(FileName);
		}

		ResetVOIP ( pOneVOIP, pAcsEvt );
		Change_State(pOneVOIP, VOIP_FREE);

		return ; 
	}

	switch(pOneVOIP->State)
	{
	case VOIP_FREE:
		if ( pAcsEvt->m_s32EventType == XMS_EVT_CALLIN )	/*呼入事件*/
		{
			pCallControl = (Acs_CallControl_Data *)FetchEventData(pAcsEvt);

			ASSERT(pCallControl->m_PrivData.m_u32DataSize == sizeof(VoIPCallPrivate_t));
			voipCallPrivate = (VoIPCallPrivate_t *)&(pCallControl->m_PrivData);			

			XMS_ctsAlertCall ( g_acsHandle, &pOneVOIP->deviceID, NULL );

			XMS_ctsAnswerCallIn ( g_acsHandle, &pOneVOIP->deviceID, NULL );			
			
			pOneVOIP->iProtocol = voipCallPrivate->m_s32Protocol;

			//Caller Info
			strncpy(pOneVOIP->CallerAddr, voipCallPrivate->m_s8CallerAddress, sizeof(pOneVOIP->CallerAddr));			
			strncpy(pOneVOIP->CallerUserID, voipCallPrivate->m_s8CallerUserID, sizeof(pOneVOIP->CallerUserID));
			strncpy ( pOneVOIP->CallerNum, pCallControl->m_s8CallingNum, sizeof(pOneVOIP->CallerNum));
			pOneVOIP->iCallerPort = (unsigned short)voipCallPrivate->m_s32CallerPort;
			//

			//Callee Info
			strncpy(pOneVOIP->CalleeAddr, voipCallPrivate->m_s8CalleeAddress, sizeof(pOneVOIP->CalleeAddr));			
			strncpy(pOneVOIP->CalleeUserID, voipCallPrivate->m_s8CalleeUserID, sizeof(pOneVOIP->CalleeUserID));
			strncpy ( pOneVOIP->CalleeNum, pCallControl->m_s8CalledNum, sizeof(pOneVOIP->CalleeNum));			
			pOneVOIP->iCalleePort = (unsigned short)voipCallPrivate->m_s32CalleePort;
			//

			DrawMain_CallInfo( pOneVOIP );
			
			Change_State ( pOneVOIP, VOIP_WAIT_ANSWERCALL );
		}
		break;

	case VOIP_WAIT_ANSWERCALL:		
		if ( pAcsEvt->m_s32EventType == XMS_EVT_ANSWERCALL )	/*应答呼入完成事件*/
		{
			pCallControl = (Acs_CallControl_Data *)FetchEventData(pAcsEvt);

			if (cfg_iVoiceCheck == 1)
			{
				if ( SearchOneFreeVoice ( pOneVOIP,  &FreeVocDeviceID ) >= 0 )
				{
					pOneVOIP->u8PlayTag = 16;
					
					pOneVOIP->VocDevID = FreeVocDeviceID;
					
					M_OneVoice(FreeVocDeviceID).UsedDevID = pOneVOIP->deviceID; 
					
					DrawMain_VocInfo ( pOneVOIP );
					
					GetFilePathName(pOneVOIP, chTmpFilePath);
					sprintf(FileName, "%s\\DemoRec.%0003d", chTmpFilePath, pOneVOIP->iSeqID);		
					RecordFile ( pOneVOIP, FileName, 8000L*10, false);

					Change_State ( pOneVOIP, VOIP_RECORDFILE );					
				
				}
			}
			else
			{
				Change_State ( pOneVOIP, VOIP_WAITHANGUP );
			}
		}
		break;

	case VOIP_RECORDFILE:
		if ( CheckRecordEnd ( pOneVOIP, pAcsEvt) )	/*record完成事件*/
		{
			BindOneFreeVoice(pOneVOIP, pOneVOIP->VocDevID);
			Change_State ( pOneVOIP, VOIP_WAITBINDOK);
		}
		break;

	case VOIP_WAITBINDOK:
		if (pAcsEvt->m_s32EventType == XMS_EVT_SETPARAM)
		{
			GetFilePathName(pOneVOIP, chTmpFilePath);
			sprintf(FileName, "%s\\DemoRec.%0003d", chTmpFilePath, pOneVOIP->iSeqID);	
			pOneVOIP->u8PlayTag ++;
			PlayFile ( &pOneVOIP->VocDevID, FileName, pOneVOIP->u8PlayTag, true );

			Change_State (pOneVOIP, VOIP_PLAYRECORD);
		}	
		break;

	case VOIP_PLAYRECORD:
		if ( CheckPlayEnd ( pOneVOIP, pAcsEvt) )	/*play完成事件*/
		{
			// 主动挂机
			UnBindOneVoice(pOneVOIP);

			XMS_ctsClearCall ( g_acsHandle, &pOneVOIP->deviceID, 0, NULL );			

			Change_State ( pOneVOIP, VOIP_WAITHANGUP );
		}
		break;
	}
}
예제 #5
0
//---------------------------------------------------------------------------
void __fastcall TLevWrt::ppbSpaceClick(TObject *Sender)
{
if (pushedPanel != NULL) Change_State(pushedPanel, "", clBtnFace);
}
예제 #6
0
//---------------------------------------------------------------------------
void __fastcall TLevWrt::ppbCellClick(TObject *Sender)
{
if (pushedPanel != NULL) Change_State(pushedPanel,
dynamic_cast<TMenuItem*>(Sender)->Caption, clWhite);
}