예제 #1
0
int CCircuitry::RecordWith(int nChan, BYTE* pBuffer, DWORD dwStopOffset)
{
	if ( ! m_pChain || ! m_pChain->IsConnected() ) return -1;
	
	if ( m_pRecIoOver->Offset >= MAX_RECLST ) return -1;
	if ( ! HasOverlappedIoCompleted(m_pRecIoOver) ) return -1;
	
	CBuffer* pOutput = m_pChain->m_pOutput;
	if ( dwStopOffset ) pOutput->Add( pBuffer, dwStopOffset + 1 );
	
	Neighbour.m_pWakeup.SetEvent();
	
	if ( int nResult = SsmRecordMemBlock(nChan, 6, pBuffer, TEMP_BUFFER, OnRecMemBlockDone, m_pRecIoOver) )
	{
#ifdef _DEBUG
		CHAR sError[1024];
		SsmGetLastErrMsg( sError );
		theApp.Message( MSG_ERROR, sError );
#endif
		return nResult;
	}
	
	m_pRecIoOver->Offset++;
	ResetEvent( m_pRecIoOver->hEvent );
	
//TRACE("%i-> RecordWith in [%i]\n", GetTickCount(), m_pRecIoOver->Offset);
	return 0;
}
예제 #2
0
int CInfoChannel::PlayXFile_init(EVTBLK *evtblk)
{
	int nChan = evtblk->nReference;
	if ( Reserved & 0x08 ) return 0;
	
	Reserved |= 0x08;	// 置状态“正在”
	SsmClearRxDtmfBuf(nChan);
	
	if ( m_pRecordset->adoEOF ) return SsmPutUserEvent( E_PROC_PlayEnd, nChan, 1 );
	
	_variant_t TheValue = m_pRecordset->GetCollect( "xvoicepath" );
	CString xUsrFile = (LPCTSTR)(_bstr_t)TheValue;
	xUsrFile.TrimLeft(); xUsrFile.TrimRight();
	
	Reserved |= 0x08;	// 置状态“正在”
	if ( PlayFile( (LPCTSTR)xUsrFile, NULL, TRUE ) )
	{
		CHAR sError[1024];
		SsmGetLastErrMsg( sError );
		theApp.Message( MSG_ERROR, sError );
		
		return SsmPutUserEvent( E_PROC_PlayEnd, nChan, 0 );
	}
	
	return 0;
}
예제 #3
0
struct state* CMailChannel::RcvFxByte_cmplt(EVTBLK *evtblk)
{
	int nChan = evtblk->nReference;
	
	if ( evtblk->wEventCode == E_PROC_PlayEnd )
	{
		UsrLvFax   = MakeUsrFaxFile( "tif" );
		
		CChannel* pChannel = Network.FindChannel( m_nTaskId );
		if ( ! pChannel ) throw "Invalid channel";
		
		if ( pChannel->RecordFax( UsrLvFax, NULL ) )
		{
			CHAR sError[1024];
			SsmGetLastErrMsg( sError );
			theApp.Message( MSG_ERROR, sError );
		}
	}
///////////////////////////	
	if ( evtblk->wEventCode == E_PROC_FaxEnd )//&& m_bPending == TRUE )
	{
		if ( ! RepackFile( (LPCTSTR)UsrLvFax ) )
		{
			CHAR sError[1024];
			fBmp_GetErrMsg( sError );
			theApp.Message( MSG_ERROR, sError );
		}
		
		PutUsrRecord( UsrLvFax ); SetEvent( Traffic.m_pWakeup );
	}
	
