ims_conf.h
4.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* CC/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __IMS_CONF_H_
#define __IMS_CONF_H_
#include "ims_core.h"
#include <list>
/**
* @brief 服务类型
*
*/
enum ims_conf_service_type_t {
ICST_MAIN, ///< 主服务
ICST_MONITOR, ///< 监控服务
ICST_CONFIG ///< 配置服务
};
/**
* @brief 服务通用配置参数
*
*/
enum ims_conf_param_type_t {
ICPT_MAXSESSION, ///< 最大session数
ICPT_BGCCPOOLSIZE ///< bgcc线程池大小
};
/**
* @brief 支持的客户端类型
*
*/
enum ims_conf_client_type_t {
ICCT_IVR, ///< IVR
ICCT_CONFIG, ///< 配置
ICCT_ACD, ///< ACD
ICCT_MONITOR ///< 监控
};
/**
* @brief 主服务配置信息
*
*/
typedef struct ims_conf_server {
ims_conf_server(uint32_t ip_, uint32_t port_): ip(ip_), port(port_) {}
uint32_t ip;
uint32_t port;
} ims_conf_server_t;
/**
* @brief 授权配置信息
*
*/
typedef struct ims_conf_acl_node {
ims_conf_acl_node(uint32_t ip_, uint32_t mask_, uint32_t bit_):
ip(ip_), mask(mask_), bit(bit_) {}
uint32_t ip;
uint32_t mask;
uint32_t bit;
} ims_conf_acl_node_t;
typedef struct ims_conf_log {
uint32_t level;
uint32_t size;
char path[LEN_256 + 1];
ims_conf_log() {
level = 0;
size = 0;
path[0] = '\0';
path[LEN_256] = '\0';
}
} ims_conf_log_t;
/**
* @brief gateway 支持的DTMF类型
*
*/
enum dtmf_type_t {
DTMF_INBAND, ///< 带内
DTMF_OTHER ///< 带外
};
/**
* @brief Gateway配置信息
*
*/
typedef struct ims_conf_gw_node {
uint32_t id; /**< no */
uint32_t ip; /**< ip */
uint32_t port; /**< port */
uint32_t max_conn;
char user[LEN_64 + 1]; /**< auth user*/
char pswd[LEN_64 + 1];
dtmf_type_t dtmf;
ims_conf_gw_node(): id(0), ip(0), port(0), max_conn(0) {
user[0] = '\0';
pswd[0] = '\0';
user[LEN_64] = '\0';
pswd[LEN_64] = '\0';
dtmf = DTMF_OTHER;
}
} ims_conf_gw_node_t;
/**
* @brief 路由类型
*
*/
enum ims_conf_route_type_t {
ICRT_OUTBOUND, ///< 外乎路由
ICRT_INBOUND ///< 呼入路由
};
/**
* @brief 路由配置信息
*
*/
typedef struct ims_conf_route_node {
char name[LEN_64 + 1]; ///< 名称
ims_conf_route_type_t type; ///< 类型
char field[LEN_64 + 1]; ///< 识别字段
char expression[LEN_128 + 1]; ///< 识别的表达式
char rule_disp_caller[LEN_64 + 1]; ///< 外乎显示主叫
char rule_call_caller[LEN_64 + 1]; ///< 真实主叫
char rule_call_called[LEN_64 + 1]; ///< 真实被叫
ims_conf_route_node() {
name[0] = '\0';
field[0] = '\0';
expression[0] = '\0';
rule_disp_caller[0] = '\0';
rule_call_caller[0] = '\0';
rule_call_called[0] = '\0';
name[LEN_64] = '\0';
field[LEN_64] = '\0';
expression[LEN_128] = '\0';
rule_disp_caller[LEN_64] = '\0';
rule_call_caller[LEN_64] = '\0';
rule_call_called[LEN_64] = '\0';
}
} ims_conf_route_node_t;
/**
* @brief 整体配置信息
*
*/
struct ims_conf {
std::map<ims_conf_service_type_t, ims_conf_server_t* > service; ///< 支持的服务
std::map<ims_conf_param_type_t, const char*> param; ///< 全局配置参数
std::map<ims_conf_client_type_t, std::list<ims_conf_acl_node_t*> > clients; ///< 支持的客户端
ims_conf_log log; ///< 通用配置信息
bool gw_log; ///< 是否打印gateway日志
std::list<ims_conf_gw_node_t*> gateway; ///< gateway列表
std::list<ims_conf_route_node_t*> route; ///< 路由规则列表
ims_conf() {
gw_log = false;
}
~ims_conf() {
}
/**
* @brief 获取指定FW的DTMF类型
*
* @param [in/out] fsno : uint32_t
* @param [in/out] type : dtmf_type_t&
* @return void
* @retval
* @see
* @note
* @author chenyuzhen
* @date 2013/01/09 17:58:20
**/
void get_gwdtmftype(uint32_t fsno, dtmf_type_t& type);
};
typedef struct ims_conf ims_conf_t;
#endif //__IMS_CONF_H_
/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */