⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callrouting.cpp

📁 Avaya AES Tsapi接口开发的 CallRouting 代码
💻 CPP
字号:
// CallRouting.cpp : Defines the class behaviors for the application.
//
// This file was generated automatically and has not been modified for
//  implementing this app except for this comment.
//
// For non-MFC folks: this file handles application initialization and
//  displays the application's main window (which is a dialog in this app)

#include "stdafx.h"
#include "CallRouting.h"
#include "CallRoutingDlg.h"
#include "global.h"
#include "utilities.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCallRoutingApp

static TCHAR BASED_CODE vdnIniFileSection[] = _T("VDN INFORMATION"); 
static TCHAR BASED_CODE othersIniFileSection[] = _T("OTHERS");
static TCHAR BASED_CODE rulesIniFileSection[] = _T("ROUTING SERVER RULES");

BEGIN_MESSAGE_MAP(CCallRoutingApp, CWinApp)
	//{{AFX_MSG_MAP(CCallRoutingApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCallRoutingApp construction

CCallRoutingApp::CCallRoutingApp()
{
	// Place all significant initialization in InitInstance

	
	
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CCallRoutingApp object

CCallRoutingApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CCallRoutingApp initialization

BOOL CCallRoutingApp::InitInstance()
{

	static char func[]="CCallRoutingApp::InitInstance";
//TODO: call AfxInitRichEdit2() to initialize richedit2 library.
	// Standard initialization

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	
	// InitCommonControls() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	InitCommonControls();

	CWinApp::InitInstance();

	m_pApp = AfxGetApp();
	//First free the string allocated by MFC at CWinApp startup.
	//The string is allocated before InitInstance is called.
	free((void*)m_pszProfileName);

	m_pszProfileName=_tcsdup(_T(".\\CallRouting.ini"));


	CString ruleStr  = GetRuleFromIniFile();
	
	char ruleBuff[500];
	memset(ruleBuff,0,sizeof(ruleBuff));

	strcpy_s(ruleBuff,ruleStr);
	char *next_token;

	for(char * str = strtok_s(ruleBuff,",", &next_token); str != NULL; str = strtok_s(NULL,",",&next_token)) {
		CRule r(str);
		rules.push_back(r);
	}

	g_defaultRoute = GetDefaultRouteFromIniFile();
	g_collectedDigits =  GetCollectedDigitsFromIniFile();
	g_vdn =  GetVDNsFromIniFile();
	g_appendString =  GetAppendStringIniFile();
	DebugLevel = GetDebugLevelFromIniFile();
	CString str = GetCallRoutingType();

	if(str == "network") {
		g_callRoutingType = network;
	} else {
		g_callRoutingType = vdn;
	}


	CallRoutingDlg dlg;
	m_pMainWnd = &dlg;
	// dlg.ShowWindow(SW_HIDE);
	INT_PTR nResponse = dlg.DoModal();
	
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
		DBG1_OUT( func, "dismissed with OK" );
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
        DBG1_OUT( func, "dismissed with Cancel" );
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}

int CCallRoutingApp::GetCollectedDigitsFromIniFile() 
{
	return atoi(m_pApp->GetProfileString(vdnIniFileSection, "CollectedDigits", "4")); 
	
}
CString CCallRoutingApp::GetVDNsFromIniFile() 
{
	return m_pApp->GetProfileString(vdnIniFileSection, "VDN",""); 
	
}
CString CCallRoutingApp::GetAppendStringIniFile() 
{
	return m_pApp->GetProfileString(othersIniFileSection, "AppendString", ""); 
	
}

CString CCallRoutingApp::GetRuleFromIniFile()
{
    return m_pApp->GetProfileString(rulesIniFileSection, "RULE", ""); 
}


int  CCallRoutingApp::GetDefaultRouteFromIniFile()
{
    return atoi(m_pApp->GetProfileString(rulesIniFileSection, "DefaultRoute", "")); 
}

int  CCallRoutingApp::GetDebugLevelFromIniFile()
{
    return atoi(m_pApp->GetProfileString(othersIniFileSection, "DebugLevel", "1")); 
}

CString CCallRoutingApp::GetCallRoutingType() 
{
	return m_pApp->GetProfileString(rulesIniFileSection, "CallRoutingType", "vdn");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -