struct interface *interface_newlist = NULL; /* first interface in new list */
-/* set default selchannel */
-void default_selchannel(struct interface_port *ifport)
+/* set default out_channel */
+void default_out_channel(struct interface_port *ifport)
{
struct select_channel *selchannel, **selchannelp;
- /* channel selection for TE-ports */
- if (!ifport->mISDNport->ntmode)
+ selchannel = (struct select_channel *)malloc(sizeof(struct select_channel));
+ if (!selchannel)
{
+ PERROR("No memory!");
+ return;
+ }
+ memuse++;
+ memset(selchannel, 0, sizeof(struct select_channel));
+
+ if (ifport->mISDNport->ntmode)
+ selchannel->channel = CHANNEL_FREE;
+ else
+ selchannel->channel = CHANNEL_ANY;
+
+ ifport->out_channel = selchannel;
+
+ /* additional channel selection for multipoint NT ports */
+ if (!ifport->mISDNport->ptp && ifport->mISDNport->ntmode)
+ {
+ selchannelp = &(selchannel->next);
selchannel = (struct select_channel *)malloc(sizeof(struct select_channel));
if (!selchannel)
{
return;
}
memuse++;
- memset(*selchannelp, 0, sizeof(struct select_channel));
- *selchannelp->channel = SEL_CHANNEL_ANY;
- selchannelp = &ifport->selchannel;
- while(*selchannelp)
- selchannelp = &((*selchannelp)->next);
+ memset(selchannel, 0, sizeof(struct select_channel));
+ selchannel->channel = CHANNEL_NO; // call waiting
*selchannelp = selchannel;
- return(0);
}
+}
+
+
+/* set default in_channel */
+void default_in_channel(struct interface_port *ifport)
+{
+ struct select_channel *selchannel;
- /* channel selection for NT-ports */
selchannel = (struct select_channel *)malloc(sizeof(struct select_channel));
if (!selchannel)
{
return;
}
memuse++;
- memset(*selchannelp, 0, sizeof(struct select_channel));
- *selchannelp->channel = SEL_CHANNEL_FREE;
- selchannelp = &ifport->selchannel;
- while(*selchannelp)
- selchannelp = &((*selchannelp)->next);
- *selchannelp = selchannel;
-
- /* additional channel selection for multipoint ports */
- if (!ifport->mISDNport->ptp)
- {
- selchannel = (struct select_channel *)malloc(sizeof(struct select_channel));
- if (!selchannel)
- {
- PERROR("No memory!");
- return;
- }
- memuse++;
- memset(*selchannelp, 0, sizeof(struct select_channel));
- *selchannelp->channel = SEL_CHANNEL_NO; // call waiting
- selchannelp = &ifport->selchannel;
- while(*selchannelp)
- selchannelp = &((*selchannelp)->next);
- *selchannelp = selchannel;
- }
+ memset(selchannel, 0, sizeof(struct select_channel));
+
+ selchannel->channel = CHANNEL_FREE;
+
+ ifport->in_channel = selchannel;
}
SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects previous 'port' definition.\n", filename, line, parameter);
return(-1);
}
+ if (interface->ifport->ptmp)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' previously ptmp was given.\n", filename, line, parameter);
+ return(-1);
+ }
/* goto end of chain */
ifport = interface->ifport;
while(ifport->next)
ifport->ptp = 1;
return(0);
}
+static int inter_ptmp(struct interface *interface, char *filename, int line, char *parameter, char *value)
+{
+ struct interface_port *ifport;
+
+ /* port in chain ? */
+ if (!interface->ifport)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects previous 'port' definition.\n", filename, line, parameter);
+ return(-1);
+ }
+ if (interface->ifport->ptp)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' previously ptp was given.\n", filename, line, parameter);
+ return(-1);
+ }
+ /* goto end of chain */
+ ifport = interface->ifport;
+ while(ifport->next)
+ ifport = ifport->next;
+ /* add value */
+ if (value[0])
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects no value.\n", filename, line, parameter);
+ return(-1);
+ }
+ ifport->ptmp = 1;
+ return(0);
+}
static int inter_tones(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
if (!strcasecmp(value, "yes"))
if (!strcasecmp(el, "force"))
{
ifport->channel_force = 1;
- if (ifport->selchannel)
+ if (ifport->out_channel)
{
SPRINT(interface_error, "Error in %s (line %d): value 'force' may only appear as first element in list.\n", filename, line);
return(-1);
} else
if (!strcasecmp(el, "any"))
{
- val = SEL_CHANNEL_ANY;
+ val = CHANNEL_ANY;
goto selchannel;
} else
if (!strcasecmp(el, "free"))
{
- val = SEL_CHANNEL_FREE;
+ val = CHANNEL_FREE;
goto selchannel;
} else
if (!strcasecmp(el, "no"))
{
- val = SEL_CHANNEL_NO;
+ val = CHANNEL_NO;
goto selchannel;
} else
{
/* set value */
selchannel->channel = val;
/* tail port */
- selchannelp = &ifport->selchannel;
+ selchannelp = &ifport->out_channel;
while(*selchannelp)
selchannelp = &((*selchannelp)->next);
*selchannelp = selchannel;
{
el = p;
p = get_seperated(p);
- if (ifport->in_select) if (ifport->in_select->channel == SEL_CHANNEL_FREE)
+ if (ifport->in_channel) if (ifport->in_channel->channel == CHANNEL_FREE)
{
SPRINT(interface_error, "Error in %s (line %d): parameter '%s' has values behind 'free' keyword. They has no effect.\n", filename, line, parameter);
return(-1);
}
if (!strcasecmp(el, "free"))
{
- val = SEL_CHANNEL_FREE;
+ val = CHANNEL_FREE;
goto selchannel;
} else
{
/* set value */
selchannel->channel = val;
/* tail port */
- selchannelp = &ifport->in_select;
+ selchannelp = &ifport->in_channel;
while(*selchannelp)
selchannelp = &((*selchannelp)->next);
*selchannelp = selchannel;
}
memuse++;
memset(ifscreen, 0, sizeof(struct interface_screen));
-#warning handle unchanged as unchanged!!
+ ifscreen->match_type = -1; /* unchecked */
+ ifscreen->match_present = -1; /* unchecked */
ifscreen->result_type = -1; /* unchanged */
ifscreen->result_present = -1; /* unchanged */
/* tail port */
if (ifscreen->match_present != -1)
{
presenterror:
- SPRINT(interface_error, "Error in %s (line %d): presentation type already set earlier.\n", filename, line, parameter);
+ SPRINT(interface_error, "Error in %s (line %d): presentation type already set earlier.\n", filename, line);
return(-1);
}
ifscreen->match_present = INFO_PRESENT_ALLOWED;
ifscreen->match_present = INFO_PRESENT_RESTRICTED;
} else {
SCPY(ifscreen->match, el);
+ /* check for % at the end */
+ if (strchr(el, '%'))
+ {
+ if (strchr(el, '%') != el+strlen(el)-1)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): %% joker found, but must at the end.\n", filename, line, parameter);
+ return(-1);
+ }
+ }
break;
}
}
ifscreen->result_present = INFO_PRESENT_RESTRICTED;
} else {
SCPY(ifscreen->result, el);
+ /* check for % at the end */
+ if (strchr(el, '%'))
+ {
+ if (strchr(el, '%') != el+strlen(el)-1)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): %% joker found, but must at the end.\n", filename, line, parameter);
+ return(-1);
+ }
+ }
break;
}
}
{
return(inter_screen(&interface->ifscreen_out, interface, filename, line, parameter, value));
}
-static int inter_filter(struct interface *interface, char *filename, int line, char *parameter, char *value)
+static int inter_nodtmf(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
+ struct interface_port *ifport;
+
+ /* port in chain ? */
+ if (!interface->ifport)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects previous 'port' definition.\n", filename, line, parameter);
+ return(-1);
+ }
+ /* goto end of chain */
+ ifport = interface->ifport;
+ while(ifport->next)
+ ifport = ifport->next;
+ ifport->nodtmf = 1;
+ return(0);
+}
#warning filter to be done
+#if 0
+static int inter_filter(struct interface *interface, char *filename, int line, char *parameter, char *value)
+{
return(0);
}
+#endif
/*
"This is required on NT-mode ports that are multipoint by default.\n"
"This parameter must follow a 'port' parameter."},
+ {"ptmp", &inter_ptmp, "",
+ "The given port above is opened as point-to-multipoint.\n"
+ "This is required on PRI NT-mode ports that are point-to-point by default.\n"
+ "This parameter must follow a 'port' parameter."},
+
{"channel_out", &inter_channel_out, "[force,][<number>][,...][,free][,any][,no]",
"Channel selection list for all outgoing calls to the interface.\n"
"A free channels is searched in order of appearance.\n"
"If no channel was requested, the first free channel found is selected.\n"
"This parameter must follow a 'port' parameter.\n"
" <number>[,...] - List of channels to accept.\n"
- " free - Accept any free channel\n"
+ " free - Accept any free channel"},
{"msn", &inter_msn, "<default MSN>,[<additional MSN>[,...]]",
"Incomming caller ID is checked against given MSN numbers.\n"
"Adds an entry for outgoing calls to the caller ID screen list.\n"
"See 'screen-in' for help."},
+ {"nodtmf", &inter_nodtmf, "",
+ "Disables DTMF detection for this interface.\n"
+ "This parameter must follow a 'port' parameter."},
+
+#if 0
+#warning todo: filter, also in the PmISDN object
{"filter", &inter_filter, "<filter> [parameters]",
"Adds/appends a filter. Filters are ordered in transmit direction.\n"
"gain <tx-volume> <rx-volume> - Changes volume (-8 .. 8)\n"
"blowfish <key> - Adds encryption. Key must be 4-56 bytes (8-112 hex characters."},
+#endif
{NULL, NULL, NULL, NULL}
};
if (!ifport->mISDNport)
{
/* open new port */
- mISDNport = mISDNport_open(ifport->portnum, ifport->ptp);
+ mISDNport = mISDNport_open(ifport->portnum, ifport->ptp, ifport->ptmp);
if (mISDNport)
{
ifport->mISDNport = mISDNport;
mISDNport->ifport = ifport;
}
}
- if (ifport->mISDNport && !ifport->selchannel)
- default_selchannel(ifport);
+ if (ifport->mISDNport)
+ {
+ /* default channel selection list */
+ if (!ifport->out_channel)
+ default_out_channel(ifport);
+ if (!ifport->in_channel)
+ default_in_channel(ifport);
+ /* default is_tones */
+ if (ifport->interface->is_tones)
+ ifport->mISDNport->is_tones = (ifport->interface->is_tones==IS_YES);
+ else
+ ifport->mISDNport->is_tones = (ifport->mISDNport->ntmode)?1:0;
+ /* default is_earlyb */
+ if (ifport->interface->is_earlyb)
+ ifport->mISDNport->is_earlyb = (ifport->interface->is_earlyb==IS_YES);
+ else
+ ifport->mISDNport->is_earlyb = (ifport->mISDNport->ntmode)?0:1;
+ }
}
interface = interface->next;
}