BOOL CCircuitry::Reset() { if ( m_pRecIoOver ) ResetRecord( m_pRecIoOver ); if ( m_pPlayIoOver ) ResetReplay( m_pPlayIoOver ); const HANDLE hEvent[] = { m_pRecIoOver ? m_pRecIoOver->hEvent : NULL, m_pPlayIoOver? m_pPlayIoOver->hEvent: NULL }; WaitForMultipleObjects( 2, hEvent, TRUE, INFINITE ); SsmHangup( m_nTaskId ); m_nTaskId = -1; m_pChain->Release(); m_pChain = new CInterlink; // ´ý»ú CString strPipe = Settings.Centric.Local; strPipe += '.'; strPipe += m_xUserId; m_pChain->Connect( strPipe ); FreeBuffer(); return FALSE; }
int voice_card_control::cti_hangUp(std::size_t channelID, std::string status) { int retVal = 0; boost::shared_ptr<trunk> t = m_trunk_vector.at(channelID); boost::unique_lock<boost::mutex> unique_lock_(t->m_trunk_mutex, boost::defer_lock); if (!unique_lock_.try_lock()) { BOOST_LOG_SEV(cia_g_logger, Warning) << "cti_hangUp函数尝试锁定通道失败, 放弃挂机, 当前通道Step值为:" << t->m_step; return -1; } else { switch (t->m_step) { case TRK_IDLE: BOOST_LOG_SEV(cia_g_logger, Warning) << "依据当前通道状态判断可能出现重复挂机, 请在后续版本调查原因, 通道号码:" << channelID; return -1; case TRK_SLEEP: BOOST_LOG_SEV(cia_g_logger, Warning) << "当前通道正在延迟挂机, 通道号码:" << channelID; return -1; default: break; } if (!t->m_call_out_param->m_hungup_by_echo_tone) { BOOST_LOG_SEV(cia_g_logger, CalloutMsg) << "由于设置非响一声挂断, 未挂断本次呼叫请求, 等待超时挂断, 通道号码:" << channelID; return -1; } retVal = SsmHangup(channelID); if (retVal == -1){ show_error(); BOOST_LOG_SEV(cia_g_logger, Warning) << "挂机失败, 请在后续版本调查原因, 通道号码:" << channelID; } else{ BOOST_LOG_SEV(cia_g_logger, CalloutMsg) << "已挂断本次呼叫请求, 通道号码:" << channelID; } ciaMessage& msg_ = t->m_call_out_param->m_ch_msg->m_procbuffer_msg; std::string transid_ = msg_.transid(); msg_.Clear(); msg_.set_type(CIA_CALL_RESPONSE); msg_.set_transid(transid_); msg_.set_status(status); if (t->m_call_out_param == nullptr) { BOOST_LOG_SEV(cia_g_logger, Critical) << "严重异常: 挂机时发现客户端socket为空"; } else { LOG_MSG_QUEUE.put(boost::make_shared<LOG_MSG>(Debug, "呼叫返回数据:\n" + t->m_call_out_param->m_ch_msg->m_procbuffer_msg.DebugString())); t->m_call_out_param->m_base_client->do_write(t->m_call_out_param->m_ch_msg); } t->realseTrunk(); unique_lock_.unlock(); m_channel_queue.put(channelID); } return retVal; }
int voice_card_control::cti_hangUp(std::size_t channelID, std::string status) { int retVal = 0; boost::shared_ptr<trunk> t = m_trunk_vector.at(channelID); boost::unique_lock<boost::mutex> unique_lock_(t->m_trunk_mutex, boost::defer_lock); if (!unique_lock_.try_lock()) { BOOST_LOG_SEV(cia_g_logger, Warning) << "业务流水:" << t->m_transId << "cti_hangUp函数尝试锁定通道失败, 放弃挂机, 当前通道Step值为:" << t->m_step; return -1; } else { if (!t->m_hungup_by_echo_tone) { BOOST_LOG_SEV(cia_g_logger, CalloutMsg) << "业务流水:" << t->m_transId << " 由于设置非响一声挂断, 未挂断本次呼叫请求, 通道号码:" << channelID; return -1; } switch (t->m_step) { case TRK_IDLE: BOOST_LOG_SEV(cia_g_logger, Warning) << "业务流水:" << t->m_transId << " 依据当前通道状态判断可能出现重复挂机, 请在后续版本调查原因, 通道号码:" << channelID; return -1; case TRK_SLEEP: BOOST_LOG_SEV(cia_g_logger, Warning) << "业务流水:" << t->m_transId << " 当前通道正在延迟挂机, 通道号码:" << channelID; return -1; default: break; } retVal = SsmHangup(channelID); if (retVal == -1){ show_error(); BOOST_LOG_SEV(cia_g_logger, Warning) << "业务流水:" << t->m_transId << " 挂机失败, 请在后续版本调查原因, 通道号码:" << channelID; } else{ BOOST_LOG_SEV(cia_g_logger, CalloutMsg) << "业务流水:" << t->m_transId << " 已挂断本次呼叫请求, 通道号码:" << channelID; } ciaMessage msg; msg.set_type(CIA_CALL_RESPONSE); msg.set_transid(t->m_transId); msg.set_status(status); t->m_client_socket->do_write(chat_message(msg)); t->realseTrunk(); m_channel_queue.put(channelID); } return retVal; }
int ShChannel::HangUp(){ return SsmHangup(ch); }