📄 cnfdemoprm.h
字号:
/**********@@@SOFT@@@WARE@@@COPY@@@RIGHT@@@**********************************
* DIALOGIC CONFIDENTIAL
*
* Copyright (C) 2006-2007 Dialogic Corporation. All Rights Reserved.
* The source code contained or described herein and all documents related
* to the source code ("Material") are owned by Dialogic Corporation or its
* suppliers or licensors. Title to the Material remains with Dialogic Corporation
* or its suppliers and licensors. The Material contains trade secrets and
* proprietary and confidential information of Dialogic or its suppliers and
* licensors. The Material is protected by worldwide copyright and trade secret
* laws and treaty provisions. No part of the Material may be used, copied,
* reproduced, modified, published, uploaded, posted, transmitted, distributed,
* or disclosed in any way without Dialogic's prior express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by Dialogic in writing.
*
***********************************@@@SOFT@@@WARE@@@COPY@@@RIGHT@@@**********/
//***********************************************************************
//***********************************************************************
// CnfDemoParams.h: interface for the CnfDemoPrm class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CNFDEMOPRM_H__E5E3A839_DBD7_4192_A383_AE92E822028B__INCLUDED_)
#define AFX_CNFDEMOPRM_H__E5E3A839_DBD7_4192_A383_AE92E822028B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ConfigFile.h"
#include "GenLog.h"
#define DFLT_LOG_FILE_NAME "CnfDemo.log"
#define DFLT_WELLCOME_FILE_NAME "welcome.pcm"
#define DFLT_BAD_PASSCODE_FILE_NAME "invalid.pcm"
#define DFLT_GOODBYE_FILE_NAME "bye.pcm"
#define DFLT_CALL_LATER_FILE_NAME "bye.pcm"
// Some conversions ( code to symbolic name )
const char * ip_digit_type_name(int code);
const char * ip_coder_name(int code);
const char * ip_vad_name(int code);
const char * ip_framesize_name(int code);
const char * ip_payload_name(int code);
//
// Cnf parameter class represents one section [Conference] in configuration file
// and holds it's parameters
//
typedef class CnfParams * PCnfParams;
class CnfParams {
public:
//--------
CnfParams(){
Init();
};
//---------------------
// copy constructor
CnfParams(CnfParams &src){
cnf_id = src.cnf_id;
pass_code = 0;
str_storestring(&pass_code, src.pass_code);
detect_digits = src.detect_digits;
voice_party = src.voice_party;
beep_notify = src.beep_notify;
private_log = src.private_log;
dtmf_clamping = src.dtmf_clamping;
tmo = src.tmo;
};
// Init members
void Init(){
cnf_id = -1;
pass_code = 0;
tmo = 0;
detect_digits = false;
dtmf_clamping = false;
voice_party = false;
private_log = LOG_NONE;
beep_notify = false;
}
// Destructor
virtual ~CnfParams(){
str_deletestoredstring(&pass_code);
};
// Compare
int operator == (CnfParams &obj) {
if (this == &obj){
return 1;
}
return COMPARE_EQUAL == str_compare(pass_code, obj.pass_code);
}
int operator > (CnfParams &obj) {
if (this == &obj){
return 0;
}
return str_compare(pass_code, obj.pass_code);
}
int operator < (CnfParams &obj) {
if (this == &obj){
return false;
}
return str_compare(obj.pass_code, pass_code);
}
// Dump internal variavles
void Dump(CGenLog *pLog){
static const char *obj_name = "CnfParams";
pLog->Log(LOG_API, obj_name,
" id = %4d", cnf_id );
pLog->Log(LOG_API, obj_name,
" dtmf_clamping = %s", YESNO(dtmf_clamping));
pLog->Log(LOG_API, obj_name,
" digits = %s", YESNO(detect_digits));
pLog->Log(LOG_API, obj_name,
" pass_code = %s",pass_code);
pLog->Log(LOG_API, obj_name,
" voice party = %s", YESNO(voice_party));
#ifdef _FR2619
pLog->Log(LOG_API, obj_name,
" beep_notify = %s", YESNO(beep_notify));
#endif
pLog->Log(LOG_API, obj_name,
" tmo = %d", tmo);
return;
}
int cnf_id;
char *pass_code;
bool detect_digits;
bool dtmf_clamping;
bool voice_party;
bool beep_notify;
MSG_TYPE private_log;
int tmo;
}; // class CnfParams
//--------------------------------------------------------------
// CnfPrmContainer is a collection of CnfParams objects
//---------------------------------------------------------------
typedef class CnfPrmContainer * PCnfPrmContainer;
class CnfPrmContainer : public list <PCnfParams> {
public:
CnfPrmContainer() {};
virtual ~CnfPrmContainer() {};
// find by pass code
bool find (const char *pass_code, PCnfParams *ppCnfParams = 0){
list<PCnfParams>::iterator pos;
for ( pos = begin(); pos != end(); ++pos) {
if (COMPARE_EQUAL == str_compare(pass_code, (*pos)->pass_code) ){
if (ppCnfParams){
*ppCnfParams = *pos;
}
return true;
}
}
if ( ppCnfParams){
*ppCnfParams = 0;
}
return false;
};
// How many conferences are defined
size_t GetNumberOfConferences(){
return size();
}
// How many dx devices are requested
size_t GetNumberOfDxDevices(){
size_t total = 0;
list<PCnfParams>::iterator pos;
PCnfParams pCnfParams;
for ( pos = begin(); pos != end(); ++pos) {
pCnfParams = *pos;
if (pCnfParams->voice_party){
++total;
}
} // for
return total;
}
// retrieve conference parameter by sequential index
bool GetConferencePrm (unsigned int inx, PCnfParams *ppCnfParams){
if (inx < size() ){
list<PCnfParams>::iterator pos = begin();
unsigned int tmp = 0;
while(tmp++ < inx){
++pos;
}
*ppCnfParams = *pos;
return true;
}
return false;
};
};// class CnfPrmContainer
//
// Ipt parameter class represents one section [IPT] in configuration file
// and holds it's parameters
//
typedef class CIptParams * PIptParams;
class CIptParams {
public:
//--------
CIptParams(){
Init();
};
//---------------------
// copy constructor
CIptParams(CIptParams &src){
ipt_id = src.ipt_id;
m_number_of_channels = src.m_number_of_channels;
m_accept_call = src.m_accept_call;
m_private_log = src.m_private_log;
ip_protocol = 0;
str_storestring(&ip_protocol,src.ip_protocol);
ip_digits = src.ip_digits;
ip_coder = src.ip_coder;
ip_frame_size = src.ip_frame_size;
ip_vad = src.ip_vad;
ip_payoad_type = src.ip_payoad_type;
};
// Init members
void Init(){
ipt_id = -1; // not used yet
m_number_of_channels = 0;
m_private_log = LOG_NONE;
ip_protocol = 0;
m_accept_call = true;
str_storestring(&ip_protocol, "SIP");
ip_digits = IP_DTMF_TYPE_INBAND_RTP;
ip_coder = CODER_TYPE_G711ALAW64K;
ip_frame_size = CODER_FRAMESIZE_30;
ip_vad = CODER_VAD_DISABLE;
ip_payoad_type = IP_USE_STANDARD_PAYLOADTYPE;
};
// Destructor
virtual ~CIptParams(){
str_deletestoredstring(&ip_protocol);
};
// Dump internal variavles
void Dump(CGenLog *pLog){
const char *name;
static const char *obj_name = "CIptParams";
pLog->Log(LOG_API, obj_name,
" [IPT %d]", ipt_id );
pLog->Log(LOG_API, obj_name,
" ipt_id = %d", ipt_id );
pLog->Log(LOG_API, obj_name,
" m_number_of_channels = %d", m_number_of_channels );
pLog->Log(LOG_API, obj_name,
" m_accept_call = %s", YESNO(m_accept_call ) ) ;
name = log_get_msgtype_name(m_private_log);
pLog->Log(LOG_API, obj_name,
" m_private_log = %d %s", m_private_log, name);
pLog->Log(LOG_API, obj_name,
" ip_protocol = %s", ip_protocol);
name = ip_digit_type_name(ip_digits);
pLog->Log(LOG_API, obj_name,
" ip_digits = %d %s", ip_digits, name);
name = ip_coder_name(ip_coder);
pLog->Log(LOG_API, obj_name,
" ip_coder = %d %s", ip_coder, name);
name = ip_framesize_name(ip_frame_size);
pLog->Log(LOG_API, obj_name,
" ip_frame_size = %d %s", ip_frame_size, name);
name = ip_vad_name(ip_vad);
pLog->Log(LOG_API, obj_name,
" ip_vad = %d %s", ip_vad, name);
name = ip_payload_name(ip_payoad_type);
pLog->Log(LOG_API, obj_name,
" ip_payoad_type = %d %s", ip_payoad_type, name);
return;
}
unsigned int m_number_of_channels; // number of timeslots to use with this configuration
bool m_accept_call; // do accept call?
MSG_TYPE m_private_log; // private log verbosity level (LOG_NONE to skip)
char *ip_protocol; // "SIP", "H323"
int ip_digits; // "INBAND", "RFC2833"
eIPM_CODER_TYPE ip_coder; // CODER_TYPE_G711ALAW64K, ...
eIPM_CODER_FRAMESIZE ip_frame_size; // CODER_FRAMESIZE_30,..
eIPM_CODER_VAD ip_vad; // use CODER_VAD_DISABLE
unsigned int ip_payoad_type; // use IP_USE_STANDARD_PAYLOADTYPE
int ipt_id; // unique ud
}; // class CIptParams
const char * get_call_control_mode_name(enumIPCCLIBMediaMode mode);
enumIPCCLIBMediaMode get_call_control_value(const char *name);
typedef enum {
RESERVE_RESOURCE_NONE,
RESERVE_RESOURCE,
RESERVE_RESOURCE_EX
}RESERVE_RESOURCE_TYPE;
RESERVE_RESOURCE_TYPE get_reserve_resource_value(const char *name);
const char *get_reserve_resource_name(RESERVE_RESOURCE_TYPE mode);
//
// Global parameters
//
typedef class CommonParams * PCommonParams;
class CommonParams {
public:
//--------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -