Disable:
--without-misdn
Enable:
--with-misdn
Otherwise it will be enable automatically, if mISDN user is installed.
14 files changed:
-DLOG_DIR="\"$(LOGdir)\"" \
-DEXTENSION_DATA="\"$(EXTENSIONdir)\""
-DLOG_DIR="\"$(LOGdir)\"" \
-DEXTENSION_DATA="\"$(EXTENSIONdir)\""
+if ENABLE_MISDN
+
+MISDN_INCLUDE = -DWITH_MISDN -DWITH_CRYPT
+MISDN_SOURCE = mISDN.cpp dss1.cpp loop.c crypt.cpp remote.cpp joinremote.cpp
+MISDN_LIB = -lmisdn
+
+endif
+
GSM_INCLUDE =
GSM_SOURCE =
GSM_LIB =
GSM_INCLUDE =
GSM_SOURCE =
GSM_LIB =
$(INSTALL) chan_lcr.so $(astmoddir)
endif
$(INSTALL) chan_lcr.so $(astmoddir)
endif
-INCLUDES = $(all_includes) $(GSM_INCLUDE) $(SS5_INCLUDE) $(SIP_INCLUDE) -Wall $(INSTALLATION_DEFINES)
+INCLUDES = $(all_includes) $(MISDN_INCLUDE) $(GSM_INCLUDE) $(SS5_INCLUDE) $(SIP_INCLUDE) -Wall $(INSTALLATION_DEFINES)
lcr_SOURCES = \
main.c select.c trace.c options.c tones.c alawulaw.c cause.c interface.c message.c callerid.c socket_server.c \
lcr_SOURCES = \
main.c select.c trace.c options.c tones.c alawulaw.c cause.c interface.c message.c callerid.c socket_server.c \
- port.cpp vbox.cpp mISDN.cpp dss1.cpp loop.c remote.cpp \
- $(GSM_SOURCE) $(SS5_SOURCE) $(SIP_SOURCE) \
+ port.cpp vbox.cpp \
+ $(MISDN_SOURCE) $(GSM_SOURCE) $(SS5_SOURCE) $(SIP_SOURCE) \
endpoint.cpp endpointapp.cpp \
endpoint.cpp endpointapp.cpp \
- appbridge.cpp apppbx.cpp route.c action.cpp action_efi.cpp action_vbox.cpp extension.c crypt.cpp mail.c \
- join.cpp joinpbx.cpp joinremote.cpp
+ appbridge.cpp apppbx.cpp route.c action.cpp action_efi.cpp action_vbox.cpp extension.c mail.c \
+ join.cpp joinpbx.cpp
-lcr_LDADD = $(LIBCRYPTO) -lmisdn -lpthread $(GSM_LIB) $(SIP_LIB)
+lcr_LDADD = $(LIBCRYPTO) $(MISDN_LIB) -lpthread $(GSM_LIB) $(SIP_LIB)
lcradmin_SOURCES = lcradmin.c cause.c options.c
lcradmin_SOURCES = lcradmin.c cause.c options.c
int EndpointAppPBX::_action_init_call(char *remote)
{
class Join *join;
int EndpointAppPBX::_action_init_call(char *remote)
{
class Join *join;
- struct port_list *portlist = ea_endpoint->ep_portlist;
- struct admin_list *admin;
/* a created call, this should never happen */
if (ea_endpoint->ep_join_id) {
/* a created call, this should never happen */
if (ea_endpoint->ep_join_id) {
/* create join */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d): Creating new join instance.\n", ea_endpoint->ep_serial);
/* create join */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d): Creating new join instance.\n", ea_endpoint->ep_serial);
+ struct port_list *portlist = ea_endpoint->ep_portlist;
+ struct admin_list *admin;
+
admin = admin_first;
while(admin) {
if (admin->remote_name[0] && !strcmp(admin->remote_name, remote))
admin = admin_first;
while(admin) {
if (admin->remote_name[0] && !strcmp(admin->remote_name, remote))
return(0);
}
join = new JoinRemote(ea_endpoint->ep_serial, remote, admin->sock);
return(0);
}
join = new JoinRemote(ea_endpoint->ep_serial, remote, admin->sock);
join = new JoinPBX(ea_endpoint);
if (!join)
FATAL("No memoy for Join instance.\n");
join = new JoinPBX(ea_endpoint);
if (!join)
FATAL("No memoy for Join instance.\n");
{
class EndpointAppPBX **apppointer;
{
class EndpointAppPBX **apppointer;
memset(&e_crypt_handler, 0, sizeof(e_crypt_handler));
add_timer(&e_crypt_handler, crypt_handler, this, 0);
memset(&e_crypt_handler, 0, sizeof(e_crypt_handler));
add_timer(&e_crypt_handler, crypt_handler, this, 0);
memset(&e_vbox_refresh, 0, sizeof(e_vbox_refresh));
add_timer(&e_vbox_refresh, vbox_refresh, this, 0);
memset(&e_action_timeout, 0, sizeof(e_action_timeout));
memset(&e_vbox_refresh, 0, sizeof(e_vbox_refresh));
add_timer(&e_vbox_refresh, vbox_refresh, this, 0);
memset(&e_action_timeout, 0, sizeof(e_action_timeout));
e_multipoint_cause = 0;
e_multipoint_location = 0;
e_dialing_queue[0] = '\0';
e_multipoint_cause = 0;
e_multipoint_location = 0;
e_dialing_queue[0] = '\0';
e_crypt = CRYPT_OFF;
e_crypt_state = CM_ST_NULL;
e_crypt_keyengine_busy = 0;
e_crypt = CRYPT_OFF;
e_crypt_state = CM_ST_NULL;
e_crypt_keyengine_busy = 0;
- e_crypt_info[0] = '\0';
+ e_crypt_info[0] = '\0';
+#endif
e_overlap = 0;
e_vbox[0] = '\0';
e_tx_state = NOTIFY_STATE_ACTIVE;
e_overlap = 0;
e_vbox[0] = '\0';
e_tx_state = NOTIFY_STATE_ACTIVE;
{
class EndpointAppPBX *temp, **tempp;
{
class EndpointAppPBX *temp, **tempp;
del_timer(&e_crypt_handler);
del_timer(&e_crypt_handler);
del_timer(&e_vbox_refresh);
del_timer(&e_action_timeout);
del_timer(&e_match_timeout);
del_timer(&e_vbox_refresh);
del_timer(&e_action_timeout);
del_timer(&e_match_timeout);
e_multipoint_cause = 0;
e_multipoint_location = 0;
e_dialing_queue[0] = '\0';
e_multipoint_cause = 0;
e_multipoint_location = 0;
e_dialing_queue[0] = '\0';
e_crypt = 0;
e_crypt_state = CM_ST_NULL;
e_crypt_keyengine_busy = 0;
e_crypt_info[0] = '\0';
e_crypt = 0;
e_crypt_state = CM_ST_NULL;
e_crypt_keyengine_busy = 0;
e_crypt_info[0] = '\0';
e_tone[0] = '\0';
e_overlap = 0;
e_vbox[0] = '\0';
e_tone[0] = '\0';
e_overlap = 0;
e_vbox[0] = '\0';
/* crypt shared */
case '7':
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) shared key encryption selected.\n", ea_endpoint->ep_serial);
/* crypt shared */
case '7':
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) shared key encryption selected.\n", ea_endpoint->ep_serial);
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) encryption off selected.\n", ea_endpoint->ep_serial);
encrypt_off();
break;
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) encryption off selected.\n", ea_endpoint->ep_serial);
encrypt_off();
break;
default:
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) unsupported keypad digit '%c'.\n", ea_endpoint->ep_serial, digit);
default:
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) unsupported keypad digit '%c'.\n", ea_endpoint->ep_serial, digit);
/*
* hunts an mISDNport that is available for an outgoing call
* if no ifname was given, any interface that is not an extension
/*
* hunts an mISDNport that is available for an outgoing call
* if no ifname was given, any interface that is not an extension
return(NULL); /* no port found */
}
return(NULL); /* no port found */
}
/* outgoing setup to port(s)
* ports will be created and a setup is sent if everything is ok. otherwhise
/* outgoing setup to port(s)
* ports will be created and a setup is sent if everything is ok. otherwhise
const char *p;
char cfp[64];
struct interface *interface;
const char *p;
char cfp[64];
struct interface *interface;
struct mISDNport *mISDNport;
struct mISDNport *mISDNport;
char portname[32];
char *dirname;
class EndpointAppPBX *atemp;
char portname[32];
char *dirname;
class EndpointAppPBX *atemp;
char ifname[sizeof(e_ext.interfaces)],
number[256];
struct port_settings port_settings;
char ifname[sizeof(e_ext.interfaces)],
number[256];
struct port_settings port_settings;
+ struct admin_list *admin;
+#endif
int earlyb;
int mode = B_MODE_TRANSPARENT;
int earlyb;
int mode = B_MODE_TRANSPARENT;
- struct admin_list *admin;
/* set bchannel mode */
mode = e_capainfo.source_mode;
/* set bchannel mode */
mode = e_capainfo.source_mode;
/* hunt for mISDNport and create Port */
mISDNport = hunt_port(ifname, &channel);
if (!mISDNport) {
/* hunt for mISDNport and create Port */
mISDNport = hunt_port(ifname, &channel);
if (!mISDNport) {
} else
port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
earlyb = mISDNport->earlyb;
} else
port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
earlyb = mISDNport->earlyb;
+#else
+ trace_header("INTERFACE (has no function)", DIRECTION_NONE);
+ add_trace("interface", NULL, "%s", ifname);
+ end_trace();
+ continue;
+#endif
}
if (!port)
FATAL("Failed to create Port instance\n");
}
if (!port)
FATAL("Failed to create Port instance\n");
p++;
/* external call */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) cfp external %s\n", ea_endpoint->ep_serial, cfp);
p++;
/* external call */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) cfp external %s\n", ea_endpoint->ep_serial, cfp);
/* hunt for mISDNport and create Port */
mISDNport = hunt_port(e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:NULL, &channel);
if (mISDNport) {
/* hunt for mISDNport and create Port */
mISDNport = hunt_port(e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:NULL, &channel);
if (mISDNport) {
if (!port)
FATAL("No memory for Port instance\n");
earlyb = mISDNport->earlyb;
if (!port)
FATAL("No memory for Port instance\n");
earlyb = mISDNport->earlyb;
port = NULL;
trace_header("INTERFACE (too busy)", DIRECTION_NONE);
add_trace("interface", NULL, "%s", e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:"any interface");
port = NULL;
trace_header("INTERFACE (too busy)", DIRECTION_NONE);
add_trace("interface", NULL, "%s", e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:"any interface");
/* hunt for mISDNport and create Port */
mISDNport = hunt_port(e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:NULL, &channel);
if (!mISDNport) {
/* hunt for mISDNport and create Port */
mISDNport = hunt_port(e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:NULL, &channel);
if (!mISDNport) {
} else
port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
earlyb = mISDNport->earlyb;
} else
port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
earlyb = mISDNport->earlyb;
+#else
+ trace_header("INTERFACE (has no function)", DIRECTION_NONE);
+ add_trace("interface", NULL, "%s", ifname);
+ end_trace();
+ continue;
+#endif
}
if (!port)
FATAL("No memory for Port instance\n");
}
if (!port)
FATAL("No memory for Port instance\n");
/* port MESSAGE_CRYPT */
void EndpointAppPBX::port_crypt(struct port_list *portlist, int message_type, union parameter *param)
{
/* port MESSAGE_CRYPT */
void EndpointAppPBX::port_crypt(struct port_list *portlist, int message_type, union parameter *param)
{
/* send crypt response to cryptman */
if (param->crypt.type == CR_MESSAGE_IND)
cryptman_msg2man(param->crypt.data, param->crypt.len);
else
cryptman_message(param->crypt.type, param->crypt.data, param->crypt.len);
/* send crypt response to cryptman */
if (param->crypt.type == CR_MESSAGE_IND)
cryptman_msg2man(param->crypt.data, param->crypt.len);
else
cryptman_message(param->crypt.type, param->crypt.data, param->crypt.len);
}
/* port MESSAGE_OVERLAP */
}
/* port MESSAGE_OVERLAP */
message_put(message);
/* disable encryption if disconnected */
//PERROR("REMOVE ME: state =%d, %d\n", e_crypt_state, e_crypt);
message_put(message);
/* disable encryption if disconnected */
//PERROR("REMOVE ME: state =%d, %d\n", e_crypt_state, e_crypt);
if (e_crypt_state)
cryptman_message(CI_DISCONNECT_IND, NULL, 0);
if (e_crypt_state)
cryptman_message(CI_DISCONNECT_IND, NULL, 0);
return;
} else {
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) the port has no patterns.\n", ea_endpoint->ep_serial);
return;
} else {
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) the port has no patterns.\n", ea_endpoint->ep_serial);
/* join MESSAGE_CRYPT */
void EndpointAppPBX::join_crypt(struct port_list *portlist, int message_type, union parameter *param)
{
/* join MESSAGE_CRYPT */
void EndpointAppPBX::join_crypt(struct port_list *portlist, int message_type, union parameter *param)
{
switch(param->crypt.type) {
/* message from remote port to "crypt manager" */
case CU_ACTK_REQ: /* activate key-exchange */
switch(param->crypt.type) {
/* message from remote port to "crypt manager" */
case CU_ACTK_REQ: /* activate key-exchange */
default:
PERROR("EPOINT(%d) epoint with terminal '%s' (caller id '%s') unknown crypt message: '%d'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->crypt.type);
}
default:
PERROR("EPOINT(%d) epoint with terminal '%s' (caller id '%s') unknown crypt message: '%d'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->crypt.type);
}
}
/* join MESSAGE_INFORMATION */
}
/* join MESSAGE_INFORMATION */
*/
void EndpointAppPBX::join_join(void)
{
*/
void EndpointAppPBX::join_join(void)
{
struct lcr_msg *message;
struct join_relation *our_relation, *other_relation;
struct join_relation **our_relation_pointer, **other_relation_pointer;
struct lcr_msg *message;
struct join_relation *our_relation, *other_relation;
struct join_relation **our_relation_pointer, **other_relation_pointer;
/* we send a retrieve to that endpoint */
// mixer will update the hold-state of the join and send it to the endpoints is changes
/* we send a retrieve to that endpoint */
// mixer will update the hold-state of the join and send it to the endpoints is changes
+#else
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) cannot join: no mISDN support anyway.\n", ea_endpoint->ep_serial);
+#endif
/* efi */
int e_efi_state; /* current spoken sample */
int e_efi_digit; /* current spoken digit */
/* efi */
int e_efi_state; /* current spoken sample */
int e_efi_digit; /* current spoken digit */
/* crypt states and vars */
int e_crypt; /* current user level crypt state */
int e_crypt_state; /* current crypt manager state */
/* crypt states and vars */
int e_crypt; /* current user level crypt state */
int e_crypt_state; /* current crypt manager state */
int e_crypt_keyengine_busy; /* current job and busy state */
int e_crypt_keyengine_return; /* return */
struct lcr_timer e_crypt_handler; /* poll timer for crypt events */
int e_crypt_keyengine_busy; /* current job and busy state */
int e_crypt_keyengine_return; /* return */
struct lcr_timer e_crypt_handler; /* poll timer for crypt events */
/* messages */
void hookflash(void);
/* messages */
void hookflash(void);
dnl enable this to have all special options on one place
dnl AC_PRESERVE_HELP_ORDER
dnl enable this to have all special options on one place
dnl AC_PRESERVE_HELP_ORDER
+# check for mISDN
+AC_ARG_WITH([misdn],
+ [AS_HELP_STRING([--with-misdn],
+ [compile with mISDN driver @<:@default=check@:>@])
+ ],
+ [],
+ [with_misdn="check"])
+
+AS_IF([test "x$with_misdn" != xno],
+ [AC_CHECK_HEADERS([mISDN/mISDNif.h],
+ [with_misdn="yes"],
+ [if test "x$with_misdn" != xcheck ; then
+ AC_MSG_FAILURE(
+ [--with-misdn was given, but test for header-file mISDN/mISDNif.h failed])
+ fi
+ ])
+ ])
+
+AM_CONDITIONAL(ENABLE_MISDN, test "x$with_misdn" == "xyes" )
+
# check for asterisk
AC_ARG_WITH([asterisk],
[AS_HELP_STRING([--with-asterisk],
# check for asterisk
AC_ARG_WITH([asterisk],
[AS_HELP_STRING([--with-asterisk],
+AS_IF([test "x$with_misdn" == xyes],[AC_MSG_NOTICE( Compiled with mISDN support )],[AC_MSG_NOTICE( Not compiled with mISDN support)])
AS_IF([test "x$with_gsm_bs" == xyes],[AC_MSG_NOTICE( Compiled with GSM network side support )],[AC_MSG_NOTICE( Not compiled with GSM network side support)])
AS_IF([test "x$with_gsm_ms" == xyes],[AC_MSG_NOTICE( Compiled with GSM mobile side support )],[AC_MSG_NOTICE( Not compiled with GSM mobile side support)])
AS_IF([test "x$with_asterisk" == xyes],[AC_MSG_NOTICE( Compiled with Asterisk channel driver support )],[AC_MSG_NOTICE( Not compiled with Asterisk channel driver support)])
AS_IF([test "x$with_gsm_bs" == xyes],[AC_MSG_NOTICE( Compiled with GSM network side support )],[AC_MSG_NOTICE( Not compiled with GSM network side support)])
AS_IF([test "x$with_gsm_ms" == xyes],[AC_MSG_NOTICE( Compiled with GSM mobile side support )],[AC_MSG_NOTICE( Not compiled with GSM mobile side support)])
AS_IF([test "x$with_asterisk" == xyes],[AC_MSG_NOTICE( Compiled with Asterisk channel driver support )],[AC_MSG_NOTICE( Not compiled with Asterisk channel driver support)])
if (port_id) {
port = find_port_id(port_id);
if (port) {
if (port_id) {
port = find_port_id(port_id);
if (port) {
if ((port->p_type&PORT_CLASS_MASK) == PORT_CLASS_mISDN)
earlyb = ((class PmISDN *)port)->p_m_mISDNport->earlyb;
if ((port->p_type&PORT_CLASS_MASK) == PORT_CLASS_mISDN)
earlyb = ((class PmISDN *)port)->p_m_mISDNport->earlyb;
+#else
+ earlyb = 0;
+#endif
if (!portlist_new(port_id, port->p_type, earlyb))
FATAL("No memory for portlist.\n");
}
if (!portlist_new(port_id, port->p_type, earlyb))
FATAL("No memory for portlist.\n");
}
struct interface *interface_newlist = NULL; /* first interface in new list */
struct interface *interface_newlist = NULL; /* first interface in new list */
/* set default out_channel */
void default_out_channel(struct interface_port *ifport)
{
/* set default out_channel */
void default_out_channel(struct interface_port *ifport)
{
selchannel = (struct select_channel *)MALLOC(sizeof(struct select_channel));
memuse++;
selchannel = (struct select_channel *)MALLOC(sizeof(struct select_channel));
memuse++;
if (ifport->mISDNport->ntmode)
selchannel->channel = CHANNEL_FREE;
else
if (ifport->mISDNport->ntmode)
selchannel->channel = CHANNEL_FREE;
else
ifport->in_channel = selchannel;
}
ifport->in_channel = selchannel;
}
/* parse string for a positive number */
/* parse string for a positive number */
}
static int inter_portnum(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
}
static int inter_portnum(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
+#ifndef WITH_MISDN
+ SPRINT(interface_error, "Error in %s (line %d): mISDN support is not compiled in.\n", filename, line);
+ return(-1);
+#else
struct interface_port *ifport, **ifportp;
struct interface *searchif;
int val;
struct interface_port *ifport, **ifportp;
struct interface *searchif;
int val;
ifportp = &((*ifportp)->next);
*ifportp = ifport;
return(0);
ifportp = &((*ifportp)->next);
*ifportp = ifport;
return(0);
}
static int inter_portname(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
}
static int inter_portname(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
+#ifndef WITH_MISDN
+ SPRINT(interface_error, "Error in %s (line %d): mISDN support is not compiled in.\n", filename, line);
+ return(-1);
+#else
struct interface_port *ifport, **ifportp;
struct interface *searchif;
struct interface_port *ifport, **ifportp;
struct interface *searchif;
ifportp = &((*ifportp)->next);
*ifportp = ifport;
return(0);
ifportp = &((*ifportp)->next);
*ifportp = ifport;
return(0);
}
static int inter_l1hold(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
}
static int inter_l1hold(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
/*
* defaults of ports if not specified by config
*/
/*
* defaults of ports if not specified by config
*/
-static void set_defaults(struct interface_port *ifport)
+static void set_mISDN_defaults(struct interface_port *ifport)
{
/* default channel selection list */
if (!ifport->out_channel)
{
/* default channel selection list */
if (!ifport->out_channel)
else
ifport->mISDNport->locally = 0;
}
else
ifport->mISDNport->locally = 0;
}
*/
void relink_interfaces(void)
{
*/
void relink_interfaces(void)
{
struct mISDNport *mISDNport;
struct mISDNport *mISDNport;
- struct interface *interface, *temp;
struct interface_port *ifport;
struct interface_port *ifport;
+#endif
+ struct interface *interface, *temp;
int found;
interface = interface_first;
int found;
interface = interface_first;
interface = interface->next;
}
interface = interface->next;
}
/* unlink all mISDNports */
mISDNport = mISDNport_first;
while(mISDNport) {
/* unlink all mISDNports */
mISDNport = mISDNport_first;
while(mISDNport) {
PDEBUG(DEBUG_ISDN, "Port %d:%s relinking!\n", ifport->portnum, ifport->portname);
ifport->mISDNport = mISDNport;
mISDNport->ifport = ifport;
PDEBUG(DEBUG_ISDN, "Port %d:%s relinking!\n", ifport->portnum, ifport->portname);
ifport->mISDNport = mISDNport;
mISDNport->ifport = ifport;
+ set_mISDN_defaults(ifport);
}
mISDNport = mISDNport->next;
}
}
mISDNport = mISDNport->next;
}
while(ifport) {
if (!ifport->mISDNport) {
if (!interface->shutdown) {
while(ifport) {
if (!ifport->mISDNport) {
if (!interface->shutdown) {
+ load_mISDN_port(ifport);
} else {
ifport->block = 2;
}
} else {
ifport->block = 2;
}
}
interface = interface->next;
}
}
interface = interface->next;
}
-void load_port(struct interface_port *ifport)
+void load_mISDN_port(struct interface_port *ifport)
{
struct mISDNport *mISDNport;
{
struct mISDNport *mISDNport;
ifport->portnum = mISDNport->portnum;
SCPY(ifport->portname, mISDNport->name);
/* set defaults */
ifport->portnum = mISDNport->portnum;
SCPY(ifport->portname, mISDNport->name);
/* set defaults */
+ set_mISDN_defaults(ifport);
/* load static port instances */
mISDNport_static(mISDNport);
} else {
ifport->block = 2; /* not available */
}
}
/* load static port instances */
mISDNport_static(mISDNport);
} else {
ifport->block = 2; /* not available */
}
}
/*
* give summary of interface syntax
/*
* give summary of interface syntax
struct interface *read_interfaces(void);
void free_interfaces(struct interface *interface_start);
void relink_interfaces(void);
struct interface *read_interfaces(void);
void free_interfaces(struct interface *interface_start);
void relink_interfaces(void);
-void load_port(struct interface_port *ifport);
+void load_mISDN_port(struct interface_port *ifport);
void doc_interface(void);
void do_screen(int out, char *id, int idsize, int *type, int *present, const char *interface_name);
struct interface *getinterfacebyname(const char *name);
void doc_interface(void);
void do_screen(int out, char *id, int idsize, int *type, int *present, const char *interface_name);
struct interface *getinterfacebyname(const char *name);
epoint->ep_app = new_endpointapp(epoint, 1, EAPP_TYPE_PBX); // outgoing
}
epoint->ep_app = new_endpointapp(epoint, 1, EAPP_TYPE_PBX); // outgoing
}
/* set serial on bchannel message
* also ref is given, so we send message with ref */
if (message_type == MESSAGE_BCHANNEL) {
message_bchannel_from_remote(this, param->bchannel.type, param->bchannel.handle);
return;
}
/* set serial on bchannel message
* also ref is given, so we send message with ref */
if (message_type == MESSAGE_BCHANNEL) {
message_bchannel_from_remote(this, param->bchannel.type, param->bchannel.handle);
return;
}
/* cannot just forward, because param is not of container "struct lcr_msg" */
message = message_create(j_serial, j_epoint_id, JOIN_TO_EPOINT, message_type);
/* cannot just forward, because param is not of container "struct lcr_msg" */
message = message_create(j_serial, j_epoint_id, JOIN_TO_EPOINT, message_type);
int i;
struct sched_param schedp;
int created_mutexd = 0,/* created_mutext = 0,*/ created_mutexe = 0,
int i;
struct sched_param schedp;
int created_mutexd = 0,/* created_mutext = 0,*/ created_mutexe = 0,
- created_lock = 0, created_signal = 0, created_debug = 0,
- created_misdn = 0, created_message = 0;
+ created_lock = 0, created_signal = 0, created_message = 0;
+#ifdef WITH_MISDN
+ int created_misdn = 0;
+#endif
char tracetext[256], lock[128];
char options_error[256];
int polling = 0;
char tracetext[256], lock[128];
char options_error[256];
int polling = 0;
/* init crc */
crc_init();
/* init crc */
crc_init();
/* the mutex init */
if (pthread_mutex_init(&mutexd, NULL)) {
/* the mutex init */
if (pthread_mutex_init(&mutexd, NULL)) {
}
polling = options.polling;
}
polling = options.polling;
/* init mISDN */
if (mISDN_initialize() < 0)
goto free;
created_misdn = 1;
/* init mISDN */
if (mISDN_initialize() < 0)
goto free;
created_misdn = 1;
/* read ruleset(s) */
if (!(ruleset_first = ruleset_parse()))
/* read ruleset(s) */
if (!(ruleset_first = ruleset_parse()))
free_interfaces(interface_first);
interface_first = NULL;
free_interfaces(interface_first);
interface_first = NULL;
/* close isdn ports */
mISDNport_close_all();
/* close isdn ports */
mISDNport_close_all();
/* flush messages */
debug_count++;
/* flush messages */
debug_count++;
if (pthread_mutex_destroy(&mutexd))
fprintf(stderr, "cannot destroy 'PDEBUG' mutex\n");
if (pthread_mutex_destroy(&mutexd))
fprintf(stderr, "cannot destroy 'PDEBUG' mutex\n");
/* deinitialize mISDN */
if (created_misdn)
mISDN_deinitialize();
/* deinitialize mISDN */
if (created_misdn)
mISDN_deinitialize();
/* close loopback, if used by GSM or remote */
if (mISDNloop.sock > -1)
mISDNloop_close();
/* close loopback, if used by GSM or remote */
if (mISDNloop.sock > -1)
mISDNloop_close();
/* display memory leak */
#define MEMCHECK(a, b) \
/* display memory leak */
#define MEMCHECK(a, b) \
#define BUDETECT ;
#endif
#define BUDETECT ;
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include <mISDN/mbuffer.h>
-#ifdef __cplusplus
-}
+#ifdef WITH_MISDN
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ #include <mISDN/mbuffer.h>
+ #ifdef __cplusplus
+ }
+ #endif
#endif
#include "macro.h"
#include "select.h"
#endif
#include "macro.h"
#include "select.h"
#include "callerid.h"
#include "route.h"
#include "port.h"
#include "callerid.h"
#include "route.h"
#include "port.h"
#include "mISDN.h"
#include "dss1.h"
#include "loop.h"
#include "remote.h"
#include "mISDN.h"
#include "dss1.h"
#include "loop.h"
#include "remote.h"
#if defined WITH_GSM_BS || defined WITH_GSM_MS
#include "gsm.h"
#endif
#if defined WITH_GSM_BS || defined WITH_GSM_MS
#include "gsm.h"
#endif
istrue,
couldbetrue,
condition,
istrue,
couldbetrue,
condition,
- dialing_required,
- avail,
- any;
struct route_rule *rule = ruleset->rule_first;
struct route_cond *cond;
struct route_action *action = NULL;
unsigned long comp_len;
struct route_rule *rule = ruleset->rule_first;
struct route_cond *cond;
struct route_action *action = NULL;
unsigned long comp_len;
char isdn_port[10];
char *argv[11]; /* check also number of args below */
char callerid[64], callerid2[64], redirid[64];
char isdn_port[10];
char *argv[11]; /* check also number of args below */
char callerid[64], callerid2[64], redirid[64];
FILE *tfp;
long long timeout, now_ll = 0, match_timeout = 0;
struct timeval current_time;
FILE *tfp;
long long timeout, now_ll = 0, match_timeout = 0;
struct timeval current_time;
struct mISDNport *mISDNport;
struct mISDNport *mISDNport;
+ int avail,
+ any;
+ int jj;
+#endif
struct admin_list *admin;
time_t now;
struct tm *now_tm;
struct admin_list *admin;
time_t now;
struct tm *now_tm;
if (ea_endpoint->ep_portlist)
if ((ea_endpoint->ep_portlist->port_type & PORT_CLASS_MASK) != PORT_CLASS_mISDN)
break;
integer = e_callerinfo.isdn_port;
goto match_integer;
if (ea_endpoint->ep_portlist)
if ((ea_endpoint->ep_portlist->port_type & PORT_CLASS_MASK) != PORT_CLASS_mISDN)
break;
integer = e_callerinfo.isdn_port;
goto match_integer;
case MATCH_INTERFACE:
if (!e_callerinfo.interface[0])
case MATCH_INTERFACE:
if (!e_callerinfo.interface[0])
case MATCH_FREE:
case MATCH_NOTFREE:
case MATCH_FREE:
case MATCH_NOTFREE:
if (!(comp_len = (unsigned long)strchr(cond->string_value, ':')))
break;
comp_len = comp_len-(unsigned long)cond->string_value;
if (!(comp_len = (unsigned long)strchr(cond->string_value, ':')))
break;
comp_len = comp_len-(unsigned long)cond->string_value;
if (avail < atoi(cond->string_value + comp_len + 1))
istrue = 1;
}
if (avail < atoi(cond->string_value + comp_len + 1))
istrue = 1;
}
mISDNport = mISDNport_first;
while(mISDNport) {
if (mISDNport->ifport)
mISDNport = mISDNport_first;
while(mISDNport) {
if (mISDNport->ifport)
}
if (!mISDNport) /* all down */
istrue = 1;
}
if (!mISDNport) /* all down */
istrue = 1;
mISDNport = mISDNport_first;
while(mISDNport) {
if (mISDNport->ifport)
mISDNport = mISDNport_first;
while(mISDNport) {
if (mISDNport->ifport)
}
if (mISDNport) /* one link at least */
istrue = 1;
}
if (mISDNport) /* one link at least */
istrue = 1;
break;
case MATCH_BUSY:
case MATCH_IDLE:
break;
case MATCH_BUSY:
case MATCH_IDLE:
any = 0;
mISDNport = mISDNport_first;
while(mISDNport) {
any = 0;
mISDNport = mISDNport_first;
while(mISDNport) {
istrue = 1;
if (!mISDNport && cond->match==MATCH_IDLE)
istrue = 1;
istrue = 1;
if (!mISDNport && cond->match==MATCH_IDLE)
istrue = 1;
break;
case MATCH_REMOTE:
break;
case MATCH_REMOTE:
{
struct admin_queue *response;
void *temp;
{
struct admin_queue *response;
void *temp;
union parameter param;
class Join *join, *joinnext;
struct mISDNport *mISDNport;
int i, ii;
union parameter param;
class Join *join, *joinnext;
struct mISDNport *mISDNport;
int i, ii;
- struct admin_list **adminp;
class Port *port, *portnext;
class Premote *remote;
class Port *port, *portnext;
class Premote *remote;
+#endif
+ struct admin_list **adminp;
/* free remote joins */
if (admin->remote_name[0]) {
/* free remote joins */
if (admin->remote_name[0]) {
"REMOTE APP release");
add_trace("app", "name", "%s", admin->remote_name);
end_trace();
"REMOTE APP release");
add_trace("app", "name", "%s", admin->remote_name);
end_trace();
/* release all exported channels */
mISDNport = mISDNport_first;
while(mISDNport) {
/* release all exported channels */
mISDNport = mISDNport_first;
while(mISDNport) {
}
mISDNport = mISDNport->next;
}
}
mISDNport = mISDNport->next;
}
+#endif
+#ifdef WITH_MISDN
/* release join */
join = join_first;
while(join) {
/* release join */
join = join_first;
while(join) {
}
if (admin->sock >= 0) {
}
if (admin->sock >= 0) {
/* no interface */
if (!ifport->mISDNport) {
/* not loaded anyway */
/* no interface */
if (!ifport->mISDNport) {
/* not loaded anyway */
/* try loading interface */
ifport->block = block;
/* try loading interface */
ifport->block = block;
+ load_mISDN_port(ifport);
/* port cannot load */
if (ifport->block >= 2) {
/* port cannot load */
if (ifport->block >= 2) {
ifport->block = 2;
goto out;
}
ifport->block = 2;
goto out;
}
/* port new blocking state */
ifport->block = response->am[0].u.x.block = block;
/* port new blocking state */
ifport->block = response->am[0].u.x.block = block;
*/
int admin_message_to_lcr(struct admin_msg *msg, struct admin_list *admin)
{
*/
int admin_message_to_lcr(struct admin_msg *msg, struct admin_list *admin)
{
struct mISDNport *mISDNport;
struct mISDNport *mISDNport;
- class Join *join;
- class JoinRemote *joinremote = NULL; /* make GCC happy */
class Port *port;
class Premote *remote = NULL; /* make GCC happy */
class Port *port;
class Premote *remote = NULL; /* make GCC happy */
+ class Join *join;
+ class JoinRemote *joinremote = NULL; /* make GCC happy */
+#endif
struct admin_list *temp;
/* hello message */
struct admin_list *temp;
/* hello message */
/* new join. the reply (NEWREF assignment) is sent from constructor */
if (msg->type == MESSAGE_NEWREF) {
if (msg->param.newref.mode) {
/* new join. the reply (NEWREF assignment) is sent from constructor */
if (msg->type == MESSAGE_NEWREF) {
if (msg->param.newref.mode) {
/* bchannel message
* no ref given for *_ack */
if (msg->type == MESSAGE_BCHANNEL)
/* bchannel message
* no ref given for *_ack */
if (msg->type == MESSAGE_BCHANNEL)
message_bchannel_from_remote(NULL, msg->param.bchannel.type, msg->param.bchannel.handle);
return(0);
}
message_bchannel_from_remote(NULL, msg->param.bchannel.type, msg->param.bchannel.handle);
return(0);
}
/* check for ref */
if (!msg->ref) {
/* check for ref */
if (!msg->ref) {
/* find join instance */
join = join_first;
while(join) {
/* find join instance */
join = join_first;
while(join) {
PDEBUG(DEBUG_LOG, "No remote instance found with ref %d. (May have been already released.)\n", msg->ref);
return(0);
PDEBUG(DEBUG_LOG, "No remote instance found with ref %d. (May have been already released.)\n", msg->ref);
return(0);
class Port *port;
class EndpointAppPBX *apppbx;
class Join *join;
class Port *port;
class EndpointAppPBX *apppbx;
class Join *join;
- struct interface *interface;
- struct interface_port *ifport;
struct mISDNport *mISDNport;
struct select_channel *selchannel;
struct mISDNport *mISDNport;
struct select_channel *selchannel;
+ int anybusy;
+#endif
+ struct interface *interface;
+ struct interface_port *ifport;
struct admin_queue *response;
struct admin_list *admin;
struct tm *now_tm;
struct admin_queue *response;
struct admin_list *admin;
struct tm *now_tm;
response->am[num].u.i.extension = interface->extension;
/* block */
response->am[num].u.i.block = ifport->block;
response->am[num].u.i.extension = interface->extension;
/* block */
response->am[num].u.i.block = ifport->block;
if (ifport->mISDNport) {
mISDNport = ifport->mISDNport;
if (ifport->mISDNport) {
mISDNport = ifport->mISDNport;
num++;
ifport = ifport->next;
num++;
ifport = ifport->next;
if (apppbx->ea_endpoint->ep_park && apppbx->ea_endpoint->ep_park_len && apppbx->ea_endpoint->ep_park_len<=(int)sizeof(response->am[num].u.e.park_callid))
memcpy(response->am[num].u.e.park_callid, apppbx->ea_endpoint->ep_park_callid, apppbx->ea_endpoint->ep_park_len);
response->am[num].u.e.park_len = apppbx->ea_endpoint->ep_park_len;
if (apppbx->ea_endpoint->ep_park && apppbx->ea_endpoint->ep_park_len && apppbx->ea_endpoint->ep_park_len<=(int)sizeof(response->am[num].u.e.park_callid))
memcpy(response->am[num].u.e.park_callid, apppbx->ea_endpoint->ep_park_callid, apppbx->ea_endpoint->ep_park_len);
response->am[num].u.e.park_len = apppbx->ea_endpoint->ep_park_len;
/* crypt */
if (apppbx->e_crypt == CRYPT_ON)
response->am[num].u.e.crypt = 1;
/* crypt */
if (apppbx->e_crypt == CRYPT_ON)
response->am[num].u.e.crypt = 1;
/* */
apppbx = apppbx->next;
num++;
/* */
apppbx = apppbx->next;
num++;
default:
response->am[num].u.p.state = ADMIN_STATE_IDLE;
}
default:
response->am[num].u.p.state = ADMIN_STATE_IDLE;
}
/* isdn */
if ((port->p_type & PORT_CLASS_mISDN_MASK) == PORT_CLASS_DSS1) {
response->am[num].u.p.isdn = 1;
/* isdn */
if ((port->p_type & PORT_CLASS_mISDN_MASK) == PORT_CLASS_DSS1) {
response->am[num].u.p.isdn = 1;
response->am[num].u.p.isdn_hold = pdss1->p_m_hold;
response->am[num].u.p.isdn_ces = pdss1->p_m_d_ces;
}
response->am[num].u.p.isdn_hold = pdss1->p_m_hold;
response->am[num].u.p.isdn_ces = pdss1->p_m_d_ces;
}
/* */
port = port->next;
num++;
/* */
port = port->next;
num++;
char buffer[256];
time_t ti = trace.sec;
struct tm *tm;
char buffer[256];
time_t ti = trace.sec;
struct tm *tm;
struct mISDNport *mISDNport;
struct mISDNport *mISDNport;
int i;
trace_string[0] = '\0'; // always clear string
int i;
trace_string[0] = '\0'; // always clear string
/* head */
if (detail >= 3) {
SCAT(trace_string, "------------------------------------------------------------------------------\n");
/* head */
if (detail >= 3) {
SCAT(trace_string, "------------------------------------------------------------------------------\n");
/* "Port: 1 (BRI PTMP TE)" */
if (trace.port >= 0) {
mISDNport = mISDNport_first;
/* "Port: 1 (BRI PTMP TE)" */
if (trace.port >= 0) {
mISDNport = mISDNport_first;
SPRINT(buffer, "Port: %d (does not exist)\n", trace.port);
SCAT(trace_string, buffer);
} else
SPRINT(buffer, "Port: %d (does not exist)\n", trace.port);
SCAT(trace_string, buffer);
} else
SCAT(trace_string, "Port: ---");
if (trace.interface[0]) {
SCAT(trace_string, "Port: ---");
if (trace.interface[0]) {