committed head of chan_misdn with a lot of new features. Most important of all: chan_misdn supports now the mISDN mqueue tree (smp,preemptible,gcc-4 aware\!). Additionally there are some code optimizations, new facility management (Calldeflect works for now).
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7413 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
bffe61fcd2
commit
8bc4a439be
File diff suppressed because it is too large
Load Diff
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "chan_misdn_config.h"
|
||||
|
||||
|
@ -36,8 +37,10 @@
|
|||
#include <asterisk/channel.h>
|
||||
#include <asterisk/logger.h>
|
||||
#include <asterisk/lock.h>
|
||||
#include <asterisk/pbx.h>
|
||||
#include <asterisk/strings.h>
|
||||
|
||||
|
||||
#include <asterisk/utils.h>
|
||||
#define AST_LOAD_CFG ast_config_load
|
||||
#define AST_DESTROY_CFG ast_config_destroy
|
||||
|
@ -57,20 +60,25 @@ struct port_config {
|
|||
int *te_choose_channel;
|
||||
char *context;
|
||||
char *language;
|
||||
char *musicclass;
|
||||
char *callerid;
|
||||
char *method;
|
||||
int *dialplan;
|
||||
int *dialplan;
|
||||
int *localdialplan;
|
||||
char *nationalprefix;
|
||||
char *internationalprefix;
|
||||
int *pres;
|
||||
int *always_immediate;
|
||||
int *immediate;
|
||||
int *senddtmf;
|
||||
int *hold_allowed;
|
||||
int *early_bconnect;
|
||||
int *use_callingpres;
|
||||
int *echocancel;
|
||||
int *echocancelwhenbridged;
|
||||
int *echotraining;
|
||||
int *jitterbuffer;
|
||||
int *jitterbuffer_upper_threshold;
|
||||
struct msn_list *msn_list;
|
||||
ast_group_t *callgroup; /* Call group */
|
||||
ast_group_t *pickupgroup; /* Pickup group */
|
||||
|
@ -148,13 +156,16 @@ static void free_port_cfg (void) {
|
|||
FREE_ELEM(te_choose_channel);
|
||||
FREE_ELEM(context);
|
||||
FREE_ELEM(language);
|
||||
FREE_ELEM(musicclass);
|
||||
FREE_ELEM(callerid);
|
||||
FREE_ELEM(method);
|
||||
FREE_ELEM(dialplan);
|
||||
FREE_ELEM(localdialplan);
|
||||
FREE_ELEM(nationalprefix);
|
||||
FREE_ELEM(internationalprefix);
|
||||
FREE_ELEM(pres);
|
||||
FREE_ELEM(always_immediate);
|
||||
FREE_ELEM(senddtmf);
|
||||
FREE_ELEM(immediate);
|
||||
FREE_ELEM(hold_allowed);
|
||||
FREE_ELEM(early_bconnect);
|
||||
|
@ -162,6 +173,8 @@ static void free_port_cfg (void) {
|
|||
FREE_ELEM(echocancel);
|
||||
FREE_ELEM(echocancelwhenbridged);
|
||||
FREE_ELEM(echotraining);
|
||||
FREE_ELEM(jitterbuffer);
|
||||
FREE_ELEM(jitterbuffer_upper_threshold);
|
||||
if (free_list[i]->msn_list)
|
||||
free_msn_list(free_list[i]->msn_list);
|
||||
FREE_ELEM(callgroup);
|
||||
|
@ -263,20 +276,28 @@ void misdn_cfg_get(int port, enum misdn_cfg_elements elem, void *buf, int bufsiz
|
|||
case MISDN_CFG_RXGAIN: GET_PORTCFG_MEMCPY(rxgain);
|
||||
break;
|
||||
case MISDN_CFG_TXGAIN: GET_PORTCFG_MEMCPY(txgain);
|
||||
break;
|
||||
case MISDN_CFG_TE_CHOOSE_CHANNEL:
|
||||
break;
|
||||
case MISDN_CFG_JITTERBUFFER: GET_PORTCFG_MEMCPY(jitterbuffer);
|
||||
break;
|
||||
case MISDN_CFG_JITTERBUFFER_UPPER_THRESHOLD: GET_PORTCFG_MEMCPY(jitterbuffer_upper_threshold);
|
||||
break;
|
||||
case MISDN_CFG_TE_CHOOSE_CHANNEL:
|
||||
GET_PORTCFG_MEMCPY(te_choose_channel);
|
||||
break;
|
||||
case MISDN_CFG_CONTEXT: GET_PORTCFG_STRCPY(context);
|
||||
break;
|
||||
case MISDN_CFG_LANGUAGE: GET_PORTCFG_STRCPY(language);
|
||||
break;
|
||||
case MISDN_CFG_CALLERID: GET_PORTCFG_STRCPY(callerid);
|
||||
break;
|
||||
case MISDN_CFG_MUSICCLASS: GET_PORTCFG_STRCPY(musicclass);
|
||||
break;
|
||||
case MISDN_CFG_CALLERID: GET_PORTCFG_STRCPY(callerid);
|
||||
break;
|
||||
case MISDN_CFG_METHOD: GET_PORTCFG_STRCPY(method);
|
||||
break;
|
||||
case MISDN_CFG_DIALPLAN: GET_PORTCFG_MEMCPY(dialplan);
|
||||
break;
|
||||
case MISDN_CFG_LOCALDIALPLAN: GET_PORTCFG_MEMCPY(localdialplan);
|
||||
break;
|
||||
case MISDN_CFG_NATPREFIX: GET_PORTCFG_STRCPY(nationalprefix);
|
||||
break;
|
||||
case MISDN_CFG_INTERNATPREFIX:
|
||||
|
@ -284,9 +305,12 @@ void misdn_cfg_get(int port, enum misdn_cfg_elements elem, void *buf, int bufsiz
|
|||
break;
|
||||
case MISDN_CFG_PRES: GET_PORTCFG_MEMCPY(pres);
|
||||
break;
|
||||
case MISDN_CFG_ALWAYS_IMMEDIATE:
|
||||
case MISDN_CFG_ALWAYS_IMMEDIATE:
|
||||
GET_PORTCFG_MEMCPY(always_immediate);
|
||||
break;
|
||||
case MISDN_CFG_SENDDTMF:
|
||||
GET_PORTCFG_MEMCPY(senddtmf);
|
||||
break;
|
||||
case MISDN_CFG_IMMEDIATE: GET_PORTCFG_MEMCPY(immediate);
|
||||
break;
|
||||
case MISDN_CFG_HOLD_ALLOWED:
|
||||
|
@ -361,7 +385,7 @@ int misdn_cfg_is_msn_valid (int port, char* msn) {
|
|||
else
|
||||
iter = port_cfg[0]->msn_list;
|
||||
for (; iter; iter = iter->next)
|
||||
if (*(iter->msn) == '*' || !strcasecmp(iter->msn, msn)) {
|
||||
if (*(iter->msn) == '*' || ast_extension_match(iter->msn, msn)) {
|
||||
misdn_cfg_unlock();
|
||||
return 1;
|
||||
}
|
||||
|
@ -518,8 +542,12 @@ void misdn_cfg_get_config_string(int port, enum misdn_cfg_elements elem, char* b
|
|||
case MISDN_CFG_GROUPNAME: GET_CFG_STRING(GROUPNAME, name);
|
||||
break;
|
||||
case MISDN_CFG_RXGAIN: GET_CFG_INT(RXGAIN, rxgain);
|
||||
break;
|
||||
case MISDN_CFG_TXGAIN: GET_CFG_INT(TXGAIN, txgain);
|
||||
break;
|
||||
case MISDN_CFG_TXGAIN: GET_CFG_INT(TXGAIN, txgain);
|
||||
case MISDN_CFG_JITTERBUFFER: GET_CFG_INT(JITTERBUFFER, jitterbuffer);
|
||||
break;
|
||||
case MISDN_CFG_JITTERBUFFER_UPPER_THRESHOLD: GET_CFG_INT(JITTERBUFFER_UPPER_THRESHOLD, jitterbuffer_upper_threshold);
|
||||
break;
|
||||
case MISDN_CFG_TE_CHOOSE_CHANNEL:
|
||||
GET_CFG_BOOL(TE_CHOOSE_CHANNEL, te_choose_channel, yes, no);
|
||||
|
@ -528,12 +556,16 @@ void misdn_cfg_get_config_string(int port, enum misdn_cfg_elements elem, char* b
|
|||
break;
|
||||
case MISDN_CFG_LANGUAGE: GET_CFG_STRING(LANGUAGE, language);
|
||||
break;
|
||||
case MISDN_CFG_MUSICCLASS: GET_CFG_STRING(MUSICCLASS, musicclass);
|
||||
break;
|
||||
case MISDN_CFG_CALLERID: GET_CFG_STRING(CALLERID, callerid);
|
||||
break;
|
||||
case MISDN_CFG_METHOD: GET_CFG_STRING(METHOD, method);
|
||||
break;
|
||||
case MISDN_CFG_DIALPLAN: GET_CFG_INT(DIALPLAN, dialplan);
|
||||
break;
|
||||
case MISDN_CFG_LOCALDIALPLAN: GET_CFG_INT(LOCALDIALPLAN, localdialplan);
|
||||
break;
|
||||
case MISDN_CFG_NATPREFIX: GET_CFG_STRING(NATIONALPREFIX, nationalprefix);
|
||||
break;
|
||||
case MISDN_CFG_INTERNATPREFIX:
|
||||
|
@ -541,9 +573,12 @@ void misdn_cfg_get_config_string(int port, enum misdn_cfg_elements elem, char* b
|
|||
break;
|
||||
case MISDN_CFG_PRES: GET_CFG_BOOL(PRESENTATION, pres, allowed, not_screened);
|
||||
break;
|
||||
case MISDN_CFG_ALWAYS_IMMEDIATE:
|
||||
case MISDN_CFG_ALWAYS_IMMEDIATE:
|
||||
GET_CFG_BOOL(ALWAYS_IMMEDIATE, always_immediate, yes, no);
|
||||
break;
|
||||
case MISDN_CFG_SENDDTMF:
|
||||
GET_CFG_BOOL(SENDDTMF, senddtmf, yes, no);
|
||||
break;
|
||||
case MISDN_CFG_IMMEDIATE: GET_CFG_BOOL(IMMEDIATE, immediate, yes, no);
|
||||
break;
|
||||
case MISDN_CFG_HOLD_ALLOWED:
|
||||
|
@ -771,50 +806,40 @@ static void build_port_config(struct ast_variable *v, char *cat) {
|
|||
|
||||
for (; v; v=v->next) {
|
||||
if (!strcasecmp(v->name, "ports")) {
|
||||
/* TODO check for value not beeing set, like PORTS= */
|
||||
char *iter;
|
||||
char *value = v->value;
|
||||
while ((iter = strchr(value, ',')) != NULL) {
|
||||
*iter = 0;
|
||||
/* strip spaces */
|
||||
while (*value && *value == ' ') {
|
||||
value++;
|
||||
}
|
||||
/* TODO check for char not 0-9 */
|
||||
|
||||
if (*value){
|
||||
int p = atoi(value);
|
||||
if (p <= max_ports && p > 0) {
|
||||
cfg_for_ports[p] = 1;
|
||||
if (strstr(value, "ptp"))
|
||||
ptp[p] = 1;
|
||||
char *value;
|
||||
char ptpbuf[BUFFERSIZE] = "";
|
||||
int start, end;
|
||||
for (value = strsep(&v->value, ","); value; value = strsep(&v->value, ","), *ptpbuf = 0) {
|
||||
if (!*value)
|
||||
continue;
|
||||
if (sscanf(value, "%d-%d%s", &start, &end, ptpbuf) >= 2) {
|
||||
for (; start <= end; start++) {
|
||||
if (start <= max_ports && start > 0) {
|
||||
cfg_for_ports[start] = 1;
|
||||
ptp[start] = (strstr(ptpbuf, "ptp")) ? 1 : 0;
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Port value '%s' of group '%s' invalid or out of range! Please edit your misdn.conf and then do a \"misdn reload\".\n", value, cat);
|
||||
}
|
||||
} else {
|
||||
if (sscanf(value, "%d%s", &start, ptpbuf)) {
|
||||
if (start <= max_ports && start > 0) {
|
||||
cfg_for_ports[start] = 1;
|
||||
ptp[start] = (strstr(ptpbuf, "ptp")) ? 1 : 0;
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Port value '%s' of group '%s' invalid or out of range! Please edit your misdn.conf and then do a \"misdn reload\".\n", value, cat);
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Port value \"%s\" of group %s invalid or out of range! Please edit your misdn.conf and then do a \"misdn reload\".\n", value, cat);
|
||||
value = ++iter;
|
||||
ast_log(LOG_ERROR, "Syntax error parsing token \"msns=%s\" at group '%s'! Please edit your misdn.conf and then do a \"misdn reload\".\n", value, cat);
|
||||
}
|
||||
}
|
||||
/* the remaining or the only one */
|
||||
/* strip spaces */
|
||||
while (*value && *value == ' ') {
|
||||
value++;
|
||||
}
|
||||
/* TODO check for char not 0-9 */
|
||||
if (*value) {
|
||||
int p = atoi(value);
|
||||
if (p <= max_ports && p > 0) {
|
||||
cfg_for_ports[p] = 1;
|
||||
if (strstr(value, "ptp"))
|
||||
ptp[p] = 1;
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Port value \"%s\" of group %s invalid or out of range! Please edit your misdn.conf and then do a \"misdn reload\".\n", value, cat);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
PARSE_CFG_STR(context);
|
||||
PARSE_CFG_INT(dialplan);
|
||||
PARSE_CFG_INT(localdialplan);
|
||||
PARSE_CFG_STR(nationalprefix);
|
||||
PARSE_CFG_STR(internationalprefix);
|
||||
PARSE_CFG_STR(language);
|
||||
PARSE_CFG_STR(musicclass);
|
||||
if (!strcasecmp(v->name, "presentation")) {
|
||||
if (v->value && strlen(v->value)) {
|
||||
new->pres = (int *)malloc(sizeof(int));
|
||||
|
@ -830,9 +855,12 @@ static void build_port_config(struct ast_variable *v, char *cat) {
|
|||
}
|
||||
PARSE_CFG_INT(rxgain);
|
||||
PARSE_CFG_INT(txgain);
|
||||
PARSE_CFG_INT(jitterbuffer);
|
||||
PARSE_CFG_INT(jitterbuffer_upper_threshold);
|
||||
PARSE_CFG_BOOL(te_choose_channel);
|
||||
PARSE_CFG_BOOL(immediate);
|
||||
PARSE_CFG_BOOL(always_immediate);
|
||||
PARSE_CFG_BOOL(senddtmf);
|
||||
PARSE_CFG_BOOL(hold_allowed);
|
||||
PARSE_CFG_BOOL(early_bconnect);
|
||||
PARSE_CFG_BOOL(use_callingpres);
|
||||
|
@ -842,38 +870,10 @@ static void build_port_config(struct ast_variable *v, char *cat) {
|
|||
PARSE_CFG_STR(callerid);
|
||||
PARSE_CFG_STR(method);
|
||||
if (!strcasecmp(v->name, "msns")) {
|
||||
/* TODO check for value not beeing set, like msns= */
|
||||
char *iter;
|
||||
char *value = v->value;
|
||||
|
||||
while ((iter = strchr(value, ',')) != NULL) {
|
||||
*iter = 0;
|
||||
/* strip spaces */
|
||||
while (*value && *value == ' ') {
|
||||
value++;
|
||||
}
|
||||
/* TODO check for char not 0-9 */
|
||||
if (*value){
|
||||
int l = strlen(value);
|
||||
if (l) {
|
||||
struct msn_list *ml = (struct msn_list *)calloc(1, sizeof(struct msn_list));
|
||||
ml->msn = (char *)calloc(l+1, sizeof(char));
|
||||
strncpy(ml->msn,value,l);
|
||||
ml->next = new->msn_list;
|
||||
new->msn_list = ml;
|
||||
}
|
||||
value = ++iter;
|
||||
}
|
||||
}
|
||||
/* the remaining or the only one */
|
||||
/* strip spaces */
|
||||
while (*value && *value == ' ') {
|
||||
value++;
|
||||
}
|
||||
/* TODO check for char not 0-9 */
|
||||
if (*value) {
|
||||
int l = strlen(value);
|
||||
if (l) {
|
||||
char *value;
|
||||
int l;
|
||||
for (value = strsep(&v->value, ","); value; value = strsep(&v->value, ",")) {
|
||||
if ((l = strlen(value))) {
|
||||
struct msn_list *ml = (struct msn_list *)calloc(1, sizeof(struct msn_list));
|
||||
ml->msn = (char *)calloc(l+1, sizeof(char));
|
||||
strncpy(ml->msn,value,l);
|
||||
|
@ -945,6 +945,10 @@ static void fill_defaults (void) {
|
|||
port_cfg[0]->rxgain = (int *)calloc(1, sizeof(int));
|
||||
if (!port_cfg[0]->txgain)
|
||||
port_cfg[0]->txgain = (int *)calloc(1, sizeof(int));
|
||||
if (!port_cfg[0]->jitterbuffer)
|
||||
port_cfg[0]->jitterbuffer = (int *)calloc(1, sizeof(int));
|
||||
if (!port_cfg[0]->jitterbuffer_upper_threshold)
|
||||
port_cfg[0]->jitterbuffer_upper_threshold = (int *)calloc(1, sizeof(int));
|
||||
if (!port_cfg[0]->te_choose_channel)
|
||||
port_cfg[0]->te_choose_channel = (int *)calloc(1, sizeof(int));
|
||||
if (!port_cfg[0]->context) {
|
||||
|
@ -955,6 +959,10 @@ static void fill_defaults (void) {
|
|||
port_cfg[0]->language = (char *)malloc(3 * sizeof(char));
|
||||
sprintf(port_cfg[0]->language, "en");
|
||||
}
|
||||
if (!port_cfg[0]->musicclass) {
|
||||
port_cfg[0]->musicclass = (char *)malloc(3 * sizeof(char));
|
||||
sprintf(port_cfg[0]->musicclass, "default");
|
||||
}
|
||||
if (!port_cfg[0]->callerid)
|
||||
port_cfg[0]->callerid = (char *)calloc(1, sizeof(char));
|
||||
if (!port_cfg[0]->method) {
|
||||
|
@ -963,6 +971,8 @@ static void fill_defaults (void) {
|
|||
}
|
||||
if (!port_cfg[0]->dialplan)
|
||||
port_cfg[0]->dialplan = (int *)calloc(1, sizeof(int));
|
||||
if (!port_cfg[0]->localdialplan)
|
||||
port_cfg[0]->localdialplan = (int *)calloc(1, sizeof(int));
|
||||
if (!port_cfg[0]->nationalprefix) {
|
||||
port_cfg[0]->nationalprefix = (char *)malloc(2 * sizeof(char));
|
||||
sprintf(port_cfg[0]->nationalprefix, "0");
|
||||
|
@ -977,6 +987,10 @@ static void fill_defaults (void) {
|
|||
}
|
||||
if (!port_cfg[0]->always_immediate)
|
||||
port_cfg[0]->always_immediate = (int *)calloc(1, sizeof(int));
|
||||
|
||||
if (!port_cfg[0]->senddtmf)
|
||||
port_cfg[0]->senddtmf = (int *)calloc(1, sizeof(int));
|
||||
|
||||
if (!port_cfg[0]->immediate)
|
||||
port_cfg[0]->immediate = (int *)calloc(1, sizeof(int));
|
||||
if (!port_cfg[0]->hold_allowed)
|
||||
|
|
|
@ -5,41 +5,30 @@
|
|||
#
|
||||
|
||||
# Verify those options with main Makefile
|
||||
ifndef LINUX
|
||||
LINUX=/lib/modules/$(shell uname -r)/build
|
||||
endif
|
||||
|
||||
CFLAGS += -pipe -c
|
||||
SOURCES = isdn_lib.c isdn_msg_parser.c
|
||||
OBJDIR = .
|
||||
OBJS = isdn_lib.o isdn_msg_parser.o
|
||||
|
||||
ifndef MISDNUSER
|
||||
MISDNUSER=/usr/src/install-misdn/mISDNuser
|
||||
endif
|
||||
|
||||
MISDNCFLAGS += -I$(MISDNUSER)/include -I$(MISDNUSER)/i4lnet -I$(MISDNUSER)/lib
|
||||
MISDNCFLAGS += -DMISDNUSER_JOLLY -I$(LINUX)/include
|
||||
OBJS = isdn_lib.o isdn_msg_parser.o fac.o
|
||||
|
||||
|
||||
all: chan_misdn_lib.a Makefile.ast
|
||||
all: chan_misdn_lib.a
|
||||
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(MISDNCFLAGS) $(CFLAGS) -o $@ $<
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
|
||||
chan_misdn_lib.a: $(OBJS)
|
||||
ar crv $@ $(OBJS)
|
||||
|
||||
Makefile.ast: FORCE
|
||||
@echo CFLAGS+=$(MISDNCFLAGS) -Imisdn/ -DCHAN_MISDN_VERSION=\\\"0.2.0\\\" >$@.tmp
|
||||
@echo MISDNUSER = $(MISDNUSER) >>$@.tmp
|
||||
@if [ -r $@ ] && cmp -s $@ $@.tmp; then rm -f $@.tmp; else mv -f $@.tmp $@; fi
|
||||
|
||||
|
||||
misdn:
|
||||
@mkdir -p lib
|
||||
cd lib ; cvs -d:pserver:anonymous:readonly@cvs.isdn4linux.de:/i4ldev co -r mqueue mISDN mISDNuser ;
|
||||
cd lib/mISDN ; make install
|
||||
cd lib/mISDNuser ; make install
|
||||
|
||||
FORCE:
|
||||
|
||||
|
||||
clean:
|
||||
rm *.a *.o Makefile.ast
|
||||
rm -rf *.a *.o *.so
|
||||
rm -rf lib
|
||||
|
|
|
@ -26,17 +26,22 @@ enum misdn_cfg_elements {
|
|||
MISDN_CFG_GROUPNAME, /* char[] */
|
||||
MISDN_CFG_RXGAIN, /* int */
|
||||
MISDN_CFG_TXGAIN, /* int */
|
||||
MISDN_CFG_JITTERBUFFER, /* int */
|
||||
MISDN_CFG_JITTERBUFFER_UPPER_THRESHOLD, /* int */
|
||||
MISDN_CFG_TE_CHOOSE_CHANNEL, /* int (bool) */
|
||||
MISDN_CFG_CONTEXT, /* char[] */
|
||||
MISDN_CFG_LANGUAGE, /* char[] */
|
||||
MISDN_CFG_MUSICCLASS, /* char[] */
|
||||
MISDN_CFG_CALLERID, /* char[] */
|
||||
MISDN_CFG_METHOD, /* char[] */
|
||||
MISDN_CFG_DIALPLAN, /* int */
|
||||
MISDN_CFG_LOCALDIALPLAN, /* int */
|
||||
MISDN_CFG_NATPREFIX, /* char[] */
|
||||
MISDN_CFG_INTERNATPREFIX, /* char[] */
|
||||
MISDN_CFG_PRES, /* int (bool) */
|
||||
MISDN_CFG_ALWAYS_IMMEDIATE, /* int (bool) */
|
||||
MISDN_CFG_IMMEDIATE, /* int (bool) */
|
||||
MISDN_CFG_SENDDTMF, /* int (bool) */
|
||||
MISDN_CFG_HOLD_ALLOWED, /* int (bool) */
|
||||
MISDN_CFG_EARLY_BCONNECT, /* int (bool) */
|
||||
MISDN_CFG_USE_CALLINGPRES, /* int (bool) */
|
||||
|
|
|
@ -0,0 +1,313 @@
|
|||
|
||||
#include "isdn_lib_intern.h"
|
||||
#include "isdn_lib.h"
|
||||
|
||||
#include "string.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#define CENTREX_ID 0xa1
|
||||
#define CALLDEFLECT_ID 0xa1
|
||||
|
||||
/**
|
||||
This file covers the encoding and decoding of facility messages and
|
||||
facility information elements.
|
||||
|
||||
There will be 2 Functions as Interface:
|
||||
|
||||
fac_enc( char **ntmsg, msg_t * msg, enum facility_type type, union facility fac, struct misdn_bchannel *bc)
|
||||
fac_dec( unsigned char *p, Q931_info_t *qi, enum facility_type *type, union facility *fac, struct misdn_bchannel *bc);
|
||||
|
||||
Those will either read the union facility or fill it.
|
||||
|
||||
internally, we will have deconding and encoding functions for each facility
|
||||
IE.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
/* support stuff */
|
||||
static void strnncpy(unsigned char *dest, unsigned char *src, int len, int dst_len)
|
||||
{
|
||||
if (len > dst_len-1)
|
||||
len = dst_len-1;
|
||||
strncpy((char *)dest, (char *)src, len);
|
||||
dest[len] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************/
|
||||
/*** FACILITY STUFF ***/
|
||||
/**********************/
|
||||
|
||||
|
||||
/* IE_FACILITY */
|
||||
void enc_ie_facility(unsigned char **ntmode, msg_t *msg, unsigned char *facility, int facility_len, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
unsigned char *p;
|
||||
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
|
||||
int l;
|
||||
|
||||
|
||||
if (!facility || facility_len<=0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
l = facility_len;
|
||||
p = msg_put(msg, l+2);
|
||||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->QI_ELEMENT(facility) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_FACILITY;
|
||||
p[1] = l;
|
||||
memcpy(p+2, facility, facility_len);
|
||||
}
|
||||
|
||||
|
||||
/* facility for siemens CENTEX (known parts implemented only) */
|
||||
void enc_ie_facility_centrex(unsigned char **ntmode, msg_t *msg, unsigned char *cnip, int setup, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
unsigned char centrex[256];
|
||||
int i = 0;
|
||||
|
||||
if (!cnip)
|
||||
return;
|
||||
|
||||
/* centrex facility */
|
||||
centrex[i++] = FACILITY_CENTREX;
|
||||
centrex[i++] = CENTREX_ID;
|
||||
|
||||
/* cnip */
|
||||
if (strlen((char *)cnip) > 15)
|
||||
{
|
||||
/* if (options.deb & DEBUG_PORT) */
|
||||
cb_log(1,0,"%s: CNIP/CONP text too long (max 13 chars), cutting.\n", __FUNCTION__);
|
||||
cnip[15] = '\0';
|
||||
}
|
||||
/* dunno what the 8 bytes mean */
|
||||
if (setup)
|
||||
{
|
||||
centrex[i++] = 0x17;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x44;
|
||||
centrex[i++] = 0x18;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x01;
|
||||
centrex[i++] = 0x09;
|
||||
} else
|
||||
{
|
||||
centrex[i++] = 0x18;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x81;
|
||||
centrex[i++] = 0x09;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x01;
|
||||
centrex[i++] = 0x0a;
|
||||
}
|
||||
|
||||
centrex[i++] = 0x80;
|
||||
centrex[i++] = strlen((char *)cnip);
|
||||
strcpy((char *)(¢rex[i]), (char *)cnip);
|
||||
i += strlen((char *)cnip);
|
||||
cb_log(4,0," cnip='%s'\n", cnip);
|
||||
|
||||
/* encode facility */
|
||||
enc_ie_facility(ntmode, msg, centrex, i, nt , bc);
|
||||
}
|
||||
|
||||
void dec_ie_facility_centrex(unsigned char *p, Q931_info_t *qi, unsigned char *centrex, int facility_len, unsigned char *cnip, int cnip_len, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
|
||||
int i = 0;
|
||||
*cnip = '\0';
|
||||
|
||||
if (facility_len >= 2)
|
||||
{
|
||||
if (centrex[i++] != FACILITY_CENTREX)
|
||||
return;
|
||||
if (centrex[i++] != CENTREX_ID)
|
||||
return;
|
||||
}
|
||||
|
||||
/* loop sub IEs of facility */
|
||||
while(facility_len > i+1)
|
||||
{
|
||||
if (centrex[i+1]+i+1 > facility_len)
|
||||
{
|
||||
printf("%s: ERROR: short read of centrex facility.\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
switch(centrex[i])
|
||||
{
|
||||
case 0x80:
|
||||
strnncpy(cnip, ¢rex[i+2], centrex[i+1], cnip_len);
|
||||
cb_log(4,0," CENTREX cnip='%s'\n", cnip);
|
||||
break;
|
||||
}
|
||||
i += 1+centrex[i+1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* facility for CALL Deflect (known parts implemented only) */
|
||||
void enc_ie_facility_calldeflect(unsigned char **ntmode, msg_t *msg, unsigned char *nr, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
unsigned char fac[256];
|
||||
|
||||
if (!nr)
|
||||
return;
|
||||
|
||||
int len = strlen(nr);
|
||||
/* calldeflect facility */
|
||||
|
||||
/* cnip */
|
||||
if (strlen((char *)nr) > 15)
|
||||
{
|
||||
/* if (options.deb & DEBUG_PORT) */
|
||||
cb_log(1,0,"%s: NR text too long (max 13 chars), cutting.\n", __FUNCTION__);
|
||||
nr[15] = '\0';
|
||||
}
|
||||
|
||||
fac[0]=FACILITY_CALLDEFLECT; // ..
|
||||
fac[1]=CALLDEFLECT_ID;
|
||||
fac[2]=0x0f + len; // strlen destination + 15 = 26
|
||||
fac[3]=0x02;
|
||||
fac[4]=0x01;
|
||||
//fac[5]=0x70;
|
||||
fac[5]=0x09;
|
||||
fac[6]=0x02;
|
||||
fac[7]=0x01;
|
||||
fac[8]=0x0d;
|
||||
fac[9]=0x30;
|
||||
fac[10]=0x07 + len; // strlen destination + 7 = 18
|
||||
fac[11]=0x30; // ...hm 0x30
|
||||
fac[12]=0x02+ len; // strlen destination + 2
|
||||
fac[13]=0x80; // CLIP
|
||||
fac[14]= len; // strlen destination
|
||||
|
||||
memcpy((unsigned char *)fac+15,nr,len);
|
||||
fac[15+len]=0x01; //sending complete
|
||||
fac[16+len]=0x01;
|
||||
fac[17+len]=0x80;
|
||||
|
||||
enc_ie_facility(ntmode, msg, fac, 17+len +1 , nt , bc);
|
||||
}
|
||||
|
||||
|
||||
void dec_ie_facility_calldeflect(unsigned char *p, Q931_info_t *qi, unsigned char *fac, int fac_len, unsigned char *cd_nr, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
*cd_nr = '\0';
|
||||
|
||||
if (fac_len >= 15)
|
||||
{
|
||||
if (fac[0] != FACILITY_CALLDEFLECT)
|
||||
return;
|
||||
if (fac[1] != CALLDEFLECT_ID)
|
||||
return;
|
||||
} else {
|
||||
cb_log(1,bc->port, "IE too short: FAC_CALLDEFLECT\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
int dest_len=fac[2]-0x0f;
|
||||
|
||||
if (dest_len <0 || dest_len > 15) {
|
||||
cb_log(1,bc->port, "IE is garbage: FAC_CALLDEFLECT\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
if (fac_len < 15+dest_len) {
|
||||
cb_log(1,bc->port, "IE too short: FAC_CALLDEFLECT\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
memcpy(cd_nr, &fac[15],dest_len);
|
||||
cd_nr[dest_len]=0;
|
||||
|
||||
cb_log(5,bc->port, "--> IE CALLDEFLECT NR: %s\n",cd_nr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void fac_enc( unsigned char **ntmsg, msg_t * msg, enum facility_type type, union facility fac, struct misdn_bchannel *bc)
|
||||
{
|
||||
switch (type) {
|
||||
case FACILITY_CENTREX:
|
||||
{
|
||||
int setup=0;
|
||||
enc_ie_facility_centrex(ntmsg, msg, fac.cnip, setup, bc->nt, bc);
|
||||
}
|
||||
break;
|
||||
case FACILITY_CALLDEFLECT:
|
||||
enc_ie_facility_calldeflect(ntmsg, msg, fac.calldeflect_nr, bc->nt, bc);
|
||||
break;
|
||||
default:
|
||||
cb_log(1,0,"Don't know how handle this facility: %d\n", type);
|
||||
}
|
||||
}
|
||||
|
||||
void fac_dec( unsigned char *p, Q931_info_t *qi, enum facility_type *type, union facility *fac, struct misdn_bchannel *bc)
|
||||
{
|
||||
int i, fac_len=0;
|
||||
unsigned char facility[256];
|
||||
|
||||
if (! (bc->nt) )
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->QI_ELEMENT(facility))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(facility) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
fac_len = p[0];
|
||||
memcpy(facility, p+1, fac_len);
|
||||
|
||||
|
||||
switch(facility[0]) {
|
||||
case FACILITY_CENTREX:
|
||||
{
|
||||
int cnip_len=15;
|
||||
|
||||
dec_ie_facility_centrex(p, qi,facility, fac_len, fac->cnip, cnip_len, bc->nt, bc);
|
||||
|
||||
*type=FACILITY_CENTREX;
|
||||
}
|
||||
break;
|
||||
case FACILITY_CALLDEFLECT:
|
||||
dec_ie_facility_calldeflect(p, qi,facility, fac_len, fac->calldeflect_nr, bc->nt, bc);
|
||||
|
||||
*type=FACILITY_CALLDEFLECT;
|
||||
break;
|
||||
default:
|
||||
cb_log(3, bc->port, "Unknown Facility received: ");
|
||||
i = 0;
|
||||
while(i < fac_len)
|
||||
{
|
||||
cb_log(3, bc->port, " %02x", facility[i]);
|
||||
i++;
|
||||
}
|
||||
cb_log(3, bc->port, " facility\n");
|
||||
|
||||
*type=FACILITY_NONE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*** FACILITY END **/
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef FAC_H
|
||||
#define FAC_H
|
||||
|
||||
void fac_enc( unsigned char **ntmsg, msg_t * msg, enum facility_type type, union facility fac, struct misdn_bchannel *bc);
|
||||
|
||||
void fac_dec( unsigned char *p, Q931_info_t *qi, enum facility_type *type, union facility *fac, struct misdn_bchannel *bc);
|
||||
|
||||
#endif
|
|
@ -23,17 +23,12 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "isdn_lib_intern.h"
|
||||
|
||||
#include <mISDNlib.h>
|
||||
#include <isdn_net.h>
|
||||
#include <l3dss1.h>
|
||||
#include <net_l3.h>
|
||||
#include <mISDNuser/mISDNlib.h>
|
||||
#include <mISDNuser/isdn_net.h>
|
||||
#include <mISDNuser/l3dss1.h>
|
||||
#include <mISDNuser/net_l3.h>
|
||||
|
||||
|
||||
#define CENTREX_FAC 0x88
|
||||
#define CENTREX_ID 0xa1
|
||||
|
||||
#define MISDN_IE_DEBG 0
|
||||
|
||||
|
@ -69,7 +64,8 @@ void enc_ie_complete(unsigned char **ntmode, msg_t *msg, int complete, int nt, s
|
|||
{
|
||||
*ntmode = p;
|
||||
} else
|
||||
qi->sending_complete = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(sending_complete) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
|
||||
p[0] = IE_COMPLETE;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +75,7 @@ void dec_ie_complete(unsigned char *p, Q931_info_t *qi, int *complete, int nt, s
|
|||
*complete = 0;
|
||||
if (!nt)
|
||||
{
|
||||
if (qi->sending_complete)
|
||||
if (qi->QI_ELEMENT(sending_complete))
|
||||
*complete = 1;
|
||||
} else
|
||||
if (p)
|
||||
|
@ -140,7 +136,7 @@ void enc_ie_bearer(unsigned char **ntmode, msg_t *msg, int coding, int capabilit
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->bearer_capability = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(bearer_capability) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_BEARER;
|
||||
p[1] = l;
|
||||
p[2] = 0x80 + (coding<<5) + capability;
|
||||
|
@ -170,10 +166,10 @@ void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *capabili
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->llc)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->llc + 1;
|
||||
else if (qi->bearer_capability)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->bearer_capability + 1;
|
||||
if (qi->QI_ELEMENT(llc))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(llc) + 1;
|
||||
else if (qi->QI_ELEMENT(bearer_capability))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(bearer_capability) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -292,7 +288,7 @@ void enc_ie_call_id(unsigned char **ntmode, msg_t *msg, unsigned char *callid, i
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->call_id = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(call_id) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CALL_ID;
|
||||
p[1] = l;
|
||||
memcpy(p+2, callid, callid_len);
|
||||
|
@ -308,8 +304,8 @@ void dec_ie_call_id(unsigned char *p, Q931_info_t *qi, unsigned char *callid, in
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->call_id)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->call_id + 1;
|
||||
if (qi->QI_ELEMENT(call_id))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(call_id) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -363,7 +359,7 @@ void enc_ie_called_pn(unsigned char **ntmode, msg_t *msg, int type, int plan, un
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->called_nr = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(called_nr) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CALLED_PN;
|
||||
p[1] = l;
|
||||
p[2] = 0x80 + (type<<4) + plan;
|
||||
|
@ -379,8 +375,8 @@ void dec_ie_called_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, u
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->called_nr)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->called_nr + 1;
|
||||
if (qi->QI_ELEMENT(called_nr))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(called_nr) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -437,7 +433,7 @@ void enc_ie_calling_pn(unsigned char **ntmode, msg_t *msg, int type, int plan, i
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->calling_nr = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(calling_nr) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CALLING_PN;
|
||||
p[1] = l;
|
||||
if (present >= 0)
|
||||
|
@ -465,8 +461,8 @@ void dec_ie_calling_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan,
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->calling_nr)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->calling_nr + 1;
|
||||
if (qi->QI_ELEMENT(calling_nr))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(calling_nr) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -539,7 +535,7 @@ void enc_ie_connected_pn(unsigned char **ntmode, msg_t *msg, int type, int plan,
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->connected_nr = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(connected_nr) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CONNECT_PN;
|
||||
p[1] = l;
|
||||
if (present >= 0)
|
||||
|
@ -567,8 +563,8 @@ void dec_ie_connected_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->connected_nr)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->connected_nr + 1;
|
||||
if (qi->QI_ELEMENT(connected_nr))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(connected_nr) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -624,7 +620,7 @@ void enc_ie_cause(unsigned char **ntmode, msg_t *msg, int location, int cause, i
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->cause = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(cause) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CAUSE;
|
||||
p[1] = l;
|
||||
p[2] = 0x80 + location;
|
||||
|
@ -637,7 +633,7 @@ void enc_ie_cause_standalone(unsigned char **ntmode, msg_t *msg, int location, i
|
|||
if (ntmode)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->cause = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(cause) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CAUSE;
|
||||
p[1] = 2;
|
||||
p[2] = 0x80 + location;
|
||||
|
@ -653,8 +649,8 @@ void dec_ie_cause(unsigned char *p, Q931_info_t *qi, int *location, int *cause,
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->cause)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->cause + 1;
|
||||
if (qi->QI_ELEMENT(cause))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(cause) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -705,7 +701,7 @@ void enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive, int ch
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->channel_id = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(channel_id) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CHANNEL_ID;
|
||||
p[1] = l;
|
||||
if (channel == 0xff)
|
||||
|
@ -725,7 +721,7 @@ void enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive, int ch
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->channel_id = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(channel_id) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CHANNEL_ID;
|
||||
p[1] = l;
|
||||
p[2] = 0x80 + 0x20 + 0x03;
|
||||
|
@ -737,7 +733,7 @@ void enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive, int ch
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->channel_id = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(channel_id) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_CHANNEL_ID;
|
||||
p[1] = l;
|
||||
p[2] = 0x80 + 0x20 + (exclusive<<3) + 0x01;
|
||||
|
@ -758,8 +754,8 @@ void dec_ie_channel_id(unsigned char *p, Q931_info_t *qi, int *exclusive, int *c
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->channel_id)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->channel_id + 1;
|
||||
if (qi->QI_ELEMENT(channel_id))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(channel_id) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -863,7 +859,7 @@ void enc_ie_date(unsigned char **ntmode, msg_t *msg, time_t ti, int nt, struct m
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->date = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(date) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_DATE;
|
||||
p[1] = l;
|
||||
p[2] = tm->tm_year % 100;
|
||||
|
@ -900,7 +896,7 @@ void enc_ie_display(unsigned char **ntmode, msg_t *msg, unsigned char *display,
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->display = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(display) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_DISPLAY;
|
||||
p[1] = l;
|
||||
strncpy((char *)p+2, (char *)display, strlen((char *)display));
|
||||
|
@ -913,8 +909,8 @@ void dec_ie_display(unsigned char *p, Q931_info_t *qi, unsigned char *display, i
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->display)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->display + 1;
|
||||
if (qi->QI_ELEMENT(display))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(display) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -950,7 +946,7 @@ void enc_ie_keypad(unsigned char **ntmode, msg_t *msg, unsigned char *keypad, in
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->keypad = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(keypad) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_KEYPAD;
|
||||
p[1] = l;
|
||||
strncpy((char *)p+2, (char *)keypad, strlen((char *)keypad));
|
||||
|
@ -963,8 +959,8 @@ void dec_ie_keypad(unsigned char *p, Q931_info_t *qi, unsigned char *keypad, int
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->keypad)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->keypad + 1;
|
||||
if (qi->QI_ELEMENT(keypad))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(keypad) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -1000,7 +996,7 @@ void enc_ie_notify(unsigned char **ntmode, msg_t *msg, int notify, int nt, struc
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->notify = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(notify) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_NOTIFY;
|
||||
p[1] = l;
|
||||
p[2] = 0x80 + notify;
|
||||
|
@ -1013,8 +1009,8 @@ void dec_ie_notify(unsigned char *p, Q931_info_t *qi, int *notify, int nt, struc
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->notify)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->notify + 1;
|
||||
if (qi->QI_ELEMENT(notify))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(notify) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -1060,7 +1056,7 @@ void enc_ie_progress(unsigned char **ntmode, msg_t *msg, int coding, int locatio
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->progress = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(progress) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_PROGRESS;
|
||||
p[1] = l;
|
||||
p[2] = 0x80 + (coding<<5) + location;
|
||||
|
@ -1077,8 +1073,8 @@ void dec_ie_progress(unsigned char *p, Q931_info_t *qi, int *coding, int *locati
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->progress)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->progress + 1;
|
||||
if (qi->QI_ELEMENT(progress))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(progress) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -1092,7 +1088,8 @@ void dec_ie_progress(unsigned char *p, Q931_info_t *qi, int *coding, int *locati
|
|||
*location = p[1] & 0x0f;
|
||||
*progress = p[2] & 0x7f;
|
||||
|
||||
if (MISDN_IE_DEBG) printf(" coding=%d location=%d progress=%d\n", *coding, *location, *progress);
|
||||
//if (MISDN_IE_DEBG) printf(" coding=%d location=%d progress=%d\n", *coding, *location, *progress);
|
||||
if (1) printf(" coding=%d location=%d progress=%d\n", *coding, *location, *progress);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1144,7 +1141,7 @@ void enc_ie_redir_nr(unsigned char **ntmode, msg_t *msg, int type, int plan, int
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->redirect_nr = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(redirect_nr) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_REDIR_NR;
|
||||
p[1] = l;
|
||||
if (present >= 0)
|
||||
|
@ -1183,8 +1180,8 @@ void dec_ie_redir_nr(unsigned char *p, Q931_info_t *qi, int *type, int *plan, in
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->redirect_nr)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->redirect_nr + 1;
|
||||
if (qi->QI_ELEMENT(redirect_nr))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(redirect_nr) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -1252,7 +1249,7 @@ void enc_ie_redir_dn(unsigned char **ntmode, msg_t *msg, int type, int plan, int
|
|||
*ntmode = p+1;
|
||||
else
|
||||
/* #warning REINSERT redir_dn, when included in te-mode */
|
||||
/*qi->redir_dn = p - (unsigned char *)qi - sizeof(Q931_info_t)*/;
|
||||
/*qi->QI_ELEMENT(redir_dn) = p - (unsigned char *)qi - sizeof(Q931_info_t)*/;
|
||||
p[0] = IE_REDIR_DN;
|
||||
p[1] = l;
|
||||
if (present >= 0)
|
||||
|
@ -1280,8 +1277,8 @@ void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, in
|
|||
{
|
||||
p = NULL;
|
||||
/* #warning REINSERT redir_dn, when included in te-mode */
|
||||
/* if (qi->redir_dn) */
|
||||
/* p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->redir_dn + 1; */
|
||||
/* if (qi->QI_ELEMENT(redir_dn)) */
|
||||
/* p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(redir_dn) + 1; */
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -1306,242 +1303,6 @@ void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, in
|
|||
}
|
||||
|
||||
|
||||
/* IE_FACILITY */
|
||||
void enc_ie_facility(unsigned char **ntmode, msg_t *msg, unsigned char *facility, int facility_len, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
unsigned char *p;
|
||||
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
|
||||
int l;
|
||||
|
||||
char debug[768];
|
||||
int i;
|
||||
|
||||
if (!facility || facility_len<=0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while(i < facility_len)
|
||||
{
|
||||
if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", facility[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (MISDN_IE_DEBG) printf(" facility%s\n", debug);
|
||||
|
||||
l = facility_len;
|
||||
p = msg_put(msg, l+2);
|
||||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->facility = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_FACILITY;
|
||||
p[1] = l;
|
||||
memcpy(p+2, facility, facility_len);
|
||||
}
|
||||
|
||||
void dec_ie_facility(unsigned char *p, Q931_info_t *qi, unsigned char *facility, int *facility_len, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
int i;
|
||||
struct misdn_stack *stack=get_stack_by_bc(bc);
|
||||
|
||||
*facility_len = 0;
|
||||
|
||||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->facility)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->facility + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
*facility_len = p[0];
|
||||
memcpy(facility, p+1, *facility_len);
|
||||
|
||||
i = 0;
|
||||
while(i < *facility_len)
|
||||
{
|
||||
cb_log(3, stack->port, " %02x", facility[i]);
|
||||
i++;
|
||||
}
|
||||
cb_log(3, stack->port, " facility\n");
|
||||
}
|
||||
|
||||
|
||||
/* facility for siemens CENTEX (known parts implemented only) */
|
||||
void enc_facility_centrex(unsigned char **ntmode, msg_t *msg, unsigned char *cnip, int setup, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
unsigned char centrex[256];
|
||||
int i = 0;
|
||||
|
||||
if (!cnip)
|
||||
return;
|
||||
|
||||
/* centrex facility */
|
||||
centrex[i++] = CENTREX_FAC;
|
||||
centrex[i++] = CENTREX_ID;
|
||||
|
||||
/* cnip */
|
||||
if (strlen((char *)cnip) > 15)
|
||||
{
|
||||
/* if (options.deb & DEBUG_PORT) */
|
||||
if (MISDN_IE_DEBG) printf("%s: CNIP/CONP text too long (max 13 chars), cutting.\n", __FUNCTION__);
|
||||
cnip[15] = '\0';
|
||||
}
|
||||
/* dunno what the 8 bytes mean */
|
||||
if (setup)
|
||||
{
|
||||
centrex[i++] = 0x17;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x44;
|
||||
centrex[i++] = 0x18;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x01;
|
||||
centrex[i++] = 0x09;
|
||||
} else
|
||||
{
|
||||
centrex[i++] = 0x18;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x81;
|
||||
centrex[i++] = 0x09;
|
||||
centrex[i++] = 0x02;
|
||||
centrex[i++] = 0x01;
|
||||
centrex[i++] = 0x0a;
|
||||
}
|
||||
|
||||
centrex[i++] = 0x80;
|
||||
centrex[i++] = strlen((char *)cnip);
|
||||
strcpy((char *)(¢rex[i]), (char *)cnip);
|
||||
i += strlen((char *)cnip);
|
||||
if (MISDN_IE_DEBG) printf(" cnip='%s'\n", cnip);
|
||||
|
||||
/* encode facility */
|
||||
enc_ie_facility(ntmode, msg, centrex, i, nt , bc);
|
||||
}
|
||||
|
||||
void dec_facility_centrex(unsigned char *p, Q931_info_t *qi, unsigned char *cnip, int cnip_len, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
unsigned char centrex[256];
|
||||
char debug[768];
|
||||
int facility_len = 0;
|
||||
int i = 0, j;
|
||||
*cnip = '\0';
|
||||
|
||||
dec_ie_facility(p, qi, centrex, &facility_len, nt, bc);
|
||||
if (facility_len >= 2)
|
||||
{
|
||||
if (centrex[i++] != CENTREX_FAC)
|
||||
return;
|
||||
if (centrex[i++] != CENTREX_ID)
|
||||
return;
|
||||
}
|
||||
|
||||
/* loop sub IEs of facility */
|
||||
while(facility_len > i+1)
|
||||
{
|
||||
if (centrex[i+1]+i+1 > facility_len)
|
||||
{
|
||||
printf("%s: ERROR: short read of centrex facility.\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
switch(centrex[i])
|
||||
{
|
||||
case 0x80:
|
||||
strnncpy(cnip, ¢rex[i+2], centrex[i+1], cnip_len);
|
||||
if (MISDN_IE_DEBG) printf(" CENTREX cnip='%s'\n", cnip);
|
||||
break;
|
||||
|
||||
default:
|
||||
j = 0;
|
||||
while(j < centrex[i+1])
|
||||
{
|
||||
if (MISDN_IE_DEBG) printf(debug+(j*3), " %02x", centrex[i+1+j]);
|
||||
i++;
|
||||
}
|
||||
if (MISDN_IE_DEBG) printf(" CENTREX unknown=0x%2x len=%d%s\n", centrex[i], centrex[i+1], debug);
|
||||
}
|
||||
i += 1+centrex[i+1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* facility for siemens CENTEX (known parts implemented only) */
|
||||
void enc_facility_calldeflect(unsigned char **ntmode, msg_t *msg, unsigned char *nr, int nt, struct misdn_bchannel *bc)
|
||||
{
|
||||
unsigned char fac[256];
|
||||
|
||||
if (!nr)
|
||||
return;
|
||||
|
||||
/* calldeflect facility */
|
||||
|
||||
/* cnip */
|
||||
if (strlen((char *)nr) > 15)
|
||||
{
|
||||
/* if (options.deb & DEBUG_PORT) */
|
||||
if (MISDN_IE_DEBG) printf("%s: NR text too long (max 13 chars), cutting.\n", __FUNCTION__);
|
||||
nr[15] = '\0';
|
||||
}
|
||||
|
||||
fac[0]=0; // len
|
||||
fac[1]=0; //len
|
||||
fac[2]=0x01; // Use D-Chan
|
||||
fac[3]=0; // Keypad len
|
||||
fac[4]=31; // user user data? len = 31 = 29 + 2
|
||||
fac[5]=0x1c; // magic?
|
||||
fac[6]=0x1d; // strlen destination + 18 = 29
|
||||
fac[7]=0x91; // ..
|
||||
fac[8]=0xA1;
|
||||
fac[9]=0x1A; // strlen destination + 15 = 26
|
||||
fac[10]=0x02;
|
||||
fac[11]=0x01;
|
||||
fac[12]=0x70;
|
||||
fac[13]=0x02;
|
||||
fac[14]=0x01;
|
||||
fac[15]=0x0d;
|
||||
fac[16]=0x30;
|
||||
fac[17]=0x12; // strlen destination + 7 = 18
|
||||
fac[18]=0x30; // ...hm 0x30
|
||||
fac[19]=0x0d; // strlen destination + 2
|
||||
fac[20]=0x80; // CLIP
|
||||
fac[21]=0x0b; // strlen destination
|
||||
fac[22]=0x01; // destination start
|
||||
fac[23]=0x01; //
|
||||
fac[24]=0x01; //
|
||||
fac[25]=0x01; //
|
||||
fac[26]=0x01; //
|
||||
fac[27]=0x01; //
|
||||
fac[28]=0x01; //
|
||||
fac[29]=0x01; //
|
||||
fac[30]=0x01; //
|
||||
fac[31]=0x01; //
|
||||
fac[32]=0x01; //
|
||||
fac[33]=0x01; // 0x1 = sending complete
|
||||
fac[34]=0x01;
|
||||
fac[35]=0x01;
|
||||
|
||||
memcpy((unsigned char *)fac+22,nr,strlen(nr));
|
||||
fac[22+strlen( nr)]=0x01; // fill with 0x01 if number is only 6 numbers (local call)
|
||||
fac[23+strlen(nr)]=0x01;
|
||||
fac[24+strlen(nr)]=0x01;
|
||||
fac[25+strlen(nr)]=0x01;
|
||||
fac[26+strlen(nr)]=0x01;
|
||||
|
||||
fac[6]=18+strlen(nr);
|
||||
fac[9]=15+strlen(nr);
|
||||
fac[17]=7+strlen(nr);
|
||||
fac[19]=2+strlen(nr);
|
||||
fac[21]=strlen(nr);
|
||||
|
||||
enc_ie_facility(ntmode, msg, &fac[4], 36-4, nt , bc);
|
||||
}
|
||||
|
||||
|
||||
/* IE_USERUSER */
|
||||
void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, unsigned char *user, int user_len, int nt, struct misdn_bchannel *bc)
|
||||
|
@ -1577,7 +1338,7 @@ void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, unsigned
|
|||
if (nt)
|
||||
*ntmode = p+1;
|
||||
else
|
||||
qi->useruser = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
qi->QI_ELEMENT(useruser) = p - (unsigned char *)qi - sizeof(Q931_info_t);
|
||||
p[0] = IE_USER_USER;
|
||||
p[1] = l;
|
||||
p[2] = 0x80 + protocol;
|
||||
|
@ -1595,8 +1356,8 @@ void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, unsigned
|
|||
if (!nt)
|
||||
{
|
||||
p = NULL;
|
||||
if (qi->useruser)
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->useruser + 1;
|
||||
if (qi->QI_ELEMENT(useruser))
|
||||
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(useruser) + 1;
|
||||
}
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -1619,3 +1380,5 @@ void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, unsigned
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,11 +14,13 @@
|
|||
#ifndef TE_LIB
|
||||
#define TE_LIB
|
||||
|
||||
|
||||
/** For initialization usage **/
|
||||
/* typedef int ie_nothing_t ;*/
|
||||
/** end of init usage **/
|
||||
|
||||
|
||||
|
||||
#define MAX_BCHANS 30
|
||||
|
||||
enum bc_state_e {
|
||||
|
@ -144,9 +146,19 @@ enum layer_e {
|
|||
UNKNOWN
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** FACILITY STUFF **/
|
||||
|
||||
enum facility_type {
|
||||
FACILITY_NONE,
|
||||
FACILITY_CALLDEFLECT
|
||||
FACILITY_CALLDEFLECT=0x91,
|
||||
FACILITY_CENTREX=0x88
|
||||
};
|
||||
|
||||
union facility {
|
||||
char calldeflect_nr[15];
|
||||
char cnip[256];
|
||||
};
|
||||
|
||||
|
||||
|
@ -161,7 +173,8 @@ struct misdn_bchannel {
|
|||
/* int b_addr; */
|
||||
int layer_id;
|
||||
|
||||
|
||||
int layer;
|
||||
|
||||
|
||||
/** var stuff**/
|
||||
int l3_id;
|
||||
|
@ -180,10 +193,11 @@ struct misdn_bchannel {
|
|||
|
||||
|
||||
void *astbuf;
|
||||
|
||||
void *misdnbuf;
|
||||
|
||||
|
||||
int te_choose_channel;
|
||||
int early_bconnect;
|
||||
|
||||
/* dtmf digit */
|
||||
int dtmf;
|
||||
|
@ -203,8 +217,11 @@ struct misdn_bchannel {
|
|||
int progress_location;
|
||||
int progress_indicator;
|
||||
|
||||
enum facility_type facility;
|
||||
char facility_calldeflect_nr[15];
|
||||
enum facility_type fac_type;
|
||||
union facility fac;
|
||||
|
||||
enum facility_type out_fac_type;
|
||||
union facility out_fac;
|
||||
|
||||
enum event_e evq;
|
||||
|
||||
|
@ -255,14 +272,14 @@ struct misdn_bchannel {
|
|||
unsigned char dad[32];
|
||||
unsigned char orig_dad[32];
|
||||
unsigned char keypad[32];
|
||||
|
||||
|
||||
unsigned char info_dad[64];
|
||||
unsigned char infos_pending[64];
|
||||
unsigned char info_keypad[32];
|
||||
unsigned char clisub[24];
|
||||
unsigned char cldsub[24];
|
||||
unsigned char fac[132];
|
||||
unsigned char uu[256];
|
||||
|
||||
/* unsigned char info_keypad[32]; */
|
||||
/* unsigned char clisub[24]; */
|
||||
/* unsigned char cldsub[24]; */
|
||||
/* unsigned char uu[256]; */
|
||||
|
||||
int cause;
|
||||
int out_cause;
|
||||
|
@ -288,11 +305,13 @@ struct misdn_bchannel {
|
|||
enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data);
|
||||
void (*cb_log) (int level, int port, char *tmpl, ...);
|
||||
int (*cb_clearl3_true)(void);
|
||||
int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
|
||||
|
||||
struct misdn_lib_iface {
|
||||
|
||||
enum event_response_e (*cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data);
|
||||
void (*cb_log)(int level, int port, char *tmpl, ...);
|
||||
int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
|
||||
int (*cb_clearl3_true)(void);
|
||||
};
|
||||
|
||||
|
@ -312,7 +331,9 @@ struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel);
|
|||
|
||||
void manager_bchannel_activate(struct misdn_bchannel *bc);
|
||||
void manager_bchannel_deactivate(struct misdn_bchannel * bc);
|
||||
int manager_tx2misdn_frm(struct misdn_bchannel *bc, void *data, int len);
|
||||
|
||||
int misdn_lib_tx2misdn_frm(struct misdn_bchannel *bc, void *data, int len);
|
||||
|
||||
void manager_send_tone (struct misdn_bchannel *bc, enum tone_e tone);
|
||||
|
||||
void manager_ph_control(struct misdn_bchannel *bc, int c1, int c2);
|
||||
|
@ -338,6 +359,7 @@ int misdn_lib_send_facility(struct misdn_bchannel *bc, enum facility_type fac, v
|
|||
void manager_ec_enable(struct misdn_bchannel *bc);
|
||||
void manager_ec_disable(struct misdn_bchannel *bc);
|
||||
|
||||
|
||||
void get_show_stack_details(int port, char *buf);
|
||||
|
||||
|
||||
|
@ -347,6 +369,10 @@ int misdn_ibuf_freecount(void *buf);
|
|||
void misdn_ibuf_memcpy_r(char *to, void *from, int len);
|
||||
void misdn_ibuf_memcpy_w(void *buf, char *from, int len);
|
||||
|
||||
void misdn_free_ibuffer(void *ibuf);
|
||||
void misdn_clear_ibuffer(void *ibuf);
|
||||
void *misdn_init_ibuffer(int len);
|
||||
|
||||
/** Ibuf interface End **/
|
||||
|
||||
void misdn_lib_setup_bc(struct misdn_bchannel *bc);
|
||||
|
@ -354,6 +380,7 @@ void misdn_lib_setup_bc(struct misdn_bchannel *bc);
|
|||
void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
|
||||
void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
|
||||
|
||||
unsigned char * flip_buf_bits ( unsigned char * buf , int len);
|
||||
|
||||
int misdn_lib_is_ptp(int port);
|
||||
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
#ifndef ISDN_LIB_INTERN
|
||||
#define ISDN_LIB_INTER
|
||||
#define ISDN_LIB_INTERN
|
||||
|
||||
|
||||
#include <mISDNlib.h>
|
||||
#include <isdn_net.h>
|
||||
#include <l3dss1.h>
|
||||
#include <net_l3.h>
|
||||
#include <mISDNuser/mISDNlib.h>
|
||||
#include <mISDNuser/isdn_net.h>
|
||||
#include <mISDNuser/l3dss1.h>
|
||||
#include <mISDNuser/net_l3.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "isdn_lib.h"
|
||||
|
||||
|
||||
|
||||
#define QI_ELEMENT(a) a.off
|
||||
|
||||
|
||||
#ifndef mISDNUSER_HEAD_SIZE
|
||||
|
@ -37,8 +36,6 @@ struct isdn_msg {
|
|||
|
||||
void (*msg_parser)(struct isdn_msg *msgs, msg_t *msg, struct misdn_bchannel *bc, int nt);
|
||||
msg_t *(*msg_builder)(struct isdn_msg *msgs, struct misdn_bchannel *bc, int nt);
|
||||
void (*msg_printer)(struct isdn_msg *msgs);
|
||||
|
||||
char *info;
|
||||
|
||||
} ;
|
||||
|
@ -60,6 +57,8 @@ struct misdn_stack {
|
|||
int b_stids[MAX_BCHANS + 1];
|
||||
|
||||
int ptp;
|
||||
|
||||
int l2_id;
|
||||
int lower_id;
|
||||
int upper_id;
|
||||
|
||||
|
@ -70,7 +69,7 @@ struct misdn_stack {
|
|||
int l1link;
|
||||
int midev;
|
||||
|
||||
enum mode_e {NT_MODE, TE_MODE} mode;
|
||||
int nt;
|
||||
|
||||
int pri;
|
||||
|
||||
|
|
|
@ -12,9 +12,14 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "isdn_lib_intern.h"
|
||||
|
||||
|
||||
#include "isdn_lib.h"
|
||||
|
||||
#include "ie.c"
|
||||
|
||||
#include "fac.h"
|
||||
|
||||
void parse_proceeding (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -30,12 +35,14 @@ void parse_proceeding (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel
|
|||
channel=-1;
|
||||
|
||||
/* ALERT: is that everytime true ? */
|
||||
if (channel > 0 && stack->mode == NT_MODE)
|
||||
|
||||
if (channel > 0 && stack->nt)
|
||||
bc->channel = channel;
|
||||
}
|
||||
|
||||
dec_ie_progress(proceeding->PROGRESS, (Q931_info_t *)proceeding, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
|
||||
|
||||
|
||||
#if DEBUG
|
||||
printf("Parsing PROCEEDING Msg\n");
|
||||
#endif
|
||||
|
@ -59,9 +66,6 @@ msg_t *build_proceeding (struct isdn_msg msgs[], struct misdn_bchannel *bc, int
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_proceeding (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
void parse_alerting (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -94,9 +98,6 @@ msg_t *build_alerting (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_alerting (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_progress (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
|
@ -125,10 +126,6 @@ msg_t *build_progress (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_progress (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_setup (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -319,10 +316,6 @@ msg_t *build_setup (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
return msg;
|
||||
}
|
||||
|
||||
void print_setup (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
void parse_connect (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
|
@ -342,7 +335,9 @@ msg_t *build_connect (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
CONNECT_t *connect;
|
||||
msg_t *msg =(msg_t*)create_l3msg(CC_CONNECT | REQUEST, MT_CONNECT, bc?bc->l3_id:-1, sizeof(CONNECT_t) ,nt);
|
||||
|
||||
|
||||
cb_log(0,0,"BUILD_CONNECT: bc:%p bc->l3id:%d, nt:%d\n",bc,bc->l3_id,nt);
|
||||
|
||||
connect=(CONNECT_t*)((msg->data+HEADER_LEN));
|
||||
|
||||
if (nt) {
|
||||
|
@ -361,10 +356,6 @@ msg_t *build_connect (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_connect (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_setup_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -408,10 +399,6 @@ msg_t *build_setup_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *b
|
|||
return msg;
|
||||
}
|
||||
|
||||
void print_setup_acknowledge (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
void parse_connect_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
#if DEBUG
|
||||
|
@ -435,10 +422,6 @@ msg_t *build_connect_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_connect_acknowledge (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_user_information (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -461,10 +444,6 @@ msg_t *build_user_information (struct isdn_msg msgs[], struct misdn_bchannel *bc
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_user_information (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_suspend_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -487,10 +466,6 @@ msg_t *build_suspend_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc,
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_suspend_reject (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_resume_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -513,10 +488,6 @@ msg_t *build_resume_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc, i
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_resume_reject (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_hold (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -539,10 +510,6 @@ msg_t *build_hold (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_hold (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_suspend (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -565,10 +532,6 @@ msg_t *build_suspend (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_suspend (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_resume (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -591,10 +554,6 @@ msg_t *build_resume (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_resume (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_hold_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -617,10 +576,6 @@ msg_t *build_hold_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_hold_acknowledge (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_suspend_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -643,10 +598,6 @@ msg_t *build_suspend_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_suspend_acknowledge (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_resume_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -669,10 +620,6 @@ msg_t *build_resume_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_resume_acknowledge (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_hold_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -695,10 +642,6 @@ msg_t *build_hold_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc, int
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_hold_reject (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_retrieve (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -721,10 +664,6 @@ msg_t *build_retrieve (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_retrieve (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_retrieve_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -748,10 +687,6 @@ msg_t *build_retrieve_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_retrieve_acknowledge (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_retrieve_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -774,10 +709,6 @@ msg_t *build_retrieve_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc,
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_retrieve_reject (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_disconnect (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -810,10 +741,6 @@ msg_t *build_disconnect (struct isdn_msg msgs[], struct misdn_bchannel *bc, int
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_disconnect (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_restart (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -831,7 +758,7 @@ void parse_restart (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *b
|
|||
dec_ie_channel_id(restart->CHANNEL_ID, (Q931_info_t *)restart, &exclusive, &channel, nt,bc);
|
||||
if (channel==0xff) /* any channel */
|
||||
channel=-1;
|
||||
cb_log(0, stack->port, "CC_RESTART Request on channel:%d on port:%d\n",stack->port);
|
||||
cb_log(0, stack->port, "CC_RESTART Request on channel:%d on this port.\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -849,10 +776,6 @@ msg_t *build_restart (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_restart (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_release (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -883,10 +806,6 @@ msg_t *build_release (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_release (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_release_complete (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -907,24 +826,22 @@ void parse_release_complete (struct isdn_msg msgs[], msg_t *msg, struct misdn_bc
|
|||
|
||||
if (nt) {
|
||||
if (hh->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
|
||||
cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] port:%d\n",stack->port);
|
||||
cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] \n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (frm->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
|
||||
cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] port:%d\n",stack->port);
|
||||
cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] \n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
dec_ie_cause(release_complete->CAUSE, (Q931_info_t *)(release_complete), &location, &bc->cause, nt,bc);
|
||||
|
||||
|
||||
#if DEBUG
|
||||
printf("Parsing RELEASE_COMPLETE Msg\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
msg_t *build_release_complete (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
|
@ -940,10 +857,6 @@ msg_t *build_release_complete (struct isdn_msg msgs[], struct misdn_bchannel *bc
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_release_complete (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_facility (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -951,20 +864,15 @@ void parse_facility (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *
|
|||
FACILITY_t *facility=(FACILITY_t*)((unsigned long)(msg->data+HEADER_LEN));
|
||||
Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
|
||||
|
||||
|
||||
#if DEBUG
|
||||
printf("Parsing FACILITY Msg\n");
|
||||
#endif
|
||||
|
||||
{
|
||||
char fac[128];
|
||||
int facility_len;
|
||||
|
||||
dec_ie_facility(facility->FACILITY, qi, fac, &facility_len, nt, bc);
|
||||
fac_dec(facility->FACILITY, qi, &bc->fac_type, &bc->fac, bc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
msg_t *build_facility (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
|
@ -978,17 +886,9 @@ msg_t *build_facility (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt
|
|||
printf("Sending %s as Display\n", bc->display);
|
||||
enc_ie_display(&facility->DISPLAY, msg, bc->display, nt,bc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch ( bc->facility ) {
|
||||
case FACILITY_CALLDEFLECT:
|
||||
enc_facility_calldeflect(&facility->FACILITY, msg, bc->facility_calldeflect_nr, nt, bc);
|
||||
|
||||
break;
|
||||
case FACILITY_NONE:
|
||||
break;
|
||||
}
|
||||
fac_enc(&facility->FACILITY, msg, bc->out_fac_type, bc->out_fac, bc);
|
||||
|
||||
}
|
||||
|
||||
|
@ -997,19 +897,14 @@ msg_t *build_facility (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_facility (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_notify (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
#if DEBUG
|
||||
printf("Parsing NOTIFY Msg\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
msg_t *build_notify (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
|
@ -1023,19 +918,14 @@ msg_t *build_notify (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_notify (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_status_enquiry (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
#if DEBUG
|
||||
printf("Parsing STATUS_ENQUIRY Msg\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
msg_t *build_status_enquiry (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
|
@ -1049,32 +939,25 @@ msg_t *build_status_enquiry (struct isdn_msg msgs[], struct misdn_bchannel *bc,
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_status_enquiry (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_information (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
INFORMATION_t *information=(INFORMATION_t*)((unsigned long)(msg->data+HEADER_LEN));
|
||||
|
||||
{
|
||||
int type, plan;
|
||||
char number[32];
|
||||
char keypad[32];
|
||||
dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)information, &type, &plan, (unsigned char *)number, sizeof(number), nt,bc);
|
||||
dec_ie_keypad(information->KEYPAD, (Q931_info_t *)information, (unsigned char *)keypad, sizeof(keypad), nt,bc);
|
||||
dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)information, &type, &plan, (unsigned char *)number, sizeof(number), nt, bc);
|
||||
dec_ie_keypad(information->KEYPAD, (Q931_info_t *)information, (unsigned char *)keypad, sizeof(keypad), nt, bc);
|
||||
strcpy(bc->info_dad, number);
|
||||
strcpy(bc->keypad,keypad);
|
||||
|
||||
}
|
||||
#if DEBUG
|
||||
printf("Parsing INFORMATION Msg\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
msg_t *build_information (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
|
@ -1099,10 +982,6 @@ msg_t *build_information (struct isdn_msg msgs[], struct misdn_bchannel *bc, int
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_information (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_status (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
|
@ -1116,9 +995,8 @@ void parse_status (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc
|
|||
#if DEBUG
|
||||
printf("Parsing STATUS Msg\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
msg_t *build_status (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
|
@ -1132,19 +1010,14 @@ msg_t *build_status (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_status (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void parse_timeout (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
#if DEBUG
|
||||
printf("Parsing STATUS Msg\n");
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
msg_t *build_timeout (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
||||
{
|
||||
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
|
||||
|
@ -1158,9 +1031,6 @@ msg_t *build_timeout (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
|||
#endif
|
||||
return msg;
|
||||
}
|
||||
void print_timeout (struct isdn_msg msgs[])
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
|
@ -1172,96 +1042,96 @@ void print_timeout (struct isdn_msg msgs[])
|
|||
|
||||
struct isdn_msg msgs_g[] = {
|
||||
{CC_PROCEEDING,L3,EVENT_PROCEEDING,
|
||||
parse_proceeding,build_proceeding,print_proceeding,
|
||||
parse_proceeding,build_proceeding,
|
||||
"PROCEEDING"},
|
||||
{CC_ALERTING,L3,EVENT_ALERTING,
|
||||
parse_alerting,build_alerting,print_alerting,
|
||||
parse_alerting,build_alerting,
|
||||
"ALERTING"},
|
||||
{CC_PROGRESS,L3,EVENT_PROGRESS,
|
||||
parse_progress,build_progress,print_progress,
|
||||
parse_progress,build_progress,
|
||||
"PROGRESS"},
|
||||
{CC_SETUP,L3,EVENT_SETUP,
|
||||
parse_setup,build_setup,print_setup,
|
||||
parse_setup,build_setup,
|
||||
"SETUP"},
|
||||
{CC_CONNECT,L3,EVENT_CONNECT,
|
||||
parse_connect,build_connect,print_connect,
|
||||
parse_connect,build_connect,
|
||||
"CONNECT"},
|
||||
{CC_SETUP_ACKNOWLEDGE,L3,EVENT_SETUP_ACKNOWLEDGE,
|
||||
parse_setup_acknowledge,build_setup_acknowledge,print_setup_acknowledge,
|
||||
parse_setup_acknowledge,build_setup_acknowledge,
|
||||
"SETUP_ACKNOWLEDGE"},
|
||||
{CC_CONNECT_ACKNOWLEDGE ,L3,EVENT_CONNECT_ACKNOWLEDGE ,
|
||||
parse_connect_acknowledge ,build_connect_acknowledge ,print_connect_acknowledge ,
|
||||
parse_connect_acknowledge ,build_connect_acknowledge,
|
||||
"CONNECT_ACKNOWLEDGE "},
|
||||
{CC_USER_INFORMATION,L3,EVENT_USER_INFORMATION,
|
||||
parse_user_information,build_user_information,print_user_information,
|
||||
parse_user_information,build_user_information,
|
||||
"USER_INFORMATION"},
|
||||
{CC_SUSPEND_REJECT,L3,EVENT_SUSPEND_REJECT,
|
||||
parse_suspend_reject,build_suspend_reject,print_suspend_reject,
|
||||
parse_suspend_reject,build_suspend_reject,
|
||||
"SUSPEND_REJECT"},
|
||||
{CC_RESUME_REJECT,L3,EVENT_RESUME_REJECT,
|
||||
parse_resume_reject,build_resume_reject,print_resume_reject,
|
||||
parse_resume_reject,build_resume_reject,
|
||||
"RESUME_REJECT"},
|
||||
{CC_HOLD,L3,EVENT_HOLD,
|
||||
parse_hold,build_hold,print_hold,
|
||||
parse_hold,build_hold,
|
||||
"HOLD"},
|
||||
{CC_SUSPEND,L3,EVENT_SUSPEND,
|
||||
parse_suspend,build_suspend,print_suspend,
|
||||
parse_suspend,build_suspend,
|
||||
"SUSPEND"},
|
||||
{CC_RESUME,L3,EVENT_RESUME,
|
||||
parse_resume,build_resume,print_resume,
|
||||
parse_resume,build_resume,
|
||||
"RESUME"},
|
||||
{CC_HOLD_ACKNOWLEDGE,L3,EVENT_HOLD_ACKNOWLEDGE,
|
||||
parse_hold_acknowledge,build_hold_acknowledge,print_hold_acknowledge,
|
||||
parse_hold_acknowledge,build_hold_acknowledge,
|
||||
"HOLD_ACKNOWLEDGE"},
|
||||
{CC_SUSPEND_ACKNOWLEDGE,L3,EVENT_SUSPEND_ACKNOWLEDGE,
|
||||
parse_suspend_acknowledge,build_suspend_acknowledge,print_suspend_acknowledge,
|
||||
parse_suspend_acknowledge,build_suspend_acknowledge,
|
||||
"SUSPEND_ACKNOWLEDGE"},
|
||||
{CC_RESUME_ACKNOWLEDGE,L3,EVENT_RESUME_ACKNOWLEDGE,
|
||||
parse_resume_acknowledge,build_resume_acknowledge,print_resume_acknowledge,
|
||||
parse_resume_acknowledge,build_resume_acknowledge,
|
||||
"RESUME_ACKNOWLEDGE"},
|
||||
{CC_HOLD_REJECT,L3,EVENT_HOLD_REJECT,
|
||||
parse_hold_reject,build_hold_reject,print_hold_reject,
|
||||
parse_hold_reject,build_hold_reject,
|
||||
"HOLD_REJECT"},
|
||||
{CC_RETRIEVE,L3,EVENT_RETRIEVE,
|
||||
parse_retrieve,build_retrieve,print_retrieve,
|
||||
parse_retrieve,build_retrieve,
|
||||
"RETRIEVE"},
|
||||
{CC_RETRIEVE_ACKNOWLEDGE,L3,EVENT_RETRIEVE_ACKNOWLEDGE,
|
||||
parse_retrieve_acknowledge,build_retrieve_acknowledge,print_retrieve_acknowledge,
|
||||
parse_retrieve_acknowledge,build_retrieve_acknowledge,
|
||||
"RETRIEVE_ACKNOWLEDGE"},
|
||||
{CC_RETRIEVE_REJECT,L3,EVENT_RETRIEVE_REJECT,
|
||||
parse_retrieve_reject,build_retrieve_reject,print_retrieve_reject,
|
||||
parse_retrieve_reject,build_retrieve_reject,
|
||||
"RETRIEVE_REJECT"},
|
||||
{CC_DISCONNECT,L3,EVENT_DISCONNECT,
|
||||
parse_disconnect,build_disconnect,print_disconnect,
|
||||
parse_disconnect,build_disconnect,
|
||||
"DISCONNECT"},
|
||||
{CC_RESTART,L3,EVENT_RESTART,
|
||||
parse_restart,build_restart,print_restart,
|
||||
parse_restart,build_restart,
|
||||
"RESTART"},
|
||||
{CC_RELEASE,L3,EVENT_RELEASE,
|
||||
parse_release,build_release,print_release,
|
||||
parse_release,build_release,
|
||||
"RELEASE"},
|
||||
{CC_RELEASE_COMPLETE,L3,EVENT_RELEASE_COMPLETE,
|
||||
parse_release_complete,build_release_complete,print_release_complete,
|
||||
parse_release_complete,build_release_complete,
|
||||
"RELEASE_COMPLETE"},
|
||||
{CC_FACILITY,L3,EVENT_FACILITY,
|
||||
parse_facility,build_facility,print_facility,
|
||||
parse_facility,build_facility,
|
||||
"FACILITY"},
|
||||
{CC_NOTIFY,L3,EVENT_NOTIFY,
|
||||
parse_notify,build_notify,print_notify,
|
||||
parse_notify,build_notify,
|
||||
"NOTIFY"},
|
||||
{CC_STATUS_ENQUIRY,L3,EVENT_STATUS_ENQUIRY,
|
||||
parse_status_enquiry,build_status_enquiry,print_status_enquiry,
|
||||
parse_status_enquiry,build_status_enquiry,
|
||||
"STATUS_ENQUIRY"},
|
||||
{CC_INFORMATION,L3,EVENT_INFORMATION,
|
||||
parse_information,build_information,print_information,
|
||||
parse_information,build_information,
|
||||
"INFORMATION"},
|
||||
{CC_STATUS,L3,EVENT_STATUS,
|
||||
parse_status,build_status,print_status,
|
||||
parse_status,build_status,
|
||||
"STATUS"},
|
||||
{CC_TIMEOUT,L3,EVENT_TIMEOUT,
|
||||
parse_timeout,build_timeout,print_timeout,
|
||||
parse_timeout,build_timeout,
|
||||
"TIMEOUT"},
|
||||
{0,0,0,NULL,NULL,NULL,NULL}
|
||||
{0,0,0,NULL,NULL,NULL}
|
||||
};
|
||||
|
||||
#define msgs_max (sizeof(msgs_g)/sizeof(struct isdn_msg))
|
||||
|
@ -1272,15 +1142,12 @@ int isdn_msg_get_index(struct isdn_msg msgs[], msg_t *msg, int nt)
|
|||
int i;
|
||||
|
||||
if (nt){
|
||||
#ifdef MISDNUSER_JOLLY
|
||||
mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
|
||||
#else
|
||||
mISDN_head_t *hh = (mISDN_head_t*)msg->data;
|
||||
#endif
|
||||
|
||||
for (i=0; i< msgs_max -1; i++)
|
||||
|
||||
for (i=0; i< msgs_max -1; i++) {
|
||||
if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
iframe_t *frm = (iframe_t*)msg->data;
|
||||
|
||||
|
|
Reference in New Issue