void voice_card_control::init_cti()
{
	BOOST_LOG_SEV(cia_g_logger, RuntimeInfo) << "读取语音卡配置文件";
	if (SsmStartCti("ShConfig.ini", "ShIndex.ini") != 0)
	{
		show_error();
		BOOST_LOG_SEV(cia_g_logger, Critical) << "读取语音卡配置文件失败";
		throw std::runtime_error("读取语音卡配置文件失败");
	}
	else{
		BOOST_LOG_SEV(cia_g_logger, RuntimeInfo) << "语音卡配置文件读取成功";
	}
	//设置驱动程序抛出事件的模式

	EVENT_SET_INFO EventMode;
	EventMode.dwWorkMode = EVENT_CALLBACK;                               // 事件回调模式
	EventMode.lpHandlerParam = (LPVOID)voice_card_control::cti_callback; // 注册回调函数

	SsmSetEvent(0xffff, -1, true, &EventMode);	                         // 启动事件触发模式

	//如果要在程序中获取SS7消息, 则需要同时注意以下两点
	//配置文件 ShConfig.ini 中, GetMsuOnAutoHandle = 1
	//程序中: SsmSetEvent(E_RCV_Ss7Msu, -1, true, &EventMode);
	SsmSetEvent(E_RCV_Ss7Msu, -1, true, &EventMode);

	BOOST_LOG_SEV(cia_g_logger, RuntimeInfo) << "正在初始化语音卡通道, 预期耗时10秒";
	while (SsmSearchIdleCallOutCh(160, 0x1E0000) < 0){	                 // 循环等待, 直到能够获取语音卡空闲通道号, 语音卡初始化完毕
		boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
	}
	BOOST_LOG_SEV(cia_g_logger, RuntimeInfo) << "语音卡通道初始化完毕";
	for (std::size_t i = 0; i < m_numChannelCount; i++){
		m_channel_queue.put(i);
		SsmBlockRemoteCh(i);	                                         // 设置通道远端堵塞(禁止来话,但仍可以呼出)
	}
}
Exemple #2
0
void CPagerChannel::Setup()
{
	CChannel::Setup();
	fcnp = &FeeLogin;
	
	SsmSetEvent(E_PROC_PlayFile, m_nChan, FALSE, NULL);
	SsmSetEvent(E_PROC_RecordFile, m_nChan, FALSE, NULL);
	SsmSetEvent(E_SYS_BargeIn, m_nChan, FALSE, NULL);
	SsmSetEvent(E_SYS_NoSound, m_nChan, FALSE, NULL);
}