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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
|
/*
* wrapper.hxx
*
* The header file for the OpenH323 Wrapper Library
*
* Copyright (c) 2002-2005 InAccess Networks
* Michalis Manousos <manousos@inaccessnetworks.com>
* Dimitris Economou <decon@inaccessnetworks.com>
*
* This file is part of "H.323 support for ASTERISK"
*
* "H.323 support for ASTERISK" is free software;
* you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*
* "H.323 support for ASTERISK" is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: wrapper.hxx,v 1.45.2.2 2005/01/14 15:33:22 manousos Exp $
*
*/
/************************************************************************/
#ifndef _WRAPPER_HXX
#define _WRAPPER_HXX
/************************************************************************/
/* TYPES & VARIABLES ****************************************************/
/* Different types of exceptions generated by the OpenH323 wrapper Library */
#define OH323EXC_NULL 0
#define OH323EXC_USER_INPUT_TONE 1
#define OH323EXC_USER_MESSAGE 2
#define OH323EXC_CALL_ALERTED 3
#define OH323EXC_CALL_TRANSFER 4
#define OH323EXC_CALL_ESTABLISHED 5
#define OH323EXC_CALL_CLEARED 6
#define OH323EXC_CTRL_ERROR 7
/* Gatekeeper check results */
#define OH323GK_FAILED (-1)
#define OH323GK_NOTUSED (-2)
#define OH323GK_NOTREGISTERED (-3)
/* Call end reason codes */
#define OH323END_LOCAL_USER 1
#define OH323END_NO_ACCEPT 2
#define OH323END_ANSWER_DENIED 3
#define OH323END_REMOTE_USER 4
#define OH323END_REFUSAL 5
#define OH323END_NO_ANSWER 6
#define OH323END_CALLER_ABORT 7
#define OH323END_TRANSPORT_FAIL 8
#define OH323END_CONNECT_FAIL 9
#define OH323END_GATEKEEPER 10
#define OH323END_NO_USER 11
#define OH323END_NO_BANDWIDTH 12
#define OH323END_CAPABILITY 13
#define OH323END_CALLFWD 14
#define OH323END_SECURITY 15
#define OH323END_LOCAL_BUSY 16
#define OH323END_LOCAL_CONGESTION 17
#define OH323END_REMOTE_BUSY 18
#define OH323END_REMOTE_CONGESTION 19
#define OH323END_UNREACHABLE 20
#define OH323END_NO_ENDPOINT 21
#define OH323END_HOST_OFFLINE 22
#define OH323END_TEMP_FAILURE 23
#define OH323END_Q931CAUSE 24
#define OH323END_DURATION_LIMIT 25
/* Requests for outgoing calls can define up to this number of
capabilities (codecs) to be negotiated */
#define WRAP_MAX_CAP_SET (20)
/* The boolean type */
typedef enum boolean {
YES,
NO
} boolean_t;
/* The codec capability enumerator */
typedef enum cap_type {
G711U = 1, /* G.711 u-Law */
G711A, /* G.711 A-Law */
G7231, /* G.723.1(6.3k) */
G72316K3, /* G.723.1(6.3k) */
G72315K3, /* G.723.1(5.3k) */
G7231A6K3, /* G.723.1A(6.3k) */
G7231A5K3, /* G.723.1A(5.3k) */
G726, /* G.726(32k) */
G72616K, /* G.726(16k) */
G72624K, /* G.726(24k) */
G72632K, /* G.726(32k) */
G72640K, /* G.726(40k) */
G728, /* G.728 */
G729, /* G.729 */
G729A, /* G.729A */
G729B, /* G.729B */
G729AB, /* G.729AB */
GSM0610, /* GSM 0610 */
MSGSM, /* Microsoft GSM Audio Capability */
LPC10, /* LPC-10 */
LINEAR16, /* 16 bit linear PCM */
SPEEXN8K, /* Speex Narrow (8k) */
CAP_UNDEFINED
} cap_type_t;
typedef enum cap_ret_val {
CAP_EP_ER,
CAP_NSUP_ER,
CAP_EXIST,
CAP_INSERT_OK,
CAP_REMOVE_OK,
CAP_REMOVEALL_OK
} cap_ret_val_t;
/* The user input mode enumarator */
typedef enum ui_mode {
UIMODE_Q931, /* Q.931 Keypad Information Element */
UIMODE_STRING, /* H.245 string */
UIMODE_TONE, /* H.245 tone */
UIMODE_RFC2833, /* RFC2833 */
UIMODE_UNDEFINED
} uimode_t;
typedef enum gk_mode {
GKMODE_DISABLE = 0,
GKMODE_DISCOVER,
GKMODE_NAME,
GKMODE_ID
} gkmode_t;
/* The listener enumarator
This enumerator could hold all the
possible types of interfaces (i.e. ATM) */
typedef enum lis_type {
TCP,
UDP,
LIS_UNDEFINED
} lis_type_t;
/* These are the return values for
the h323_start_listener and
the h323_remove_listener functions. */
typedef enum lis_ret_val {
LIS_EP_ER, /* End Point error */
LIS_NSUP_ER, /* Listener not supported */
LIS_EXIST, /* Listener already exist */
LIS_FAILOP_ER, /* Fail to establish listener */
LIS_START_OK, /* Listener is started succesfully */
LIS_REMOVE_OK, /* Listener is removed succesfully */
LIS_REMOVEALL_OK /* All listeners were removed succesfully */
} lis_ret_val_t;
/* This enum shows the direction of a logical channel. */
typedef enum lchan_dir {
NONE = 0,
PLAYER,
RECORDER,
BOTH
} lchan_dir_t;
/* The return values of the h323_{make/clear/answer/indicate}_call functions */
typedef enum call_ret_val {
CALL_EP_ER,
CALL_START_OK,
CALL_START_ER,
CALL_END_OK,
CALL_END_ER,
CALL_ANS_OK,
CALL_ANS_ER,
CALL_IND_OK,
CALL_IND_ER,
CALL_CHG_OK,
CALL_CHG_ER
} call_ret_val_t;
/* This enum contains the indications that can be send over a H.323 connection. */
typedef enum call_indication {
IND_RINGING,
IND_BUSY,
IND_CONGESTION
} indication_t;
/* The 'call_options' struct is filled by the
application and passed to the library to make the call */
typedef struct call_options {
char *cid;
char *cidname;
char *dnis;
int cap[WRAP_MAX_CAP_SET];
unsigned int connectPort;
} call_options_t;
/* The 'call_details' struct is filled by the library and passed to
the application through the various callback functions */
typedef struct call_details {
char call_token[256];
unsigned int call_reference;
char call_source_alias[256];
char call_dest_alias[256];
char call_source_e164[256];
char call_dest_e164[256];
char call_dnid[256];
char call_rdnis[256];
char remote_app[256];
int call_end_reason;
int call_duration;
char remote_addr[256];
char local_addr[256];
} call_details_t;
typedef struct rtp_stats {
long packets_sent;
long octets_sent;
long packets_recv;
long octets_recv;
long packets_lost;
long packets_late;
long packets_ooo;
long average_send_time;
long max_send_time;
long min_send_time;
long average_recv_time;
long max_recv_time;
long min_recv_time;
long average_jitter;
long max_jitter;
long current_jitter_size;
long with_rr;
long reported_fraction_lost;
long reported_total_lost;
long reported_sequence;
long reported_jitter;
} rtp_stats_t;
/* This is a callback prototype function, called when the Openh323
OnStartLogicalChannel is invoked. */
/*typedef char *(*start_logchan_cb)(call_details_t, lchan_dir_t, int, int, int *, char *, int);*/
typedef char *(*start_logchan_cb)(call_details_t, lchan_dir_t, int, int, int *);
/* This is the callback prototype function which has to be called when
the OpenH323 OnConnectionCleared callback is invoked */
typedef char *(*clear_con_cb)(call_details_t);
/* This is the callback prototype function which has to be
called when the OnAlerting callback is invoked */
typedef int (*alert_con_cb)(call_details_t);
/* This is the callback prototype function called when the Openh323
library has an exception pending. */
typedef int (*h323_exception_cb)(call_details_t, int, char *);
/* This is the callback prototype function called when the
OnAnswerCall callback is invoked. */
typedef int (*init_con_cb)(call_details_t);
/* This is the callback prototype function called when the
OnRTPStatistics callback is invoked. */
typedef int (*stats_con_cb)(call_details_t, rtp_stats_t);
/* This is the callback prototype functions called when the
H323Connection objects need data to send/have data ready. */
typedef int (*read_con_cb)(int id, char *buf, int len);
typedef int (*write_con_cb)(int id, char *buf, int len);
/************************************************************************/
/* Wrapper library API **************************************************/
/* XXX Needs to be documented... */
#ifdef cplusplus
extern "C" {
#endif
/* See "cap_type" above */
const int h323_codec_number = 22;
void h323_appinfo_set(char *, int, int, int);
void h323_end_point_create(char **, int, int, int, char *);
void h323_end_point_destroy(void);
boolean_t end_point_exist(void);
/* Set the callback functions */
int h323_callback_register(start_logchan_cb, clear_con_cb, alert_con_cb,
h323_exception_cb, init_con_cb, stats_con_cb);
/* H.323 codec and user-input capability related functions */
cap_ret_val_t h323_add_capability(cap_type_t, int);
cap_ret_val_t h323_set_capability(cap_type_t, int);
cap_ret_val_t h323_find_capability(cap_type_t);
cap_ret_val_t h323_removeall_capabilities(void);
cap_ret_val_t h323_set_senduimode(uimode_t);
/* H.323 options setup related functions */
int h323_set_options(int, int, int, int, int, int, int,
#ifdef HAS_OH323MODS
int, int,
#endif
int);
int h323_set_ports(unsigned, unsigned, unsigned, unsigned,
unsigned, unsigned);
/* H.323 listener related funcions */
lis_ret_val_t h323_start_listener(lis_type_t lis, char *, int);
lis_ret_val_t h323_remove_listener(lis_type_t lis);
lis_ret_val_t h323_removeall_listeners(void);
/* H.323 gatekeeper related funcions */
int h323_get_gk(char *, int);
int h323_set_gk(gkmode_t, char *, char *, int, char **, int);
int h323_reset_gk(gkmode_t, char *);
int h323_get_conn_info(const char *, char *, int);
unsigned h323_check_bandwidth(void);
/* Send a DTMF tone to remote endpoint */
void h323_send_tone(const char *call_token, char tone);
void h323_send_text(const char *call_token, char *text);
/* H.323 create, handle and destroy sessions */
call_ret_val_t h323_make_call(char *host, call_details_t *pcd,
call_options_t call_options);
call_ret_val_t h323_clear_call(const char *call_token);
call_ret_val_t h323_answer_call(const char *call_token);
call_ret_val_t h323_change_call(const char *call_token, const char *new_mode);
call_ret_val_t h323_indicate_call(const char *call_token, indication_t type);
/* Get the status of a call */
int h323_is_call_connected(const char *call_token);
int h323_get_reason_code(int reason);
char *h323_get_reason_desc(int reason);
#ifdef cplusplus
}
#endif
#endif /* _WRAPPER_HXX */
/* End of file *************************************************************/
|