Freetdm: moved some defines from ftmod_sangoma_isdn.h to ftmod_sangoma_isdn_user.h
This commit is contained in:
parent
f0d1578592
commit
9d021b8dc4
|
@ -47,11 +47,12 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "private/ftdm_core.h"
|
#include "private/ftdm_core.h"
|
||||||
|
#include "ftmod_sangoma_isdn_user.h"
|
||||||
|
|
||||||
#include <sng_isdn.h>
|
#include <sng_isdn.h>
|
||||||
|
|
||||||
/* Theoretical limit for MAX_SPANS_PER_NFAS_LINK is 31,
|
/* Theoretical limit for MAX_SPANS_PER_NFAS_LINK is 31,
|
||||||
but set to 8 for now to save some memor */
|
but set to 8 for now to save some memory */
|
||||||
|
|
||||||
#define MAX_SPANS_PER_NFAS_LINK 8
|
#define MAX_SPANS_PER_NFAS_LINK 8
|
||||||
#define NUM_E1_CHANNELS_PER_SPAN 32
|
#define NUM_E1_CHANNELS_PER_SPAN 32
|
||||||
|
@ -64,31 +65,6 @@
|
||||||
|
|
||||||
/* TODO: rename all *_cc_* to *_an_* */
|
/* TODO: rename all *_cc_* to *_an_* */
|
||||||
|
|
||||||
#define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL };
|
|
||||||
#define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type);
|
|
||||||
#define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \
|
|
||||||
_TYPE _FUNC1 (const char *name) \
|
|
||||||
{ \
|
|
||||||
int i; \
|
|
||||||
_TYPE t = _MAX ; \
|
|
||||||
\
|
|
||||||
for (i = 0; i < _MAX ; i++) { \
|
|
||||||
if (!strcasecmp(name, _STRINGS[i])) { \
|
|
||||||
t = (_TYPE) i; \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
return t; \
|
|
||||||
} \
|
|
||||||
const char * _FUNC2 (_TYPE type) \
|
|
||||||
{ \
|
|
||||||
if (type > _MAX) { \
|
|
||||||
type = _MAX; \
|
|
||||||
} \
|
|
||||||
return _STRINGS[(int)type]; \
|
|
||||||
} \
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -163,45 +139,7 @@ typedef enum {
|
||||||
SNGISDN_EVENT_RST_IND,
|
SNGISDN_EVENT_RST_IND,
|
||||||
} ftdm_sngisdn_event_id_t;
|
} ftdm_sngisdn_event_id_t;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
/* Call is not end-to-end ISDN */
|
|
||||||
SNGISDN_PROGIND_DESCR_NETE_ISDN,
|
|
||||||
/* Destination address is non-ISDN */
|
|
||||||
SNGISDN_PROGIND_DESCR_DEST_NISDN,
|
|
||||||
/* Origination address is non-ISDN */
|
|
||||||
SNGISDN_PROGIND_DESCR_ORIG_NISDN,
|
|
||||||
/* Call has returned to the ISDN */
|
|
||||||
SNGISDN_PROGIND_DESCR_RET_ISDN,
|
|
||||||
/* Interworking as occured and has resulted in a telecommunication service change */
|
|
||||||
SNGISDN_PROGIND_DESCR_SERV_CHANGE,
|
|
||||||
/* In-band information or an appropriate pattern is now available */
|
|
||||||
SNGISDN_PROGIND_DESCR_IB_AVAIL,
|
|
||||||
/* Invalid */
|
|
||||||
SNGISDN_PROGIND_DESCR_INVALID,
|
|
||||||
} ftdm_sngisdn_progind_descr_t;
|
|
||||||
#define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid"
|
|
||||||
SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t);
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
/* User */
|
|
||||||
SNGISDN_PROGIND_LOC_USER,
|
|
||||||
/* Private network serving the local user */
|
|
||||||
SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR,
|
|
||||||
/* Public network serving the local user */
|
|
||||||
SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR,
|
|
||||||
/* Transit network */
|
|
||||||
SNGISDN_PROGIND_LOC_TRANSIT_NET,
|
|
||||||
/* Public network serving remote user */
|
|
||||||
SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR,
|
|
||||||
/* Private network serving remote user */
|
|
||||||
SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR,
|
|
||||||
/* Network beyond the interworking point */
|
|
||||||
SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW,
|
|
||||||
/* Invalid */
|
|
||||||
SNGISDN_PROGIND_LOC_INVALID,
|
|
||||||
} ftdm_sngisdn_progind_loc_t;
|
|
||||||
#define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid"
|
|
||||||
SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t);
|
|
||||||
|
|
||||||
typedef struct ftdm_sngisdn_prog_ind {
|
typedef struct ftdm_sngisdn_prog_ind {
|
||||||
ftdm_sngisdn_progind_loc_t loc; /* location */
|
ftdm_sngisdn_progind_loc_t loc; /* location */
|
||||||
|
@ -499,3 +437,15 @@ void sngisdn_print_span(ftdm_stream_handle_t *stream, ftdm_span_t *span);
|
||||||
|
|
||||||
#endif /* __FTMOD_SNG_ISDN_H__ */
|
#endif /* __FTMOD_SNG_ISDN_H__ */
|
||||||
|
|
||||||
|
/* For Emacs:
|
||||||
|
* Local Variables:
|
||||||
|
* mode:c
|
||||||
|
* indent-tabs-mode:t
|
||||||
|
* tab-width:4
|
||||||
|
* c-basic-offset:4
|
||||||
|
* End:
|
||||||
|
* For VIM:
|
||||||
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
|
@ -280,7 +280,9 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
|
||||||
ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability);
|
ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability);
|
||||||
} else if (!strcasecmp(var, "outbound-bearer_layer1")) {
|
} else if (!strcasecmp(var, "outbound-bearer_layer1")) {
|
||||||
ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1);
|
ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1);
|
||||||
} else if (!strcasecmp(var, "local-number")) {
|
} else if (!strcasecmp(var, "channel-restart-on-link-up")) {
|
||||||
|
parse_yesno(var, val, &signal_data->restart_opt);
|
||||||
|
} else if (!strcasecmp(var, "local-number")) {
|
||||||
if (add_local_number(val, span) != FTDM_SUCCESS) {
|
if (add_local_number(val, span) != FTDM_SUCCESS) {
|
||||||
return FTDM_FAIL;
|
return FTDM_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010, Sangoma Technologies
|
||||||
|
* David Yat Sin <davidy@sangoma.com>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* * Neither the name of the original author; nor the names of any contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#ifndef __FTMOD_SANGOMA_ISDN_USER_H__
|
||||||
|
#define __FTMOD_SANGOMA_ISDN_USER_H__
|
||||||
|
|
||||||
|
|
||||||
|
#define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL };
|
||||||
|
#define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type);
|
||||||
|
#define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \
|
||||||
|
_TYPE _FUNC1 (const char *name) \
|
||||||
|
{ \
|
||||||
|
int i; \
|
||||||
|
_TYPE t = _MAX ; \
|
||||||
|
\
|
||||||
|
for (i = 0; i < _MAX ; i++) { \
|
||||||
|
if (!strcasecmp(name, _STRINGS[i])) { \
|
||||||
|
t = (_TYPE) i; \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
return t; \
|
||||||
|
} \
|
||||||
|
const char * _FUNC2 (_TYPE type) \
|
||||||
|
{ \
|
||||||
|
if (type > _MAX) { \
|
||||||
|
type = _MAX; \
|
||||||
|
} \
|
||||||
|
return _STRINGS[(int)type]; \
|
||||||
|
} \
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* Call is not end-to-end ISDN */
|
||||||
|
SNGISDN_PROGIND_DESCR_NETE_ISDN,
|
||||||
|
/* Destination address is non-ISDN */
|
||||||
|
SNGISDN_PROGIND_DESCR_DEST_NISDN,
|
||||||
|
/* Origination address is non-ISDN */
|
||||||
|
SNGISDN_PROGIND_DESCR_ORIG_NISDN,
|
||||||
|
/* Call has returned to the ISDN */
|
||||||
|
SNGISDN_PROGIND_DESCR_RET_ISDN,
|
||||||
|
/* Interworking as occured and has resulted in a telecommunication service change */
|
||||||
|
SNGISDN_PROGIND_DESCR_SERV_CHANGE,
|
||||||
|
/* In-band information or an appropriate pattern is now available */
|
||||||
|
SNGISDN_PROGIND_DESCR_IB_AVAIL,
|
||||||
|
/* Invalid */
|
||||||
|
SNGISDN_PROGIND_DESCR_INVALID,
|
||||||
|
} ftdm_sngisdn_progind_descr_t;
|
||||||
|
#define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid"
|
||||||
|
SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t);
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* User */
|
||||||
|
SNGISDN_PROGIND_LOC_USER,
|
||||||
|
/* Private network serving the local user */
|
||||||
|
SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR,
|
||||||
|
/* Public network serving the local user */
|
||||||
|
SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR,
|
||||||
|
/* Transit network */
|
||||||
|
SNGISDN_PROGIND_LOC_TRANSIT_NET,
|
||||||
|
/* Public network serving remote user */
|
||||||
|
SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR,
|
||||||
|
/* Private network serving remote user */
|
||||||
|
SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR,
|
||||||
|
/* Network beyond the interworking point */
|
||||||
|
SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW,
|
||||||
|
/* Invalid */
|
||||||
|
SNGISDN_PROGIND_LOC_INVALID,
|
||||||
|
} ftdm_sngisdn_progind_loc_t;
|
||||||
|
#define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid"
|
||||||
|
SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __FTMOD_SANGOMA_ISDN_USER_H__*/
|
||||||
|
|
||||||
|
/* For Emacs:
|
||||||
|
* Local Variables:
|
||||||
|
* mode:c
|
||||||
|
* indent-tabs-mode:t
|
||||||
|
* tab-width:4
|
||||||
|
* c-basic-offset:4
|
||||||
|
* End:
|
||||||
|
* For VIM:
|
||||||
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************/
|
Loading…
Reference in New Issue