	return ChkDTSignal( evtblk, &RcvFxByte );
}
예제 #4
0
void CCorpChannelDx::OnRecdPacket(IRecdPacket* pPacket)
{
    if ( ! _tcscmp(pPacket->PakParam, "STOP") )
    {
        CChannel::OnRecdPacket( pPacket );
        return;
    }

    //CString xNewFile = Settings.Meeting.RecFile;
    CString xNewFile = "<DATE>\\<REMOTE>-<TIME>.PCM";

    if ( xNewFile.Find( "<DATE>" ) >= 0 )
    {
        SYSTEMTIME pTime;
        GetLocalTime( &pTime );

        CString strValue;
        strValue.Format( "%04i年%02i月%02i日",
                         pTime.wYear, pTime.wMonth, pTime.wDay );
        Replace( xNewFile, "<DATE>", strValue );
    }

    if ( xNewFile.Find( "<TIME>" ) >= 0 )
    {
        SYSTEMTIME pTime;
        GetLocalTime( &pTime );

        CString strValue;
        strValue.Format( "%02i时%02i分%02i秒%03i",
                         pTime.wHour, pTime.wMinute, pTime.wSecond, pTime.wMilliseconds );
        Replace( xNewFile, "<TIME>", strValue );
    }

    if ( xNewFile.Find( "<REMOTE>" ) >= 0 )
    {
        CString strValue;
        Replace( xNewFile, "<REMOTE>", RemoteId );
    }

    for ( LPCTSTR xPath = xNewFile, xPathExt = NULL;
            xPathExt = _tcsistr(xPath, "\\"); xPath = xPathExt + 1 )
    {
        CString strValue = xNewFile.Left(xPathExt - (LPCTSTR)xNewFile);
        CreateDirectory( "中国电信\\" + strValue, NULL );
    }

    SsmSetRecMixer( m_nChan, TRUE, 0 );
    if ( RecordFile(xNewFile, "中国电信") )
    {
        CHAR sError[1024];
        SsmGetLastErrMsg( sError );
        throw sError;
    }

    theApp.Message( MSG_TEMP,"Record[%i] -> %s", m_nChan, xNewFile );
}
예제 #5
0
int CCorpChannelDx::WaitDial_init(EVTBLK *evtblk)
{
    if ( ! CChannel::WaitDial_init(evtblk) ) return 0;

    int nChan = evtblk->nReference;
    CHAR sError[1024];
    SsmGetLastErrMsg( sError );
    theApp.Message( MSG_ERROR, "error on channel %d: %s", nChan, sError );

    //UpdateState( "UNKNOWN" ); m_bPending = FALSE;
    fcnp = &bkOffHk;
    Reserved &= 0;

    return (this->*fcnp->initiate)(evtblk);
}
예제 #6
0
void CCallerChannel::SetLinker(int nChan)
{
	KillLinker();

	if ( SsmTalkWithEx(m_nChan, 1, nChan, 1) )
	{
		CHAR sError[1024];
		SsmGetLastErrMsg( sError );
		theApp.Message( MSG_ERROR, "SsmTalkWith:%i,%i ->%s", m_nChan,nChan,sError );
	}

	CChannel* pChannel = Network.FindChannel( nChan );
	if ( ! pChannel ) throw "Invalid channel";
	pChannel->m_nTaskId = m_nChan;
	m_nTaskId = nChan;

//#ifdef _DEBUG
	theApp.Message(MSG_DEBUG,"SetLinker: %i with %i", m_nChan, nChan);
//#endif
}
예제 #7
0
int CCircuitry::ReplayWith(int nChan, CInterlink* pChain)
{
	if ( ! pChain || ! pChain->IsConnected() ) return -1;
	
	if ( m_pPlayIoOver->Offset >= MAX_PLAYLST ) return -1;
	if ( ! HasOverlappedIoCompleted(m_pPlayIoOver) ) return -1;
	
	CBuffer* pInput = pChain->m_pInput;
	if ( pInput->m_nLength > MASK_BUFFER ) pInput->Remove( pInput->m_nLength - MASK_BUFFER );
	if ( pInput->m_nLength < TEMP_BUFFER ) return -1;
	
	Neighbour.m_pWakeup.SetEvent();
	m_pPlayIoOver->Internal = STATUS_PENDING;
//TRACE("%i->buffer in[%i], [%i]\n", GetTickCount(), pInput->m_nBuffer,pInput->m_nLength);
	
	m_nPlyCookie %= MAX_PLAYLST;
	BYTE* pBuffer = m_pBufferIn[0] + ( m_nPlyCookie++ * TEMP_BUFFER );
	
	CopyMemory( pBuffer, pInput->m_pBuffer, TEMP_BUFFER );
	pInput->Remove( TEMP_BUFFER );
	
	if ( int nResult = SsmPlayMemBlock(nChan, 6, pBuffer, TEMP_BUFFER, OnPlayMemBlockDone, m_pPlayIoOver) )
	{
#ifdef _DEBUG
		CHAR sError[1024];
		SsmGetLastErrMsg( sError );
		theApp.Message( MSG_ERROR, sError );
#endif
		m_pPlayIoOver->Internal = 0;
		return nResult;
	}
	
	m_pPlayIoOver->Offset++;
	m_pPlayIoOver->Internal = 0;
	ResetEvent( m_pPlayIoOver->hEvent );
	
//TRACE("%i-> ReplayWith in [%i]\n", GetTickCount(), m_pPlayIoOver->Offset);
	return 0;
}
/**
 * 显示语音卡错误
 *
 */
void voice_card_control::show_error()
{
	char buff[5000];
	SsmGetLastErrMsg(buff);
	BOOST_LOG_SEV(cia_g_logger, Warning) << "SsmGetLastErrMsg:" << buff;
}