backup
authorSuper User <root@isdn.jolly.ten>
Sat, 7 Jul 2007 15:13:20 +0000 (17:13 +0200)
committerSuper User <root@isdn.jolly.ten>
Sat, 7 Jul 2007 15:13:20 +0000 (17:13 +0200)
compiles, runs, but not enough debugged

33 files changed:
Makefile
action.cpp
action_vbox.cpp
admin.h
admin_client.c
admin_server.c
apppbx.cpp
apppbx.h
call.h
callchan.cpp
callpbx.cpp
callpbx.h
crypt.cpp
dss1.cpp
endpoint.cpp
extension.h
genext.c
genrc.c
ie.cpp
interface.c
interface.h
mISDN.cpp
mISDN.h
main.c
main.h
message.h
options.c
port.cpp
route.c
todo.txt
trace.c
trace.h
vbox.cpp

index bf0d7c2..420653d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #*****************************************************************************\
 #*                                                                           **
 #*****************************************************************************\
 #*                                                                           **
-#* PBX4Linux                                                                 **
+#* Linux Call Router                                                         **
 #*                                                                           **
 #*---------------------------------------------------------------------------**
 #* Copyright: Andreas Eversberg                                              **
 #*                                                                           **
 #*---------------------------------------------------------------------------**
 #* Copyright: Andreas Eversberg                                              **
@@ -14,13 +14,13 @@ WITH-CRYPTO = 42 # comment this out, if no libcrypto should be used
 
 # select location to install
 INSTALL_BIN = /usr/local/bin
 
 # select location to install
 INSTALL_BIN = /usr/local/bin
-INSTALL_DATA = /usr/local/pbx
+INSTALL_DATA = /usr/local/lcr
 
 # give locations for the libraries
 LINUX_INCLUDE = -I/usr/src/linux/include
 
 # give location of the mISDN libraries
 
 # give locations for the libraries
 LINUX_INCLUDE = -I/usr/src/linux/include
 
 # give location of the mISDN libraries
-MISDNUSER_INCLUDE = -I../mISDNuser/include
+MISDNUSER_INCLUDE = -I../mISDNuser/include -I../mISDNuser/i4lnet
 MISDNUSER_LIB = -L../mISDNuser/lib -L../mISDNuser/i4lnet
 LIBS += -lisdnnet -lmISDN -lpthread
 
 MISDNUSER_LIB = -L../mISDNuser/lib -L../mISDNuser/i4lnet
 LIBS += -lisdnnet -lmISDN -lpthread
 
@@ -30,9 +30,9 @@ CURSES = -lncurses
 CC = g++
 LD = $(CC)
 WIZZARD = ./wizzard
 CC = g++
 LD = $(CC)
 WIZZARD = ./wizzard
-PBX = ./pbx
-PBXADMIN = ./pbxadmin
-PBXWATCH = ./pbxwatch
+LCR = ./lcr
+LCRADMIN = ./lcradmin
+LCRWATCH = ./lcrwatch
 GEN = ./gentones
 GENW = ./genwave
 GENRC = ./genrc
 GEN = ./gentones
 GENW = ./genwave
 GENRC = ./genrc
@@ -55,14 +55,14 @@ endif
 #      @echo Please report any bug. To compile use \"make beta\".
 #      @exit
 
 #      @echo Please report any bug. To compile use \"make beta\".
 #      @exit
 
-all: $(PBXADMIN) $(PBX) $(GEN) $(GENW) $(GENRC) $(GENEXT)
+all: $(LCR) $(LCRADMIN) $(GEN) $(GENW) $(GENRC) $(GENEXT)
        @sh -c 'grep -n strcpy *.c* ; if test $$''? = 0 ; then echo "dont use strcpy, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n strncpy *.c* ; if test $$''? = 0 ; then echo "dont use strncpy, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n strcat *.c* ; if test $$''? = 0 ; then echo "dont use strcat, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n strncat *.c* ; if test $$''? = 0 ; then echo "dont use strncat, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n sprintf *.c* ; if test $$''? = 0 ; then echo "dont use sprintf, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n snprintf *.c* ; if test $$''? = 0 ; then echo "dont use snprintf, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n strcpy *.c* ; if test $$''? = 0 ; then echo "dont use strcpy, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n strncpy *.c* ; if test $$''? = 0 ; then echo "dont use strncpy, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n strcat *.c* ; if test $$''? = 0 ; then echo "dont use strcat, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n strncat *.c* ; if test $$''? = 0 ; then echo "dont use strncat, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n sprintf *.c* ; if test $$''? = 0 ; then echo "dont use sprintf, use makro instead." ; exit -1 ; fi'
        @sh -c 'grep -n snprintf *.c* ; if test $$''? = 0 ; then echo "dont use snprintf, use makro instead." ; exit -1 ; fi'
-       @echo "All PBX binaries done"
+       @echo "All LCR binaries done"
        @sync
        @exit
 
        @sync
        @exit
 
@@ -93,21 +93,6 @@ mISDN.o: mISDN.cpp *.h Makefile
 dss1.o: dss1.cpp ie.cpp *.h Makefile
        $(CC) -c $(CFLAGS) dss1.cpp -o dss1.o
 
 dss1.o: dss1.cpp ie.cpp *.h Makefile
        $(CC) -c $(CFLAGS) dss1.cpp -o dss1.o
 
-opal.o: opal.cpp *.h Makefile
-       $(CC) -c $(CFLAGS) opal.cpp -o opal.o
-
-opal_mgr.o: opal_mgr.cpp *.h Makefile
-       $(CC) -c $(CFLAGS) opal_mgr.cpp -o opal_mgr.o
-
-opal_pbxep.o: opal_pbxep.cpp *.h Makefile
-       $(CC) -c $(CFLAGS) opal_pbxep.cpp -o opal_pbxep.o
-
-opal_pbxcon.o: opal_pbxcon.cpp *.h Makefile
-       $(CC) -c $(CFLAGS) opal_pbxcon.cpp -o opal_pbxcon.o
-
-opal_pbxms.o: opal_pbxms.cpp *.h Makefile
-       $(CC) -c $(CFLAGS) opal_pbxms.cpp -o opal_pbxms.o
-
 #knock.o: knock.cpp *.h Makefile
 #      $(CC) -c $(CFLAGS) knock.cpp -o knock.o
 #
 #knock.o: knock.cpp *.h Makefile
 #      $(CC) -c $(CFLAGS) knock.cpp -o knock.o
 #
@@ -173,7 +158,7 @@ trace.o: trace.c *.h Makefile
 #      $(CC) $(LIBDIR) $(CFLAGS) -lm wizzard.c \
 #      -o $(WIZZARD) 
 
 #      $(CC) $(LIBDIR) $(CFLAGS) -lm wizzard.c \
 #      -o $(WIZZARD) 
 
-$(PBX): main.o \
+$(LCR): main.o \
        options.o \
        interface.o \
        extension.o \
        options.o \
        interface.o \
        extension.o \
@@ -226,15 +211,15 @@ $(PBX): main.o \
        callchan.o \
        admin_server.o \
        trace.o \
        callchan.o \
        admin_server.o \
        trace.o \
-       $(LIBS) -o $(PBX
+       $(LIBS) -o $(LCR
 
 
-$(PBXADMIN): admin_client.c cause.c *.h Makefile
+$(LCRADMIN): admin_client.c cause.c *.h Makefile
        $(CC) $(LIBDIR) $(CFLAGS) $(CURSES) -lm admin_client.c cause.c \
        $(CC) $(LIBDIR) $(CFLAGS) $(CURSES) -lm admin_client.c cause.c \
-       -o $(PBXADMIN) 
+       -o $(LCRADMIN) 
 
 
-$(PBXWATCH): watch.c *.h Makefile
+$(LCRWATCH): watch.c *.h Makefile
        $(CC) $(LIBDIR) $(CFLAGS) -lm watch.c \
        $(CC) $(LIBDIR) $(CFLAGS) -lm watch.c \
-       -o $(PBXWATCH) 
+       -o $(LCRWATCH) 
 
 $(GEN):        gentones.c *.h Makefile 
        $(CC) $(LIBDIR) $(CFLAGS) -lm gentones.c \
 
 $(GEN):        gentones.c *.h Makefile 
        $(CC) $(LIBDIR) $(CFLAGS) -lm gentones.c \
@@ -257,10 +242,10 @@ $(GENEXT): options.o extension.o genext.o
 #      @exit
 
 install:
 #      @exit
 
 install:
-       -killall -9 -w -q pbx # the following error must be ignored
-       cp $(PBX) $(INSTALL_BIN)
-       cp $(PBXADMIN) $(INSTALL_BIN)
-#      cp $(PBXWATCH) $(INSTALL_BIN)
+       -killall -9 -w -q lcr # the following error must be ignored
+       cp $(LCR) $(INSTALL_BIN)
+       cp $(LCRADMIN) $(INSTALL_BIN)
+#      cp $(LCRWATCH) $(INSTALL_BIN)
        cp $(GEN) $(INSTALL_BIN)
        cp $(GENW) $(INSTALL_BIN)
        cp $(GENRC) $(INSTALL_BIN)
        cp $(GEN) $(INSTALL_BIN)
        cp $(GENW) $(INSTALL_BIN)
        cp $(GENRC) $(INSTALL_BIN)
@@ -291,7 +276,7 @@ install:
 
 clean:
        touch *
 
 clean:
        touch *
-       rm -f $(PBX) $(PBXADMIN) $(PBXWATCH) $(GEN) $(GENW) $(GENRC) $(GENEXT)
+       rm -f $(LCR) $(LCRADMIN) $(LCRWATCH) $(GEN) $(GENW) $(GENRC) $(GENEXT)
        rm -f *.o
        rm -f .*.c.sw* .*.cpp.sw* .*.h.sw*
        rm -f bla nohup.out
        rm -f *.o
        rm -f .*.c.sw* .*.cpp.sw* .*.h.sw*
        rm -f bla nohup.out
@@ -299,22 +284,22 @@ clean:
 
 tar:
        make clean
 
 tar:
        make clean
-       cd .. &&  tar -cvzf pbx4linux_`date +%Y%m%d`.tar.gz pbx4linux
+       cd .. &&  tar -cvzf lcr_`date +%Y%m%d`.tar.gz lcr
 
 
-start: $(PBX)
+start: $(LCR)
        sync
        sync
-       -killall -9 -w -q pbx # the following error must be ignored
-       $(PBX) start
+       -killall -9 -w -q lcr # the following error must be ignored
+       $(LCR) start
 
 
-s: $(PBX)
+s: $(LCR)
        sync
        sync
-       -killall -9 -w -q pbx # the following error must be ignored
-       $(PBX) start
+       -killall -9 -w -q lcr # the following error must be ignored
+       $(LCR) start
 
 
-fork: $(PBX)
+fork: $(LCR)
        sync
        sync
-       -killall -9 -w -q pbx # the following error must be ignored
-       $(PBX) fork
+       -killall -9 -w -q lcr # the following error must be ignored
+       $(LCR) fork
 
 
 
 
 
 
index 20a8c54..b77d937 100644 (file)
@@ -133,12 +133,12 @@ void EndpointAppPBX::action_dialing_internal(void)
        memcpy(&callerinfo, &e_callerinfo, sizeof(callerinfo));
        memcpy(&redirinfo, &e_redirinfo, sizeof(redirinfo));
        memset(&dialinginfo, 0, sizeof(dialinginfo));
        memcpy(&callerinfo, &e_callerinfo, sizeof(callerinfo));
        memcpy(&redirinfo, &e_redirinfo, sizeof(redirinfo));
        memset(&dialinginfo, 0, sizeof(dialinginfo));
-       dialinginfo.itype = INFO_ITYPE_INTERN;
-       SCPY(dialinginfo.number, e_dialinginfo.number);
+       dialinginfo.itype = INFO_ITYPE_ISDN_EXTENSION;
+       SCPY(dialinginfo.id, e_dialinginfo.id);
 
        /* process extension */
        if ((rparam = routeparam(e_action, PARAM_EXTENSION)))
 
        /* process extension */
        if ((rparam = routeparam(e_action, PARAM_EXTENSION)))
-               SCPY(dialinginfo.number, rparam->string_value);
+               SCPY(dialinginfo.id, rparam->string_value);
 
        /* process number type */
        if ((rparam = routeparam(e_action, PARAM_TYPE)))
 
        /* process number type */
        if ((rparam = routeparam(e_action, PARAM_TYPE)))
@@ -179,10 +179,10 @@ void EndpointAppPBX::action_dialing_internal(void)
        }
 
        /* check if extension exists AND only if not multiple extensions */
        }
 
        /* check if extension exists AND only if not multiple extensions */
-       if (!read_extension(&ext, dialinginfo.number) && !strchr(dialinginfo.number,','))
+       if (!read_extension(&ext, dialinginfo.id) && !strchr(dialinginfo.id,','))
        {
                trace_header("ACTION extension (extension doesn't exist)", DIRECTION_NONE);
        {
                trace_header("ACTION extension (extension doesn't exist)", DIRECTION_NONE);
-               add_trace("extension", NULL, dialinginfo.number);
+               add_trace("extension", NULL, dialinginfo.id);
                end_trace();
                new_state(EPOINT_STATE_OUT_DISCONNECT);
                message_disconnect_port(portlist, CAUSE_UNALLOCATED, LOCATION_PRIVATE_LOCAL, "");
                end_trace();
                new_state(EPOINT_STATE_OUT_DISCONNECT);
                message_disconnect_port(portlist, CAUSE_UNALLOCATED, LOCATION_PRIVATE_LOCAL, "");
@@ -193,7 +193,7 @@ void EndpointAppPBX::action_dialing_internal(void)
        if (e_ext.rights < 1)
        {
                trace_header("ACTION extension (dialing to extension denied)", DIRECTION_NONE);
        if (e_ext.rights < 1)
        {
                trace_header("ACTION extension (dialing to extension denied)", DIRECTION_NONE);
-               add_trace("extension", NULL, dialinginfo.number);
+               add_trace("extension", NULL, dialinginfo.id);
                end_trace();
                new_state(EPOINT_STATE_OUT_DISCONNECT);
                message_disconnect_port(portlist, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, "");
                end_trace();
                new_state(EPOINT_STATE_OUT_DISCONNECT);
                message_disconnect_port(portlist, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, "");
@@ -203,7 +203,7 @@ void EndpointAppPBX::action_dialing_internal(void)
 
        /* add or update internal call */
        trace_header("ACTION extension (calling)", DIRECTION_NONE);
 
        /* add or update internal call */
        trace_header("ACTION extension (calling)", DIRECTION_NONE);
-       add_trace("extension", NULL, dialinginfo.number);
+       add_trace("extension", NULL, dialinginfo.id);
        end_trace();
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_SETUP);
        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
        end_trace();
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_SETUP);
        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
@@ -258,18 +258,18 @@ void EndpointAppPBX::action_dialing_external(void)
        memcpy(&callerinfo, &e_callerinfo, sizeof(callerinfo));
        memcpy(&redirinfo, &e_redirinfo, sizeof(redirinfo));
        memset(&dialinginfo, 0, sizeof(dialinginfo));
        memcpy(&callerinfo, &e_callerinfo, sizeof(callerinfo));
        memcpy(&redirinfo, &e_redirinfo, sizeof(redirinfo));
        memset(&dialinginfo, 0, sizeof(dialinginfo));
-       dialinginfo.itype = INFO_ITYPE_EXTERN;
+       dialinginfo.itype = INFO_ITYPE_ISDN;
        dialinginfo.sending_complete = 0;
        dialinginfo.sending_complete = 0;
-       SCPY(dialinginfo.number, e_extdialing);
+       SCPY(dialinginfo.id, e_extdialing);
 
        /* process prefix */
        if ((rparam = routeparam(e_action, PARAM_PREFIX)))
 
        /* process prefix */
        if ((rparam = routeparam(e_action, PARAM_PREFIX)))
-               SPRINT(dialinginfo.number, "%s%s", rparam->string_value, e_extdialing);
+               SPRINT(dialinginfo.id, "%s%s", rparam->string_value, e_extdialing);
 
        /* process number complete */
        if ((rparam = routeparam(e_action, PARAM_COMPLETE)))
                if ((rparam = routeparam(e_action, PARAM_PREFIX)))
 
        /* process number complete */
        if ((rparam = routeparam(e_action, PARAM_COMPLETE)))
                if ((rparam = routeparam(e_action, PARAM_PREFIX)))
-                       SCPY(dialinginfo.number, rparam->string_value);
+                       SCPY(dialinginfo.id, rparam->string_value);
                dialinginfo.sending_complete = 1;
 
        /* process number type */
                dialinginfo.sending_complete = 1;
 
        /* process number type */
@@ -338,7 +338,7 @@ void EndpointAppPBX::action_dialing_external(void)
                return;
        }
 
                return;
        }
 
-       if (!strncmp(dialinginfo.number, options.national, strlen(options.national))
+       if (!strncmp(dialinginfo.id, options.national, strlen(options.national))
         || dialinginfo.ntype == INFO_NTYPE_NATIONAL
         || dialinginfo.ntype == INFO_NTYPE_INTERNATIONAL)
        {
         || dialinginfo.ntype == INFO_NTYPE_NATIONAL
         || dialinginfo.ntype == INFO_NTYPE_INTERNATIONAL)
        {
@@ -353,7 +353,7 @@ void EndpointAppPBX::action_dialing_external(void)
                }
        }
 
                }
        }
 
-       if (!strncmp(dialinginfo.number, options.international, strlen(options.international))
+       if (!strncmp(dialinginfo.id, options.international, strlen(options.international))
         || dialinginfo.ntype == INFO_NTYPE_INTERNATIONAL)
        {
                /* check if international calls are denied */
         || dialinginfo.ntype == INFO_NTYPE_INTERNATIONAL)
        {
                /* check if international calls are denied */
@@ -369,7 +369,7 @@ void EndpointAppPBX::action_dialing_external(void)
 
        /* add or update outgoing call */
        trace_header("ACTION extern (calling)", DIRECTION_NONE);
 
        /* add or update outgoing call */
        trace_header("ACTION extern (calling)", DIRECTION_NONE);
-       add_trace("number", NULL, dialinginfo.number);
+       add_trace("number", NULL, dialinginfo.id);
        if (dialinginfo.interfaces[0])
                add_trace("interfaces", NULL, dialinginfo.interfaces);
        end_trace();
        if (dialinginfo.interfaces[0])
                add_trace("interfaces", NULL, dialinginfo.interfaces);
        end_trace();
@@ -451,19 +451,19 @@ void EndpointAppPBX::action_dialing_vbox_record(void)
        memset(&dialinginfo, 0, sizeof(dialinginfo));
        dialinginfo.itype = INFO_ITYPE_VBOX;
        dialinginfo.sending_complete = 1;
        memset(&dialinginfo, 0, sizeof(dialinginfo));
        dialinginfo.itype = INFO_ITYPE_VBOX;
        dialinginfo.sending_complete = 1;
-       SCPY(dialinginfo.number, rparam->string_value);
+       SCPY(dialinginfo.id, rparam->string_value);
 
        /* append special announcement (if given) */
        if ((rparam = routeparam(e_action, PARAM_ANNOUNCEMENT)))
        if (rparam->string_value[0])
        {
 
        /* append special announcement (if given) */
        if ((rparam = routeparam(e_action, PARAM_ANNOUNCEMENT)))
        if (rparam->string_value[0])
        {
-               SCAT(dialinginfo.number, ",");
-               SCAT(dialinginfo.number, rparam->string_value);
+               SCAT(dialinginfo.id, ",");
+               SCAT(dialinginfo.id, rparam->string_value);
        }
 
        /* add or update internal call */
        trace_header("ACTION vbox-record (calling)", DIRECTION_NONE);
        }
 
        /* add or update internal call */
        trace_header("ACTION vbox-record (calling)", DIRECTION_NONE);
-       add_trace("extension", NULL, "%s", dailinginfo.number);
+       add_trace("extension", NULL, "%s", dialinginfo.id);
        end_trace();
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_SETUP);
        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
        end_trace();
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_SETUP);
        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
@@ -557,7 +557,7 @@ void EndpointAppPBX::action_init_partyline(void)
 
        /* send setup to call */
        trace_header("ACTION partyline (calling)", DIRECTION_NONE);
 
        /* send setup to call */
        trace_header("ACTION partyline (calling)", DIRECTION_NONE);
-       add_trace("room", NULL, "%d", partylind);
+       add_trace("room", NULL, "%d", partyline);
        end_trace();
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_SETUP);
        message->param.setup.partyline = partyline;
        end_trace();
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_SETUP);
        message->param.setup.partyline = partyline;
@@ -581,34 +581,34 @@ void EndpointAppPBX::action_hangup_call(void)
        /* check */
        if (e_ext.number[0] == '\0')
        {
        /* check */
        if (e_ext.number[0] == '\0')
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because caller is unknown (not internal).\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because caller is unknown (not internal).\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.id);
                return;
        }
        if (!(read_extension(&e_ext, e_ext.number)))
        {
                return;
        }
        if (!(read_extension(&e_ext, e_ext.number)))
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because cannot read settings.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because cannot read settings.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.id);
                return;
        }
                return;
        }
-       if (e_dialinginfo.number[0] == '\0')
+       if (e_dialinginfo.id[0] == '\0')
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number because nothing was dialed.\n", ea_endpoint->ep_serial, e_ext.number);
                return;
        }
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number because nothing was dialed.\n", ea_endpoint->ep_serial, e_ext.number);
                return;
        }
-       if (!strcmp(e_dialinginfo.number, e_ext.last_out[0]))
+       if (!strcmp(e_dialinginfo.id, e_ext.last_out[0]))
        {
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.id);
                return;
        }
 
        /* insert */
                return;
        }
 
        /* insert */
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last number '%s'.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last number '%s'.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.id);
        i = MAX_REMEMBER-1;
        while(i)
        {
                UCPY(e_ext.last_out[i], e_ext.last_out[i-1]);
                i--;
        }
        i = MAX_REMEMBER-1;
        while(i)
        {
                UCPY(e_ext.last_out[i], e_ext.last_out[i-1]);
                i--;
        }
-       SCPY(e_ext.last_out[0], e_dialinginfo.number);
+       SCPY(e_ext.last_out[0], e_dialinginfo.id);
 
        /* write extension */
        write_extension(&e_ext, e_ext.number);
 
        /* write extension */
        write_extension(&e_ext, e_ext.number);
@@ -672,9 +672,9 @@ void EndpointAppPBX::action_dialing_login(void)
                message->param.connectinfo.present = INFO_PRESENT_RESTRICTED;
        else    message->param.connectinfo.present = e_ext.callerid_present;
        /* handle restricted caller ids */
                message->param.connectinfo.present = INFO_PRESENT_RESTRICTED;
        else    message->param.connectinfo.present = e_ext.callerid_present;
        /* handle restricted caller ids */
-       apply_callerid_restriction(e_ext.anon_ignore, portlist->port_type, message->param.connectinfo.id, &message->param.connectinfo.ntype, &message->param.connectinfo.present, &message->param.connectinfo.screen, message->param.connectinfo.voip, message->param.connectinfo.intern, message->param.connectinfo.name);
+       apply_callerid_restriction(e_ext.anon_ignore, message->param.connectinfo.id, &message->param.connectinfo.ntype, &message->param.connectinfo.present, &message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name);
        /* display callerid if desired for extension */
        /* display callerid if desired for extension */
-       SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype, message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.voip, message->param.connectinfo.intern, message->param.connectinfo.name));
+       SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype, message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name));
        message->param.connectinfo.ntype = e_ext.callerid_type;
        message_put(message);
        logmessage(message);
        message->param.connectinfo.ntype = e_ext.callerid_type;
        message_put(message);
        logmessage(message);
@@ -700,8 +700,8 @@ void EndpointAppPBX::action_dialing_login(void)
                e_action = &action_password;
                e_match_timeout = 0;
                e_match_to_action = NULL;
                e_action = &action_password;
                e_match_timeout = 0;
                e_match_to_action = NULL;
-               e_dialinginfo.number[0] = '\0';
-               e_extdialing = strchr(e_dialinginfo.number, '\0');
+               e_dialinginfo.id[0] = '\0';
+               e_extdialing = strchr(e_dialinginfo.id, '\0');
 
                /* set timeout */
                e_password_timeout = now+20;
 
                /* set timeout */
                e_password_timeout = now+20;
@@ -716,8 +716,8 @@ void EndpointAppPBX::action_dialing_login(void)
                if (e_ruleset)
                        e_rule = e_ruleset->rule_first;
                e_action = NULL;
                if (e_ruleset)
                        e_rule = e_ruleset->rule_first;
                e_action = NULL;
-               e_dialinginfo.number[0] = '\0';
-               e_extdialing = e_dialinginfo.number;
+               e_dialinginfo.id[0] = '\0';
+               e_extdialing = e_dialinginfo.id;
                set_tone(portlist, "dialpbx");
        }
 }
                set_tone(portlist, "dialpbx");
        }
 }
@@ -1016,8 +1016,8 @@ void EndpointAppPBX::_action_redial_reply(int in)
                add_trace("number", NULL, "%s", last);
                add_trace("last but", NULL, "%d", e_select);
                end_trace();
                add_trace("number", NULL, "%s", last);
                add_trace("last but", NULL, "%d", e_select);
                end_trace();
-               SCPY(e_dialinginfo.number, last);
-               e_extdialing = e_dialinginfo.number;
+               SCPY(e_dialinginfo.id, last);
+               e_extdialing = e_dialinginfo.id;
                e_action = NULL;
                process_dialing();
                return;
                e_action = NULL;
                process_dialing();
                return;
@@ -1117,7 +1117,7 @@ void EndpointAppPBX::action_dialing_powerdial(void)
        logmessage(message);
 
        /* do dialing */
        logmessage(message);
 
        /* do dialing */
-       SCPY(e_dialinginfo.number, e_ext.last_out[0]);
+       SCPY(e_dialinginfo.id, e_ext.last_out[0]);
        e_powerdialing = -1; /* indicates the existence of powerdialing but no redial time given */
        e_powercount = 0;
        e_action = NULL;
        e_powerdialing = -1; /* indicates the existence of powerdialing but no redial time given */
        e_powercount = 0;
        e_action = NULL;
@@ -1281,8 +1281,8 @@ void EndpointAppPBX::action_dialing_abbrev(void)
        if (name) if (name[0])
                add_trace("name", NULL, "%s", name);
        end_trace();
        if (name) if (name[0])
                add_trace("name", NULL, "%s", name);
        end_trace();
-       SCPY(e_dialinginfo.number, phone);
-       e_extdialing = e_dialinginfo.number;
+       SCPY(e_dialinginfo.id, phone);
+       e_extdialing = e_dialinginfo.id;
        e_action = NULL;
        process_dialing();
 }
        e_action = NULL;
        process_dialing();
 }
@@ -1339,8 +1339,7 @@ void EndpointAppPBX::action_dialing_test(void)
                set_tone(portlist, NULL);
                memset(&e_connectinfo, 0, sizeof(e_connectinfo));
                SCPY(e_connectinfo.id, e_callerinfo.id);
                set_tone(portlist, NULL);
                memset(&e_connectinfo, 0, sizeof(e_connectinfo));
                SCPY(e_connectinfo.id, e_callerinfo.id);
-               SCPY(e_connectinfo.intern, e_callerinfo.intern);
-               SCPY(e_connectinfo.voip, e_callerinfo.voip);
+               SCPY(e_connectinfo.extension, e_callerinfo.extension);
                e_connectinfo.itype = e_callerinfo.itype;
                e_connectinfo.ntype = e_callerinfo.ntype;
                e_connectinfo.present = e_callerinfo.present;
                e_connectinfo.itype = e_callerinfo.itype;
                e_connectinfo.ntype = e_callerinfo.ntype;
                e_connectinfo.present = e_callerinfo.present;
@@ -1348,9 +1347,9 @@ void EndpointAppPBX::action_dialing_test(void)
                message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
                memcpy(&message->param.connectinfo, &e_connectinfo, sizeof(struct connect_info));
                /* handle restricted caller ids */
                message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
                memcpy(&message->param.connectinfo, &e_connectinfo, sizeof(struct connect_info));
                /* handle restricted caller ids */
-               apply_callerid_restriction(e_ext.anon_ignore, portlist->port_type, message->param.connectinfo.id, &message->param.connectinfo.ntype, &message->param.connectinfo.present, &message->param.connectinfo.screen, message->param.connectinfo.voip, message->param.connectinfo.intern, message->param.connectinfo.name);
+               apply_callerid_restriction(e_ext.anon_ignore, message->param.connectinfo.id, &message->param.connectinfo.ntype, &message->param.connectinfo.present, &message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name);
                /* display callerid if desired for extension */
                /* display callerid if desired for extension */
-               SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype, message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.voip, message->param.connectinfo.intern, message->param.connectinfo.name));
+               SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype, message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name));
                message_put(message);
                logmessage(message);
 
                message_put(message);
                logmessage(message);
 
@@ -1680,19 +1679,19 @@ void EndpointAppPBX::action_dialing_calculator(void)
                        switch(mode)
                        {
                                case 0: /* multiply */
                        switch(mode)
                        {
                                case 0: /* multiply */
-                               UNPRINT(e_extdialing, sizeof(e_dialinginfo.number)-strlen(e_dialinginfo.number), "%.8f", sign1*value1*value2);
+                               UNPRINT(e_extdialing, sizeof(e_dialinginfo.id)-strlen(e_dialinginfo.id), "%.8f", sign1*value1*value2);
                                break;
                                case 1: /* divide */
                                break;
                                case 1: /* divide */
-                               UNPRINT(e_extdialing, sizeof(e_dialinginfo.number)-strlen(e_dialinginfo.number), "%.8f", sign1*value1/value2);
+                               UNPRINT(e_extdialing, sizeof(e_dialinginfo.id)-strlen(e_dialinginfo.id), "%.8f", sign1*value1/value2);
                                break;
                                case 2: /* add */
                                break;
                                case 2: /* add */
-                               UNPRINT(e_extdialing, sizeof(e_dialinginfo.number)-strlen(e_dialinginfo.number), "%.8f", sign1*value1+value2);
+                               UNPRINT(e_extdialing, sizeof(e_dialinginfo.id)-strlen(e_dialinginfo.id), "%.8f", sign1*value1+value2);
                                break;
                                case 3: /* substract */
                                break;
                                case 3: /* substract */
-                               UNPRINT(e_extdialing, sizeof(e_dialinginfo.number)-strlen(e_dialinginfo.number), "%.8f", sign1*value1-value2);
+                               UNPRINT(e_extdialing, sizeof(e_dialinginfo.id)-strlen(e_dialinginfo.id), "%.8f", sign1*value1-value2);
                                break;
                        }
                                break;
                        }
-                       e_dialinginfo.number[sizeof(e_dialinginfo.number)-1] = '\0';
+                       e_dialinginfo.id[sizeof(e_dialinginfo.id)-1] = '\0';
                        if (strchr(e_extdialing, '.')) /* remove zeroes */
                        {
                                while (e_extdialing[strlen(e_extdialing)-1] == '0')
                        if (strchr(e_extdialing, '.')) /* remove zeroes */
                        {
                                while (e_extdialing[strlen(e_extdialing)-1] == '0')
@@ -1787,7 +1786,7 @@ void EndpointAppPBX::_action_goto_menu(int mode)
        if (!e_ruleset)
        {
                trace_header("ACTION goto/menu (ruleset not found)", DIRECTION_NONE);
        if (!e_ruleset)
        {
                trace_header("ACTION goto/menu (ruleset not found)", DIRECTION_NONE);
-               add_trace("ruleset", "NULL", "%s", praram->string_value);
+               add_trace("ruleset", NULL, "%s", rparam->string_value);
                end_trace();
                goto disconnect;
        }
                end_trace();
                goto disconnect;
        }
@@ -1795,27 +1794,27 @@ void EndpointAppPBX::_action_goto_menu(int mode)
        /* if the 'menu' was selected, we will flush all digits */
        if (mode)
        {
        /* if the 'menu' was selected, we will flush all digits */
        if (mode)
        {
-               e_dialinginfo.number[0] = 0;
-               e_extdialing = e_dialinginfo.number;
+               e_dialinginfo.id[0] = 0;
+               e_extdialing = e_dialinginfo.id;
        } else
        {
                /* remove digits that are required to match the rule */
                if (!(rparam = routeparam(e_action, PARAM_STRIP)))
                {
                        if (e_extdialing)
        } else
        {
                /* remove digits that are required to match the rule */
                if (!(rparam = routeparam(e_action, PARAM_STRIP)))
                {
                        if (e_extdialing)
-                               SCPY(e_dialinginfo.number, e_extdialing);
-                       e_extdialing = e_dialinginfo.number;
+                               SCPY(e_dialinginfo.id, e_extdialing);
+                       e_extdialing = e_dialinginfo.id;
                }
        }
 
        /* play sample */
        trace_header("ACTION goto/menu (change to)", DIRECTION_NONE);
                }
        }
 
        /* play sample */
        trace_header("ACTION goto/menu (change to)", DIRECTION_NONE);
-       add_trace("ruleset", "NULL", "%s", e_ruleset->name);
-       if (e_dialinginfo.number[0])
-               add_trace("dialing", "NULL", "%s", e_dialinginfo.number);
+       add_trace("ruleset", NULL, "%s", e_ruleset->name);
+       if (e_dialinginfo.id[0])
+               add_trace("dialing", NULL, "%s", e_dialinginfo.id);
        if ((rparam = routeparam(e_action, PARAM_SAMPLE)))
        {
        if ((rparam = routeparam(e_action, PARAM_SAMPLE)))
        {
-               add_trace("sample", "NULL", "%s", praram->string_value);
+               add_trace("sample", NULL, "%s", rparam->string_value);
                set_tone(ea_endpoint->ep_portlist, rparam->string_value);
        }
        end_trace();
                set_tone(ea_endpoint->ep_portlist, rparam->string_value);
        }
        end_trace();
@@ -1915,7 +1914,7 @@ void EndpointAppPBX::action_dialing_help(void)
        /* show all things that would match */
 #if 0
        struct numbering *numbering = numbering_int;
        /* show all things that would match */
 #if 0
        struct numbering *numbering = numbering_int;
-       char dialing[sizeof(e_dialinginfo.number)];
+       char dialing[sizeof(e_dialinginfo.id)];
        int i;
        struct message *message;
        struct route_param *rparam;
        int i;
        struct message *message;
        struct route_param *rparam;
@@ -1925,15 +1924,15 @@ void EndpointAppPBX::action_dialing_help(void)
                return;
 
        /* scroll menu */
                return;
 
        /* scroll menu */
-       if (strchr(e_dialinginfo.number,'*'))
+       if (strchr(e_dialinginfo.id,'*'))
        {
                e_menu--;
        {
                e_menu--;
-               e_dialinginfo.number[0] = '\0';
+               e_dialinginfo.id[0] = '\0';
        }
        }
-       if (strchr(e_dialinginfo.number,'#'))
+       if (strchr(e_dialinginfo.id,'#'))
        {
                e_menu++;
        {
                e_menu++;
-               e_dialinginfo.number[0] = '\0';
+               e_dialinginfo.id[0] = '\0';
        }
        
        /* get position in menu */
        }
        
        /* get position in menu */
@@ -1964,15 +1963,15 @@ void EndpointAppPBX::action_dialing_help(void)
        }
 
        /* if we dial something else we need to add the prefix and change the action */
        }
 
        /* if we dial something else we need to add the prefix and change the action */
-       if (e_dialinginfo.number[0])
+       if (e_dialinginfo.id[0])
        {
                e_action = NUMB_ACTION_NONE;
                SCPY(dialing, numbering->prefix);
                //we ignore the first digit after selecting
        {
                e_action = NUMB_ACTION_NONE;
                SCPY(dialing, numbering->prefix);
                //we ignore the first digit after selecting
-               //SCAT(dialing, e_dialinginfo.number);
-               SCPY(e_dialinginfo.number, dialing);
-               e_extdialing = e_dialinginfo.number+strlen(numbering->prefix);
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' dialing: %s\n", ea_endpoint->ep_serial, e_ext.number, numb_actions[numbering->action], e_dialinginfo.number);
+               //SCAT(dialing, e_dialinginfo.id);
+               SCPY(e_dialinginfo.id, dialing);
+               e_extdialing = e_dialinginfo.id+strlen(numbering->prefix);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' dialing: %s\n", ea_endpoint->ep_serial, e_ext.number, numb_actions[numbering->action], e_dialinginfo.id);
 nesting?:
                process_dialing();
                return;
 nesting?:
                process_dialing();
                return;
@@ -2011,7 +2010,7 @@ void EndpointAppPBX::action_hangup_execute(void)
 {
        struct route_param *rparam;
        char *command = "", isdn_port[10];
 {
        struct route_param *rparam;
        char *command = "", isdn_port[10];
-       char *argv[8+1]; /* check also number of args below */
+       char *argv[7+1]; /* check also number of args below */
        int i = 0;
 
        /* get script / command */
        int i = 0;
 
        /* get script / command */
@@ -2037,12 +2036,11 @@ void EndpointAppPBX::action_hangup_execute(void)
        }
        argv[1+i] = e_extdialing;
        argv[2+i] = numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype);
        }
        argv[1+i] = e_extdialing;
        argv[2+i] = numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype);
-       argv[3+i] = e_callerinfo.intern;
-       argv[4+i] = e_callerinfo.voip;
-       argv[5+i] = e_callerinfo.name;
+       argv[3+i] = e_callerinfo.extension;
+       argv[4+i] = e_callerinfo.name;
        SPRINT(isdn_port, "%d", e_callerinfo.isdn_port);
        SPRINT(isdn_port, "%d", e_callerinfo.isdn_port);
-       argv[6+i] = isdn_port;
-       argv[7+i] = NULL; /* check also number of args above */
+       argv[5+i] = isdn_port;
+       argv[6+i] = NULL; /* check also number of args above */
        execve("/bin/sh", argv, environ);
 }
 
        execve("/bin/sh", argv, environ);
 }
 
@@ -2106,7 +2104,7 @@ void EndpointAppPBX::action_init_pick(void)
        
        trace_header("ACTION pick", DIRECTION_NONE);
        if (extensions) if (extensions[0])
        
        trace_header("ACTION pick", DIRECTION_NONE);
        if (extensions) if (extensions[0])
-               add_trace("extensions", NULL, "%s", file);
+               add_trace("extensions", NULL, "%s", extensions);
        end_trace();
        pick_call(extensions);
 }
        end_trace();
        pick_call(extensions);
 }
@@ -2165,8 +2163,8 @@ void EndpointAppPBX::action_dialing_password(void)
        if (e_ruleset)
                e_rule = e_ruleset->rule_first;
        e_action = NULL;
        if (e_ruleset)
                e_rule = e_ruleset->rule_first;
        e_action = NULL;
-       e_dialinginfo.number[0] = '\0';
-       e_extdialing = e_dialinginfo.number;
+       e_dialinginfo.id[0] = '\0';
+       e_extdialing = e_dialinginfo.id;
        set_tone(portlist, "dialpbx");
 }
 
        set_tone(portlist, "dialpbx");
 }
 
@@ -2259,13 +2257,13 @@ void EndpointAppPBX::process_dialing(void)
 
 #if 0
        /* check if we do menu selection */
 
 #if 0
        /* check if we do menu selection */
-       if (e_action==NUMB_ACTION_NONE && (e_dialinginfo.number[0]=='*' || e_dialinginfo.number[0]=='#'))
+       if (e_action==NUMB_ACTION_NONE && (e_dialinginfo.id[0]=='*' || e_dialinginfo.id[0]=='#'))
        /* do menu selection */
        if (e_ext.display_menu)
        {
                if (portlist->port_type==PORT_TYPE_DSS1_NT_IN || portlist->port_type==PORT_TYPE_DSS1_NT_OUT) /* only if the dialing terminal is an isdn telephone connected to an internal port */
                {
        /* do menu selection */
        if (e_ext.display_menu)
        {
                if (portlist->port_type==PORT_TYPE_DSS1_NT_IN || portlist->port_type==PORT_TYPE_DSS1_NT_OUT) /* only if the dialing terminal is an isdn telephone connected to an internal port */
                {
-                       e_dialinginfo.number[0] = '\0';
+                       e_dialinginfo.id[0] = '\0';
                        e_action = NUMB_ACTION_MENU;
                        e_menu = 0;
                        process_dialing();
                        e_action = NUMB_ACTION_MENU;
                        e_menu = 0;
                        process_dialing();
@@ -2300,30 +2298,30 @@ void EndpointAppPBX::process_dialing(void)
                e_select = 0;
 
                /* check for external call */
                e_select = 0;
 
                /* check for external call */
-               if (!strncmp(e_dialinginfo.number, "extern:", 7))
+               if (!strncmp(e_dialinginfo.id, "extern:", 7))
                {
                {
-                       e_extdialing = e_dialinginfo.number+7;
+                       e_extdialing = e_dialinginfo.id+7;
                        e_action = &action_external;
                        goto process_action;
                }
                /* check for internal call */
                        e_action = &action_external;
                        goto process_action;
                }
                /* check for internal call */
-               if (!strncmp(e_dialinginfo.number, "intern:", 7))
+               if (!strncmp(e_dialinginfo.id, "intern:", 7))
                {
                {
-                       e_extdialing = e_dialinginfo.number+7;
+                       e_extdialing = e_dialinginfo.id+7;
                        e_action = &action_internal;
                        goto process_action;
                }
                /* check for chan call */
                        e_action = &action_internal;
                        goto process_action;
                }
                /* check for chan call */
-               if (!strncmp(e_dialinginfo.number, "chan:", 5))
+               if (!strncmp(e_dialinginfo.id, "chan:", 5))
                {
                {
-                       e_extdialing = e_dialinginfo.number+4;
+                       e_extdialing = e_dialinginfo.id+4;
                        e_action = &action_chan;
                        goto process_action;
                }
                /* check for vbox call */
                        e_action = &action_chan;
                        goto process_action;
                }
                /* check for vbox call */
-               if (!strncmp(e_dialinginfo.number, "vbox:", 5))
+               if (!strncmp(e_dialinginfo.id, "vbox:", 5))
                {
                {
-                       e_extdialing = e_dialinginfo.number+5;
+                       e_extdialing = e_dialinginfo.id+5;
                        e_action = &action_vbox;
                        goto process_action;
                }
                        e_action = &action_vbox;
                        goto process_action;
                }
@@ -2331,7 +2329,7 @@ void EndpointAppPBX::process_dialing(void)
                if (e_match_timeout && now_d>=e_match_timeout)
                {
                        /* return timeout rule */
                if (e_match_timeout && now_d>=e_match_timeout)
                {
                        /* return timeout rule */
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', timeout in ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number, e_ruleset->name);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', timeout in ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.id, e_ruleset->name);
                        e_match_timeout = 0;
                        e_action = e_match_to_action;
                        e_extdialing = e_match_to_extdialing;
                        e_match_timeout = 0;
                        e_action = e_match_to_action;
                        e_extdialing = e_match_to_extdialing;
@@ -2343,7 +2341,7 @@ void EndpointAppPBX::process_dialing(void)
                {
 //PDEBUG(~0, "HANG-BUG-DEBUGGING: before routing\n");
                        /* check for matching rule */
                {
 //PDEBUG(~0, "HANG-BUG-DEBUGGING: before routing\n");
                        /* check for matching rule */
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', checking matching rule of ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number, e_ruleset->name);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', checking matching rule of ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.id, e_ruleset->name);
                        if (e_ruleset)
                        {
                                e_action = route(e_ruleset);
                        if (e_ruleset)
                        {
                                e_action = route(e_ruleset);
@@ -2456,7 +2454,7 @@ void EndpointAppPBX::process_dialing(void)
 
                if (!e_action)
                {
 
                if (!e_action)
                {
-                       SPRINT(message->param.notifyinfo.display, "> %s", e_dialinginfo.number);
+                       SPRINT(message->param.notifyinfo.display, "> %s", e_dialinginfo.id);
                } else
                {
                        SPRINT(message->param.notifyinfo.display, "%s%s%s", action_defs[e_action->index].name, (e_extdialing[0])?" ":"", e_extdialing);
                } else
                {
                        SPRINT(message->param.notifyinfo.display, "%s%s%s", action_defs[e_action->index].name, (e_extdialing[0])?" ":"", e_extdialing);
@@ -2492,20 +2490,20 @@ void EndpointAppPBX::process_hangup(int cause, int location)
                } else
                if (!e_stop)
                        time(&e_stop);
                } else
                if (!e_stop)
                        time(&e_stop);
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): writing connect from %s to %s into logfile of %s\n", ea_endpoint->ep_serial, e_callerinfo.id, e_dialinginfo.number, e_ext.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): writing connect from %s to %s into logfile of %s\n", ea_endpoint->ep_serial, e_callerinfo.id, e_dialinginfo.id, e_ext.number);
                switch(e_dialinginfo.itype)
                {
                        case INFO_ITYPE_CHAN:
                switch(e_dialinginfo.itype)
                {
                        case INFO_ITYPE_CHAN:
-                       SPRINT(dialingtext, "chan:%s", e_dialinginfo.number);
+                       SPRINT(dialingtext, "chan:%s", e_dialinginfo.id);
                        break;
                        break;
-                       case INFO_ITYPE_INTERN:
-                       SPRINT(dialingtext, "intern:%s", e_dialinginfo.number);
+                       case INFO_ITYPE_ISDN_EXTENSION:
+                       SPRINT(dialingtext, "intern:%s", e_dialinginfo.id);
                        break;
                        case INFO_ITYPE_VBOX:
                        break;
                        case INFO_ITYPE_VBOX:
-                       SPRINT(dialingtext, "vbox:%s", e_dialinginfo.number);
+                       SPRINT(dialingtext, "vbox:%s", e_dialinginfo.id);
                        break;
                        default:
                        break;
                        default:
-                       SPRINT(dialingtext, "%s", e_dialinginfo.number);
+                       SPRINT(dialingtext, "%s", e_dialinginfo.id);
                }
 
                if (e_callerinfo.id[0])
                }
 
                if (e_callerinfo.id[0])
@@ -2515,18 +2513,16 @@ void EndpointAppPBX::process_hangup(int cause, int location)
                /* allpy restriction */
                if (!e_ext.anon_ignore && e_callerinfo.present==INFO_PRESENT_RESTRICTED)
                        SPRINT(callertext, "anonymous");
                /* allpy restriction */
                if (!e_ext.anon_ignore && e_callerinfo.present==INFO_PRESENT_RESTRICTED)
                        SPRINT(callertext, "anonymous");
-               if (e_callerinfo.intern[0]) /* add intern if present */
-                       UNPRINT(strchr(callertext,'\0'), sizeof(callertext)-1+strlen(callertext), " (intern %s)", e_callerinfo.intern);
-               if (e_callerinfo.voip[0]) /* add voip if present */
-                       UNPRINT(strchr(callertext,'\0'), sizeof(callertext)-1+strlen(callertext), " (voip %s)", e_callerinfo.voip);
+               if (e_callerinfo.extension[0]) /* add intern if present */
+                       UNPRINT(strchr(callertext,'\0'), sizeof(callertext)-1+strlen(callertext), " (intern %s)", e_callerinfo.extension);
                write_log(e_ext.number, callertext, dialingtext, e_start, e_stop, 0, cause, location);
 
                /* store last received call for reply-list */
                write_log(e_ext.number, callertext, dialingtext, e_start, e_stop, 0, cause, location);
 
                /* store last received call for reply-list */
-               if (e_callerinfo.id[0] || e_callerinfo.intern[0])
+               if (e_callerinfo.id[0] || e_callerinfo.extension[0])
                if (e_ext.anon_ignore || e_callerinfo.present!=INFO_PRESENT_RESTRICTED)
                {
                if (e_ext.anon_ignore || e_callerinfo.present!=INFO_PRESENT_RESTRICTED)
                {
-                       if (e_callerinfo.intern[0])
-                               SPRINT(callertext, "intern:%s", e_callerinfo.intern);
+                       if (e_callerinfo.extension[0])
+                               SPRINT(callertext, "intern:%s", e_callerinfo.extension);
                        else
                                SPRINT(callertext, "extern:%s", numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype));
                        if (!!strcmp(callertext, e_ext.last_in[0]))
                        else
                                SPRINT(callertext, "extern:%s", numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype));
                        if (!!strcmp(callertext, e_ext.last_in[0]))
index b2f06d9..650bf9a 100644 (file)
@@ -609,8 +609,8 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        if (e_vbox_index_callerid[0]!='\0' && !!strcmp(e_vbox_index_callerid,"anonymous") && !!strcmp(e_vbox_index_callerid,"unknown"))
                        {
                                set_tone(portlist, "dialing");
                        if (e_vbox_index_callerid[0]!='\0' && !!strcmp(e_vbox_index_callerid,"anonymous") && !!strcmp(e_vbox_index_callerid,"unknown"))
                        {
                                set_tone(portlist, "dialing");
-                               SPRINT(e_dialinginfo.number, "extern:%s", e_vbox_index_callerid);
-                               e_extdialing = e_dialinginfo.number;
+                               SPRINT(e_dialinginfo.id, "extern:%s", e_vbox_index_callerid);
+                               e_extdialing = e_dialinginfo.id;
                                e_action = NULL;
                                process_dialing();
                                return;
                                e_action = NULL;
                                process_dialing();
                                return;
diff --git a/admin.h b/admin.h
index f86036f..40a0cb8 100644 (file)
--- a/admin.h
+++ b/admin.h
@@ -9,7 +9,7 @@
 **                                                                           **
 \*****************************************************************************/
 
 **                                                                           **
 \*****************************************************************************/
 
-#define SOCKET_NAME "/var/run/PBX4Linux.socket"
+#define SOCKET_NAME "/var/run/LCR.socket"
 
 /* structures that define message between admin-tool and pbx */
 
 
 /* structures that define message between admin-tool and pbx */
 
@@ -22,6 +22,8 @@ enum { /* messages */
        ADMIN_RESPONSE_CMD_DIAL,
        ADMIN_REQUEST_CMD_RELEASE,
        ADMIN_RESPONSE_CMD_RELEASE,
        ADMIN_RESPONSE_CMD_DIAL,
        ADMIN_REQUEST_CMD_RELEASE,
        ADMIN_RESPONSE_CMD_RELEASE,
+       ADMIN_REQUEST_CMD_BLOCK,
+       ADMIN_RESPONSE_CMD_BLOCK,
        ADMIN_REQUEST_STATE,
        ADMIN_RESPONSE_STATE,
        ADMIN_RESPONSE_S_INTERFACE,
        ADMIN_REQUEST_STATE,
        ADMIN_RESPONSE_STATE,
        ADMIN_RESPONSE_S_INTERFACE,
@@ -44,6 +46,8 @@ enum { /* messages */
 struct admin_response_cmd {
        int             error;          /* error code 0 = ok*/
        char            message[256];   /* info / response text */
 struct admin_response_cmd {
        int             error;          /* error code 0 = ok*/
        char            message[256];   /* info / response text */
+       int             block;
+       int             portnum;
 };
 
 struct admin_response_state {
 };
 
 struct admin_response_state {
@@ -57,12 +61,13 @@ struct admin_response_state {
 };
 
 struct admin_response_interface {
 };
 
 struct admin_response_interface {
-       int             portnum;
        char            interface_name[32];
        char            interface_name[32];
+       int             portnum;
+       int             block;
        int             ntmode;
        int             ptp;
        int             pri;
        int             ntmode;
        int             ptp;
        int             pri;
-       int             iftype;
+       int             extension;
        int             use; /* number of ports that use this interface */
        int             l1link; /* down(0) or up(1) */
        int             l2link; /* down(0) or up(1) */
        int             use; /* number of ports that use this interface */
        int             l1link; /* down(0) or up(1) */
        int             l2link; /* down(0) or up(1) */
index 82b21e9..982b836 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************\
 **                                                                           **
 /*****************************************************************************\
 **                                                                           **
-** PBX4Linux                                                                 **
+** LCR                                                                       **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
@@ -26,9 +26,9 @@
 #include "admin.h"
 #include "cause.h"
 
 #include "admin.h"
 #include "cause.h"
 
-#define LTEE {addch(/*ACS_LTEE*/'t');addch(/*ACS_HLINE*/'q');addch(/*ACS_HLINE*/'q');}
-#define LLCORNER {addch(/*ACS_LLCORNER*/'m');addch(/*ACS_HLINE*/'q');addch(/*ACS_HLINE*/'q');}
-#define VLINE {addch(/*ACS_VLINE*/'x');addstr("  ");}
+#define LTEE {addch(ACS_LTEE);addch(ACS_HLINE);addch(ACS_HLINE);}
+#define LLCORNER {addch(ACS_LLCORNER);addch(ACS_HLINE);addch(ACS_HLINE);}
+#define VLINE {addch(ACS_VLINE);addstr("  ");}
 #define EMPTY {addstr("   ");}
 //char rotator[] = {'-', '\\', '|', '/'};
 int    lastlines, lastcols;
 #define EMPTY {addstr("   ");}
 //char rotator[] = {'-', '\\', '|', '/'};
 int    lastlines, lastcols;
@@ -42,6 +42,9 @@ enum {
        MODE_ROUTE,
        MODE_DIAL,
        MODE_RELEASE,
        MODE_ROUTE,
        MODE_DIAL,
        MODE_RELEASE,
+       MODE_UNBLOCK,
+       MODE_BLOCK,
+       MODE_UNLOAD,
        MODE_TESTCALL,
        MODE_TRACE,
 };
        MODE_TESTCALL,
        MODE_TRACE,
 };
@@ -459,7 +462,7 @@ char *admin_state(int sock)
        /* send reload command */
        memset(&msg, 0, sizeof(msg));
        msg.message = ADMIN_REQUEST_STATE;
        /* send reload command */
        memset(&msg, 0, sizeof(msg));
        msg.message = ADMIN_REQUEST_STATE;
-//     printf("sizeof=%d\n",sizeof(msg));
+//     printf("sizeof=%d\n",sizeof(msg));fflush(stdout);
        if (write(sock, &msg, sizeof(msg)) != sizeof(msg))
        {
                cleanup_curses();
        if (write(sock, &msg, sizeof(msg)) != sizeof(msg))
        {
                cleanup_curses();
@@ -472,6 +475,7 @@ char *admin_state(int sock)
                cleanup_curses();
                return("Broken pipe while receiving response.");
        }
                cleanup_curses();
                return("Broken pipe while receiving response.");
        }
+
        if (msg.message != ADMIN_RESPONSE_STATE)
        {
                cleanup_curses();
        if (msg.message != ADMIN_RESPONSE_STATE)
        {
                cleanup_curses();
@@ -484,19 +488,22 @@ char *admin_state(int sock)
                return("Not enough memory for messages.");
        }
        off=0;
                return("Not enough memory for messages.");
        }
        off=0;
-readagain:
-       if ((len = read(sock, ((unsigned char *)(m))+off, num*sizeof(struct admin_message)-off)) != num*(int)sizeof(struct admin_message)-off)
+       if (num)
        {
        {
-               if (len <= 0) {
-                       free(m);
-//                     fprintf(stderr, "got=%d expected=%d\n", i, num*sizeof(struct admin_message));
-                       cleanup_curses();
-                       return("Broken pipe while receiving state infos.");
-               }
-               if (len < num*(int)sizeof(struct admin_message))
+               readagain:
+               if ((len = read(sock, ((unsigned char *)(m))+off, num*sizeof(struct admin_message)-off)) != num*(int)sizeof(struct admin_message)-off)
                {
                {
-                       off+=len;
-                       goto readagain;
+                       if (len <= 0) {
+                               free(m);
+       //                      fprintf(stderr, "got=%d expected=%d\n", i, num*sizeof(struct admin_message));
+                               cleanup_curses();
+                               return("Broken pipe while receiving state infos.");
+                       }
+                       if (len < num*(int)sizeof(struct admin_message))
+                       {
+                               off+=len;
+                               goto readagain;
+                       }
                }
        }
        j = 0;
                }
        }
        j = 0;
@@ -633,112 +640,125 @@ readagain:
                        /* show interface summary */
                        move(++line>1?line:1, 0);
                        color(white);
                        /* show interface summary */
                        move(++line>1?line:1, 0);
                        color(white);
-
-                       SPRINT(buffer, "%s(%d) '%s' %s use:%d ", (m[i].u.i.ntmode)?"NT":"TE", m[i].u.i.portnum, m[i].u.i.interface_name, (m[i].u.i.ptp)?"ptp ":"ptmp", m[i].u.i.use);
-                       addstr(buffer);
-                       if (m[i].u.i.ptp || !m[i].u.i.ntmode)
+                       if (m[i].u.i.block >= 2)
                        {
                        {
-                               color((m[i].u.i.l2link)?green:red);
-                               addstr((m[i].u.i.l2link)?"  L2 UP":"  L2 down");
-                       }
-                       color((m[i].u.i.l1link)?green:blue);
-                       addstr((m[i].u.i.l1link)?"  L1 ACTIVE":"  L1 inactive");
-                       if (line+2 >= LINES) goto end;
-                       /* show channels */
-                       if (show_interfaces > 1)
+                               SPRINT(buffer, "%s (%d)%s", m[i].u.i.interface_name, m[i].u.i.portnum, (m[i].u.i.extension)?" (extension)":"");
+                               addstr(buffer);
+                               color(red);
+                               addstr("  not loaded");
+                       } else
                        {
                        {
-                               ltee = 0;
-                               j = k =0;
-                               jj = m[i].u.i.channels;
-                               while(j < jj)
+                               SPRINT(buffer, "%s (%d) %s %s%s use:%d", m[i].u.i.interface_name, m[i].u.i.portnum, (m[i].u.i.ntmode)?"NT-mode":"TE-mode", (m[i].u.i.ptp)?"ptp ":"ptmp", (m[i].u.i.extension)?" extension":"", m[i].u.i.use);
+                               addstr(buffer);
+                               if (m[i].u.i.ptp || !m[i].u.i.ntmode)
+                               {
+                                       color((m[i].u.i.l2link)?green:red);
+                                       addstr((m[i].u.i.l2link)?"  L2 UP":"  L2 down");
+                               }
+                               color((m[i].u.i.l1link)?green:blue);
+                               addstr((m[i].u.i.l1link)?"  L1 ACTIVE":"  L1 inactive");
+                               if (m[i].u.i.block)
                                {
                                {
-                                       /* show all channels */
-                                       if (show_interfaces>2 || m[i].u.i.busy[j]>0)
+                                       color(red);
+                                       addstr("  blocked");
+                               }
+                               if (line+2 >= LINES) goto end;
+                               /* show channels */
+                               if (show_interfaces > 1)
+                               {
+                                       ltee = 0;
+                                       j = k =0;
+                                       jj = m[i].u.i.channels;
+                                       while(j < jj)
                                        {
                                        {
-                                               color(cyan);
-                                               /* show left side / right side */
-                                               if ((k & 1) && (COLS > 70))
+                                               /* show all channels */
+                                               if (show_interfaces>2 || m[i].u.i.busy[j]>0)
                                                {
                                                {
-                                                       move(line>1?line:1,4+((COLS-4)/2));
-                                               } else
-                                               {
-                                                       move(++line>1?line:1, 1);
-                                                       LTEE
-                                                       ltee = 1;
-                                               }
-                                               k++;
-                                               color(white);
-                                               if (m[i].u.i.pri)
-                                                       SPRINT(buffer,"S%2d: ", j+1+(j>=15));
-                                               else
-                                                       SPRINT(buffer,"B%2d: ", j+1);
-                                               addstr(buffer);
-                                               if (!m[i].u.i.ptp)
-                                                       goto ptmp;
-                                               if (m[i].u.i.l2link)
-                                               {
-                                                       ptmp:
-                                                       color((m[i].u.i.busy[j])?yellow:blue);
-                                                       addstr((m[i].u.i.busy[j])?"busy":"idle");
-                                               } else
-                                               {
-                                                       color(red);
-                                                       addstr("blk ");
-                                               }
-                                               if (m[i].u.i.port[j])
-                                               {
-                                                       /* search for port */
-                                                       l = msg.u.s.interfaces+msg.u.s.calls+msg.u.s.epoints;
-                                                       ll = l+msg.u.s.ports;
-                                                       while(l < ll)
+                                                       color(cyan);
+                                                       /* show left side / right side */
+                                                       if ((k & 1) && (COLS > 70))
                                                        {
                                                        {
-                                                               if (m[l].u.p.serial == m[i].u.i.port[j])
+                                                               move(line>1?line:1,4+((COLS-4)/2));
+                                                       } else
+                                                       {
+                                                               move(++line>1?line:1, 1);
+                                                               LTEE
+                                                               ltee = 1;
+                                                       }
+                                                       k++;
+                                                       color(white);
+                                                       if (m[i].u.i.pri)
+                                                               SPRINT(buffer,"S%2d: ", j+1+(j>=15));
+                                                       else
+                                                               SPRINT(buffer,"B%2d: ", j+1);
+                                                       addstr(buffer);
+                                                       if (!m[i].u.i.ptp)
+                                                               goto ptmp;
+                                                       if (m[i].u.i.l2link && m[i].u.i.block==0)
+                                                       {
+                                                               ptmp:
+                                                               color((m[i].u.i.busy[j])?yellow:blue);
+                                                               addstr((m[i].u.i.busy[j])?"busy":"idle");
+                                                       } else
+                                                       {
+                                                               color(red);
+                                                               addstr("blk ");
+                                                       }
+                                                       if (m[i].u.i.port[j])
+                                                       {
+                                                               /* search for port */
+                                                               l = msg.u.s.interfaces+msg.u.s.calls+msg.u.s.epoints;
+                                                               ll = l+msg.u.s.ports;
+                                                               while(l < ll)
                                                                {
                                                                {
-                                                                       SPRINT(buffer, " %s(%ld)", m[l].u.p.name, m[l].u.p.serial);
-                                                                       addstr(buffer);
+                                                                       if (m[l].u.p.serial == m[i].u.i.port[j])
+                                                                       {
+                                                                               SPRINT(buffer, " %s(%ld)", m[l].u.p.name, m[l].u.p.serial);
+                                                                               addstr(buffer);
+                                                                       }
+                                                                       l++;
                                                                }
                                                                }
-                                                               l++;
                                                        }
                                                        }
-                                               }
-                                               if (line+2 >= LINES)
-                                               {
-                                                       if (ltee)
+                                                       if (line+2 >= LINES)
                                                        {
                                                        {
-                                                               color(cyan);
-                                                               move(line>1?line:1, 1);
-                                                               LLCORNER
+                                                               if (ltee)
+                                                               {
+                                                                       color(cyan);
+                                                                       move(line>1?line:1, 1);
+                                                                       LLCORNER
+                                                               }
+                                                               goto end;
                                                        }
                                                        }
-                                                       goto end;
                                                }
                                                }
+                                               j++;
                                        }
                                        }
-                                       j++;
-                               }
-                               if (ltee)
-                               {
-                                       color(cyan);
-                                       move(line>1?line:1, 1);
-                                       LLCORNER
-                               }
-                               if (line+2 >= LINES) goto end;
-                               /* show summary if no channels were shown */
-                               if (show_interfaces<2 && ltee==0)
-                               {
-                                       color(cyan);
-                                       move(++line>1?line:1, 1);
-                                       LLCORNER
-                                               
-                                       if (m[i].u.i.l2link)
+                                       if (ltee)
                                        {
                                        {
-                                               color(green);
-                                               SPRINT(buffer,"all %d channels free", m[i].u.i.channels);
-                                       } else
+                                               color(cyan);
+                                               move(line>1?line:1, 1);
+                                               LLCORNER
+                                       }
+                                       if (line+2 >= LINES) goto end;
+                                       /* show summary if no channels were shown */
+                                       if (show_interfaces<2 && ltee==0)
                                        {
                                        {
-                                               color(red);
-                                               SPRINT(buffer,"all %d channels blocked", m[i].u.i.channels);
+                                               color(cyan);
+                                               move(++line>1?line:1, 1);
+                                               LLCORNER
+                                                       
+                                               if (m[i].u.i.l2link && m[i].u.i.block==0)
+                                               {
+                                                       color(green);
+                                                       SPRINT(buffer,"all %d channels free", m[i].u.i.channels);
+                                               } else
+                                               {
+                                                       color(red);
+                                                       SPRINT(buffer,"all %d channels blocked", m[i].u.i.channels);
+                                               }
+                                               addstr(buffer);
                                        }
                                        }
-                                       addstr(buffer);
+                                       if (line+2 >= LINES) goto end;
                                }
                                }
-                               if (line+2 >= LINES) goto end;
                        }
                        i++;
                        anything = 1;
                        }
                        i++;
                        anything = 1;
@@ -905,7 +925,7 @@ readagain:
                {
                        move(line++>1?line-1:1, 0);
                        color(blue);
                {
                        move(line++>1?line-1:1, 0);
                        color(blue);
-                       hline(/*ACS_HLINE*/'q', COLS);
+                       hline(ACS_HLINE, COLS);
                        color(white);
                        
                        l = logcur-(LINES-line-2);
                        color(white);
                        
                        l = logcur-(LINES-line-2);
@@ -933,7 +953,7 @@ readagain:
        move(0, 0);
        color(white);
        msg.u.s.version_string[sizeof(msg.u.s.version_string)-1] = '\0';
        move(0, 0);
        color(white);
        msg.u.s.version_string[sizeof(msg.u.s.version_string)-1] = '\0';
-       SPRINT(buffer, "PBX4Linux %s", msg.u.s.version_string);
+       SPRINT(buffer, "LCR %s", msg.u.s.version_string);
        addstr(buffer);
        if (COLS>50)
        {
        addstr(buffer);
        if (COLS>50)
        {
@@ -946,7 +966,7 @@ readagain:
        /* displeay head line */
        move(1, 0);
        color(blue);
        /* displeay head line */
        move(1, 0);
        color(blue);
-       hline(/*ACS_HLINE*/'q', COLS);
+       hline(ACS_HLINE, COLS);
        if (offset)
        {
                move(1, 1);
        if (offset)
        {
                move(1, 1);
@@ -957,7 +977,7 @@ readagain:
        /* display end */
        move(LINES-2, 0);
        color(white);
        /* display end */
        move(LINES-2, 0);
        color(white);
-       hline(/*ACS_HLINE*/'q', COLS);
+       hline(ACS_HLINE, COLS);
        move(LINES-1, 0);
        color(white);
        SPRINT(buffer, "i = interfaces '%s'  c = calls '%s'  l = log  q = quit  +/- = scroll", text_interfaces[show_interfaces], text_calls[show_calls]);
        move(LINES-1, 0);
        color(white);
        SPRINT(buffer, "i = interfaces '%s'  c = calls '%s'  l = log  q = quit  +/- = scroll", text_interfaces[show_interfaces], text_calls[show_calls]);
@@ -1052,6 +1072,21 @@ char *admin_cmd(int sock, int mode, char *extension, char *number)
                msg.message = ADMIN_REQUEST_CMD_RELEASE;
                SCPY(msg.u.x.message, number);
                break;
                msg.message = ADMIN_REQUEST_CMD_RELEASE;
                SCPY(msg.u.x.message, number);
                break;
+               case MODE_UNBLOCK:
+               msg.message = ADMIN_REQUEST_CMD_BLOCK;
+               msg.u.x.portnum = atoi(number);
+               msg.u.x.block = 0;
+               break;
+               case MODE_BLOCK:
+               msg.message = ADMIN_REQUEST_CMD_BLOCK;
+               msg.u.x.portnum = atoi(number);
+               msg.u.x.block = 1;
+               break;
+               case MODE_UNLOAD:
+               msg.message = ADMIN_REQUEST_CMD_BLOCK;
+               msg.u.x.portnum = atoi(number);
+               msg.u.x.block = 2;
+               break;
        }
 
        if (write(sock, &msg, sizeof(msg)) != sizeof(msg))
        }
 
        if (write(sock, &msg, sizeof(msg)) != sizeof(msg))
@@ -1078,6 +1113,12 @@ char *admin_cmd(int sock, int mode, char *extension, char *number)
                if (msg.message != ADMIN_RESPONSE_CMD_RELEASE)
                        return("Response not valid.");
                break;
                if (msg.message != ADMIN_RESPONSE_CMD_RELEASE)
                        return("Response not valid.");
                break;
+               case MODE_UNBLOCK:
+               case MODE_BLOCK:
+               case MODE_UNLOAD:
+               if (msg.message != ADMIN_RESPONSE_CMD_BLOCK)
+                       return("Response not valid.");
+               break;
        }
 
        /* process response */
        }
 
        /* process response */
@@ -1293,10 +1334,13 @@ int main(int argc, char *argv[])
                printf("\n");
                printf("Usage: %s state | interface | route | dial ...\n", argv[0]);
                printf("state - View current states using graphical console output.\n");
                printf("\n");
                printf("Usage: %s state | interface | route | dial ...\n", argv[0]);
                printf("state - View current states using graphical console output.\n");
-               printf("interface - Tell PBX to reload \"interface.conf\".\n");
-               printf("route - Tell PBX to reload \"route.conf\".\n");
-               printf("dial <extension> <number> - Tell PBX the next number to dial for extension.\n");
-               printf("release <number> - Tell PBX to release endpoint with given number.\n");
+               printf("interface - Tell LCR to reload \"interface.conf\".\n");
+               printf("route - Tell LCR to reload \"route.conf\".\n");
+               printf("dial <extension> <number> - Tell LCR the next number to dial for extension.\n");
+               printf("release <number> - Tell LCR to release endpoint with given number.\n");
+               printf("block <port> - Block given port.\n");
+               printf("unblock <port> - Unblock given port.\n");
+               printf("unload <port> - Unload port. To load port use 'block' or 'unblock'.\n");
                printf("testcall <interface> <callerid> <number> [present|restrict [<capability>]] - Testcall\n");
                printf(" -> capability = <bc> <mode> <codec> <hlc> <exthlc> (Values must be numbers, -1 to omit.)\n");
                printf("trace [brief|short] [<filter> [...]] - Shows call trace. Use filter to reduce output.\n");
                printf("testcall <interface> <callerid> <number> [present|restrict [<capability>]] - Testcall\n");
                printf(" -> capability = <bc> <mode> <codec> <hlc> <exthlc> (Values must be numbers, -1 to omit.)\n");
                printf("trace [brief|short] [<filter> [...]] - Shows call trace. Use filter to reduce output.\n");
@@ -1330,6 +1374,24 @@ int main(int argc, char *argv[])
                        goto usage;
                mode = MODE_RELEASE;
        } else
                        goto usage;
                mode = MODE_RELEASE;
        } else
+       if (!(strcasecmp(argv[1],"unblock")))
+       {
+               if (argc <= 2)
+                       goto usage;
+               mode = MODE_UNBLOCK;
+       } else
+       if (!(strcasecmp(argv[1],"block")))
+       {
+               if (argc <= 2)
+                       goto usage;
+               mode = MODE_BLOCK;
+       } else
+       if (!(strcasecmp(argv[1],"unload")))
+       {
+               if (argc <= 2)
+                       goto usage;
+               mode = MODE_UNLOAD;
+       } else
        if (!(strcasecmp(argv[1],"testcall")))
        {
                if (argc <= 4)
        if (!(strcasecmp(argv[1],"testcall")))
        {
                if (argc <= 4)
@@ -1357,7 +1419,7 @@ int main(int argc, char *argv[])
        if ((conn = connect(sock, (struct sockaddr *)&sock_address, SUN_LEN(&sock_address))) < 0)
        {
                close(sock);
        if ((conn = connect(sock, (struct sockaddr *)&sock_address, SUN_LEN(&sock_address))) < 0)
        {
                close(sock);
-               fprintf(stderr, "Failed to connect to socket \"%s\".\nIs PBX4Linux running?\n", sock_address.sun_path);
+               fprintf(stderr, "Failed to connect to socket \"%s\".\nIs LCR running?\n", sock_address.sun_path);
                exit(EXIT_FAILURE);
        }
 
                exit(EXIT_FAILURE);
        }
 
@@ -1378,6 +1440,9 @@ int main(int argc, char *argv[])
                break;
 
                case MODE_RELEASE:
                break;
 
                case MODE_RELEASE:
+               case MODE_UNBLOCK:
+               case MODE_BLOCK:
+               case MODE_UNLOAD:
                ret = admin_cmd(sock, mode, NULL, argv[2]);
                break;
 
                ret = admin_cmd(sock, mode, NULL, argv[2]);
                break;
 
index 756376f..ad40516 100644 (file)
@@ -164,7 +164,7 @@ int admin_interface(struct admin_queue **responsep)
        if (!response)
                return(-1);
        memuse++;
        if (!response)
                return(-1);
        memuse++;
-       memset(response, 0, sizeof(admin_queue));
+       memset(response, 0, sizeof(admin_queue)+sizeof(admin_message));
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_CMD_INTERFACE;
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_CMD_INTERFACE;
@@ -256,11 +256,11 @@ int admin_route(struct admin_queue **responsep)
                        apppbx->release(RELEASE_ALL, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL);
                        start_trace(0,
                                NULL,
                        apppbx->release(RELEASE_ALL, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL);
                        start_trace(0,
                                NULL,
-                               nationalize(apppbx->e_callerinfo.id, apppbx->e_callerinfo.ntype),
-                               apppbx->e_dialinginfo.number,
+                               numberrize_callerinfo(apppbx->e_callerinfo.id, apppbx->e_callerinfo.ntype),
+                               apppbx->e_dialinginfo.id,
                                DIRECTION_NONE,
                                CATEGORY_EP,
                                DIRECTION_NONE,
                                CATEGORY_EP,
-                               apppbx->e_serial,
+                               apppbx->ea_endpoint->ep_serial,
                                "KICK (reload routing)");
                }
 
                                "KICK (reload routing)");
                }
 
@@ -277,7 +277,7 @@ int admin_route(struct admin_queue **responsep)
        if (!response)
                return(-1);
        memuse++;
        if (!response)
                return(-1);
        memuse++;
-       memset(response, 0, sizeof(admin_queue));
+       memset(response, 0, sizeof(admin_queue)+sizeof(admin_message));
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_CMD_ROUTE;
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_CMD_ROUTE;
@@ -307,7 +307,7 @@ int admin_dial(struct admin_queue **responsep, char *message)
        if (!response)
                return(-1);
        memuse++;
        if (!response)
                return(-1);
        memuse++;
-       memset(response, 0, sizeof(admin_queue));
+       memset(response, 0, sizeof(admin_queue)+sizeof(admin_message));
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_CMD_DIAL;
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_CMD_DIAL;
@@ -340,6 +340,107 @@ int admin_dial(struct admin_queue **responsep, char *message)
 
 
 /*
 
 
 /*
+ * do blocking
+ * 
+ * 0 = make port available
+ * 1 = make port administratively blocked
+ * 2 = unload port
+ * the result is returned:
+ * 0 = port is now available
+ * 1 = port is now blocked
+ * 2 = port cannot be loaded or has been unloaded
+ * -1 = port doesn't exist
+ */
+int admin_block(struct admin_queue **responsep, int portnum, int block)
+{
+       struct admin_queue      *response;      /* response pointer */
+       struct interface        *interface;
+       struct interface_port   *ifport;
+
+       /* create block response */
+       response = (struct admin_queue *)malloc(sizeof(struct admin_queue)+sizeof(admin_message));
+       if (!response)
+               return(-1);
+       memuse++;
+       memset(response, 0, sizeof(admin_queue)+sizeof(admin_message));
+       response->num = 1;
+       /* message */
+       response->am[0].message = ADMIN_RESPONSE_CMD_BLOCK;
+       response->am[0].u.x.portnum = portnum;
+
+       /* search for port */
+       interface = interface_first;
+       while(interface)
+       {
+               ifport = interface->ifport;
+               while(ifport)
+               {
+                       if (ifport->portnum == portnum)
+                               break;
+                       ifport = ifport->next;
+               }
+               if (ifport)
+                       break;
+               interface = interface->next;
+       }
+       /* not found, we return -1 */
+       if (!ifport)
+       {
+               response->am[0].u.x.block = -1;
+               response->am[0].u.x.error = 1;
+               SPRINT(response->am[0].u.x.message, "Port %d does not exist.", portnum);
+               goto out;
+       }
+
+       /* no interface */
+       if (!ifport->mISDNport)
+       {
+               /* not loaded anyway */
+               if (block >= 2)
+               {
+                       response->am[0].u.x.block = 2;
+                       goto out;
+               }
+
+               /* try loading interface */
+               ifport->block = block;
+               load_port(ifport);
+
+               /* port cannot load */
+               if (ifport->block >= 2)
+               {
+                       response->am[0].u.x.block = 2;
+                       response->am[0].u.x.error = 1;
+                       SPRINT(response->am[0].u.x.message, "Port %d will not load.", portnum);
+                       goto out;
+               }
+
+               /* port loaded */
+               response->am[0].u.x.block = ifport->block;
+               goto out;
+       }
+
+       /* if we shall unload interface */
+       if (block >= 2)
+       {
+               mISDNport_close(ifport->mISDNport);
+               ifport->mISDNport = 0;
+               ifport->block = 2;
+               goto out;
+       }
+       
+       /* port new blocking state */
+       ifport->block = response->am[0].u.x.block = block;
+
+       out:
+       /* attach to response chain */
+       *responsep = response;
+       responsep = &response->next;
+       return(0);
+}
+
+
+/*
  * do release
  */
 int admin_release(struct admin_queue **responsep, char *message)
  * do release
  */
 int admin_release(struct admin_queue **responsep, char *message)
@@ -353,7 +454,7 @@ int admin_release(struct admin_queue **responsep, char *message)
        if (!response)
                return(-1);
        memuse++;
        if (!response)
                return(-1);
        memuse++;
-       memset(response, 0, sizeof(admin_queue));
+       memset(response, 0, sizeof(admin_queue)+sizeof(admin_message));
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_CMD_RELEASE;
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_CMD_RELEASE;
@@ -416,7 +517,7 @@ int admin_call(struct admin_list *admin, struct admin_message *msg)
        apppbx->e_capainfo.bearer_info1 = msg->u.call.bc_info1;
        apppbx->e_capainfo.hlc = msg->u.call.hlc;
        apppbx->e_capainfo.exthlc = msg->u.call.exthlc;
        apppbx->e_capainfo.bearer_info1 = msg->u.call.bc_info1;
        apppbx->e_capainfo.hlc = msg->u.call.hlc;
        apppbx->e_capainfo.exthlc = msg->u.call.exthlc;
-       SCPY(apppbx->e_dialinginfo.number, msg->u.call.dialing);
+       SCPY(apppbx->e_dialinginfo.id, msg->u.call.dialing);
        SCPY(apppbx->e_dialinginfo.interfaces, msg->u.call.interface);
        apppbx->e_dialinginfo.sending_complete = 1;
 
        SCPY(apppbx->e_dialinginfo.interfaces, msg->u.call.interface);
        apppbx->e_dialinginfo.sending_complete = 1;
 
@@ -461,7 +562,7 @@ void admin_call_response(int adminid, int message, char *connected, int cause, i
        if (!response)
                return;
        memuse++;
        if (!response)
                return;
        memuse++;
-       memset(response, 0, sizeof(admin_queue));
+       memset(response, 0, sizeof(admin_queue)+sizeof(admin_message));
        response->num = 1;
        /* message */
        response->am[0].message = message;
        response->num = 1;
        /* message */
        response->am[0].message = message;
@@ -488,6 +589,8 @@ int admin_state(struct admin_queue **responsep)
        class EndpointAppPBX    *apppbx;
        class Call              *call;
        class Pdss1             *pdss1;
        class EndpointAppPBX    *apppbx;
        class Call              *call;
        class Pdss1             *pdss1;
+       struct interface        *interface;
+       struct interface_port   *ifport;
        struct mISDNport        *mISDNport;
        int                     i;
        int                     num;
        struct mISDNport        *mISDNport;
        int                     i;
        int                     num;
@@ -499,7 +602,7 @@ int admin_state(struct admin_queue **responsep)
        if (!response)
                return(-1);
        memuse++;
        if (!response)
                return(-1);
        memuse++;
-       memset(response, 0, sizeof(admin_queue));
+       memset(response, 0, sizeof(admin_queue)+sizeof(admin_message));
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_STATE;
        response->num = 1;
        /* message */
        response->am[0].message = ADMIN_RESPONSE_STATE;
@@ -510,12 +613,17 @@ int admin_state(struct admin_queue **responsep)
        /* log file */
        SCPY(response->am[0].u.s.logfile, options.log);
        /* interface count */
        /* log file */
        SCPY(response->am[0].u.s.logfile, options.log);
        /* interface count */
-       mISDNport = mISDNport_first;
        i = 0;
        i = 0;
-       while(mISDNport)
+       interface = interface_first;
+       while(interface)
        {
        {
-               i++;
-               mISDNport = mISDNport->next;
+               ifport = interface->ifport;
+               while(ifport)
+               {
+                       i++;
+                       ifport = ifport->next;
+               }
+               interface = interface->next;
        }
        response->am[0].u.s.interfaces = i;
        /* call count */
        }
        response->am[0].u.s.interfaces = i;
        /* call count */
@@ -537,8 +645,8 @@ int admin_state(struct admin_queue **responsep)
        }
        response->am[0].u.s.epoints = i;
        /* port count */
        }
        response->am[0].u.s.epoints = i;
        /* port count */
-       port = port_first;
        i = 0;
        i = 0;
+       port = port_first;
        while(port)
        {
                i++;
        while(port)
        {
                i++;
@@ -551,52 +659,67 @@ int admin_state(struct admin_queue **responsep)
 
        /* create response for all interfaces */
        num = (response->am[0].u.s.interfaces)+(response->am[0].u.s.calls)+(response->am[0].u.s.epoints)+(response->am[0].u.s.ports);
 
        /* create response for all interfaces */
        num = (response->am[0].u.s.interfaces)+(response->am[0].u.s.calls)+(response->am[0].u.s.epoints)+(response->am[0].u.s.ports);
+       if (num == 0)
+               return(0);
        response = (struct admin_queue *)malloc(sizeof(admin_queue)+(num*sizeof(admin_message)));
        if (!response)
                return(-1);
        memuse++;
        response = (struct admin_queue *)malloc(sizeof(admin_queue)+(num*sizeof(admin_message)));
        if (!response)
                return(-1);
        memuse++;
-       memset(response, 0, sizeof(admin_queue)+(num*sizeof(admin_queue)));
+       memset(response, 0, sizeof(admin_queue)+(num*sizeof(admin_message)));
        response->num = num;
        *responsep = response;
        responsep = &response->next;
        response->num = num;
        *responsep = response;
        responsep = &response->next;
-       mISDNport = mISDNport_first;
+       interface = interface_first;
        num = 0;
        num = 0;
-       while(mISDNport)
+       while(interface)
        {
        {
-               /* message */
-               response->am[num].message = ADMIN_RESPONSE_S_INTERFACE;
-               /* portnum */
-               response->am[num].u.i.portnum = mISDNport->portnum;
-               /* interface */
-               SCPY(response->am[num].u.i.interface_name, mISDNport->interface_name);
-               /* iftype */
-               response->am[num].u.i.iftype = mISDNport->iftype;
-               /* ptp */
-               response->am[num].u.i.ptp = mISDNport->ptp;
-               /* ntmode */
-               response->am[num].u.i.ntmode = mISDNport->ntmode;
-               /* pri */
-               response->am[num].u.i.pri = mISDNport->pri;
-               /* use */
-               response->am[num].u.i.use = mISDNport->use;
-               /* l1link */
-               response->am[num].u.i.l1link = mISDNport->l1link;
-               /* l2link */
-               response->am[num].u.i.l2link = mISDNport->l2link;
-               /* channels */
-               response->am[num].u.i.channels = mISDNport->b_num;
-               /* channel info */
-               i = 0;
-               anybusy = 0;
-               while(i < mISDNport->b_num)
+               ifport = interface->ifport;
+               while(ifport)
                {
                {
-                       response->am[num].u.i.busy[i] = mISDNport->b_state[i];
-                       if (mISDNport->b_port[i])
-                               response->am[num].u.i.port[i] = mISDNport->b_port[i]->p_serial;
-                       i++;
+                       /* message */
+                       response->am[num].message = ADMIN_RESPONSE_S_INTERFACE;
+                       /* interface */
+                       SCPY(response->am[num].u.i.interface_name, interface->name);
+                       /* portnum */
+                       response->am[num].u.i.portnum = ifport->portnum;
+                       /* iftype */
+                       response->am[num].u.i.extension = interface->extension;
+                       /* block */
+                       response->am[num].u.i.block = ifport->block;
+                       if (ifport->mISDNport)
+                       {
+                               mISDNport = ifport->mISDNport;
+
+                               /* ptp */
+                               response->am[num].u.i.ptp = mISDNport->ptp;
+                               /* ntmode */
+                               response->am[num].u.i.ntmode = mISDNport->ntmode;
+                               /* pri */
+                               response->am[num].u.i.pri = mISDNport->pri;
+                               /* use */
+                               response->am[num].u.i.use = mISDNport->use;
+                               /* l1link */
+                               response->am[num].u.i.l1link = mISDNport->l1link;
+                               /* l2link */
+                               response->am[num].u.i.l2link = mISDNport->l2link;
+                               /* channels */
+                               response->am[num].u.i.channels = mISDNport->b_num;
+                               /* channel info */
+                               i = 0;
+                               anybusy = 0;
+                               while(i < mISDNport->b_num)
+                               {
+                                       response->am[num].u.i.busy[i] = mISDNport->b_state[i];
+                                       if (mISDNport->b_port[i])
+                                               response->am[num].u.i.port[i] = mISDNport->b_port[i]->p_serial;
+                                       i++;
+                               }
+                       }
+                       num++;
+
+                       ifport = ifport->next;
                }
                }
-               mISDNport = mISDNport->next;
-               num++;
+               interface = interface->next;
        }
 
        /* create response for all calls */
        }
 
        /* create response for all calls */
@@ -673,7 +796,7 @@ int admin_state(struct admin_queue **responsep)
                /* callerid */
                SCPY(response->am[num].u.e.callerid, apppbx->e_callerinfo.id);
                /* dialing */
                /* callerid */
                SCPY(response->am[num].u.e.callerid, apppbx->e_callerinfo.id);
                /* dialing */
-               SCPY(response->am[num].u.e.dialing, apppbx->e_dialinginfo.number);
+               SCPY(response->am[num].u.e.dialing, apppbx->e_dialinginfo.id);
                /* action string */
                if (apppbx->e_action)
                        SCPY(response->am[num].u.e.action, action_defs[apppbx->e_action->index].name);
                /* action string */
                if (apppbx->e_action)
                        SCPY(response->am[num].u.e.action, action_defs[apppbx->e_action->index].name);
@@ -918,16 +1041,25 @@ int admin_handle(void)
                                PERROR("Failed to create state response for socket %d.\n", admin->sock);
                                goto response_error;
                        }
                                PERROR("Failed to create state response for socket %d.\n", admin->sock);
                                goto response_error;
                        }
-                       case ADMIN_REQUEST_MESSAGE:
+                       break;
+
+                       case ADMIN_REQUEST_CMD_BLOCK:
+                       if (admin_block(&admin->response, msg.u.x.portnum, msg.u.x.block) < 0)
+                       {
+                               PERROR("Failed to create block response for socket %d.\n", admin->sock);
+                               goto response_error;
+                       }
+                       break;
+
+#warning interface tbd
+#if 0
+                       case ADMIN_MESSAGE:
                        if (admin_message(&admin->response) < 0)
                        {
                                PERROR("Failed to create message response for socket %d.\n", admin->sock);
                        if (admin_message(&admin->response) < 0)
                        {
                                PERROR("Failed to create message response for socket %d.\n", admin->sock);
-                               response_error:
-                               *adminp = admin->next;
-                               free_connection(admin);
-                               admin = *adminp;
-                               continue;
+                               goto response_error;
                        }
                        }
+#endif
 #if 0
 #warning DEBUGGING
 {
 #if 0
 #warning DEBUGGING
 {
@@ -948,7 +1080,11 @@ int admin_handle(void)
                        if (admin_call(admin, &msg))
                        {
                                PERROR("Failed to create call for socket %d.\n", admin->sock);
                        if (admin_call(admin, &msg))
                        {
                                PERROR("Failed to create call for socket %d.\n", admin->sock);
-                               goto response_error;
+                               response_error:
+                               *adminp = admin->next;
+                               free_connection(admin);
+                               admin = *adminp;
+                               continue;
                        }
                        break;
 
                        }
                        break;
 
index d28ae87..dda9da3 100644 (file)
@@ -60,7 +60,7 @@ EndpointAppPBX::EndpointAppPBX(class Endpoint *epoint) : EndpointApp(epoint)
        e_match_timeout = 0;
        e_match_to_action = NULL;
         e_select = 0;
        e_match_timeout = 0;
        e_match_to_action = NULL;
         e_select = 0;
-        e_extdialing = e_dialinginfo.number;
+        e_extdialing = e_dialinginfo.id;
 //        e_knocking = 0;
 //        e_knocktime = 0;
        e_hold = 0;
 //        e_knocking = 0;
 //        e_knocktime = 0;
        e_hold = 0;
@@ -150,7 +150,7 @@ void EndpointAppPBX::trace_header(char *name, int direction)
        start_trace(ea_endpoint->ep_serial,
                    NULL,
                    numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype),
        start_trace(ea_endpoint->ep_serial,
                    NULL,
                    numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype),
-                   e_dialinginfo.number,
+                   e_dialinginfo.id,
                    direction,
                    CATEGORY_EP,
                    ea_endpoint->ep_serial,
                    direction,
                    CATEGORY_EP,
                    ea_endpoint->ep_serial,
@@ -409,7 +409,7 @@ void EndpointAppPBX::release(int release, int calllocation, int callcause, int p
                        e_match_timeout = 0;
                        e_match_to_action = NULL;
                        //e_select = 0;
                        e_match_timeout = 0;
                        e_match_to_action = NULL;
                        //e_select = 0;
-                       e_extdialing = e_dialinginfo.number;
+                       e_extdialing = e_dialinginfo.id;
                        e_connectedmode = 0;
                        e_dtmf = 0;
                        e_dtmf_time = 0;
                        e_connectedmode = 0;
                        e_dtmf = 0;
                        e_dtmf_time = 0;
@@ -438,7 +438,7 @@ void EndpointAppPBX::release(int release, int calllocation, int callcause, int p
                        {
                                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) preparing callback to internal: %s interface %s\n", ea_endpoint->ep_serial, e_ext.number, e_extension_interface);
                                /* create callback to the current terminal */
                        {
                                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) preparing callback to internal: %s interface %s\n", ea_endpoint->ep_serial, e_ext.number, e_extension_interface);
                                /* create callback to the current terminal */
-                               SCPY(e_dialinginfo.number, e_ext.number);
+                               SCPY(e_dialinginfo.id, e_ext.number);
                                SCPY(e_dialinginfo.interfaces, e_extension_interface);
                                e_dialinginfo.itype = INFO_ITYPE_ISDN_EXTENSION;
                                e_dialinginfo.ntype = INFO_NTYPE_UNKNOWN;
                                SCPY(e_dialinginfo.interfaces, e_extension_interface);
                                e_dialinginfo.itype = INFO_ITYPE_ISDN_EXTENSION;
                                e_dialinginfo.ntype = INFO_NTYPE_UNKNOWN;
@@ -446,15 +446,15 @@ void EndpointAppPBX::release(int release, int calllocation, int callcause, int p
                        {
                                if (e_cbto[0])
                                {
                        {
                                if (e_cbto[0])
                                {
-                                       SCPY(e_dialinginfo.number, e_cbto);
+                                       SCPY(e_dialinginfo.id, e_cbto);
                                } else
                                {
                                        /* numberrize caller id and use it to dial to the callback */
                                } else
                                {
                                        /* numberrize caller id and use it to dial to the callback */
-                                       SCPY(e_dialinginfo.number, numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype));
+                                       SCPY(e_dialinginfo.id, numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype));
                                }
                                e_dialinginfo.itype = INFO_ITYPE_ISDN;
                                e_dialinginfo.ntype = INFO_NTYPE_UNKNOWN;
                                }
                                e_dialinginfo.itype = INFO_ITYPE_ISDN;
                                e_dialinginfo.ntype = INFO_NTYPE_UNKNOWN;
-                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) preparing callback to external: %s\n", ea_endpoint->ep_serial, e_dialinginfo.number);
+                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) preparing callback to external: %s\n", ea_endpoint->ep_serial, e_dialinginfo.id);
                        }
                        return;
                }
                        }
                        return;
                }
@@ -467,9 +467,9 @@ void EndpointAppPBX::release(int release, int calllocation, int callcause, int p
 
 
 /* cancel callerid if restricted, unless anon-ignore is enabled at extension or port is of type external (so called police gets caller id :)*/
 
 
 /* cancel callerid if restricted, unless anon-ignore is enabled at extension or port is of type external (so called police gets caller id :)*/
-void apply_callerid_restriction(int anon_ignore, int port_type, char *id, int *ntype, int *present, int *screen, char *voip, char *extension, char *name)
+void apply_callerid_restriction(int anon_ignore, char *id, int *ntype, int *present, int *screen, char *extension, char *name)
 {
 {
-       PDEBUG(DEBUG_EPOINT, "id='%s' ntype=%d present=%d screen=%d voip='%s' extension='%s' name='%s'\n", (id)?id:"NULL", (ntype)?*ntype:-1, (present)?*present:-1, (screen)?*screen:-1, (voip)?voip:"NULL", (extension)?extension:"NULL", (name)?name:"NULL");
+       PDEBUG(DEBUG_EPOINT, "id='%s' ntype=%d present=%d screen=%d extension='%s' name='%s'\n", (id)?id:"NULL", (ntype)?*ntype:-1, (present)?*present:-1, (screen)?*screen:-1, (extension)?extension:"NULL", (name)?name:"NULL");
 
        /* caller id is not restricted, so we do nothing */
        if (*present != INFO_PRESENT_RESTRICTED)
 
        /* caller id is not restricted, so we do nothing */
        if (*present != INFO_PRESENT_RESTRICTED)
@@ -503,19 +503,17 @@ void apply_callerid_restriction(int anon_ignore, int port_type, char *id, int *n
 }
 
 /* used display message to display callerid as available */
 }
 
 /* used display message to display callerid as available */
-char *EndpointAppPBX::apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *voip, char *extension, char *name)
+char *EndpointAppPBX::apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *extension, char *name)
 {
        static char display[81];
 
        display[0] = '\0';
        char *cid = numberrize_callerinfo(id, ntype);
 
 {
        static char display[81];
 
        display[0] = '\0';
        char *cid = numberrize_callerinfo(id, ntype);
 
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) id='%s' itype=%d ntype=%d present=%d screen=%d voip='%s' extension='%s' name='%s'\n", ea_endpoint->ep_serial, (id)?id:"NULL", itype, ntype, present, screen, (voip)?voip:"NULL", (extension)?extension:"NULL", (name)?name:"NULL");
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) id='%s' itype=%d ntype=%d present=%d screen=%d extension='%s' name='%s'\n", ea_endpoint->ep_serial, (id)?id:"NULL", itype, ntype, present, screen, (extension)?extension:"NULL", (name)?name:"NULL");
 
        if (!id)
                id = "";
 
        if (!id)
                id = "";
-       if (!voip)
-               voip = "";
        if (!extension)
                extension = "";
        if (!name)
        if (!extension)
                extension = "";
        if (!name)
@@ -537,7 +535,7 @@ char *EndpointAppPBX::apply_callerid_display(char *id, int itype, int ntype, int
        }
 
        /* external caller id */
        }
 
        /* external caller id */
-       if (!extension[0] && !voip[0] && e_ext.display_ext)
+       if (!extension[0] && e_ext.display_ext)
        {
                if (!display[0])
                {
        {
                if (!display[0])
                {
@@ -553,16 +551,6 @@ char *EndpointAppPBX::apply_callerid_display(char *id, int itype, int ntype, int
                }
        }
 
                }
        }
 
-       /* voip caller id */
-       if (voip[0] && e_ext.display_voip)
-       {
-               if (!display[0] && cid[0])
-                               SCAT(display, cid);
-               if (display[0])
-                               SCAT(display, " ");
-               SCAT(display, voip);
-       }
-
        /* display if callerid is anonymouse but available due anon-ignore */
        if (e_ext.display_anon && present==INFO_PRESENT_RESTRICTED)
        {
        /* display if callerid is anonymouse but available due anon-ignore */
        if (e_ext.display_anon && present==INFO_PRESENT_RESTRICTED)
        {
@@ -769,7 +757,9 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
 {
        struct interface *interface;
        struct interface_port *ifport, *ifport_start;
 {
        struct interface *interface;
        struct interface_port *ifport, *ifport_start;
+       struct select_channel *selchannel; 
        struct mISDNport *mISDNport;
        struct mISDNport *mISDNport;
+       int index, i;
 
        interface = interface_first;
 
 
        interface = interface_first;
 
@@ -787,7 +777,7 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
                        trace_header("CHANNEL SELECTION (found interface)", DIRECTION_NONE);
                        add_trace("interface", NULL, "%s", ifname);
                        end_trace();
                        trace_header("CHANNEL SELECTION (found interface)", DIRECTION_NONE);
                        add_trace("interface", NULL, "%s", ifname);
                        end_trace();
-                       goto found;
+                       goto foundif;
                }
 
        } else
                }
 
        } else
@@ -798,12 +788,13 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
                        trace_header("CHANNEL SELECTION (found non extension interface)", DIRECTION_NONE);
                        add_trace("interface", NULL, "%s", interface->name);
                        end_trace();
                        trace_header("CHANNEL SELECTION (found non extension interface)", DIRECTION_NONE);
                        add_trace("interface", NULL, "%s", interface->name);
                        end_trace();
-                       goto found;
+                       goto foundif;
                }
        }
 
        interface = interface->next;
        goto checknext;
                }
        }
 
        interface = interface->next;
        goto checknext;
+foundif:
 
        /* see if interface has ports */
        if (!interface->ifport)
 
        /* see if interface has ports */
        if (!interface->ifport)
@@ -817,14 +808,14 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
        }
 
        /* select port by algorithm */
        }
 
        /* select port by algorithm */
-       ifport_start = interface->port;
+       ifport_start = interface->ifport;
        index = 0;
        if (interface->hunt == HUNT_ROUNDROBIN)
        {
                while(ifport_start->next && index<interface->hunt_next)
                {
                        ifport_start = ifport_start->next;
        index = 0;
        if (interface->hunt == HUNT_ROUNDROBIN)
        {
                while(ifport_start->next && index<interface->hunt_next)
                {
                        ifport_start = ifport_start->next;
-                       i++;
+                       index++;
                }
                trace_header("CHANNEL SELECTION (starting round-robin)", DIRECTION_NONE);
                add_trace("port", NULL, "%d", ifport_start->portnum);
                }
                trace_header("CHANNEL SELECTION (starting round-robin)", DIRECTION_NONE);
                add_trace("port", NULL, "%d", ifport_start->portnum);
@@ -847,8 +838,6 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
        }
        mISDNport = ifport->mISDNport;
 
        }
        mISDNport = ifport->mISDNport;
 
-#warning admin block auch bei incomming calls
-#warning calls releasen, wenn port entfernt wird, geblockt wird
        /* see if port is administratively blocked */
        if (ifport->block)
        {
        /* see if port is administratively blocked */
        if (ifport->block)
        {
@@ -871,13 +860,13 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
 
        /* check for channel form selection list */
        *channel = 0;
 
        /* check for channel form selection list */
        *channel = 0;
-       selchannel = ifport->selchannel;
+       selchannel = ifport->out_channel;
        while(selchannel)
        {
                switch(selchannel->channel)
                {
                        case CHANNEL_FREE: /* free channel */
        while(selchannel)
        {
                switch(selchannel->channel)
                {
                        case CHANNEL_FREE: /* free channel */
-                       if (mISDNport->b_inuse >= mISDNport->b_num)
+                       if (mISDNport->b_reserved >= mISDNport->b_num)
                                break; /* all channel in use or reserverd */
                        /* find channel */
                        i = 0;
                                break; /* all channel in use or reserverd */
                        /* find channel */
                        i = 0;
@@ -898,7 +887,7 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
                        break;
 
                        case CHANNEL_ANY: /* don't ask for channel */
                        break;
 
                        case CHANNEL_ANY: /* don't ask for channel */
-                       if (mISDNport->b_inuse >= mISDNport->b_num)
+                       if (mISDNport->b_reserved >= mISDNport->b_num)
                        {
                                break; /* all channel in use or reserverd */
                        }
                        {
                                break; /* all channel in use or reserverd */
                        }
@@ -906,7 +895,7 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
                        add_trace("port", NULL, "%d", ifport->portnum);
                        add_trace("position", NULL, "%d", index);
                        end_trace();
                        add_trace("port", NULL, "%d", ifport->portnum);
                        add_trace("position", NULL, "%d", index);
                        end_trace();
-                       *channel = SEL_CHANNEL_ANY;
+                       *channel = CHANNEL_ANY;
                        break;
 
                        case CHANNEL_NO: /* call waiting */
                        break;
 
                        case CHANNEL_NO: /* call waiting */
@@ -914,7 +903,7 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
                        add_trace("port", NULL, "%d", ifport->portnum);
                        add_trace("position", NULL, "%d", index);
                        end_trace();
                        add_trace("port", NULL, "%d", ifport->portnum);
                        add_trace("position", NULL, "%d", index);
                        end_trace();
-                       *channel = SEL_CHANNEL_NO;
+                       *channel = CHANNEL_NO;
                        break;
 
                        default:
                        break;
 
                        default:
@@ -996,12 +985,11 @@ void EndpointAppPBX::out_setup(void)
        class EndpointAppPBX    *atemp;
 //     char                    allowed_ports[256];
 //     char                    exten[256];
        class EndpointAppPBX    *atemp;
 //     char                    allowed_ports[256];
 //     char                    exten[256];
-       int                     i, ii;
-       int                     use;
        char                    ifname[sizeof(e_ext.interfaces)],
                                number[256];
        struct port_settings    port_settings;
        int                     channel = 0;
        char                    ifname[sizeof(e_ext.interfaces)],
                                number[256];
        struct port_settings    port_settings;
        int                     channel = 0;
+       int                     earlyb;
 
        /* create settings for creating port */
        memset(&port_settings, 0, sizeof(port_settings));
 
        /* create settings for creating port */
        memset(&port_settings, 0, sizeof(port_settings));
@@ -1046,13 +1034,13 @@ void EndpointAppPBX::out_setup(void)
                /* FALL THROUGH !!!! */
                case INFO_ITYPE_VBOX:
                /* get dialed extension's info */
                /* FALL THROUGH !!!! */
                case INFO_ITYPE_VBOX:
                /* get dialed extension's info */
-//             SCPY(exten, e_dialinginfo.number);
+//             SCPY(exten, e_dialinginfo.id);
 //             if (strchr(exten, ','))
 //                     *strchr(exten, ',') = '\0';
 //             if (!read_extension(&e_ext, exten))
 //             if (strchr(exten, ','))
 //                     *strchr(exten, ',') = '\0';
 //             if (!read_extension(&e_ext, exten))
-               if (!read_extension(&e_ext, e_dialinginfo.number))
+               if (!read_extension(&e_ext, e_dialinginfo.id))
                {
                {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) extension %s not configured\n", ea_endpoint->ep_serial, e_dialinginfo.number);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) extension %s not configured\n", ea_endpoint->ep_serial, e_dialinginfo.id);
                        release(RELEASE_ALL, LOCATION_PRIVATE_LOCAL, CAUSE_OUTOFORDER, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL); /* RELEASE_TYPE, call, port */
                        return; /* must exit here */
                }
                        release(RELEASE_ALL, LOCATION_PRIVATE_LOCAL, CAUSE_OUTOFORDER, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL); /* RELEASE_TYPE, call, port */
                        return; /* must exit here */
                }
@@ -1125,7 +1113,7 @@ void EndpointAppPBX::out_setup(void)
 
                /* call to all internal interfaces */
                p = e_ext.interfaces;
 
                /* call to all internal interfaces */
                p = e_ext.interfaces;
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) generating multiple calls for extension %s to interfaces %s\n", ea_endpoint->ep_serial, e_dialinginfo.number, p);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) generating multiple calls for extension %s to interfaces %s\n", ea_endpoint->ep_serial, e_dialinginfo.id, p);
                while(*p)
                {
                        ifname[0] = '\0';
                while(*p)
                {
                        ifname[0] = '\0';
@@ -1146,20 +1134,20 @@ void EndpointAppPBX::out_setup(void)
                                continue;
                        }
                        /* creating INTERNAL port */
                                continue;
                        }
                        /* creating INTERNAL port */
-                       SPRINT(portname, "%s-%d-out", mISDNport->interface_name, mISDNport->portnum);
-                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport.channel_force);
+                       SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
+                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force);
                        if (!port)
                        {
                        if (!port)
                        {
-                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) port '%s' failed to create\n", ea_endpoint->ep_serial, mISDNport->interface_name);
+                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) port '%s' failed to create\n", ea_endpoint->ep_serial, mISDNport->ifport->interface->name);
                                goto check_anycall_intern;
                        }
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) got port %s\n", ea_endpoint->ep_serial, port->p_name);
                        memset(&dialinginfo, 0, sizeof(dialinginfo));
                                goto check_anycall_intern;
                        }
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) got port %s\n", ea_endpoint->ep_serial, port->p_name);
                        memset(&dialinginfo, 0, sizeof(dialinginfo));
-                       SCPY(dialinginfo.number, e_dialinginfo.number);
+                       SCPY(dialinginfo.id, e_dialinginfo.id);
                        dialinginfo.itype = INFO_ITYPE_ISDN_EXTENSION;
                        dialinginfo.ntype = e_dialinginfo.ntype;
                        /* create port_list relation */
                        dialinginfo.itype = INFO_ITYPE_ISDN_EXTENSION;
                        dialinginfo.ntype = e_dialinginfo.ntype;
                        /* create port_list relation */
-                       portlist = ea_endpoint->portlist_new(port->p_serial, port->p_type, mISDNport->is_earlyb);
+                       portlist = ea_endpoint->portlist_new(port->p_serial, port->p_type, mISDNport->earlyb);
                        if (!portlist)
                        {
                                PERROR("EPOINT(%d) cannot allocate port_list relation\n", ea_endpoint->ep_serial);
                        if (!portlist)
                        {
                                PERROR("EPOINT(%d) cannot allocate port_list relation\n", ea_endpoint->ep_serial);
@@ -1175,20 +1163,20 @@ void EndpointAppPBX::out_setup(void)
                        }
 //                     dss1 = (class Pdss1 *)port;
                        /* message */
                        }
 //                     dss1 = (class Pdss1 *)port;
                        /* message */
-//printf("INTERNAL caller=%s,id=%s,dial=%s\n", param.setup.networkid, param.setup.callerinfo.id, param.setup.dialinginfo.number);
+//printf("INTERNAL caller=%s,id=%s,dial=%s\n", param.setup.networkid, param.setup.callerinfo.id, param.setup.dialinginfo.id);
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_SETUP);
                        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
                        memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
                        memcpy(&message->param.setup.callerinfo, &e_callerinfo, sizeof(struct caller_info));
                        memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
 //terminal                     SCPY(message->param.setup.from_terminal, e_ext.number);
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_SETUP);
                        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
                        memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
                        memcpy(&message->param.setup.callerinfo, &e_callerinfo, sizeof(struct caller_info));
                        memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
 //terminal                     SCPY(message->param.setup.from_terminal, e_ext.number);
-//terminal                     if (e_dialinginfo.number)
-//terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.number);
+//terminal                     if (e_dialinginfo.id)
+//terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
                        /* handle restricted caller ids */
                        /* handle restricted caller ids */
-                       apply_callerid_restriction(e_ext.anon_ignore, port->p_type, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.voip, message->param.setup.callerinfo.intern, message->param.setup.callerinfo.name);
-                       apply_callerid_restriction(e_ext.anon_ignore, port->p_type, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, NULL, message->param.setup.redirinfo.voip, message->param.setup.redirinfo.intern, 0);
+                       apply_callerid_restriction(e_ext.anon_ignore, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+                       apply_callerid_restriction(e_ext.anon_ignore, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
                        /* display callerid if desired for extension */
                        /* display callerid if desired for extension */
-                       SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.voip, message->param.setup.callerinfo.intern, message->param.setup.callerinfo.name));
+                       SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
 //printf("\n\ndisplay = %s\n\n\n",message->param.setup.callerinfo.display);
                        /* use cnip, if enabld */
                        if (!e_ext.centrex)
 //printf("\n\ndisplay = %s\n\n\n",message->param.setup.callerinfo.display);
                        /* use cnip, if enabld */
                        if (!e_ext.centrex)
@@ -1201,9 +1189,9 @@ void EndpointAppPBX::out_setup(void)
                                message->param.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
                        }
                        /* use internal caller id */
                                message->param.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
                        }
                        /* use internal caller id */
-                       if (e_callerinfo.intern[0] && (message->param.setup.callerinfo.present!=INFO_PRESENT_RESTRICTED || e_ext.anon_ignore))
+                       if (e_callerinfo.extension[0] && (message->param.setup.callerinfo.present!=INFO_PRESENT_RESTRICTED || e_ext.anon_ignore))
                        {
                        {
-                               SCPY(message->param.setup.callerinfo.id, e_callerinfo.intern);
+                               SCPY(message->param.setup.callerinfo.id, e_callerinfo.extension);
                                message->param.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
                        }
                        message_put(message);
                                message->param.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
                        }
                        message_put(message);
@@ -1225,12 +1213,12 @@ void EndpointAppPBX::out_setup(void)
                cfu_only: /* entry point for cfu */
                cfb_only: /* entry point for cfb */
                cfnr_only: /* entry point for cfnr */
                cfu_only: /* entry point for cfu */
                cfb_only: /* entry point for cfb */
                cfnr_only: /* entry point for cfnr */
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call extension %s for external destiantion(s) '%s'\n", ea_endpoint->ep_serial, e_dialinginfo.number, p);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call extension %s for external destiantion(s) '%s'\n", ea_endpoint->ep_serial, e_dialinginfo.id, p);
 //             i=0;
                while(*p)
                {
 //             i=0;
                while(*p)
                {
-                       /* only if vbox should be dialed, and terminal is given */
                        earlyb = 0;
                        earlyb = 0;
+                       /* only if vbox should be dialed, and terminal is given */
                        if (!strcmp(p, "vbox") && e_ext.number[0])
                        {
                                /* go to the end of p */
                        if (!strcmp(p, "vbox") && e_ext.number[0])
                        {
                                /* go to the end of p */
@@ -1253,63 +1241,16 @@ void EndpointAppPBX::out_setup(void)
                                        SCCAT(cfp, *p++);
                                if (*p == ',')
                                        p++;
                                        SCCAT(cfp, *p++);
                                if (*p == ',')
                                        p++;
-               hier auch wie oben
                                /* external call */
                                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) cfp external %s\n", ea_endpoint->ep_serial, cfp);
                                /* hunt for mISDNport and create Port */
                                /* external call */
                                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) cfp external %s\n", ea_endpoint->ep_serial, cfp);
                                /* hunt for mISDNport and create Port */
-                               mISDNport = mISDNport_first;
-                               port = NULL;
-                               while(mISDNport)
-                               {
-                                       /* check for external or given interface */
-                                       if (((!e_dialinginfo.interfaces[0])&&mISDNport->iftype==IF_EXTERN) || !strcmp(mISDNport->interface_name, e_dialinginfo.interfaces))
-                                       {
-                                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) interface '%s' found\n", ea_endpoint->ep_serial, mISDNport->interface_name);
-                                               cause = CAUSE_NOCHANNEL; /* when failing: out of channels */
-                                               /* if PTP, skip all down links */
-                                               if (mISDNport->ptp && !mISDNport->l2link)
-                                               {
-                                                       trace_header("INTERFACE (layer 2 is down)", DIRECTION_NONE);
-                                                       add_trace("interface", NULL, "%s", mISDNport->interface_name);
-                                                       end_trace();
-                                                       mISDNport = mISDNport->next;
-                                                       continue;
-                                               }
-                                               /* if no channel is available */
-                                               if (mISDNport->multilink || !mISDNport->ntmode || mISDNport->ptp)
-                                               {
-                                                       use = 0;
-                                                       i = 0;
-                                                       ii = mISDNport->b_num;
-                                                       while(i < ii)
-                                                       {
-                                                               if (mISDNport->b_state[i])
-                                                                       use++;
-                                                               i++;
-                                                       }
-                                                       if (use >= mISDNport->b_num)
-                                                       {
-                                                               trace_header("INTERFACE (no free channel)", DIRECTION_NONE);
-                                                               add_trace("interface", NULL, "%s", mISDNport->interface_name);
-                                                               end_trace();
-                                                               mISDNport = mISDNport->next;
-                                                               continue;
-                                                       }
-                                               }
-                                               /* found interface */
-                                               trace_header("INTERFACE (found)", DIRECTION_NONE);
-                                               add_trace("interface", NULL, "%s", mISDNport->interface_name);
-                                               end_trace();
-                                               break;
-                                       }
-                                       mISDNport = mISDNport->next;
-                               }
+                               mISDNport = hunt_port(e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:NULL, &channel);
                                if (mISDNport)
                                {
                                        /* creating EXTERNAL port*/
                                if (mISDNport)
                                {
                                        /* creating EXTERNAL port*/
-                                       SPRINT(portname, "%s-%d-out", mISDNport->interface_name, mISDNport->portnum);
-                                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings);
-                                       earlyb = mISDNport->is_earlyb;
+                                       SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
+                                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force);
+                                       earlyb = mISDNport->earlyb;
                                } else
                                {
                                        port = NULL;
                                } else
                                {
                                        port = NULL;
@@ -1325,8 +1266,8 @@ void EndpointAppPBX::out_setup(void)
                        }
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) found or created port %s\n", ea_endpoint->ep_serial, port->p_name);
                        memset(&dialinginfo, 0, sizeof(dialinginfo));
                        }
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) found or created port %s\n", ea_endpoint->ep_serial, port->p_name);
                        memset(&dialinginfo, 0, sizeof(dialinginfo));
-                       SCPY(dialinginfo.number, cfp);
-                       dialinginfo.itype = INFO_ITYPE_EXTERN;
+                       SCPY(dialinginfo.id, cfp);
+                       dialinginfo.itype = INFO_ITYPE_ISDN;
                        dialinginfo.ntype = e_dialinginfo.ntype;
                        portlist = ea_endpoint->portlist_new(port->p_serial, port->p_type, earlyb);
                        if (!portlist)
                        dialinginfo.ntype = e_dialinginfo.ntype;
                        portlist = ea_endpoint->portlist_new(port->p_serial, port->p_type, earlyb);
                        if (!portlist)
@@ -1335,7 +1276,7 @@ void EndpointAppPBX::out_setup(void)
                                delete port;
                                goto check_anycall_intern;
                        }
                                delete port;
                                goto check_anycall_intern;
                        }
-//printf("EXTERNAL caller=%s,id=%s,dial=%s\n", param.setup.networkid, param.setup.callerinfo.id, param.setup.dialinginfo.number);
+//printf("EXTERNAL caller=%s,id=%s,dial=%s\n", param.setup.networkid, param.setup.callerinfo.id, param.setup.dialinginfo.id);
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_SETUP);
                        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
                        memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_SETUP);
                        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
                        memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
@@ -1344,19 +1285,19 @@ void EndpointAppPBX::out_setup(void)
                        if (e_ext.clip==CLIP_HIDE && port->p_type!=PORT_TYPE_VBOX_OUT)
                        {
                                SCPY(message->param.setup.callerinfo.id, e_ext.callerid);
                        if (e_ext.clip==CLIP_HIDE && port->p_type!=PORT_TYPE_VBOX_OUT)
                        {
                                SCPY(message->param.setup.callerinfo.id, e_ext.callerid);
-                               SCPY(message->param.setup.callerinfo.intern, e_ext.number);
+                               SCPY(message->param.setup.callerinfo.extension, e_ext.number);
                                message->param.setup.callerinfo.ntype = e_ext.callerid_type;
                                message->param.setup.callerinfo.present = e_ext.callerid_present;
                        }
                        memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
 //terminal                     SCPY(message->param.setup.from_terminal, e_ext.number);
                                message->param.setup.callerinfo.ntype = e_ext.callerid_type;
                                message->param.setup.callerinfo.present = e_ext.callerid_present;
                        }
                        memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
 //terminal                     SCPY(message->param.setup.from_terminal, e_ext.number);
-//terminal                     if (e_dialinginfo.number)
-//terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.number);
+//terminal                     if (e_dialinginfo.id)
+//terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
                                /* handle restricted caller ids */
                                /* handle restricted caller ids */
-                       apply_callerid_restriction(e_ext.anon_ignore, port->p_type, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.voip, message->param.setup.callerinfo.intern, message->param.setup.callerinfo.name);
-                       apply_callerid_restriction(e_ext.anon_ignore, port->p_type, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, NULL, message->param.setup.redirinfo.voip, message->param.setup.redirinfo.intern, 0);
+                       apply_callerid_restriction(e_ext.anon_ignore, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+                       apply_callerid_restriction(e_ext.anon_ignore, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
                        /* display callerid if desired for extension */
                        /* display callerid if desired for extension */
-                       SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.voip, message->param.setup.callerinfo.intern, message->param.setup.callerinfo.name));
+                       SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
                        message_put(message);
                        logmessage(message);
                        anycall = 1;
                        message_put(message);
                        logmessage(message);
                        anycall = 1;
@@ -1377,9 +1318,9 @@ void EndpointAppPBX::out_setup(void)
 
                /* *********************** external call */
                default:
 
                /* *********************** external call */
                default:
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) dialing external: '%s'\n", ea_endpoint->ep_serial, e_dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) dialing external: '%s'\n", ea_endpoint->ep_serial, e_dialinginfo.id);
                /* call to extenal interfaces */
                /* call to extenal interfaces */
-               p = e_dialinginfo.number;
+               p = e_dialinginfo.id;
                do
                {
                        number[0] = '\0';
                do
                {
                        number[0] = '\0';
@@ -1390,63 +1331,21 @@ void EndpointAppPBX::out_setup(void)
                        /* found number */
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) calling to number '%s' interface '%s'\n", ea_endpoint->ep_serial, number, e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:"any interface");
                        /* hunt for mISDNport and create Port */
                        /* found number */
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) calling to number '%s' interface '%s'\n", ea_endpoint->ep_serial, number, e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:"any interface");
                        /* hunt for mISDNport and create Port */
-                       mISDNport = mISDNport_first;
-                       port = NULL;
-                       while(mISDNport)
+                       /* hunt for mISDNport and create Port */
+                       mISDNport = hunt_port(e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:NULL, &channel);
+                       if (mISDNport)
                        {
                        {
-                               /* check for external or given interface */
-                               if ((!e_dialinginfo.interfaces[0]&&mISDNport->iftype==IF_EXTERN) || !strcmp(mISDNport->interface_name, e_dialinginfo.interfaces))
-                               {
-                                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) interface '%s' found\n", ea_endpoint->ep_serial, mISDNport->interface_name);
-                                       cause = CAUSE_NOCHANNEL; /* when failing: out of channels */
-                                       /* if PTP, skip all down links */
-                                       if (mISDNport->ptp && !mISDNport->l2link)
-                                       {
-                                               trace_header("INTERFACE (layer 2 is down)", DIRECTION_NONE);
-                                               add_trace("interface", NULL, "%s", mISDNport->interface_name);
-                                               end_trace();
-                                               mISDNport = mISDNport->next;
-                                               continue;
-                                       }
-                                       /* if no channel is available */
-                                       if (mISDNport->multilink || !mISDNport->ntmode || mISDNport->ptp)
-                                       {
-                                               use = 0;
-                                               i = 0;
-                                               ii = mISDNport->b_num;
-                                               while(i < ii)
-                                               {
-                                                       if (mISDNport->b_state[i])
-                                                               use++;
-                                                       i++;
-                                               }
-                                               if (use >= mISDNport->b_num)
-                                               {
-                                                       trace_header("INTERFACE (no free channel)", DIRECTION_NONE);
-                                                       add_trace("interface", NULL, "%s", mISDNport->interface_name);
-                                                       end_trace();
-                                                       mISDNport = mISDNport->next;
-                                                       continue;
-                                               }
-                                       }
-                                       /* found interface */
-                                       trace_header("INTERFACE (found)", DIRECTION_NONE);
-                                       add_trace("interface", NULL, "%s", mISDNport->interface_name);
-                                       end_trace();
-                                       break;
-                               }
-                               mISDNport = mISDNport->next;
-                       }
-                       if (!mISDNport)
+                               /* creating EXTERNAL port*/
+                               SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
+                               port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force);
+                               earlyb = mISDNport->earlyb;
+                       } else
                        {
                                trace_header("INTERFACE (too busy)", DIRECTION_NONE);
                                add_trace("interface", NULL, "%s", e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:"any interface");
                                end_trace();
                                goto check_anycall_extern;
                        }
                        {
                                trace_header("INTERFACE (too busy)", DIRECTION_NONE);
                                add_trace("interface", NULL, "%s", e_dialinginfo.interfaces[0]?e_dialinginfo.interfaces:"any interface");
                                end_trace();
                                goto check_anycall_extern;
                        }
-                       /* creating EXTERNAL port*/
-                       SPRINT(portname, "%s-%d-out", mISDNport->interface_name, mISDNport->portnum);
-                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings);
                        if (!port)      
                        {
                                PERROR("EPOINT(%d) no memory for external port, exitting\n", ea_endpoint->ep_serial);
                        if (!port)      
                        {
                                PERROR("EPOINT(%d) no memory for external port, exitting\n", ea_endpoint->ep_serial);
@@ -1454,10 +1353,10 @@ void EndpointAppPBX::out_setup(void)
                        }
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) created port %s\n", ea_endpoint->ep_serial, port->p_name);
                        memset(&dialinginfo, 0, sizeof(dialinginfo));
                        }
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) created port %s\n", ea_endpoint->ep_serial, port->p_name);
                        memset(&dialinginfo, 0, sizeof(dialinginfo));
-                       SCPY(dialinginfo.number, number);
-                       dialinginfo.itype = INFO_ITYPE_EXTERN;
+                       SCPY(dialinginfo.id, number);
+                       dialinginfo.itype = INFO_ITYPE_ISDN;
                        dialinginfo.ntype = e_dialinginfo.ntype;
                        dialinginfo.ntype = e_dialinginfo.ntype;
-                       portlist = ea_endpoint->portlist_new(port->p_serial, port->p_type, mISDNport->is_earlyb);
+                       portlist = ea_endpoint->portlist_new(port->p_serial, port->p_type, mISDNport->earlyb);
                        if (!portlist)
                        {
                                PERROR("EPOINT(%d) cannot allocate port_list relation\n", ea_endpoint->ep_serial);
                        if (!portlist)
                        {
                                PERROR("EPOINT(%d) cannot allocate port_list relation\n", ea_endpoint->ep_serial);
@@ -1465,21 +1364,21 @@ void EndpointAppPBX::out_setup(void)
                                goto check_anycall_extern;
                        }
 //                     dss1 = (class Pdss1 *)port;
                                goto check_anycall_extern;
                        }
 //                     dss1 = (class Pdss1 *)port;
-//printf("EXTERNAL caller=%s,id=%s,dial=%s\n", param.setup.networkid, param.setup.callerinfo.id, param.setup.dialinginfo.number);
+//printf("EXTERNAL caller=%s,id=%s,dial=%s\n", param.setup.networkid, param.setup.callerinfo.id, param.setup.dialinginfo.id);
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_SETUP);
                        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_SETUP);
                        memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
-                       SCPY(message->param.setup.dialinginfo.number, number);
+                       SCPY(message->param.setup.dialinginfo.id, number);
                        memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
                        memcpy(&message->param.setup.callerinfo, &e_callerinfo, sizeof(struct caller_info));
                        memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
 //terminal                     SCPY(message->param.setup.from_terminal, e_ext.number);
                        memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
                        memcpy(&message->param.setup.callerinfo, &e_callerinfo, sizeof(struct caller_info));
                        memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
 //terminal                     SCPY(message->param.setup.from_terminal, e_ext.number);
-//terminal                     if (e_dialinginfo.number)
-//terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.number);
+//terminal                     if (e_dialinginfo.id)
+//terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
                                /* handle restricted caller ids */
                                /* handle restricted caller ids */
-                       apply_callerid_restriction(e_ext.anon_ignore, port->p_type, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.voip, message->param.setup.callerinfo.intern, message->param.setup.callerinfo.name);
-                       apply_callerid_restriction(e_ext.anon_ignore, port->p_type, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, NULL, message->param.setup.redirinfo.voip, message->param.setup.redirinfo.intern, 0);
+                       apply_callerid_restriction(e_ext.anon_ignore, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+                       apply_callerid_restriction(e_ext.anon_ignore, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
                        /* display callerid if desired for extension */
                        /* display callerid if desired for extension */
-                       SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.voip, message->param.setup.callerinfo.intern, message->param.setup.callerinfo.name));
+                       SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
                        message_put(message);
                        logmessage(message);
                        anycall = 1;
                        message_put(message);
                        logmessage(message);
                        anycall = 1;
@@ -1708,10 +1607,10 @@ void EndpointAppPBX::hookflash(void)
        e_action = NULL;
        new_state(EPOINT_STATE_IN_OVERLAP);
        e_connectedmode = 1;
        e_action = NULL;
        new_state(EPOINT_STATE_IN_OVERLAP);
        e_connectedmode = 1;
-       SCPY(e_dialinginfo.number, e_ext.prefix);
-        e_extdialing = e_dialinginfo.number;
+       SCPY(e_dialinginfo.id, e_ext.prefix);
+        e_extdialing = e_dialinginfo.id;
        e_call_pattern = 0;
        e_call_pattern = 0;
-       if (e_dialinginfo.number[0])
+       if (e_dialinginfo.id[0])
        {
                set_tone(ea_endpoint->ep_portlist, "dialing");
                process_dialing();
        {
                set_tone(ea_endpoint->ep_portlist, "dialing");
                process_dialing();
@@ -1731,9 +1630,6 @@ void EndpointAppPBX::port_setup(struct port_list *portlist, int message_type, un
 {
        struct message          *message;
        char                    buffer[256];
 {
        struct message          *message;
        char                    buffer[256];
-       char                    extension[32];
-       char                    extension1[32];
-       char                    *p;
        int                     writeext;               /* flags need to write extension after modification */
        class Port              *port;
 
        int                     writeext;               /* flags need to write extension after modification */
        class Port              *port;
 
@@ -1746,23 +1642,22 @@ void EndpointAppPBX::port_setup(struct port_list *portlist, int message_type, un
 
        /* screen incoming caller id */
        screen(0, e_callerinfo.id, sizeof(e_callerinfo.id), &e_callerinfo.ntype, &e_callerinfo.present);
 
        /* screen incoming caller id */
        screen(0, e_callerinfo.id, sizeof(e_callerinfo.id), &e_callerinfo.ntype, &e_callerinfo.present);
-colp, outclip, outcolp
 
        /* process extension */
 
        /* process extension */
-       if (e_callerinfo.itype == INFO_ITYPE_INTERN)
+       if (e_callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call is extension\n", ea_endpoint->ep_serial);
                /* port makes call from extension */
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call is extension\n", ea_endpoint->ep_serial);
                /* port makes call from extension */
-               SCPY(e_callerinfo.intern, e_callerinfo.id);
-               SCPY(e_ext.number, e_callerinfo.intern);
+               SCPY(e_callerinfo.extension, e_callerinfo.id);
+               SCPY(e_ext.number, e_callerinfo.extension);
                SCPY(e_extension_interface, e_callerinfo.interface);
        } else
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call is external or voip\n", ea_endpoint->ep_serial);
        }
        trace_header("SETUP", DIRECTION_IN);
                SCPY(e_extension_interface, e_callerinfo.interface);
        } else
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call is external or voip\n", ea_endpoint->ep_serial);
        }
        trace_header("SETUP", DIRECTION_IN);
-       if (e_callerinfo.intern[0])
-               add_trace("extension", NULL, "%s", e_callerinfo.intern);
+       if (e_callerinfo.extension[0])
+               add_trace("extension", NULL, "%s", e_callerinfo.extension);
        add_trace("caller id", "number", "%s", numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype));
        if (e_callerinfo.present == INFO_PRESENT_RESTRICTED)
                add_trace("caller id", "present", "restricted");
        add_trace("caller id", "number", "%s", numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype));
        if (e_callerinfo.present == INFO_PRESENT_RESTRICTED)
                add_trace("caller id", "present", "restricted");
@@ -1772,11 +1667,11 @@ colp, outclip, outcolp
                if (e_redirinfo.present == INFO_PRESENT_RESTRICTED)
                        add_trace("redir'ing", "present", "restricted");
        }
                if (e_redirinfo.present == INFO_PRESENT_RESTRICTED)
                        add_trace("redir'ing", "present", "restricted");
        }
-       if (e_dialinginfo.number)
-               add_trace("dialing", "number", "%s", e_dialinginfo.number));
+       if (e_dialinginfo.id)
+               add_trace("dialing", "number", "%s", e_dialinginfo.id);
        end_trace();
 
        end_trace();
 
-       if (e_callerinfo.itype == INFO_ITYPE_INTERN)
+       if (e_callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call from extension '%s'\n", ea_endpoint->ep_serial, e_ext.number);
 
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call from extension '%s'\n", ea_endpoint->ep_serial, e_ext.number);
 
@@ -1795,20 +1690,20 @@ colp, outclip, outcolp
                }
                writeext = 0;
 
                }
                writeext = 0;
 
-               /* put prefix (next) in front of e_dialinginfo.number */
+               /* put prefix (next) in front of e_dialinginfo.id */
                if (e_ext.next[0])
                {
                if (e_ext.next[0])
                {
-                       SPRINT(buffer, "%s%s", e_ext.next, e_dialinginfo.number);
-                       SCPY(e_dialinginfo.number, buffer);
+                       SPRINT(buffer, "%s%s", e_ext.next, e_dialinginfo.id);
+                       SCPY(e_dialinginfo.id, buffer);
                        e_ext.next[0] = '\0';
                        writeext = 1;
                } else if (e_ext.prefix[0])
                {
                        e_ext.next[0] = '\0';
                        writeext = 1;
                } else if (e_ext.prefix[0])
                {
-                       SPRINT(buffer, "%s%s", e_ext.prefix, e_dialinginfo.number);
-                       SCPY(e_dialinginfo.number, buffer);
+                       SPRINT(buffer, "%s%s", e_ext.prefix, e_dialinginfo.id);
+                       SCPY(e_dialinginfo.id, buffer);
                }
 
                }
 
-               /* screen caller id */
+               /* screen caller id by extension's config */
                e_callerinfo.screen = INFO_SCREEN_NETWORK;
                if (e_ext.name[0])
                        SCPY(e_callerinfo.name, e_ext.name);
                e_callerinfo.screen = INFO_SCREEN_NETWORK;
                if (e_ext.name[0])
                        SCPY(e_callerinfo.name, e_ext.name);
@@ -1838,7 +1733,7 @@ colp, outclip, outcolp
                        write_extension(&e_ext, e_ext.number);
 
                /* set volume of rx and tx */
                        write_extension(&e_ext, e_ext.number);
 
                /* set volume of rx and tx */
-               if (param->setup.callerinfo.itype == INFO_ITYPE_INTERN)
+               if (param->setup.callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
                if (e_ext.txvol!=256 || e_ext.rxvol!=256)
                {
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_mISDNSIGNAL);
                if (e_ext.txvol!=256 || e_ext.rxvol!=256)
                {
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_mISDNSIGNAL);
@@ -1876,9 +1771,9 @@ colp, outclip, outcolp
        if (e_ruleset)
                        e_rule = e_ruleset->rule_first;
        e_action = NULL;
        if (e_ruleset)
                        e_rule = e_ruleset->rule_first;
        e_action = NULL;
-        e_extdialing = e_dialinginfo.number;
+        e_extdialing = e_dialinginfo.id;
        new_state(EPOINT_STATE_IN_SETUP);
        new_state(EPOINT_STATE_IN_SETUP);
-       if (e_dialinginfo.number[0])
+       if (e_dialinginfo.id[0])
        {
                set_tone(portlist, "dialing");
        } else
        {
                set_tone(portlist, "dialing");
        } else
@@ -1903,7 +1798,7 @@ colp, outclip, outcolp
 void EndpointAppPBX::port_information(struct port_list *portlist, int message_type, union parameter *param)
 {
        trace_header("INFORMATION", DIRECTION_IN);
 void EndpointAppPBX::port_information(struct port_list *portlist, int message_type, union parameter *param)
 {
        trace_header("INFORMATION", DIRECTION_IN);
-       add_trace("dialing", NULL, "%s", param->information.number);
+       add_trace("dialing", NULL, "%s", param->information.id);
        if (param->information.sending_complete)
                add_trace("complete", NULL, NULL);
        end_trace();
        if (param->information.sending_complete)
                add_trace("complete", NULL, NULL);
        end_trace();
@@ -1912,7 +1807,7 @@ void EndpointAppPBX::port_information(struct port_list *portlist, int message_ty
        /* turn off dtmf detection, in case dtmf is sent with keypad information */
        if (e_dtmf)
        {
        /* turn off dtmf detection, in case dtmf is sent with keypad information */
        if (e_dtmf)
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) received dialing information, so dtmf is now disabled, to prevent double detection by keypad+dtmf.\n", ea_endpoint->ep_serial, param->information.number, e_ext.number, e_callerinfo.id);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) received dialing information, so dtmf is now disabled, to prevent double detection by keypad+dtmf.\n", ea_endpoint->ep_serial, param->information.id, e_ext.number, e_callerinfo.id);
                e_dtmf = 0;
        }
 
                e_dtmf = 0;
        }
 
@@ -1921,7 +1816,7 @@ void EndpointAppPBX::port_information(struct port_list *portlist, int message_ty
        if (e_action->index == ACTION_VBOX_PLAY)
        {
                /* concat dialing string */
        if (e_action->index == ACTION_VBOX_PLAY)
        {
                /* concat dialing string */
-               SCAT(e_dialinginfo.number, param->information.number);
+               SCAT(e_dialinginfo.id, param->information.id);
                process_dialing();
                return;
        }
                process_dialing();
                return;
        }
@@ -1929,9 +1824,9 @@ void EndpointAppPBX::port_information(struct port_list *portlist, int message_ty
        /* keypad when disconnect but in connected mode */
        if (e_state==EPOINT_STATE_OUT_DISCONNECT && e_connectedmode)
        {
        /* keypad when disconnect but in connected mode */
        if (e_state==EPOINT_STATE_OUT_DISCONNECT && e_connectedmode)
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) keypad information received after disconnect: %s.\n", ea_endpoint->ep_serial, param->information.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) keypad information received after disconnect: %s.\n", ea_endpoint->ep_serial, param->information.id);
                /* processing keypad function */
                /* processing keypad function */
-               if (param->information.number[0] == '0')
+               if (param->information.id[0] == '0')
                {
                        hookflash();
                }
                {
                        hookflash();
                }
@@ -1941,14 +1836,14 @@ void EndpointAppPBX::port_information(struct port_list *portlist, int message_ty
        /* keypad when connected */
        if (e_state == EPOINT_STATE_CONNECT && e_ext.keypad)
        {
        /* keypad when connected */
        if (e_state == EPOINT_STATE_CONNECT && e_ext.keypad)
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) keypad information received during connect: %s.\n", ea_endpoint->ep_serial, param->information.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) keypad information received during connect: %s.\n", ea_endpoint->ep_serial, param->information.id);
                /* processing keypad function */
                /* processing keypad function */
-               if (param->information.number[0] == '0')
+               if (param->information.id[0] == '0')
                {
                        hookflash();
                }
                {
                        hookflash();
                }
-               if (param->information.number[0])
-                       keypad_function(param->information.number[0]);
+               if (param->information.id[0])
+                       keypad_function(param->information.id[0]);
                return;
        }
        if (e_state != EPOINT_STATE_IN_OVERLAP)
                return;
        }
        if (e_state != EPOINT_STATE_IN_OVERLAP)
@@ -1956,9 +1851,9 @@ void EndpointAppPBX::port_information(struct port_list *portlist, int message_ty
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) ignored because we are not in overlap, or connect state.\n", ea_endpoint->ep_serial);
                return;
        }
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) ignored because we are not in overlap, or connect state.\n", ea_endpoint->ep_serial);
                return;
        }
-       if (!param->information.number[0])
+       if (!param->information.id[0])
                return;
                return;
-       if (e_dialinginfo.number[0]=='\0' && !e_action)
+       if (e_dialinginfo.id[0]=='\0' && !e_action)
        {
                set_tone(portlist, "dialing");
        }
        {
                set_tone(portlist, "dialing");
        }
@@ -1972,7 +1867,7 @@ void EndpointAppPBX::port_information(struct port_list *portlist, int message_ty
                        set_tone(portlist, "dialing");
        }
        /* concat dialing string */
                        set_tone(portlist, "dialing");
        }
        /* concat dialing string */
-       SCAT(e_dialinginfo.number, param->information.number);
+       SCAT(e_dialinginfo.id, param->information.id);
        process_dialing();
 }
 
        process_dialing();
 }
 
@@ -1996,10 +1891,10 @@ NOTE: vbox is now handled due to overlap state
        if (e_action->index == ACTION_VBOX_PLAY)
        {
                /* concat dialing string */
        if (e_action->index == ACTION_VBOX_PLAY)
        {
                /* concat dialing string */
-               if (strlen(e_dialinginfo.number)+1 < sizeof(e_dialinginfo.number))
+               if (strlen(e_dialinginfo.id)+1 < sizeof(e_dialinginfo.id))
                {
                {
-                       e_dialinginfo.number[strlen(e_dialinginfo.number)+1] = '\0';
-                       e_dialinginfo.number[strlen(e_dialinginfo.number)] = param->dtmf;
+                       e_dialinginfo.id[strlen(e_dialinginfo.id)+1] = '\0';
+                       e_dialinginfo.id[strlen(e_dialinginfo.id)] = param->dtmf;
                        process_dialing();
                }
                /* continue to process *X# sequences */
                        process_dialing();
                }
                /* continue to process *X# sequences */
@@ -2079,15 +1974,15 @@ NOTE: vbox is now handled due to overlap state
        /* dialing using dtmf digit */
        if (e_state==EPOINT_STATE_IN_OVERLAP)// && e_state==e_connectedmode)
        {
        /* dialing using dtmf digit */
        if (e_state==EPOINT_STATE_IN_OVERLAP)// && e_state==e_connectedmode)
        {
-               if (e_dialinginfo.number[0]=='\0' && !e_action)
+               if (e_dialinginfo.id[0]=='\0' && !e_action)
                {
                        set_tone(portlist, "dialing");
                }
                /* concat dialing string */
                {
                        set_tone(portlist, "dialing");
                }
                /* concat dialing string */
-               if (strlen(e_dialinginfo.number)+1 < sizeof(e_dialinginfo.number))
+               if (strlen(e_dialinginfo.id)+1 < sizeof(e_dialinginfo.id))
                {
                {
-                       e_dialinginfo.number[strlen(e_dialinginfo.number)+1] = '\0';
-                       e_dialinginfo.number[strlen(e_dialinginfo.number)] = param->dtmf;
+                       e_dialinginfo.id[strlen(e_dialinginfo.id)+1] = '\0';
+                       e_dialinginfo.id[strlen(e_dialinginfo.id)] = param->dtmf;
                        process_dialing();
                }
        }
                        process_dialing();
                }
        }
@@ -2118,14 +2013,14 @@ void EndpointAppPBX::port_overlap(struct port_list *portlist, int message_type,
                /* send what we have not dialed yet, because we had no setup complete */
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) dialing pending digits: '%s'\n", ea_endpoint->ep_serial, e_dialing_queue);
                message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_INFORMATION);
                /* send what we have not dialed yet, because we had no setup complete */
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) dialing pending digits: '%s'\n", ea_endpoint->ep_serial, e_dialing_queue);
                message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_INFORMATION);
-               SCPY(message->param.information.number, e_dialing_queue);
+               SCPY(message->param.information.id, e_dialing_queue);
                message->param.information.ntype = INFO_NTYPE_UNKNOWN;
                message_put(message);
                logmessage(message);
                e_dialing_queue[0] = '\0';
        }
        /* check if pattern is available */
                message->param.information.ntype = INFO_NTYPE_UNKNOWN;
                message_put(message);
                logmessage(message);
                e_dialing_queue[0] = '\0';
        }
        /* check if pattern is available */
-       if (!ea_endpoint->ep_portlist->next && portlist->earlyb) /* one port_list relation and tones available */
+       if (!ea_endpoint->ep_portlist->next && portlist->early_b) /* one port_list relation and tones available */
        {
                /* indicate patterns */
                message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_PATTERN);
        {
                /* indicate patterns */
                message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_PATTERN);
@@ -2168,7 +2063,7 @@ void EndpointAppPBX::port_proceeding(struct port_list *portlist, int message_typ
        end_trace();
        e_state = EPOINT_STATE_OUT_PROCEEDING;
        /* check if pattern is availatle */
        end_trace();
        e_state = EPOINT_STATE_OUT_PROCEEDING;
        /* check if pattern is availatle */
-       if (!ea_endpoint->ep_portlist->next && (portlist->earlyb || portlist->port_type==PORT_TYPE_VBOX_OUT)) /* one port_list relation and tones available */
+       if (!ea_endpoint->ep_portlist->next && (portlist->early_b || portlist->port_type==PORT_TYPE_VBOX_OUT)) /* one port_list relation and tones available */
        {
                /* indicate patterns */
                message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_PATTERN);
        {
                /* indicate patterns */
                message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_PATTERN);
@@ -2210,7 +2105,7 @@ void EndpointAppPBX::port_alerting(struct port_list *portlist, int message_type,
        end_trace();
        new_state(EPOINT_STATE_OUT_ALERTING);
        /* check if pattern is available */
        end_trace();
        new_state(EPOINT_STATE_OUT_ALERTING);
        /* check if pattern is available */
-       if (!ea_endpoint->ep_portlist->next && (portlist->earlyb || portlist->port_type==PORT_TYPE_VBOX_OUT)) /* one port_list relation and tones available */
+       if (!ea_endpoint->ep_portlist->next && (portlist->early_b || portlist->port_type==PORT_TYPE_VBOX_OUT)) /* one port_list relation and tones available */
        {
                /* indicate patterns */
                message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_PATTERN);
        {
                /* indicate patterns */
                message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_PATTERN);
@@ -2254,8 +2149,8 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
 
        memcpy(&e_connectinfo, &param->connectinfo, sizeof(e_connectinfo));
        trace_header("CONNECT", DIRECTION_IN);
 
        memcpy(&e_connectinfo, &param->connectinfo, sizeof(e_connectinfo));
        trace_header("CONNECT", DIRECTION_IN);
-       if (e_connectinfo.intern[0])
-               add_trace("extension", NULL, "%s", e_connectinfo.intern);
+       if (e_connectinfo.extension[0])
+               add_trace("extension", NULL, "%s", e_connectinfo.extension);
        add_trace("connect id", "number", "%s", numberrize_callerinfo(e_connectinfo.id, e_connectinfo.ntype));
        if (e_connectinfo.present == INFO_PRESENT_RESTRICTED)
                add_trace("connect id", "present", "restricted");
        add_trace("connect id", "number", "%s", numberrize_callerinfo(e_connectinfo.id, e_connectinfo.ntype));
        if (e_connectinfo.present == INFO_PRESENT_RESTRICTED)
                add_trace("connect id", "present", "restricted");
@@ -2282,7 +2177,7 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
 
        e_start = now;
 
 
        e_start = now;
 
-       /* screen incoming caller id */
+       /* screen incoming connected id */
        screen(0, e_connectinfo.id, sizeof(e_connectinfo.id), &e_connectinfo.ntype, &e_connectinfo.present);
 
        /* screen connected name */
        screen(0, e_connectinfo.id, sizeof(e_connectinfo.id), &e_connectinfo.ntype, &e_connectinfo.present);
 
        /* screen connected name */
@@ -2290,7 +2185,7 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
                SCPY(e_connectinfo.name, e_ext.name);
 
        /* add internal id to colp */
                SCPY(e_connectinfo.name, e_ext.name);
 
        /* add internal id to colp */
-       SCPY(e_connectinfo.intern, e_ext.number);
+       SCPY(e_connectinfo.extension, e_ext.number);
 
        /* we store the connected port number */
        SCPY(e_extension_interface, e_connectinfo.interfaces);
 
        /* we store the connected port number */
        SCPY(e_extension_interface, e_connectinfo.interfaces);
@@ -2299,8 +2194,8 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
        if (portlist->port_type==PORT_TYPE_VBOX_OUT || e_ext.colp==COLP_HIDE)
        {
                SCPY(e_connectinfo.id, e_ext.callerid);
        if (portlist->port_type==PORT_TYPE_VBOX_OUT || e_ext.colp==COLP_HIDE)
        {
                SCPY(e_connectinfo.id, e_ext.callerid);
-               SCPY(e_connectinfo.intern, e_ext.number);
-               e_connectinfo.itype = INFO_ITYPE_INTERN;
+               SCPY(e_connectinfo.extension, e_ext.number);
+               e_connectinfo.itype = INFO_ITYPE_ISDN_EXTENSION;
                e_connectinfo.ntype = e_ext.callerid_type;
                e_connectinfo.present = e_ext.callerid_present;
        }
                e_connectinfo.ntype = e_ext.callerid_type;
                e_connectinfo.present = e_ext.callerid_present;
        }
@@ -2337,7 +2232,7 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
                                port = find_port_id(portlist->port_id);
                                if (port)
                                {
                                port = find_port_id(portlist->port_id);
                                if (port)
                                {
-                                       SCPY(e_connectinfo.id, nationalize_callerinfo(port->p_dialinginfo.number, &e_connectinfo.ntype));
+                                       SCPY(e_connectinfo.id, nationalize_callerinfo(port->p_dialinginfo.id, &e_connectinfo.ntype));
                                        e_connectinfo.present = INFO_PRESENT_ALLOWED;
                                }
                        }
                                        e_connectinfo.present = INFO_PRESENT_ALLOWED;
                                }
                        }
@@ -2372,13 +2267,13 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
 
                /* put prefix in front of e_cbdialing */
                SPRINT(buffer, "%s%s", e_ext.prefix, e_cbdialing);
 
                /* put prefix in front of e_cbdialing */
                SPRINT(buffer, "%s%s", e_ext.prefix, e_cbdialing);
-               SCPY(e_dialinginfo.number, buffer);
-               e_dialinginfo.itype = INFO_ITYPE_EXTERN;
+               SCPY(e_dialinginfo.id, buffer);
+               e_dialinginfo.itype = INFO_ITYPE_ISDN;
                e_dialinginfo.ntype = INFO_NTYPE_UNKNOWN;
 
                /* use caller id (or if exist: id_next_call) for this call */
                e_callerinfo.screen = INFO_SCREEN_NETWORK;
                e_dialinginfo.ntype = INFO_NTYPE_UNKNOWN;
 
                /* use caller id (or if exist: id_next_call) for this call */
                e_callerinfo.screen = INFO_SCREEN_NETWORK;
-               SCPY(e_callerinfo.intern, e_ext.number);
+               SCPY(e_callerinfo.extension, e_ext.number);
                if (e_ext.id_next_call_present >= 0)
                {
                        SCPY(e_callerinfo.id, e_ext.id_next_call);
                if (e_ext.id_next_call_present >= 0)
                {
                        SCPY(e_callerinfo.id, e_ext.id_next_call);
@@ -2405,8 +2300,8 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
                        e_action = &action_password_write;
                        e_match_timeout = 0;
                        e_match_to_action = NULL;
                        e_action = &action_password_write;
                        e_match_timeout = 0;
                        e_match_to_action = NULL;
-                       e_dialinginfo.number[0] = '\0';
-                       e_extdialing = strchr(e_dialinginfo.number, '\0');
+                       e_dialinginfo.id[0] = '\0';
+                       e_extdialing = strchr(e_dialinginfo.id, '\0');
                        e_password_timeout = now+20;
                        process_dialing();
                } else
                        e_password_timeout = now+20;
                        process_dialing();
                } else
@@ -2416,8 +2311,8 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
                        if (e_ruleset)
                                e_rule = e_ruleset->rule_first;
                        e_action = NULL;
                        if (e_ruleset)
                                e_rule = e_ruleset->rule_first;
                        e_action = NULL;
-                       e_extdialing = e_dialinginfo.number;
-                       if (e_dialinginfo.number[0])
+                       e_extdialing = e_dialinginfo.id;
+                       if (e_dialinginfo.id[0])
                        {
                                set_tone(portlist, "dialing");
                                process_dialing();
                        {
                                set_tone(portlist, "dialing");
                                process_dialing();
@@ -2458,7 +2353,7 @@ void EndpointAppPBX::port_disconnect_release(struct port_list *portlist, int mes
        /* signal to call tool */
        admin_call_response(e_adminid, (message_type==MESSAGE_DISCONNECT)?ADMIN_CALL_DISCONNECT:ADMIN_CALL_RELEASE, "", param->disconnectinfo.cause, param->disconnectinfo.location, 0);
 
        /* signal to call tool */
        admin_call_response(e_adminid, (message_type==MESSAGE_DISCONNECT)?ADMIN_CALL_DISCONNECT:ADMIN_CALL_RELEASE, "", param->disconnectinfo.cause, param->disconnectinfo.location, 0);
 
-       trace_header((message_type==MESSAGE_DISCONNECT)?"DISCONNECT":"RELEASE", DIRECTION_IN);
+       trace_header((message_type==MESSAGE_DISCONNECT)?(char *)"DISCONNECT":(char *)"RELEASE", DIRECTION_IN);
        add_trace("cause", "value", "%d", param->disconnectinfo.cause);
        add_trace("cause", "location", "%d", param->disconnectinfo.location);
        end_trace();
        add_trace("cause", "value", "%d", param->disconnectinfo.cause);
        add_trace("cause", "location", "%d", param->disconnectinfo.location);
        end_trace();
@@ -2554,9 +2449,8 @@ void EndpointAppPBX::port_disconnect_release(struct port_list *portlist, int mes
                int haspatterns = 0;
                /* check if pattern is available */
                if (ea_endpoint->ep_portlist)
                int haspatterns = 0;
                /* check if pattern is available */
                if (ea_endpoint->ep_portlist)
-               if (!ea_endpoint->ep_portlist->next && ea_endpoint->ep_portlist->earlyb)
-#warning wie ist das bei einem asterisk, gibts auch tones?
-               if (callpbx_countrelations(ea_endpoint->ep_call_id)==2 // we must count relations, in order not to disturb the conference ; NOTE: 
+               if (!ea_endpoint->ep_portlist->next && ea_endpoint->ep_portlist->early_b)
+               if (callpbx_countrelations(ea_endpoint->ep_call_id)==2 // we must count relations, in order not to disturb the conference ; NOTE: asterisk always counts two, since it is a point to point call 
                 && message_type != MESSAGE_RELEASE) // if we release, we are done
                        haspatterns = 1;
                if (haspatterns)
                 && message_type != MESSAGE_RELEASE) // if we release, we are done
                        haspatterns = 1;
                if (haspatterns)
@@ -2697,7 +2591,7 @@ void EndpointAppPBX::port_notify(struct port_list *portlist, int message_type, u
                case INFO_NOTIFY_REMOTE_RETRIEVAL:
                case INFO_NOTIFY_USER_RESUMED:
                /* set volume of rx and tx */
                case INFO_NOTIFY_REMOTE_RETRIEVAL:
                case INFO_NOTIFY_USER_RESUMED:
                /* set volume of rx and tx */
-               if (param->setup.callerinfo.itype == INFO_ITYPE_INTERN)
+               if (param->setup.callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
                if (e_ext.txvol!=256 || e_ext.rxvol!=256)
                if (portlist)
                {
                if (e_ext.txvol!=256 || e_ext.rxvol!=256)
                if (portlist)
                {
@@ -2869,7 +2763,6 @@ void EndpointAppPBX::ea_message_port(unsigned long port_id, int message_type, un
 {
        struct port_list *portlist;
        struct message *message;
 {
        struct port_list *portlist;
        struct message *message;
-       class Port *port;
 
        portlist = ea_endpoint->ep_portlist;
        while(portlist)
 
        portlist = ea_endpoint->ep_portlist;
        while(portlist)
@@ -2935,7 +2828,7 @@ void EndpointAppPBX::ea_message_port(unsigned long port_id, int message_type, un
 
                /* PORT sends SETUP message */
                case MESSAGE_SETUP:
 
                /* PORT sends SETUP message */
                case MESSAGE_SETUP:
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call from callerid=%s, dialing=%s\n", ea_endpoint->ep_serial, param->setup.callerinfo.id, param->setup.dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call from callerid=%s, dialing=%s\n", ea_endpoint->ep_serial, param->setup.callerinfo.id, param->setup.dialinginfo.id);
                if (e_state!=EPOINT_STATE_IDLE)
                {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) ignored because we are not in idle state.\n", ea_endpoint->ep_serial);
                if (e_state!=EPOINT_STATE_IDLE)
                {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) ignored because we are not in idle state.\n", ea_endpoint->ep_serial);
@@ -2946,7 +2839,7 @@ void EndpointAppPBX::ea_message_port(unsigned long port_id, int message_type, un
 
                /* PORT sends INFORMATION message */
                case MESSAGE_INFORMATION: /* additional digits received */
 
                /* PORT sends INFORMATION message */
                case MESSAGE_INFORMATION: /* additional digits received */
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call dialing more=%s (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->information.number, e_ext.number, e_callerinfo.id);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call dialing more=%s (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->information.id, e_ext.number, e_callerinfo.id);
                port_information(portlist, message_type, param);
                break;
 
                port_information(portlist, message_type, param);
                break;
 
@@ -3237,7 +3130,7 @@ void EndpointAppPBX::call_connect(struct port_list *portlist, int message_type,
                memcpy(&message->param, param, sizeof(union parameter));
                /* screen incoming caller id */
                screen(1, e_connectinfo.id, sizeof(e_connectinfo.id), &e_connectinfo.ntype, &e_connectinfo.present);
                memcpy(&message->param, param, sizeof(union parameter));
                /* screen incoming caller id */
                screen(1, e_connectinfo.id, sizeof(e_connectinfo.id), &e_connectinfo.ntype, &e_connectinfo.present);
-               memcpy(&message->param.connnectinfo, e_connectinfo);
+               memcpy(&message->param.connectinfo, &e_connectinfo, sizeof(e_connectinfo));
 
                /* screen clip if prefix is required */
                if (e_ext.number[0] && message->param.connectinfo.id[0] && e_ext.clip_prefix[0])
 
                /* screen clip if prefix is required */
                if (e_ext.number[0] && message->param.connectinfo.id[0] && e_ext.clip_prefix[0])
@@ -3248,16 +3141,16 @@ void EndpointAppPBX::call_connect(struct port_list *portlist, int message_type,
                }
 
                /* use internal caller id */
                }
 
                /* use internal caller id */
-               if (e_ext.number[0] && e_connectinfo.intern[0] && (message->param.connectinfo.present!=INFO_PRESENT_RESTRICTED || e_ext.anon_ignore))
+               if (e_ext.number[0] && e_connectinfo.extension[0] && (message->param.connectinfo.present!=INFO_PRESENT_RESTRICTED || e_ext.anon_ignore))
                {
                {
-                       SCPY(message->param.connectinfo.id, e_connectinfo.intern);
+                       SCPY(message->param.connectinfo.id, e_connectinfo.extension);
                        message->param.connectinfo.ntype = INFO_NTYPE_UNKNOWN;
                }
 
                /* handle restricted caller ids */
                        message->param.connectinfo.ntype = INFO_NTYPE_UNKNOWN;
                }
 
                /* handle restricted caller ids */
-               apply_callerid_restriction(e_ext.anon_ignore, portlist->port_type, message->param.connectinfo.id, &message->param.connectinfo.ntype, &message->param.connectinfo.present, &message->param.connectinfo.screen, message->param.connectinfo.voip, message->param.connectinfo.intern, message->param.connectinfo.name);
+               apply_callerid_restriction(e_ext.anon_ignore, message->param.connectinfo.id, &message->param.connectinfo.ntype, &message->param.connectinfo.present, &message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name);
                /* display callerid if desired for extension */
                /* display callerid if desired for extension */
-               SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype, message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.voip, message->param.connectinfo.intern, message->param.connectinfo.name));
+               SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype, message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name));
 
                /* use conp, if enabld */
                if (!e_ext.centrex)
 
                /* use conp, if enabld */
                if (!e_ext.centrex)
@@ -3398,7 +3291,7 @@ void EndpointAppPBX::call_setup(struct port_list *portlist, int message_type, un
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) we are in setup state, so we do overlap dialing.\n", ea_endpoint->ep_serial);
                /* if digits changed, what we have already dialed */
        {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) we are in setup state, so we do overlap dialing.\n", ea_endpoint->ep_serial);
                /* if digits changed, what we have already dialed */
-               if (!!strncmp(e_dialinginfo.number,param->setup.dialinginfo.number,strlen(e_dialinginfo.number)))
+               if (!!strncmp(e_dialinginfo.id,param->setup.dialinginfo.id,strlen(e_dialinginfo.id)))
                {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) we have dialed digits which have been changed or we have a new multidial, so we must redial.\n", ea_endpoint->ep_serial);
                        /* release all ports */
                {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) we have dialed digits which have been changed or we have a new multidial, so we must redial.\n", ea_endpoint->ep_serial);
                        /* release all ports */
@@ -3431,7 +3324,7 @@ void EndpointAppPBX::call_setup(struct port_list *portlist, int message_type, un
                /* if we have a pending redial, so we just adjust the dialing number */
                if (e_redial)
                {
                /* if we have a pending redial, so we just adjust the dialing number */
                if (e_redial)
                {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) redial in progress, so we update the dialing number to %s.\n", ea_endpoint->ep_serial, param->setup.dialinginfo.number);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) redial in progress, so we update the dialing number to %s.\n", ea_endpoint->ep_serial, param->setup.dialinginfo.id);
                        memcpy(&e_dialinginfo, &param->setup.dialinginfo, sizeof(e_dialinginfo));
                        return;
                }
                        memcpy(&e_dialinginfo, &param->setup.dialinginfo, sizeof(e_dialinginfo));
                        return;
                }
@@ -3446,15 +3339,15 @@ void EndpointAppPBX::call_setup(struct port_list *portlist, int message_type, un
                if (e_state == EPOINT_STATE_OUT_SETUP)
                {
                        /* queue digits */
                if (e_state == EPOINT_STATE_OUT_SETUP)
                {
                        /* queue digits */
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) digits '%s' are queued because we didn't receive a setup acknowledge.\n", ea_endpoint->ep_serial, param->setup.dialinginfo.number);
-                       SCAT(e_dialing_queue, param->setup.dialinginfo.number + strlen(e_dialinginfo.number));
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) digits '%s' are queued because we didn't receive a setup acknowledge.\n", ea_endpoint->ep_serial, param->setup.dialinginfo.id);
+                       SCAT(e_dialing_queue, param->setup.dialinginfo.id + strlen(e_dialinginfo.id));
                        
                } else
                {
                        /* get what we have not dialed yet */
                        
                } else
                {
                        /* get what we have not dialed yet */
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) we have already dialed '%s', we received '%s', what's left '%s'.\n", ea_endpoint->ep_serial, e_dialinginfo.number, param->setup.dialinginfo.number, param->setup.dialinginfo.number+strlen(e_dialinginfo.number));
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) we have already dialed '%s', we received '%s', what's left '%s'.\n", ea_endpoint->ep_serial, e_dialinginfo.id, param->setup.dialinginfo.id, param->setup.dialinginfo.id+strlen(e_dialinginfo.id));
                        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_INFORMATION);
                        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_INFORMATION);
-                       SCPY(message->param.information.number, param->setup.dialinginfo.number + strlen(e_dialinginfo.number));
+                       SCPY(message->param.information.id, param->setup.dialinginfo.id + strlen(e_dialinginfo.id));
                        message->param.information.ntype = INFO_NTYPE_UNKNOWN;
                        message_put(message);
                        logmessage(message);
                        message->param.information.ntype = INFO_NTYPE_UNKNOWN;
                        message_put(message);
                        logmessage(message);
@@ -3470,8 +3363,8 @@ void EndpointAppPBX::call_setup(struct port_list *portlist, int message_type, un
                return;
        }
        /* if an internal extension is dialed, copy that number */
                return;
        }
        /* if an internal extension is dialed, copy that number */
-       if (param->setup.dialinginfo.itype==INFO_ITYPE_INTERN || param->setup.dialinginfo.itype==INFO_ITYPE_VBOX)
-               SCPY(e_ext.number, param->setup.dialinginfo.number);
+       if (param->setup.dialinginfo.itype==INFO_ITYPE_ISDN_EXTENSION || param->setup.dialinginfo.itype==INFO_ITYPE_VBOX)
+               SCPY(e_ext.number, param->setup.dialinginfo.id);
        /* if an internal extension is dialed, get extension's info about caller */
        if (e_ext.number[0]) 
        {
        /* if an internal extension is dialed, get extension's info about caller */
        if (e_ext.number[0]) 
        {
@@ -3569,9 +3462,9 @@ void EndpointAppPBX::call_notify(struct port_list *portlist, int message_type, u
                message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_NOTIFY);
                memcpy(&message->param.notifyinfo, &param->notifyinfo, sizeof(struct notify_info));
                /* handle restricted caller ids */
                message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_NOTIFY);
                memcpy(&message->param.notifyinfo, &param->notifyinfo, sizeof(struct notify_info));
                /* handle restricted caller ids */
-               apply_callerid_restriction(e_ext.anon_ignore, portlist->port_type, message->param.notifyinfo.id, &message->param.notifyinfo.ntype, &message->param.notifyinfo.present, NULL, message->param.notifyinfo.voip, message->param.notifyinfo.intern, 0);
+               apply_callerid_restriction(e_ext.anon_ignore, message->param.notifyinfo.id, &message->param.notifyinfo.ntype, &message->param.notifyinfo.present, 0, message->param.notifyinfo.extension, NULL);
                /* display callerid if desired for extension */
                /* display callerid if desired for extension */
-               SCPY(message->param.notifyinfo.display, apply_callerid_display(message->param.notifyinfo.id, message->param.notifyinfo.itype, message->param.notifyinfo.ntype, message->param.notifyinfo.present, 0, message->param.notifyinfo.voip, message->param.notifyinfo.intern, NULL));
+               SCPY(message->param.notifyinfo.display, apply_callerid_display(message->param.notifyinfo.id, message->param.notifyinfo.itype, message->param.notifyinfo.ntype, message->param.notifyinfo.present, 0, message->param.notifyinfo.extension, NULL));
                message_put(message);
                logmessage(message);
                portlist = portlist->next;
                message_put(message);
                logmessage(message);
                portlist = portlist->next;
@@ -3623,7 +3516,7 @@ void EndpointAppPBX::ea_message_call(unsigned long call_id, int message_type, un
 
                /* CALL sends INFORMATION message */
                case MESSAGE_INFORMATION:
 
                /* CALL sends INFORMATION message */
                case MESSAGE_INFORMATION:
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received more digits: '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->information.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received more digits: '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->information.id);
                call_information(portlist, message_type, param);
                break;
 
                call_information(portlist, message_type, param);
                break;
 
@@ -3690,7 +3583,7 @@ void EndpointAppPBX::ea_message_call(unsigned long call_id, int message_type, un
 
                /* CALL sends SETUP message */
                case MESSAGE_SETUP:
 
                /* CALL sends SETUP message */
                case MESSAGE_SETUP:
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint received setup from terminal='%s',id='%s' to id='%s' (dialing itype=%d)\n", ea_endpoint->ep_serial, param->setup.callerinfo.intern, param->setup.callerinfo.id, param->setup.dialinginfo.number, param->setup.dialinginfo.itype);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint received setup from terminal='%s',id='%s' to id='%s' (dialing itype=%d)\n", ea_endpoint->ep_serial, param->setup.callerinfo.extension, param->setup.callerinfo.id, param->setup.dialinginfo.id, param->setup.dialinginfo.itype);
                call_setup(portlist, message_type, param);
                return;
                break;
                call_setup(portlist, message_type, param);
                return;
                break;
@@ -3961,9 +3854,9 @@ reject:
        message->param.connectinfo.itype = eapp->e_callerinfo.itype;
        message->param.connectinfo.ntype = eapp->e_callerinfo.ntype;
        /* handle restricted caller ids */
        message->param.connectinfo.itype = eapp->e_callerinfo.itype;
        message->param.connectinfo.ntype = eapp->e_callerinfo.ntype;
        /* handle restricted caller ids */
-       apply_callerid_restriction(e_ext.anon_ignore, ea_endpoint->ep_portlist->port_type, message->param.connectinfo.id, &message->param.connectinfo.ntype, &message->param.connectinfo.present, &message->param.connectinfo.screen, message->param.connectinfo.voip, message->param.connectinfo.intern, message->param.connectinfo.name);
+       apply_callerid_restriction(e_ext.anon_ignore, message->param.connectinfo.id, &message->param.connectinfo.ntype, &message->param.connectinfo.present, &message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name);
        /* display callerid if desired for extension */
        /* display callerid if desired for extension */
-       SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype,  message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.voip, message->param.connectinfo.intern, message->param.connectinfo.name));
+       SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype,  message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name));
        message_put(message);
 
        /* we send a connect to the audio path (not for vbox) */
        message_put(message);
 
        /* we send a connect to the audio path (not for vbox) */
@@ -3972,7 +3865,7 @@ reject:
        message_put(message);
 
        /* beeing paranoid, we make call update */
        message_put(message);
 
        /* beeing paranoid, we make call update */
-       callpbx->c_mixer = 1;
+       callpbx->c_updatebridge = 1;
 
        if (options.deb & DEBUG_EPOINT)
        {
 
        if (options.deb & DEBUG_EPOINT)
        {
@@ -4177,7 +4070,7 @@ void EndpointAppPBX::join_call(void)
        PDEBUG(DEBUG_EPOINT, "EPOINT(%d)d-call completely removed!\n");
 
        /* mixer must update */
        PDEBUG(DEBUG_EPOINT, "EPOINT(%d)d-call completely removed!\n");
 
        /* mixer must update */
-       our_callpbx->c_mixer = 1; /* update mixer flag */
+       our_callpbx->c_updatebridge = 1; /* update mixer flag */
 
        /* we send a retrieve to that endpoint */
        // mixer will update the hold-state of the call and send it to the endpoints is changes
 
        /* we send a retrieve to that endpoint */
        // mixer will update the hold-state of the call and send it to the endpoints is changes
@@ -4291,8 +4184,6 @@ int EndpointAppPBX::check_external(char **errstr, class Port **port)
 
 void EndpointAppPBX::logmessage(struct message *message)
 {
 
 void EndpointAppPBX::logmessage(struct message *message)
 {
-       class Port *port;
-       class Pdss1 *pdss1;
        char *logtext = "unknown";
        char buffer[64];
 
        char *logtext = "unknown";
        char buffer[64];
 
@@ -4306,19 +4197,19 @@ void EndpointAppPBX::logmessage(struct message *message)
        {
                case MESSAGE_SETUP:
                trace_header("SETUP", DIRECTION_OUT);
        {
                case MESSAGE_SETUP:
                trace_header("SETUP", DIRECTION_OUT);
-               if (message->param.setup.callerinfo.intern[0])
-                       add_trace("extension", NULL, "%s", message->param.setup.callerinfo.intern);
+               if (message->param.setup.callerinfo.extension[0])
+                       add_trace("extension", NULL, "%s", message->param.setup.callerinfo.extension);
                add_trace("caller id", "number", "%s", numberrize_callerinfo(message->param.setup.callerinfo.id, message->param.setup.callerinfo.ntype));
                if (message->param.setup.callerinfo.present == INFO_PRESENT_RESTRICTED)
                        add_trace("caller id", "present", "restricted");
                add_trace("caller id", "number", "%s", numberrize_callerinfo(message->param.setup.callerinfo.id, message->param.setup.callerinfo.ntype));
                if (message->param.setup.callerinfo.present == INFO_PRESENT_RESTRICTED)
                        add_trace("caller id", "present", "restricted");
-               if (message->param.setup.redirinfo.number[0])
+               if (message->param.setup.redirinfo.id[0])
                {
                        add_trace("redir'ing", "number", "%s", numberrize_callerinfo(message->param.setup.redirinfo.id, message->param.setup.redirinfo.ntype));
                        if (message->param.setup.redirinfo.present == INFO_PRESENT_RESTRICTED)
                                add_trace("redir'ing", "present", "restricted");
                }
                {
                        add_trace("redir'ing", "number", "%s", numberrize_callerinfo(message->param.setup.redirinfo.id, message->param.setup.redirinfo.ntype));
                        if (message->param.setup.redirinfo.present == INFO_PRESENT_RESTRICTED)
                                add_trace("redir'ing", "present", "restricted");
                }
-               if (message->param.setup.dialinginfo.number[0])
-                       add_trace("dialing", NULL, "%s", message->param.setup.dialinginfo.number);
+               if (message->param.setup.dialinginfo.id[0])
+                       add_trace("dialing", NULL, "%s", message->param.setup.dialinginfo.id);
                end_trace();
                break;
 
                end_trace();
                break;
 
@@ -4339,8 +4230,8 @@ void EndpointAppPBX::logmessage(struct message *message)
 
                case MESSAGE_CONNECT:
                trace_header("CONNECT", DIRECTION_OUT);
 
                case MESSAGE_CONNECT:
                trace_header("CONNECT", DIRECTION_OUT);
-               if (message->param.connectinfo.intern[0])
-                       add_trace("extension", NULL, "%s", message->param.connectinfo.intern);
+               if (message->param.connectinfo.extension[0])
+                       add_trace("extension", NULL, "%s", message->param.connectinfo.extension);
                add_trace("connect id", "number", "%s", numberrize_callerinfo(message->param.connectinfo.id, message->param.connectinfo.ntype));
                if (message->param.connectinfo.present == INFO_PRESENT_RESTRICTED)
                        add_trace("connect id", "present", "restricted");
                add_trace("connect id", "number", "%s", numberrize_callerinfo(message->param.connectinfo.id, message->param.connectinfo.ntype));
                if (message->param.connectinfo.present == INFO_PRESENT_RESTRICTED)
                        add_trace("connect id", "present", "restricted");
@@ -4444,7 +4335,7 @@ void EndpointAppPBX::logmessage(struct message *message)
                trace_header("NOTIFY", DIRECTION_OUT);
                if (message->param.notifyinfo.notify)
                        add_trace("indicator", NULL, "%s", logtext);
                trace_header("NOTIFY", DIRECTION_OUT);
                if (message->param.notifyinfo.notify)
                        add_trace("indicator", NULL, "%s", logtext);
-               if (message->param.notifyinfo.number[0])
+               if (message->param.notifyinfo.id[0])
                {
                        add_trace("redir'on", "number", "%s", numberrize_callerinfo(message->param.notifyinfo.id, message->param.notifyinfo.ntype));
                        if (message->param.notifyinfo.present == INFO_PRESENT_RESTRICTED)
                {
                        add_trace("redir'on", "number", "%s", numberrize_callerinfo(message->param.notifyinfo.id, message->param.notifyinfo.ntype));
                        if (message->param.notifyinfo.present == INFO_PRESENT_RESTRICTED)
@@ -4457,7 +4348,7 @@ void EndpointAppPBX::logmessage(struct message *message)
 
                case MESSAGE_INFORMATION:
                trace_header("INFORMATION", DIRECTION_OUT);
 
                case MESSAGE_INFORMATION:
                trace_header("INFORMATION", DIRECTION_OUT);
-               add_trace("dialing", NULL, "%s", message->param.information.number);
+               add_trace("dialing", NULL, "%s", message->param.information.id);
                end_trace();
                break;
 
                end_trace();
                break;
 
index d0ec28b..a3fa660 100644 (file)
--- a/apppbx.h
+++ b/apppbx.h
@@ -225,7 +225,8 @@ class EndpointAppPBX : public EndpointApp
        void keypad_function(char digit);
        void set_tone(struct port_list *portlist, char *tone);
        void out_setup(void);
        void keypad_function(char digit);
        void set_tone(struct port_list *portlist, char *tone);
        void out_setup(void);
-       char *apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *h323, char *intern, char *name);
+       struct mISDNport *hunt_port(char *ifname, int *channel);
+       char *apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *extension, char *name);
        void auth(int job, int bit_num);
 
        /* vbox playback stuff */
        void auth(int job, int bit_num);
 
        /* vbox playback stuff */
@@ -352,7 +353,7 @@ class EndpointAppPBX : public EndpointApp
 
 char *nationalize_callerinfo(char *string, int *type);
 char *numberrize_callerinfo(char *string, int type);
 
 char *nationalize_callerinfo(char *string, int *type);
 char *numberrize_callerinfo(char *string, int type);
-void apply_callerid_restriction(int anon_ignore, int port_type, char *id, int *ntype, int *present, int *screen, char *voip, char *intern, char *name);
+void apply_callerid_restriction(int anon_ignore, char *id, int *ntype, int *present, int *screen, char *extension, char *name);
 void send_mail(char *filename, char *callerid, char *callerintern, char *callername, char *vbox_email, int vbox_year, int vbox_mon, int vbox_mday, int vbox_hour, int vbox_min, char *terminal);
 
 
 void send_mail(char *filename, char *callerid, char *callerintern, char *callername, char *vbox_email, int vbox_year, int vbox_mon, int vbox_mday, int vbox_hour, int vbox_min, char *terminal);
 
 
diff --git a/call.h b/call.h
index ff2fc15..2315b56 100644 (file)
--- a/call.h
+++ b/call.h
@@ -9,7 +9,7 @@
 **                                                                           **
 \*****************************************************************************/ 
 
 **                                                                           **
 \*****************************************************************************/ 
 
-enum { CALL_TYPE_NONE, CALL_TYPE_PBX, CALL_TYPE_CHAN};
+enum { CALL_TYPE_NONE, CALL_TYPE_PBX, CALL_TYPE_ASTERISK};
 
 /* call
  *
 
 /* call
  *
index 0c946c5..a3c7599 100644 (file)
@@ -38,7 +38,7 @@ CallChan::CallChan(class Endpoint *epoint) : Call(epoint)
 
        PDEBUG(DEBUG_CALL, "creating new call and connecting it to the endpoint.\n");
 
 
        PDEBUG(DEBUG_CALL, "creating new call and connecting it to the endpoint.\n");
 
-       c_type = CALL_TYPE_CHAN;
+       c_type = CALL_TYPE_ASTERISK;
        c_epoint_id = epoint->ep_serial;
 
        PDEBUG(DEBUG_CALL, "Constructor(new call)");
        c_epoint_id = epoint->ep_serial;
 
        PDEBUG(DEBUG_CALL, "Constructor(new call)");
index 39dc82b..7fd1a94 100644 (file)
@@ -403,8 +403,8 @@ void CallPBX::bridge(void)
                 */
                message = message_create(c_serial, relation->epoint_id, CALL_TO_EPOINT, MESSAGE_mISDNSIGNAL);
                message->param.mISDNsignal.message = mISDNSIGNAL_CALLDATA;
                 */
                message = message_create(c_serial, relation->epoint_id, CALL_TO_EPOINT, MESSAGE_mISDNSIGNAL);
                message->param.mISDNsignal.message = mISDNSIGNAL_CALLDATA;
-               message->param.mISDNsignal.calldata = (relnum==2 && !allmISDN);
-               PDEBUG(DEBUG_CALL, "call %d sets 'calldata' on port %s to %d\n", c_serial, port->p_name, calldata);
+               message->param.mISDNsignal.calldata = (relations==2 && !allmISDN);
+               PDEBUG(DEBUG_CALL, "call %d sets 'calldata' on port %s to %d\n", c_serial, port->p_name, message->param.mISDNsignal.calldata);
                message_put(message);
 
                relation = relation->next;
                message_put(message);
 
                relation = relation->next;
@@ -597,6 +597,9 @@ int callpbx_countrelations(unsigned long call_id)
        if (!call)
                return(0);
 
        if (!call)
                return(0);
 
+       if (call->c_type != CALL_TYPE_ASTERISK)
+               return(2);
+
        if (call->c_type != CALL_TYPE_PBX)
                return(0);
        callpbx = (class CallPBX *)call;
        if (call->c_type != CALL_TYPE_PBX)
                return(0);
        callpbx = (class CallPBX *)call;
@@ -681,8 +684,7 @@ void CallPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
        int new_state;
        struct message *message;
 //     int size, writesize, oldpointer;
        int new_state;
        struct message *message;
 //     int size, writesize, oldpointer;
-       class Endpoint *epoint;
-       char *number;
+       char *number, *numbers;
 
        if (!epoint_id)
        {
 
        if (!epoint_id)
        {
@@ -833,9 +835,10 @@ void CallPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
                switch(message_type)
                {
                        case MESSAGE_SETUP:
                switch(message_type)
                {
                        case MESSAGE_SETUP:
-                       if (param->dialinginfo.itype == INFO_ITYPE_ISDN_EXTENSION)
+                       if (param->setup.dialinginfo.itype == INFO_ITYPE_ISDN_EXTENSION)
                        {
                        {
-                               while(number = strsep(&param->dialinginfo.number, ','))
+                               numbers = param->setup.dialinginfo.id;
+                               while((number = strsep(&numbers, ",")))
                                {
                                        if (out_setup(epoint_id, message_type, param, number))
                                                return; // call destroyed
                                {
                                        if (out_setup(epoint_id, message_type, param, number))
                                                return; // call destroyed
@@ -938,8 +941,8 @@ int CallPBX::out_setup(unsigned long epoint_id, int message_type, union paramete
                relation = c_relation;
                while(relation)
                {
                relation = c_relation;
                while(relation)
                {
-                       message = message_create(c_serial, releation->epoint_id, CALL_TO_EPOINT, MESSAGE_RELEASE);
-                       message->param.disconnectinfo.cause = (relation->epoint_id==epoint_id)CAUSE_RESSOURCEUNAVAIL?:CAUSE_NORMAL; 
+                       message = message_create(c_serial, relation->epoint_id, CALL_TO_EPOINT, MESSAGE_RELEASE);
+                       message->param.disconnectinfo.cause = (relation->epoint_id==epoint_id)?CAUSE_RESSOURCEUNAVAIL:CAUSE_NORMAL; 
                        message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
                        message_put(message);
                        relation = relation->next;
                        message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
                        message_put(message);
                        relation = relation->next;
@@ -973,14 +976,9 @@ int CallPBX::out_setup(unsigned long epoint_id, int message_type, union paramete
        message = message_create(c_serial, relation->epoint_id, CALL_TO_EPOINT, message_type);
        memcpy(&message->param, param, sizeof(union parameter));
        if (newnumber)
        message = message_create(c_serial, relation->epoint_id, CALL_TO_EPOINT, message_type);
        memcpy(&message->param, param, sizeof(union parameter));
        if (newnumber)
-               SCPY(message->param.setup.dialinginfo.number, newnumber);
-       PDEBUG(DEBUG_CALL, "setup message sent to ep %d with number='%s'.\n", relation->epoint_id, message->param.setup.dialinginfo.number);
+               SCPY(message->param.setup.dialinginfo.id, newnumber);
+       PDEBUG(DEBUG_CALL, "setup message sent to ep %d with number='%s'.\n", relation->epoint_id, message->param.setup.dialinginfo.id);
        message_put(message);
        return(0);
 }
 
        message_put(message);
        return(0);
 }
 
-todo: beim release von einem relation_type_setup muss der cause gesammelt werden, bis keine weitere setup-relation mehr existiert
-beim letzten den collected cause senden
-bridge kann ruhig loslegen, das aber dokumentieren
-bridge Ã¼berdenken: wer sendet, welche töne verfügbar sind, u.s.w
-
index 25e3220..c84d89a 100644 (file)
--- a/callpbx.h
+++ b/callpbx.h
@@ -63,6 +63,7 @@ class CallPBX : public Call
        char c_dialed[1024];            /* dial string of (all) number(s) */
        char c_todial[32];              /* overlap dialing (part not signalled yet) */
        
        char c_dialed[1024];            /* dial string of (all) number(s) */
        char c_todial[32];              /* overlap dialing (part not signalled yet) */
        
+       int c_pid;                      /* pid of call to generate bridge id */
        int c_updatebridge;             /* bridge must be updated */
        struct call_relation *c_relation; /* list of endpoints that are related to the call */
 
        int c_updatebridge;             /* bridge must be updated */
        struct call_relation *c_relation; /* list of endpoints that are related to the call */
 
index 65890c3..2b75792 100644 (file)
--- a/crypt.cpp
+++ b/crypt.cpp
@@ -1832,8 +1832,8 @@ void EndpointAppPBX::encrypt_shared(void)
        }
 
        /* check the key for the call */
        }
 
        /* check the key for the call */
-       if (port->p_type==PORT_TYPE_DSS1_TE_OUT || port->p_type==PORT_TYPE_DSS1_NT_OUT || port->p_type==PORT_TYPE_SIP_OUT)
-               ret = parse_secrets((char *)e_ext.number, (char *)port->p_dialinginfo.number, &auth_pointer, &crypt_pointer, &key_pointer);
+       if (port->p_type==PORT_TYPE_DSS1_TE_OUT || port->p_type==PORT_TYPE_DSS1_NT_OUT)
+               ret = parse_secrets((char *)e_ext.number, (char *)port->p_dialinginfo.id, &auth_pointer, &crypt_pointer, &key_pointer);
        else
        {
                if (!port->p_callerinfo.id[0])
        else
        {
                if (!port->p_callerinfo.id[0])
index 095f8ff..452c775 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -36,7 +36,7 @@ extern "C" {
  */
 Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive) : PmISDN(type, mISDNport, portname, settings, channel, exclusive)
 {
  */
 Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive) : PmISDN(type, mISDNport, portname, settings, channel, exclusive)
 {
-       p_callerinfo.itype = (mISDNport->ifport->interface->extension)?INFO_ITYPE_ISDN:INFO_ITYPE_ISDN_EXTENSION;
+       p_callerinfo.itype = (mISDNport->ifport->interface->extension)?INFO_ITYPE_ISDN_EXTENSION:INFO_ITYPE_ISDN;
        p_m_d_ntmode = mISDNport->ntmode;
        p_m_d_l3id = 0;
        p_m_d_ces = -1;
        p_m_d_ntmode = mISDNport->ntmode;
        p_m_d_l3id = 0;
        p_m_d_ces = -1;
@@ -469,7 +469,7 @@ int Pdss1::hunt_bchannel(int channel, int exclusive)
        }
 use_channel:
        add_trace("conclusion", NULL, "channel available");
        }
 use_channel:
        add_trace("conclusion", NULL, "channel available");
-       add_trace("connect", "channel", "%d", p_m_b_channel);
+       add_trace("connect", "channel", "%d", channel);
        end_trace();
        return(channel);
 }
        end_trace();
        return(channel);
 }
@@ -518,7 +518,7 @@ void Pdss1::setup_ind(unsigned long prim, unsigned long dinfo, void *data)
 
        l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN);
        dec_ie_calling_pn(setup->CALLING_PN, (Q931_info_t *)((unsigned long)data+headerlen), &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id));
 
        l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN);
        dec_ie_calling_pn(setup->CALLING_PN, (Q931_info_t *)((unsigned long)data+headerlen), &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id));
-       dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *)((unsigned long)data+headerlen), &called_type, &called_plan, (unsigned char *)p_dialinginfo.number, sizeof(p_dialinginfo.number));
+       dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *)((unsigned long)data+headerlen), &called_type, &called_plan, (unsigned char *)p_dialinginfo.id, sizeof(p_dialinginfo.id));
        dec_ie_keypad(setup->KEYPAD, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)keypad, sizeof(keypad));
 #ifdef CENTREX
        /* te-mode: CNIP (calling name identification presentation) */
        dec_ie_keypad(setup->KEYPAD, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)keypad, sizeof(keypad));
 #ifdef CENTREX
        /* te-mode: CNIP (calling name identification presentation) */
@@ -596,7 +596,7 @@ void Pdss1::setup_ind(unsigned long prim, unsigned long dinfo, void *data)
        SCPY(p_callerinfo.interface, p_m_mISDNport->ifport->interface->name);
 
        /* dialing information */
        SCPY(p_callerinfo.interface, p_m_mISDNport->ifport->interface->name);
 
        /* dialing information */
-       SCAT(p_dialinginfo.number, (char *)keypad);
+       SCAT(p_dialinginfo.id, (char *)keypad);
        switch (called_type)
        {
                case 0x1:
        switch (called_type)
        {
                case 0x1:
@@ -808,12 +808,12 @@ void Pdss1::information_ind(unsigned long prim, unsigned long dinfo, void *data)
        struct message *message;
 
        l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN);
        struct message *message;
 
        l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN);
-       dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)((unsigned long)data+headerlen), &type, &plan, (unsigned char *)p_dialinginfo.number, sizeof(p_dialinginfo.number));
+       dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)((unsigned long)data+headerlen), &type, &plan, (unsigned char *)p_dialinginfo.id, sizeof(p_dialinginfo.id));
        dec_ie_keypad(information->KEYPAD, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)keypad, sizeof(keypad));
        dec_ie_complete(information->COMPLETE, (Q931_info_t *)((unsigned long)data+headerlen), &p_dialinginfo.sending_complete);
        end_trace();
 
        dec_ie_keypad(information->KEYPAD, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)keypad, sizeof(keypad));
        dec_ie_complete(information->COMPLETE, (Q931_info_t *)((unsigned long)data+headerlen), &p_dialinginfo.sending_complete);
        end_trace();
 
-       SCAT(p_dialinginfo.number, (char *)keypad);
+       SCAT(p_dialinginfo.id, (char *)keypad);
        switch (type)
        {
                case 0x1:
        switch (type)
        {
                case 0x1:
@@ -1120,16 +1120,20 @@ void Pdss1::connect_ind(unsigned long prim, unsigned long dinfo, void *data)
        p_connectinfo.isdn_port = p_m_portnum;
        SCPY(p_connectinfo.interfaces, p_m_mISDNport->ifport->interface->name);
 
        p_connectinfo.isdn_port = p_m_portnum;
        SCPY(p_connectinfo.interfaces, p_m_mISDNport->ifport->interface->name);
 
-       /* send connect acknowledge */
-       dmsg = create_l3msg(CC_CONNECT | RESPONSE, MT_CONNECT, dinfo, sizeof(CONNECT_ACKNOWLEDGE_t), p_m_d_ntmode);
-       connect_acknowledge = (CONNECT_ACKNOWLEDGE_t *)(dmsg->data + headerlen);
-       l1l2l3_trace_header(p_m_mISDNport, this, CC_CONNECT | RESPONSE, DIRECTION_OUT);
-       /* if we had no bchannel before, we send it now */
-       if (!bchannel_before && p_m_b_channel)
-               enc_ie_channel_id(&connect_acknowledge->CHANNEL_ID, dmsg, 1, p_m_b_channel);
-       end_trace();
-       msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
-
+       /* only in nt-mode we send connect ack. in te-mode it is done by stack itself or optional */
+       if (p_m_d_ntmode)
+       {
+               /* send connect acknowledge */
+               dmsg = create_l3msg(CC_CONNECT | RESPONSE, MT_CONNECT, dinfo, sizeof(CONNECT_ACKNOWLEDGE_t), p_m_d_ntmode);
+               connect_acknowledge = (CONNECT_ACKNOWLEDGE_t *)(dmsg->data + headerlen);
+               l1l2l3_trace_header(p_m_mISDNport, this, CC_CONNECT | RESPONSE, DIRECTION_OUT);
+               /* if we had no bchannel before, we send it now */
+               if (!bchannel_before && p_m_b_channel)
+                       enc_ie_channel_id(&connect_acknowledge->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+               end_trace();
+               msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+       }
+       
        message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_CONNECT);
        memcpy(&message->param.connectinfo, &p_connectinfo, sizeof(struct connect_info));
        message_put(message);
        message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_CONNECT);
        memcpy(&message->param.connectinfo, &p_connectinfo, sizeof(struct connect_info));
        message_put(message);
@@ -1155,7 +1159,7 @@ void Pdss1::disconnect_ind(unsigned long prim, unsigned long dinfo, void *data)
                cause = 16;
 
        /* release if we are remote sends us no tones */
                cause = 16;
 
        /* release if we are remote sends us no tones */
-       if (p_m_mISDNport->is_earlyb)
+       if (p_m_mISDNport->earlyb)
        {
                RELEASE_t *release;
                msg_t *dmsg;
        {
                RELEASE_t *release;
                msg_t *dmsg;
@@ -1719,7 +1723,7 @@ void Pdss1::resume_ind(unsigned long prim, unsigned long dinfo, void *data)
                PERROR("no memory for epointlist\n");
                exit(-1);
        }
                PERROR("no memory for epointlist\n");
                exit(-1);
        }
-       if (!(epoint->portlist_new(p_serial, p_type, p_m_mISDNport->is_earlyb)))
+       if (!(epoint->portlist_new(p_serial, p_type, p_m_mISDNport->earlyb)))
        {
                PERROR("no memory for portlist\n");
                exit(-1);
        {
                PERROR("no memory for portlist\n");
                exit(-1);
@@ -2032,7 +2036,7 @@ int Pdss1::handler(void)
 {
        int ret;
 
 {
        int ret;
 
-       if ((ret = Port::handler()))
+       if ((ret = PmISDN::handler()))
                return(ret);
 
        /* handle destruction */
                return(ret);
 
        /* handle destruction */
@@ -2056,12 +2060,12 @@ void Pdss1::message_information(unsigned long epoint_id, int message_id, union p
        INFORMATION_t *information;
        msg_t *dmsg;
 
        INFORMATION_t *information;
        msg_t *dmsg;
 
-       if (param->information.number[0]) /* only if we have something to dial */
+       if (param->information.id[0]) /* only if we have something to dial */
        {
                dmsg = create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, p_m_d_l3id, sizeof(INFORMATION_t), p_m_d_ntmode);
                information = (INFORMATION_t *)(dmsg->data + headerlen);
                l1l2l3_trace_header(p_m_mISDNport, this, CC_INFORMATION | REQUEST, DIRECTION_OUT);
        {
                dmsg = create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, p_m_d_l3id, sizeof(INFORMATION_t), p_m_d_ntmode);
                information = (INFORMATION_t *)(dmsg->data + headerlen);
                l1l2l3_trace_header(p_m_mISDNport, this, CC_INFORMATION | REQUEST, DIRECTION_OUT);
-               enc_ie_called_pn(&information->CALLED_PN, dmsg, 0, 1, (unsigned char *)param->information.number);
+               enc_ie_called_pn(&information->CALLED_PN, dmsg, 0, 1, (unsigned char *)param->information.id);
                end_trace();
                msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
        }
                end_trace();
                msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
        }
@@ -2251,9 +2255,9 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet
        if (type >= 0)
                enc_ie_calling_pn(&setup->CALLING_PN, dmsg, type, plan, present, screen, (unsigned char *)p_callerinfo.id);
        /* dialing information */
        if (type >= 0)
                enc_ie_calling_pn(&setup->CALLING_PN, dmsg, type, plan, present, screen, (unsigned char *)p_callerinfo.id);
        /* dialing information */
-       if (p_dialinginfo.number[0]) /* only if we have something to dial */
+       if (p_dialinginfo.id[0]) /* only if we have something to dial */
        {
        {
-               enc_ie_called_pn(&setup->CALLED_PN, dmsg, 0, 1, (unsigned char *)p_dialinginfo.number);
+               enc_ie_called_pn(&setup->CALLED_PN, dmsg, 0, 1, (unsigned char *)p_dialinginfo.id);
        }
        /* sending complete */
        if (p_dialinginfo.sending_complete)
        }
        /* sending complete */
        if (p_dialinginfo.sending_complete)
@@ -2513,7 +2517,7 @@ void Pdss1::message_overlap(unsigned long epoint_id, int message_id, union param
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
-       if (p_m_mISDNport->is_tones)
+       if (p_m_mISDNport->tones)
                enc_ie_progress(&setup_acknowledge->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        end_trace();
        msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
                enc_ie_progress(&setup_acknowledge->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        end_trace();
        msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
@@ -2539,7 +2543,7 @@ void Pdss1::message_proceeding(unsigned long epoint_id, int message_id, union pa
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
-       if (p_m_mISDNport->is_tones)
+       if (p_m_mISDNport->tones)
                enc_ie_progress(&proceeding->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        end_trace();
        msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
                enc_ie_progress(&proceeding->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        end_trace();
        msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
@@ -2586,7 +2590,7 @@ void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union para
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
-       if (p_m_mISDNport->is_tones)
+       if (p_m_mISDNport->tones)
                enc_ie_progress(&alerting->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        end_trace();
        msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
                enc_ie_progress(&alerting->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        end_trace();
        msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
@@ -2735,7 +2739,7 @@ void Pdss1::message_disconnect(unsigned long epoint_id, int message_id, union pa
        char *p = NULL;
 
        /* we reject during incoming setup when we have no tones. also if we are in outgoing setup state */
        char *p = NULL;
 
        /* we reject during incoming setup when we have no tones. also if we are in outgoing setup state */
-       if ((p_state==PORT_STATE_IN_SETUP && !p_m_mISDNport->is_tones)
+       if ((p_state==PORT_STATE_IN_SETUP && !p_m_mISDNport->tones)
         || p_state==PORT_STATE_OUT_SETUP)
        {
                /* sending release to endpoint */
         || p_state==PORT_STATE_OUT_SETUP)
        {
                /* sending release to endpoint */
@@ -2790,7 +2794,7 @@ void Pdss1::message_disconnect(unsigned long epoint_id, int message_id, union pa
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
-       if (p_m_mISDNport->is_tones)
+       if (p_m_mISDNport->tones)
                enc_ie_progress(&disconnect->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        /* send cause */
        enc_ie_cause(&disconnect->CAUSE, dmsg, (p_m_d_ntmode && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
                enc_ie_progress(&disconnect->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        /* send cause */
        enc_ie_cause(&disconnect->CAUSE, dmsg, (p_m_d_ntmode && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
@@ -2889,7 +2893,7 @@ void Pdss1::message_release(unsigned long epoint_id, int message_id, union param
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_capainfo.bearer_capa==INFO_BC_SPEECH
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
-       if (p_m_mISDNport->is_tones)
+       if (p_m_mISDNport->tones)
                enc_ie_progress(&disconnect->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        /* send cause */
        enc_ie_cause(&disconnect->CAUSE, dmsg, (p_m_d_ntmode && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
                enc_ie_progress(&disconnect->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
        /* send cause */
        enc_ie_cause(&disconnect->CAUSE, dmsg, (p_m_d_ntmode && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
index 1e66143..53d2149 100644 (file)
@@ -69,7 +69,7 @@ Endpoint::Endpoint(int port_id, int call_id)
                if (port)
                {
                        if ((port->p_type&PORT_CLASS_mISDN_MASK) == PORT_CLASS_mISDN_DSS1)
                if (port)
                {
                        if ((port->p_type&PORT_CLASS_mISDN_MASK) == PORT_CLASS_mISDN_DSS1)
-                               earlyb = ((class PmISDN *)port)->p_m_mISDNport->is_earlyb;
+                               earlyb = ((class PmISDN *)port)->p_m_mISDNport->earlyb;
                        if (!portlist_new(port_id, port->p_type, earlyb))
                        {
                                PERROR("no mem for portlist, exitting...\n");
                        if (!portlist_new(port_id, port->p_type, earlyb))
                        {
                                PERROR("no mem for portlist, exitting...\n");
index 4a09d7f..f62eb96 100644 (file)
@@ -140,7 +140,6 @@ struct extension {
        int display_cause;      /* clear cause using display message */
        int display_ext;        /* display external caller ids */
        int display_int;        /* display internal caller ids */
        int display_cause;      /* clear cause using display message */
        int display_ext;        /* display external caller ids */
        int display_int;        /* display internal caller ids */
-       int display_voip;       /* display h323 caller ids */
        int display_fake;       /* display fake caller ids */
        int display_anon;       /* display anonymouse caller ids */
        int display_menu;       /* display menu */
        int display_fake;       /* display fake caller ids */
        int display_anon;       /* display anonymouse caller ids */
        int display_menu;       /* display menu */
index f26b8f8..cab89ad 100644 (file)
--- a/genext.c
+++ b/genext.c
@@ -1,6 +1,6 @@
 /*****************************************************************************\
 **                                                                           **
 /*****************************************************************************\
 **                                                                           **
-** PBX4Linux                                                                 **
+** LCR                                                                       **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
diff --git a/genrc.c b/genrc.c
index 7b69cca..8cb5b00 100644 (file)
--- a/genrc.c
+++ b/genrc.c
@@ -1,6 +1,6 @@
 /*****************************************************************************\
 **                                                                           **
 /*****************************************************************************\
 **                                                                           **
-** PBX4Linux                                                                 **
+** LCR                                                                       **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
@@ -51,7 +51,7 @@ int main(void)
        char protocol[1024], layermask[1024], types[256];
 
        printf("\n\nThis program generates a script, which is used to start/stop/restart mISDN\n");
        char protocol[1024], layermask[1024], types[256];
 
        printf("\n\nThis program generates a script, which is used to start/stop/restart mISDN\n");
-       printf("driver. All configuration of cards is done for using with the PBX.\n");
+       printf("driver. All configuration of cards is done for using with the LCR.\n");
 
        while(i < (int)sizeof(mode)) /* number of cards */
        {
 
        while(i < (int)sizeof(mode)) /* number of cards */
        {
@@ -67,7 +67,7 @@ int main(void)
                ptp[i] = 0;
                do
                {
                ptp[i] = 0;
                do
                {
-                       printf("\nIs your port #%d connected to point-to-multipoint line/phone, which supports multiple\ntelephones (Mehrgeräteanschluss) OR is it a point-to-point link which is used\nfor PBX and supports extension dialing (Anlagenanschluss)?\n[ptp | ptm]: ", i+1); fflush(stdout);
+                       printf("\nIs your port #%d connected to point-to-multipoint line/phone, which supports multiple\ntelephones (Mehrgeräteanschluss) OR is it a point-to-point link which is used\nfor LCR and supports extension dialing (Anlagenanschluss)?\n[ptp | ptm]: ", i+1); fflush(stdout);
                        scanf("%s", input);
                } while (!!strcmp(input,"ptp") && !!strcmp(input,"ptm"));
                ptp[i] = (input[2]=='p')?1:0;
                        scanf("%s", input);
                } while (!!strcmp(input,"ptp") && !!strcmp(input,"ptm"));
                ptp[i] = (input[2]=='p')?1:0;
@@ -152,16 +152,16 @@ int main(void)
 
        n = i;
 
 
        n = i;
 
-       printf("\nWhere do you like to load the modules from, enter 0 for default, 1 for\n'/usr/local/pbx/modules/' or the full path.\n[0 | 1 | <path>]: "); fflush(stdout);
+       printf("\nWhere do you like to load the modules from, enter 0 for default, 1 for\n'/usr/local/lcr/modules/' or the full path.\n[0 | 1 | <path>]: "); fflush(stdout);
        scanf("%s", input);
        if (!strcmp(input, "0"))
                SCPY(input, "");
        if (!strcmp(input, "1"))
        scanf("%s", input);
        if (!strcmp(input, "0"))
                SCPY(input, "");
        if (!strcmp(input, "1"))
-               SCPY(input, "/usr/local/pbx/modules");
+               SCPY(input, "/usr/local/lcr/modules");
        if (input[0]) if (input[strlen(input)-1] != '/')
                SCAT(input, "/");
 
        if (input[0]) if (input[strlen(input)-1] != '/')
                SCAT(input, "/");
 
-       printf("\n\nFinally tell me where to write the mISDN rc file.\Enter the name 'mISDN' for current directory.\nYou may want to say '/usr/local/pbx/mISDN' or '/etc/rc.d/mISDN'\n: "); fflush(stdout);
+       printf("\n\nFinally tell me where to write the mISDN rc file.\Enter the name 'mISDN' for current directory.\nYou may want to say '/usr/local/lcr/mISDN' or '/etc/rc.d/mISDN'\n: "); fflush(stdout);
        scanf("%s", name);
        if (!(fp=fopen(name, "w")))
        {
        scanf("%s", name);
        if (!(fp=fopen(name, "w")))
        {
diff --git a/ie.cpp b/ie.cpp
index 0ac73a4..b27920f 100644 (file)
--- a/ie.cpp
+++ b/ie.cpp
@@ -526,7 +526,7 @@ void Pdss1::dec_ie_calling_pn(unsigned char *p, Q931_info_t *qi, int *type, int
        add_trace("calling_pn", "plan", "%d", *plan);
        add_trace("calling_pn", "present", "%d", *present);
        add_trace("calling_pn", "screen", "%d", *screen);
        add_trace("calling_pn", "plan", "%d", *plan);
        add_trace("calling_pn", "present", "%d", *present);
        add_trace("calling_pn", "screen", "%d", *screen);
-       add_trace("calling_pn", "number", "%s", *number);
+       add_trace("calling_pn", "number", "%s", number);
 }
 
 
 }
 
 
index 2fe7b2c..7b90d15 100644 (file)
@@ -256,7 +256,6 @@ static int inter_port(struct interface *interface, char *filename, int line, cha
 {
        struct interface_port *ifport, **ifportp;
        struct interface *searchif;
 {
        struct interface_port *ifport, **ifportp;
        struct interface *searchif;
-       struct interface_port *searchport;
        int val;
 
        val = get_number(value);
        int val;
 
        val = get_number(value);
@@ -269,7 +268,7 @@ static int inter_port(struct interface *interface, char *filename, int line, cha
        searchif = interface_newlist;
        while(searchif)
        {
        searchif = interface_newlist;
        while(searchif)
        {
-               searchport = searchif->ifport;
+               ifport = searchif->ifport;
                while(ifport)
                {
                        if (ifport->portnum == val)
                while(ifport)
                {
                        if (ifport->portnum == val)
@@ -883,7 +882,7 @@ struct interface *read_interfaces(void)
                        parameter[strlen(parameter)-1] = '\0';
 
                        /* check if interface name already exists */
                        parameter[strlen(parameter)-1] = '\0';
 
                        /* check if interface name already exists */
-                       interface = interface_first;
+                       interface = interface_newlist;
                        while(interface)
                        {
                                if (!strcasecmp(interface->name, parameter+1))
                        while(interface)
                        {
                                if (!strcasecmp(interface->name, parameter+1))
@@ -921,10 +920,12 @@ struct interface *read_interfaces(void)
                        {
                                if (ifparam->func(interface, filename, line, parameter, value))
                                        goto error;
                        {
                                if (ifparam->func(interface, filename, line, parameter, value))
                                        goto error;
-                               continue;
+                               break;
                        }
                        ifparam++;
                }
                        }
                        ifparam++;
                }
+               if (ifparam->name)
+                       continue;
 
                SPRINT(interface_error, "Error in %s (line %d): unknown parameter: '%s'.\n", filename, line, parameter);
                goto error;
 
                SPRINT(interface_error, "Error in %s (line %d): unknown parameter: '%s'.\n", filename, line, parameter);
                goto error;
@@ -1092,38 +1093,52 @@ void relink_interfaces(void)
                {
                        if (!ifport->mISDNport)
                        {
                {
                        if (!ifport->mISDNport)
                        {
-                               /* open new port */
-                               mISDNport = mISDNport_open(ifport->portnum, ifport->ptp, ifport->ptmp);
-                               if (mISDNport)
-                               {
-                                       ifport->mISDNport = mISDNport;
-                                       mISDNport->ifport = 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;
+                               load_port(ifport);
                        }
                        }
+                       ifport = ifport->next;
                }
                interface = interface->next;
        }
 
 }
 
                }
                interface = interface->next;
        }
 
 }
 
+
+/*
+ * load port
+ */
+void load_port(struct interface_port *ifport)
+{
+       struct mISDNport *mISDNport;
+
+       /* open new port */
+       mISDNport = mISDNport_open(ifport->portnum, ifport->ptp, ifport->ptmp, ifport->interface);
+       if (mISDNport)
+       {
+               /* link port */
+               ifport->mISDNport = mISDNport;
+               mISDNport->ifport = ifport;
+               
+               /* 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->tones = (ifport->interface->is_tones==IS_YES);
+               else
+                       ifport->mISDNport->tones = (ifport->mISDNport->ntmode)?1:0;
+               /* default is_earlyb */
+               if (ifport->interface->is_earlyb)
+                       ifport->mISDNport->earlyb = (ifport->interface->is_earlyb==IS_YES);
+               else
+                       ifport->mISDNport->earlyb = (ifport->mISDNport->ntmode)?0:1;
+       } else
+       {
+               ifport->block = 2; /* not available */
+       }
+}
+
 /*
  * give summary of interface syntax
  */
 /*
  * give summary of interface syntax
  */
@@ -1151,4 +1166,3 @@ void doc_interface(void)
        }
 }
 
        }
 }
 
-
index ce15094..c7dac41 100644 (file)
@@ -109,6 +109,7 @@ extern char interface_error[256];
 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 doc_interface(void);
 
 
 void doc_interface(void);
 
 
index cf70697..d82e513 100644 (file)
--- a/mISDN.cpp
+++ b/mISDN.cpp
@@ -141,9 +141,9 @@ void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, char *ms
 {
        /* init trace with given values */
        start_trace(mISDNport?mISDNport->portnum:0,
 {
        /* init trace with given values */
        start_trace(mISDNport?mISDNport->portnum:0,
-                   mISDNport?mISDNport->ifport->interface:NULL,
+                   (mISDNport)?((mISDNport->ifport)?mISDNport->ifport->interface:NULL):NULL,
                    port?numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype):NULL,
                    port?numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype):NULL,
-                   port?port->p_dialinginfo.number:NULL,
+                   port?port->p_dialinginfo.id:NULL,
                    direction,
                    CATEGORY_CH,
                    port?port->p_serial:0,
                    direction,
                    CATEGORY_CH,
                    port?port->p_serial:0,
@@ -245,7 +245,7 @@ void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsign
        start_trace(mISDNport?mISDNport->portnum:0,
                    mISDNport?mISDNport->ifport->interface:NULL,
                    port?numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype):NULL,
        start_trace(mISDNport?mISDNport->portnum:0,
                    mISDNport?mISDNport->ifport->interface:NULL,
                    port?numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype):NULL,
-                   port?port->p_dialinginfo.number:NULL,
+                   port?port->p_dialinginfo.id:NULL,
                    direction,
                    CATEGORY_CH,
                    port?port->p_serial:0,
                    direction,
                    CATEGORY_CH,
                    port?port->p_serial:0,
@@ -304,15 +304,15 @@ static int _bchannel_create(struct mISDNport *mISDNport, int i)
        mISDN_pid_t pid;
        int ret;
 
        mISDN_pid_t pid;
        int ret;
 
-       if (mISDNport->b_stid[i])
+       if (!mISDNport->b_stid[i])
        {
        {
-               PERROR("Error: no stack for index");
-               return(-1);
+               PERROR("Error: no stack for index %d\n", i);
+               return(0);
        }
        if (mISDNport->b_addr[i])
        {
        }
        if (mISDNport->b_addr[i])
        {
-               PERROR("Error: stack already created");
-               return(-1);
+               PERROR("Error: stack already created for index %d\n", i);
+               return(0);
        }
 
        /* create new layer */
        }
 
        /* create new layer */
@@ -363,15 +363,15 @@ static int _bchannel_create(struct mISDNport *mISDNport, int i)
                goto stack_error;
        chan_trace_header(mISDNport, mISDNport->b_port[i], "BCHANNEL create stack", DIRECTION_OUT);
        add_trace("channel", NULL, "%d", i+1+(i>=15));
                goto stack_error;
        chan_trace_header(mISDNport, mISDNport->b_port[i], "BCHANNEL create stack", DIRECTION_OUT);
        add_trace("channel", NULL, "%d", i+1+(i>=15));
-       add_trace("stack", "id", "%d", mISDNport->b_stid[i]);
-       add_trace("stack", "address", "%d", mISDNport->b_addr[i]);
+       add_trace("stack", "id", "0x%8x", mISDNport->b_stid[i]);
+       add_trace("stack", "address", "0x%8x", mISDNport->b_addr[i]);
        end_trace();
 
        end_trace();
 
-       return(0);
+       return(1);
 
 failed:
        mISDNport->b_addr[i] = 0;
 
 failed:
        mISDNport->b_addr[i] = 0;
-       return(-1);
+       return(0);
 }
 
 
 }
 
 
@@ -466,8 +466,8 @@ static void _bchannel_destroy(struct mISDNport *mISDNport, int i)
 
        chan_trace_header(mISDNport, mISDNport->b_port[i], "BCHANNEL remove stack", DIRECTION_OUT);
        add_trace("channel", NULL, "%d", i+1+(i>=15));
 
        chan_trace_header(mISDNport, mISDNport->b_port[i], "BCHANNEL remove stack", DIRECTION_OUT);
        add_trace("channel", NULL, "%d", i+1+(i>=15));
-       add_trace("stack", "id", "%d", mISDNport->b_stid[i]);
-       add_trace("stack", "address", "%d", mISDNport->b_addr[i]);
+       add_trace("stack", "id", "0x%8x", mISDNport->b_stid[i]);
+       add_trace("stack", "address", "0x%8x", mISDNport->b_addr[i]);
        end_trace();
        /* remove our stack only if set */
        PDEBUG(DEBUG_BCHANNEL, "free stack (b_addr=0x%x)\n", mISDNport->b_addr[i]);
        end_trace();
        /* remove our stack only if set */
        PDEBUG(DEBUG_BCHANNEL, "free stack (b_addr=0x%x)\n", mISDNport->b_addr[i]);
@@ -533,14 +533,15 @@ All actions taken on these events depend on the current bchannel's state and if
 void bchannel_event(struct mISDNport *mISDNport, int i, int event)
 {
        int state = mISDNport->b_state[i];
 void bchannel_event(struct mISDNport *mISDNport, int i, int event)
 {
        int state = mISDNport->b_state[i];
-       
+
+printf("event=%d state=%d\n", event, state);   
        switch(event)
        {
                case B_EVENT_ACTIVATE:
        switch(event)
        {
                case B_EVENT_ACTIVATE:
-               /* port may not be used by any other bchannel */
-               if (mISDNport->b_port[i])
+               /* port must be linked in order to allow activation */
+               if (!mISDNport->b_port[i])
                {
                {
-                       PERROR("SOFTWARE ERROR: bchannel must not be linked to a Port class\n");
+                       PERROR("SOFTWARE ERROR: bchannel must be linked to a Port class\n");
                        exit(-1);
                }
                switch(state)
                        exit(-1);
                }
                switch(state)
@@ -775,7 +776,7 @@ int PmISDN::handler(void)
 
        inbuffer = (p_m_fromup_buffer_writep - p_m_fromup_buffer_readp) & FROMUP_BUFFER_MASK;
        /* send tone data to isdn device only if we have data */
 
        inbuffer = (p_m_fromup_buffer_writep - p_m_fromup_buffer_readp) & FROMUP_BUFFER_MASK;
        /* send tone data to isdn device only if we have data */
-       if (p_tone_fh>=0 || p_tone_fetched || p_m_crypt_msg_loops || inbuffer)
+       if (p_tone_name[0] || p_m_crypt_msg_loops || inbuffer)
        {
                /* calculate how much to transmit */
                if (!p_last_tv_sec)
        {
                /* calculate how much to transmit */
                if (!p_last_tv_sec)
@@ -793,13 +794,14 @@ int PmISDN::handler(void)
                }
                if (elapsed >= ISDN_TRANSMIT)
                {
                }
                if (elapsed >= ISDN_TRANSMIT)
                {
-                       unsigned char buf[mISDN_HEADER_LEN+ISDN_PRELOAD], *p = buf;
+                       unsigned char buf[mISDN_HEADER_LEN+ISDN_PRELOAD];
                        iframe_t *frm = (iframe_t *)buf;
                        iframe_t *frm = (iframe_t *)buf;
+                       unsigned char *p = buf+mISDN_HEADER_LEN;
 
                        p_last_tv_sec = now_tv.tv_sec;
                        p_last_tv_msec = now_tv.tv_usec/1000;
 
 
                        p_last_tv_sec = now_tv.tv_sec;
                        p_last_tv_msec = now_tv.tv_usec/1000;
 
-                       /* read tones */
+                       /* read tones or fill with silence */
                        length = read_audio(p, elapsed);
 
                        /*
                        length = read_audio(p, elapsed);
 
                        /*
@@ -810,6 +812,7 @@ int PmISDN::handler(void)
                         */
                        if (inbuffer)
                        {
                         */
                        if (inbuffer)
                        {
+                               printf("nix\n");
                                /* inbuffer might be less than we skip due to audio */
                                if (inbuffer <= length)
                                {
                                /* inbuffer might be less than we skip due to audio */
                                if (inbuffer <= length)
                                {
@@ -840,6 +843,7 @@ int PmISDN::handler(void)
                        /* overwrite buffer with crypto stuff */
                        if (p_m_crypt_msg_loops)
                        {
                        /* overwrite buffer with crypto stuff */
                        if (p_m_crypt_msg_loops)
                        {
+                               printf("nix2\n");
                                /* send pending message */
                                int tosend;
 
                                /* send pending message */
                                int tosend;
 
@@ -853,7 +857,7 @@ int PmISDN::handler(void)
                                        length = tosend;
 
                                /* copy message (part) to buffer */
                                        length = tosend;
 
                                /* copy message (part) to buffer */
-                               memcpy(buf, p_m_crypt_msg+p_m_crypt_msg_current, tosend);
+                               memcpy(p, p_m_crypt_msg+p_m_crypt_msg_current, tosend);
                                p_m_crypt_msg_current += tosend;
                                if (p_m_crypt_msg_current == p_m_crypt_msg_len)
                                {
                                p_m_crypt_msg_current += tosend;
                                if (p_m_crypt_msg_current == p_m_crypt_msg_len)
                                {
@@ -865,7 +869,6 @@ int PmISDN::handler(void)
                        frm->addr = p_m_mISDNport->b_addr[p_m_b_index] | FLG_MSG_DOWN;
                        frm->dinfo = 0;
                        frm->len = length;
                        frm->addr = p_m_mISDNport->b_addr[p_m_b_index] | FLG_MSG_DOWN;
                        frm->dinfo = 0;
                        frm->len = length;
-                       memcpy(&frm->data.p, buf, length);
                        mISDN_write(mISDNdevice, frm, mISDN_HEADER_LEN+frm->len, TIMEOUT_1SEC);
 
                        if (p_debug_nothingtosend)
                        mISDN_write(mISDNdevice, frm, mISDN_HEADER_LEN+frm->len, TIMEOUT_1SEC);
 
                        if (p_debug_nothingtosend)
@@ -1009,7 +1012,7 @@ void PmISDN::bchannel_receive(iframe_t *frm)
         * the call is connected OR tones feature is enabled.
         */
        if (p_state!=PORT_STATE_CONNECT
         * the call is connected OR tones feature is enabled.
         */
        if (p_state!=PORT_STATE_CONNECT
-        && !p_m_mISDNport->is_tones)
+        && !p_m_mISDNport->tones)
                return;
 
 #if 0
                return;
 
 #if 0
@@ -1501,6 +1504,10 @@ int mISDN_handler(void)
                mISDNport = mISDNport->next;
        } 
 
                mISDNport = mISDNport->next;
        } 
 
+       /* no device, no read */
+       if (mISDNdevice < 0)
+               return(0);
+
        /* get message from kernel */
        if (!(msg = alloc_msg(MAX_MSG_SIZE)))
                return(1);
        /* get message from kernel */
        if (!(msg = alloc_msg(MAX_MSG_SIZE)))
                return(1);
@@ -1525,6 +1532,7 @@ int mISDN_handler(void)
        /* global prim */
        switch(frm->prim)
        {
        /* global prim */
        switch(frm->prim)
        {
+               case MGR_DELLAYER | CONFIRM:
                case MGR_INITTIMER | CONFIRM:
                case MGR_ADDTIMER | CONFIRM:
                case MGR_DELTIMER | CONFIRM:
                case MGR_INITTIMER | CONFIRM:
                case MGR_ADDTIMER | CONFIRM:
                case MGR_DELTIMER | CONFIRM:
@@ -1776,7 +1784,7 @@ int mISDN_handler(void)
 /*
  * global function to add a new card (port)
  */
 /*
  * global function to add a new card (port)
  */
-struct mISDNport *mISDNport_open(int port, int ptp, int ptmp)
+struct mISDNport *mISDNport_open(int port, int ptp, int ptmp, struct interface *interface)
 {
        int ret;
        unsigned char buff[1025];
 {
        int ret;
        unsigned char buff[1025];
@@ -1911,7 +1919,7 @@ struct mISDNport *mISDNport_open(int port, int ptp, int ptmp)
        /* add mISDNport structure */
        mISDNportp = &mISDNport_first;
        while(*mISDNportp)
        /* add mISDNport structure */
        mISDNportp = &mISDNport_first;
        while(*mISDNportp)
-               mISDNportp = &mISDNport->next;
+               mISDNportp = &((*mISDNportp)->next);
        mISDNport = (struct mISDNport *)calloc(1, sizeof(struct mISDNport));
        if (!mISDNport)
        {
        mISDNport = (struct mISDNport *)calloc(1, sizeof(struct mISDNport));
        if (!mISDNport)
        {
@@ -2075,7 +2083,7 @@ struct mISDNport *mISDNport_open(int port, int ptp, int ptmp)
        PDEBUG(DEBUG_BCHANNEL, "using 'mISDN_dsp.o' module\n");
 
        start_trace(mISDNport->portnum,
        PDEBUG(DEBUG_BCHANNEL, "using 'mISDN_dsp.o' module\n");
 
        start_trace(mISDNport->portnum,
-                   mISDNport->ifport->interface,
+                   interface,
                    NULL,
                    NULL,
                    DIRECTION_NONE,
                    NULL,
                    NULL,
                    DIRECTION_NONE,
@@ -2126,21 +2134,25 @@ void mISDNport_close(struct mISDNport *mISDNport)
                port = port->next;
        }
 
                port = port->next;
        }
 
-       start_trace(mISDNport->portnum,
-                   mISDNport->ifport->interface,
-                   NULL,
-                   NULL,
-                   DIRECTION_NONE,
-                   CATEGORY_CH,
-                   0,
-                   "PORT (close)");
-       end_trace();
+       /* only if we are already part of interface */
+       if (mISDNport->ifport)
+       {
+               start_trace(mISDNport->portnum,
+                           mISDNport->ifport->interface,
+                           NULL,
+                           NULL,
+                           DIRECTION_NONE,
+                           CATEGORY_CH,
+                           0,
+                           "PORT (close)");
+               end_trace();
+       }
 
        /* free bchannels */
        i = 0;
        while(i < mISDNport->b_num)
        {
 
        /* free bchannels */
        i = 0;
        while(i < mISDNport->b_num)
        {
-               if (mISDNport->b_stid[i])
+               if (mISDNport->b_addr[i])
                {
                        _bchannel_destroy(mISDNport, i);
                        PDEBUG(DEBUG_BCHANNEL, "freeing %s port %d bchannel (index %d).\n", (mISDNport->ntmode)?"NT":"TE", mISDNport->portnum, i);
                {
                        _bchannel_destroy(mISDNport, i);
                        PDEBUG(DEBUG_BCHANNEL, "freeing %s port %d bchannel (index %d).\n", (mISDNport->ntmode)?"NT":"TE", mISDNport->portnum, i);
@@ -2171,9 +2183,8 @@ void mISDNport_close(struct mISDNport *mISDNport)
        PDEBUG(DEBUG_BCHANNEL, "freeing d-stack.\n");
        if (mISDNport->d_stid)
        {
        PDEBUG(DEBUG_BCHANNEL, "freeing d-stack.\n");
        if (mISDNport->d_stid)
        {
-//             mISDN_clear_stack(mISDNdevice, mISDNport->d_stid);
-               if (mISDNport->lower_id)
-                       mISDN_write_frame(mISDNdevice, buf, mISDNport->lower_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
+               if (mISDNport->upper_id)
+                       mISDN_write_frame(mISDNdevice, buf, mISDNport->upper_id | FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
        }
 
        /* remove from list */
        }
 
        /* remove from list */
@@ -2183,12 +2194,13 @@ void mISDNport_close(struct mISDNport *mISDNport)
                if (*mISDNportp == mISDNport)
                {
                        *mISDNportp = (*mISDNportp)->next;
                if (*mISDNportp == mISDNport)
                {
                        *mISDNportp = (*mISDNportp)->next;
+                       mISDNportp = NULL;
                        break;
                }
                mISDNportp = &((*mISDNportp)->next);
        }
 
                        break;
                }
                mISDNportp = &((*mISDNportp)->next);
        }
 
-       if (!(*mISDNportp))
+       if (mISDNportp)
        {
                PERROR("software error, mISDNport not in list\n");
                exit(-1);
        {
                PERROR("software error, mISDNport not in list\n");
                exit(-1);
diff --git a/mISDN.h b/mISDN.h
index 1798b88..e8df862 100644 (file)
--- a/mISDN.h
+++ b/mISDN.h
@@ -46,8 +46,8 @@ struct mISDNport {
        int use; /* counts the number of port that uses this port */
        int ntmode; /* is TRUE if port is nt mode */
        int pri; /* is TRUE if port is a primary rate interface */
        int use; /* counts the number of port that uses this port */
        int ntmode; /* is TRUE if port is nt mode */
        int pri; /* is TRUE if port is a primary rate interface */
-       int is_tones; /* TRUE if tones are sent outside connect state */
-       int is_earlyb; /* TRUE if tones are received outside connect state */
+       int tones; /* TRUE if tones are sent outside connect state */
+       int earlyb; /* TRUE if tones are received outside connect state */
        int upper_id; /* id to transfer data down */
        int lower_id; /* id to transfer data up */
        int d_stid;
        int upper_id; /* id to transfer data down */
        int lower_id; /* id to transfer data up */
        int d_stid;
@@ -79,7 +79,7 @@ calls with no bchannel (call waiting, call on hold).
 
 /* mISDN none-object functions */
 void mISDN_port_info(void);
 
 /* mISDN none-object functions */
 void mISDN_port_info(void);
-struct mISDNport *mISDNport_open(int port, int ptp, int ptmp);
+struct mISDNport *mISDNport_open(int port, int ptp, int ptmp, struct interface *interface);
 void mISDNport_close_all(void);
 void mISDNport_close(struct mISDNport *mISDNport);
 void mISDN_port_reorder(void);
 void mISDNport_close_all(void);
 void mISDNport_close(struct mISDNport *mISDNport);
 void mISDN_port_reorder(void);
diff --git a/main.c b/main.c
index c97e69d..770ecb1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -66,7 +66,7 @@ int last_debug = 0;
 int debug_newline = 1;
 int nooutput = 0;
 
 int debug_newline = 1;
 int nooutput = 0;
 
-static void debug(const char *function, int line, char *prefix, char *buffer)
+void debug(const char *function, int line, char *prefix, char *buffer)
 {
        /* if we have a new debug count, we add a mark */
        if (last_debug != debug_count)
 {
        /* if we have a new debug count, we add a mark */
        if (last_debug != debug_count)
@@ -169,7 +169,7 @@ void sighandler(int sigset)
                        schedp.sched_priority = 0;
                        sched_setscheduler(0, SCHED_OTHER, &schedp);
                }
                        schedp.sched_priority = 0;
                        sched_setscheduler(0, SCHED_OTHER, &schedp);
                }
-               fprintf(stderr, "PBX: Signal received: %d\n", sigset);
+               fprintf(stderr, "LCR: Signal received: %d\n", sigset);
                PERROR("Signal received: %d\n", sigset);
        }
 }
                PERROR("Signal received: %d\n", sigset);
        }
 }
@@ -178,18 +178,8 @@ void sighandler(int sigset)
 /*
  * the main
  */
 /*
  * the main
  */
-#ifdef VOIP
-#define ARGC (args.GetCount()+1)
-#define ARGV(a) (args[a-1])
-void PBXMain::Main(void)
-{
-       PArgList &args = GetArguments();
-#else
-#define ARGC (argc)
-#define ARGV(a) (argv[a])
 int main(int argc, char *argv[])
 {
 int main(int argc, char *argv[])
 {
-#endif
        int                     ret = -1;
        int                     lockfd = -1; /* file lock */
        struct message          *message;
        int                     ret = -1;
        int                     lockfd = -1; /* file lock */
        struct message          *message;
@@ -218,13 +208,13 @@ int main(int argc, char *argv[])
        printf("\n** %s  Version %s\n\n", NAME, VERSION_STRING);
 
        /* show options */
        printf("\n** %s  Version %s\n\n", NAME, VERSION_STRING);
 
        /* show options */
-       if (ARGC <= 1)
+       if (argc <= 1)
        {
                usage:
                printf("\n");
        {
                usage:
                printf("\n");
-               printf("Usage: pbx (query | start | fork | rules | route)\n");
+               printf("Usage: lcr (query | start | fork | rules | route)\n");
                printf("query     = Show available isdn ports.\n");
                printf("query     = Show available isdn ports.\n");
-               printf("start     = Run pbx normally, abort with CTRL+C.\n");
+               printf("start     = Run lcr normally, abort with CTRL+C.\n");
                printf("fork      = Do daemon fork and run as background process.\n");
                printf("interface = Get help of available interface syntax.\n");
                printf("rules     = Get help of available routing rule syntax.\n");
                printf("fork      = Do daemon fork and run as background process.\n");
                printf("interface = Get help of available interface syntax.\n");
                printf("rules     = Get help of available routing rule syntax.\n");
@@ -266,7 +256,7 @@ int main(int argc, char *argv[])
        created_mutexe = 1;
 
        /* show interface */
        created_mutexe = 1;
 
        /* show interface */
-       if (!(strcasecmp(ARGV(1),"interface")))
+       if (!(strcasecmp(argv[1],"interface")))
        {
                doc_interface();
                ret = 0;
        {
                doc_interface();
                ret = 0;
@@ -274,18 +264,18 @@ int main(int argc, char *argv[])
        }
 
        /* show rules */
        }
 
        /* show rules */
-       if (!(strcasecmp(ARGV(1),"rules")))
+       if (!(strcasecmp(argv[1],"rules")))
        {
        {
-               if (ARGC <= 2)
+               if (argc <= 2)
                        doc_rules(NULL);
                else
                        doc_rules(NULL);
                else
-                       doc_rules(ARGV(2));
+                       doc_rules(argv[2]);
                ret = 0;
                goto free;
        }
 
        /* query available isdn ports */
                ret = 0;
                goto free;
        }
 
        /* query available isdn ports */
-       if (!(strcasecmp(ARGV(1),"query")))
+       if (!(strcasecmp(argv[1],"query")))
        {
                mISDN_port_info();
                ret = 0;
        {
                mISDN_port_info();
                ret = 0;
@@ -327,7 +317,7 @@ int main(int argc, char *argv[])
 
 #if 0
        /* query available isdn ports */
 
 #if 0
        /* query available isdn ports */
-       if (!(strcasecmp(ARGV(1),"route")))
+       if (!(strcasecmp(argv[1],"route")))
        {
                ruleset_debug(ruleset_first);
                ret = 0;
        {
                ruleset_debug(ruleset_first);
                ret = 0;
@@ -336,7 +326,7 @@ int main(int argc, char *argv[])
 #endif
 
        /* do fork in special cases */
 #endif
 
        /* do fork in special cases */
-       if (!(strcasecmp(ARGV(1),"fork")))
+       if (!(strcasecmp(argv[1],"fork")))
        {
                pid_t pid;
 
        {
                pid_t pid;
 
@@ -365,27 +355,27 @@ int main(int argc, char *argv[])
                }
                if (pid != 0)
                {
                }
                if (pid != 0)
                {
-                       printf("PBX: Starting daemon.\n");
+                       printf("LCR: Starting daemon.\n");
                        exit(0);
                }
                nooutput = 1;
        } else
        /* if not start */
                        exit(0);
                }
                nooutput = 1;
        } else
        /* if not start */
-       if (!!strcasecmp(ARGV(1),"start"))
+       if (!!strcasecmp(argv[1],"start"))
        {
                goto usage;
        }
 
        /* create lock and lock! */
        {
                goto usage;
        }
 
        /* create lock and lock! */
-       if ((lockfd = open("/var/run/pbx.lock", O_CREAT, 0)) < 0)
+       if ((lockfd = open("/var/run/lcr.lock", O_CREAT, 0)) < 0)
        {
        {
-               fprintf(stderr, "Cannot create lock file: /var/run/pbx.lock\n");
+               fprintf(stderr, "Cannot create lock file: /var/run/lcr.lock\n");
                goto free;
        }
        if (flock(lockfd, LOCK_EX|LOCK_NB) < 0)
        {
                if (errno == EWOULDBLOCK)
                goto free;
        }
        if (flock(lockfd, LOCK_EX|LOCK_NB) < 0)
        {
                if (errno == EWOULDBLOCK)
-                       fprintf(stderr, "PBX: Another PBX process is running. Please kill the other one.\n");
+                       fprintf(stderr, "LCR: Another LCR process is running. Please kill the other one.\n");
                else    fprintf(stderr, "Locking process failed: errno=%d\n", errno);
                goto free;
        }
                else    fprintf(stderr, "Locking process failed: errno=%d\n", errno);
                goto free;
        }
@@ -417,7 +407,6 @@ int main(int argc, char *argv[])
        }
        relink_interfaces();
        interface_first = interface_newlist;
        }
        relink_interfaces();
        interface_first = interface_newlist;
-       free_interfaces(interface_newlist);
        interface_newlist = NULL;
        
        /* locking memory paging */
        interface_newlist = NULL;
        
        /* locking memory paging */
@@ -693,7 +682,7 @@ BUDETECT
                        idletime += 4000;
                }
        }
                        idletime += 4000;
                }
        }
-       printf("PBX terminated\n");
+       printf("LCR terminated\n");
        ret=0;
 
        /* free all */
        ret=0;
 
        /* free all */
@@ -811,7 +800,7 @@ free:
 
        /* take me out */
        if (ret)
 
        /* take me out */
        if (ret)
-               printf("PBX: Exit (code %d)\n", ret);
+               printf("LCR: Exit (code %d)\n", ret);
 #ifdef VOIP
        return;
 #else
 #ifdef VOIP
        return;
 #else
diff --git a/main.h b/main.h
index 62241fb..723d51c 100644 (file)
--- a/main.h
+++ b/main.h
@@ -1,6 +1,6 @@
 /*****************************************************************************\
 **                                                                           **
 /*****************************************************************************\
 **                                                                           **
-** PBX4Linux                                                                 **
+** LCR                                                                       **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
@@ -9,11 +9,11 @@
 **                                                                           **
 \*****************************************************************************/ 
 
 **                                                                           **
 \*****************************************************************************/ 
 
-#define NAME           "PBX4Linux"
+#define NAME           "LCR"
 
 #define DEFAULT_ENDPOINT_APP EndpointAppPBX
 
 
 #define DEFAULT_ENDPOINT_APP EndpointAppPBX
 
-#define VERSION_STRING "3.6 (Januar 2006)"
+#define VERSION_STRING "0.1 (August 2007)"
 
 extern int memuse;
 extern int mmemuse;
 
 extern int memuse;
 extern int mmemuse;
@@ -32,6 +32,7 @@ extern int fhuse;
 #define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, 0, fmt, ## arg)
 void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...);
 void _printerror(const char *function, int line, const char *fmt, ...);
 #define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, 0, fmt, ## arg)
 void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...);
 void _printerror(const char *function, int line, const char *fmt, ...);
+void debug(const char *function, int line, char *prefix, char *buffer);
 
 #define DEBUG_CONFIG   0x0001
 #define DEBUG_MSG      0x0002
 
 #define DEBUG_CONFIG   0x0001
 #define DEBUG_MSG      0x0002
index e34e2f3..fc00c02 100644 (file)
--- a/message.h
+++ b/message.h
@@ -141,7 +141,7 @@ struct caller_info {
 
 /* call-info structure DIALING */
 struct dialing_info {
 
 /* call-info structure DIALING */
 struct dialing_info {
-       char number[256];               /* number dialing (so far) */
+       char id[256];                   /* number dialing (so far) */
        char interfaces[128];           /* interfaces for extenal calls */
        int itype;                      /* type of interface */
        int ntype;                      /* type of number */
        char interfaces[128];           /* interfaces for extenal calls */
        int itype;                      /* type of interface */
        int ntype;                      /* type of number */
@@ -151,7 +151,6 @@ struct dialing_info {
 /* call-info structure CONNECT */
 struct connect_info {
        char id[32];                    /* id of caller (user number) */
 /* call-info structure CONNECT */
 struct connect_info {
        char id[32];                    /* id of caller (user number) */
-       char voip[64];                  /* URI of voip (or gateway) */
        char extension[32];             /* internal id */
        char name[16];
        int isdn_port;                  /* internal/external port (if call is isdn) */
        char extension[32];             /* internal id */
        char name[16];
        int isdn_port;                  /* internal/external port (if call is isdn) */
@@ -173,8 +172,7 @@ struct disconnect_info {
 /* call-info structure REDIR */
 struct redir_info {
        char id[32];                    /* id of caller (user number) */
 /* call-info structure REDIR */
 struct redir_info {
        char id[32];                    /* id of caller (user number) */
-       char voip[64];                  /* host of voip (or gateway) */
-       char intern[32];                /* internal id */
+       char extension[32];             /* internal id */
        int isdn_port;                  /* internal/external port (if call is isdn) */
        int itype;                      /* type of interface */
        int ntype;                      /* type of number */
        int isdn_port;                  /* internal/external port (if call is isdn) */
        int itype;                      /* type of interface */
        int ntype;                      /* type of number */
@@ -196,8 +194,7 @@ struct capa_info {
 struct notify_info {
        int notify;                     /* notifications (see INFO_NOTIFY_*) */
        char id[32];                    /* redirection id (user number) */
 struct notify_info {
        int notify;                     /* notifications (see INFO_NOTIFY_*) */
        char id[32];                    /* redirection id (user number) */
-       char voip[64];                  /* host of voip (or gateway) */
-       char intern[32];                /* internal id */
+       char extension[32];             /* internal id */
        int isdn_port;                  /* internal/external port (if call is isdn) */
        int itype;                      /* type of interface */
        int ntype;                      /* type of number */
        int isdn_port;                  /* internal/external port (if call is isdn) */
        int itype;                      /* type of interface */
        int ntype;                      /* type of number */
index 3e5dda8..16813f6 100644 (file)
--- a/options.c
+++ b/options.c
@@ -15,7 +15,7 @@
 #include "main.h"
 
 struct options options = {
 #include "main.h"
 
 struct options options = {
-       "/usr/local/pbx/log",           /* log file */
+       "/usr/local/lcr/log",           /* log file */
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
index 1c0f63e..abd480d 100644 (file)
--- a/port.cpp
+++ b/port.cpp
@@ -825,9 +825,9 @@ void Port::close_record(int beep)
        PDEBUG(DEBUG_PORT, "data still in record buffer: %d (dir %d)\n", (p_record_buffer_writep - p_record_buffer_readp) & RECORD_BUFFER_MASK, p_record_buffer_dir);
 
        memcpy(&callerinfo, &p_callerinfo, sizeof(struct caller_info));
        PDEBUG(DEBUG_PORT, "data still in record buffer: %d (dir %d)\n", (p_record_buffer_writep - p_record_buffer_readp) & RECORD_BUFFER_MASK, p_record_buffer_dir);
 
        memcpy(&callerinfo, &p_callerinfo, sizeof(struct caller_info));
-       apply_callerid_restriction(p_record_anon_ignore, -1, callerinfo.id, &callerinfo.ntype, &callerinfo.present, &callerinfo.screen, NULL/*callerinfo.voip*/, callerinfo.extension, callerinfo.name);
+       apply_callerid_restriction(p_record_anon_ignore, callerinfo.id, &callerinfo.ntype, &callerinfo.present, &callerinfo.screen, callerinfo.extension, callerinfo.name);
 
 
-       SCPY(number, p_dialinginfo.number);
+       SCPY(number, p_dialinginfo.id);
        SCPY(callerid, numberrize_callerinfo(callerinfo.id, callerinfo.ntype));
        if (callerid[0] == '\0')
        {
        SCPY(callerid, numberrize_callerinfo(callerinfo.id, callerinfo.ntype));
        if (callerid[0] == '\0')
        {
diff --git a/route.c b/route.c
index c992686..97c61a6 100644 (file)
--- a/route.c
+++ b/route.c
@@ -2047,7 +2047,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset)
                                goto match_string;
 
                                case MATCH_DIALING:
                                goto match_string;
 
                                case MATCH_DIALING:
-                               string = e_dialinginfo.number;
+                               string = e_dialinginfo.id;
                                goto match_string_prefix;
 
                                case MATCH_ENBLOCK:
                                goto match_string_prefix;
 
                                case MATCH_ENBLOCK:
@@ -2387,7 +2387,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset)
                        /* set timeout in the furture */
                        e_match_timeout = timeout;
                        e_match_to_action = rule->action_first;
                        /* set timeout in the furture */
                        e_match_timeout = timeout;
                        e_match_to_action = rule->action_first;
-                       e_match_to_extdialing = e_dialinginfo.number + dialing_required;
+                       e_match_to_extdialing = e_dialinginfo.id + dialing_required;
                        match = 0; /* matches in the future */
                }
                if (match == 1)
                        match = 0; /* matches in the future */
                }
                if (match == 1)
@@ -2396,7 +2396,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset)
                        action = rule->action_first;
                        e_match_timeout = 0; /* no timeout */
                        e_match_to_action = NULL;
                        action = rule->action_first;
                        e_match_timeout = 0; /* no timeout */
                        e_match_to_action = NULL;
-                       e_extdialing = e_dialinginfo.number + dialing_required;
+                       e_extdialing = e_dialinginfo.id + dialing_required;
                        break;
                }
                if (match == 2)
                        break;
                }
                if (match == 2)
index 7f3651c..81cacd2 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -20,6 +20,13 @@ display message during nothing/play
 Port -> Channel
 Call -> Link
 
 Port -> Channel
 Call -> Link
 
+connect_acknowledge
+
+
+maybe:
+
+delay - per param setzen, lokal als mISDNsignal und remote mittels setup
+
 
 
 old stuff....
 
 
 old stuff....
diff --git a/trace.c b/trace.c
index ebe117d..e5e9a2e 100644 (file)
--- a/trace.c
+++ b/trace.c
@@ -11,9 +11,8 @@
 
 #include "main.h"
 
 
 #include "main.h"
 
-trace auch ein printdebug
 struct trace trace;
 struct trace trace;
-char trace_string[MX_TRACE_ELEMENTS * 100 + 400];
+char trace_string[MAX_TRACE_ELEMENTS * 100 + 400];
 
 static char *spaces[11] = {
        "          ",
 
 static char *spaces[11] = {
        "          ",
@@ -37,10 +36,10 @@ void start_trace(int port, struct interface *interface, char *caller, char *dial
 {
        if (trace.name[0])
                PERROR("trace already started (name=%s)\n", trace.name);
 {
        if (trace.name[0])
                PERROR("trace already started (name=%s)\n", trace.name);
-       memset(trace, 0, sizeof(struct trace));
+       memset(&trace, 0, sizeof(struct trace));
        trace.port = port;
        trace.port = port;
-       if (interface) if (interface[0])
-               SCPY(trace.interface, interface);
+       if (interface)
+               SCPY(trace.interface, interface->name);
        if (caller) if (caller[0])
                SCPY(trace.caller, caller);
        if (dialing) if (dialing[0])
        if (caller) if (caller[0])
                SCPY(trace.caller, caller);
        if (dialing) if (dialing[0])
@@ -60,7 +59,7 @@ void start_trace(int port, struct interface *interface, char *caller, char *dial
  * if subelement is given, element will also contain a subelement
  * if multiple subelements belong to same element, name must be equal for all subelements
  */
  * if subelement is given, element will also contain a subelement
  * if multiple subelements belong to same element, name must be equal for all subelements
  */
-void add_trace(char *name, char *sub, const char *fmt, ...);
+void add_trace(char *name, char *sub, const char *fmt, ...)
 {
        va_list args;
 
 {
        va_list args;
 
@@ -73,7 +72,7 @@ void add_trace(char *name, char *sub, const char *fmt, ...);
        if (!name[0])
        {
                nostring:
        if (!name[0])
        {
                nostring:
-               PERROR("trace with name=%s gets element with no string\n", trace->name);
+               PERROR("trace with name=%s gets element with no string\n", trace.name);
                return;
        }
        
                return;
        }
        
@@ -84,7 +83,7 @@ void add_trace(char *name, char *sub, const char *fmt, ...);
        if (fmt) if (fmt[0])
        {
                va_start(args, fmt);
        if (fmt) if (fmt[0])
        {
                va_start(args, fmt);
-               VUNPRINT(trace.element[trace.element].value, sizeof(trace.element[trace.elements].value)-1, fmt, args);
+               VUNPRINT(trace.element[trace.elements].value, sizeof(trace.element[trace.elements].value)-1, fmt, args);
                va_end(args);
        }
 
                va_end(args);
        }
 
@@ -94,51 +93,33 @@ void add_trace(char *name, char *sub, const char *fmt, ...);
 
 
 /*
 
 
 /*
- * trace ends
- * this function will put the trace to sockets and logfile, if requested
- */
-void end_trace(void);
-{
-       if (!trace.name[0])
-               PERROR("trace not started\n");
-       
-       /* process log file */
-       if (options.log[0])
-       {
-               string = print_trace(1, 0, NULL, NULL, NULL, -1, "AP", CATEGORY_EP);
-               fwrite(string, strlen(string), 1, fp);
-               if (options.deb)
-                       debug(NULL, 0, "trace", string);
-       }
-
-       memset(trace, 0, sizeof(struct trace));
-}
-
-
-/*
  * prints trace to socket or log
  * detail: 1 = brief, 2=short, 3=long
  */
  * prints trace to socket or log
  * detail: 1 = brief, 2=short, 3=long
  */
-static char *print_trace(int detail, int port, char *interface, char *caller, char *dialing, int category);
+static char *print_trace(int detail, int port, char *interface, char *caller, char *dialing, int category)
 {
 {
-       trace_string[0] = '\0';
        char buffer[256];
        char buffer[256];
+       time_t ti = trace.sec;
        struct tm *tm;
        struct tm *tm;
+       struct mISDNport *mISDNport;
+       int i;
+
+       trace_string[0] = '\0'; // always clear string
 
        if (detail < 1)
 
        if (detail < 1)
-               return;
+               return(NULL);
 
        /* filter trace */
        if (port && trace.port)
 
        /* filter trace */
        if (port && trace.port)
-               if (port != trace.port) return;
-       if (interface && interface[0] && trace.interface[0])
-               if (!!strcasecmp(interface, trace.interface)) return;
-       if (caller && caller[0] && trace.caller[0])
-               if (!!strcasecmp(caller, trace.caller)) return;
-       if (dialing && dialing[0] && trace.dialing[0])
-               if (!!strcasecmp(dialing, trace.dialing)) return;
-       if (category && category[0] && trace.category[0])
-               if (!!strcasecmp(category, trace.category)) return;
+               if (port != trace.port) return(NULL);
+       if (interface) if (interface[0] && trace.interface[0])
+               if (!!strcasecmp(interface, trace.interface)) return(NULL);
+       if (caller) if (caller[0] && trace.caller[0])
+               if (!!strcasecmp(caller, trace.caller)) return(NULL);
+       if (dialing) if (dialing[0] && trace.dialing[0])
+               if (!!strcasecmp(dialing, trace.dialing)) return(NULL);
+       if (category && trace.category)
+               if (category != trace.category) return(NULL);
 
        /* head */
        if (detail >= 3)
 
        /* head */
        if (detail >= 3)
@@ -149,12 +130,12 @@ static char *print_trace(int detail, int port, char *interface, char *caller, ch
                        mISDNport = mISDNport_first;
                        while(mISDNport)
                        {
                        mISDNport = mISDNport_first;
                        while(mISDNport)
                        {
-                               if (mISDNport->number == trace.port)
+                               if (mISDNport->portnum == trace.port)
                                        break;
                                mISDNport = mISDNport->next;
                        }
                        if (mISDNport)
                                        break;
                                mISDNport = mISDNport->next;
                        }
                        if (mISDNport)
-                               SPRINT(buffer, "Port: %d (%s %s %s)", port, (mISDNport->pri)?"PRI":"BRI", (mISDNport->ptp)?"PTP":"PTMP", (mISDNport->nt)?"NT":"TE");
+                               SPRINT(buffer, "Port: %d (%s %s %s)", port, (mISDNport->pri)?"PRI":"BRI", (mISDNport->ptp)?"PTP":"PTMP", (mISDNport->ntmode)?"NT":"TE");
                        else
                                SPRINT(buffer, "Port: %d (does not exist}\n", port);
                        SCAT(trace_string, buffer);
                        else
                                SPRINT(buffer, "Port: %d (does not exist}\n", port);
                        SCAT(trace_string, buffer);
@@ -178,8 +159,8 @@ static char *print_trace(int detail, int port, char *interface, char *caller, ch
                        SCAT(trace_string, "  Caller: ---\n");
 
                /* "Time: 25.08.73 05:14:39.282" */
                        SCAT(trace_string, "  Caller: ---\n");
 
                /* "Time: 25.08.73 05:14:39.282" */
-               tm = localtime(&trace.sec);
-               SPRINT(buffer, "Time: %02d.%02d.%02d %02d:%02d:%02d.%03d", tm->tm_mday, tm->tm_mon+1, tm->tm_year%100, tm->tm_hour, tm->tm_min, tm->tm_sec, trace->usec/1000);
+               tm = localtime(&ti);
+               SPRINT(buffer, "Time: %02d.%02d.%02d %02d:%02d:%02d.%03d", tm->tm_mday, tm->tm_mon+1, tm->tm_year%100, tm->tm_hour, tm->tm_min, tm->tm_sec, trace.usec/1000);
                SCAT(trace_string, buffer);
 
                if (trace.direction)
                SCAT(trace_string, buffer);
 
                if (trace.direction)
@@ -232,14 +213,14 @@ static char *print_trace(int detail, int port, char *interface, char *caller, ch
                                buffer[0] = '\0';
                        SCAT(trace_string, buffer);
                        if (trace.element[i].sub[0])
                                buffer[0] = '\0';
                        SCAT(trace_string, buffer);
                        if (trace.element[i].sub[0])
-                               SPRINT(buffer, " %s=", trace.element[i].sub, value);
+                               SPRINT(buffer, " %s=", trace.element[i].sub);
                        else
                        else
-                               SPRINT(buffer, " ", value);
+                               SPRINT(buffer, " ");
                        SCAT(trace_string, buffer);
                        SCAT(trace_string, buffer);
-                       if (strchr(value, ' '))
-                               SPRINT(buffer, "'%s'", value);
+                       if (strchr(trace.element[i].value, ' '))
+                               SPRINT(buffer, "'%s'", trace.element[i].value);
                        else
                        else
-                               SPRINT(buffer, "%s", value);
+                               SPRINT(buffer, "%s", trace.element[i].value);
                        SCAT(trace_string, buffer);
                        i++;
                }
                        SCAT(trace_string, buffer);
                        i++;
                }
@@ -257,14 +238,14 @@ static char *print_trace(int detail, int port, char *interface, char *caller, ch
                                SPRINT(buffer, "           ");
                        SCAT(trace_string, buffer);
                        if (trace.element[i].sub[0])
                                SPRINT(buffer, "           ");
                        SCAT(trace_string, buffer);
                        if (trace.element[i].sub[0])
-                               SPRINT(buffer, " : %s%s = ", trace.element[i].sub, spaces[strlen(trace.element[i].sub)], value);
+                               SPRINT(buffer, " : %s%s = ", trace.element[i].sub, spaces[strlen(trace.element[i].sub)]);
                        else
                        else
-                               SPRINT(buffer, " :              ", value);
+                               SPRINT(buffer, " :              ");
                        SCAT(trace_string, buffer);
                        SCAT(trace_string, buffer);
-                       if (strchr(value, ' '))
-                               SPRINT(buffer, "'%s'\n", value);
+                       if (strchr(trace.element[i].value, ' '))
+                               SPRINT(buffer, "'%s'\n", trace.element[i].value);
                        else
                        else
-                               SPRINT(buffer, "%s\n", value);
+                               SPRINT(buffer, "%s\n", trace.element[i].value);
                        SCAT(trace_string, buffer);
                        i++;
                }
                        SCAT(trace_string, buffer);
                        i++;
                }
@@ -274,12 +255,38 @@ static char *print_trace(int detail, int port, char *interface, char *caller, ch
        /* end */
        if (detail >= 3)
                SCAT(trace_string, "\n");
        /* end */
        if (detail >= 3)
                SCAT(trace_string, "\n");
+       return(trace_string);
+}
+
+
+/*
+ * trace ends
+ * this function will put the trace to sockets and logfile, if requested
+ */
+void end_trace(void)
+{
+       char *string;
+
+       if (!trace.name[0])
+               PERROR("trace not started\n");
+       
+       /* process log file */
+       if (options.deb)
+       {
+               string = print_trace(1, 0, NULL, NULL, NULL, 0);
+               if (string)
+               {
+                       debug(NULL, 0, "trace", string);
+               }
+       }
+printf("%s", print_trace(3, 0, NULL, NULL, NULL, 0));
+#warning trace auch zum socket
+//     fwrite(string, strlen(string), 1, fp);
+
+       memset(&trace, 0, sizeof(struct trace));
 }
 
 
 
 }
 
 
 
-^todo:
-socket
-file open
 
 
 
 
diff --git a/trace.h b/trace.h
index 816f660..54fdefe 100644 (file)
--- a/trace.h
+++ b/trace.h
@@ -10,8 +10,8 @@
 \*****************************************************************************/ 
 
 struct trace_element {
 \*****************************************************************************/ 
 
 struct trace_element {
-       char name[10];
-       char sub[10];
+       char name[11];
+       char sub[11];
        char value[64];
 };
 
        char value[64];
 };
 
@@ -26,7 +26,7 @@ struct trace {
        unsigned long sec, usec;
        
        /* type */
        unsigned long sec, usec;
        
        /* type */
-       char category[4];
+       int category;
        int serial;
        char name[64];
 
        int serial;
        char name[64];
 
index bbd0c50..4585680 100644 (file)
--- a/vbox.cpp
+++ b/vbox.cpp
@@ -227,7 +227,7 @@ int VBoxPort::message_epoint(unsigned long epoint_id, int message_id, union para
                /* get apppbx */
                memcpy(&p_vbox_ext, &((class EndpointAppPBX *)(epoint->ep_app))->e_ext, sizeof(p_vbox_ext));
                /* extract optional announcement file */
                /* get apppbx */
                memcpy(&p_vbox_ext, &((class EndpointAppPBX *)(epoint->ep_app))->e_ext, sizeof(p_vbox_ext));
                /* extract optional announcement file */
-               if ((c = strchr(param->setup.dialinginfo.number, ',')))
+               if ((c = strchr(param->setup.dialinginfo.id, ',')))
                {
                        if (c[1] == '/')
                                SPRINT(filename, c+1);
                {
                        if (c[1] == '/')
                                SPRINT(filename, c+1);
@@ -238,7 +238,7 @@ int VBoxPort::message_epoint(unsigned long epoint_id, int message_id, union para
                {
                        SPRINT(filename, "%s/%s/%s/vbox/announcement", INSTALL_DATA, options.extensions_dir, p_vbox_ext.number);
                }
                {
                        SPRINT(filename, "%s/%s/%s/vbox/announcement", INSTALL_DATA, options.extensions_dir, p_vbox_ext.number);
                }
-               PDEBUG(DEBUG_VBOX, "PORT(%s) vbox port received setup from '%s' to '%s'\n", p_name, param->setup.callerinfo.id, param->setup.dialinginfo.number);
+               PDEBUG(DEBUG_VBOX, "PORT(%s) vbox port received setup from '%s' to '%s'\n", p_name, param->setup.callerinfo.id, param->setup.dialinginfo.id);
                memcpy(&p_callerinfo, &param->setup.callerinfo, sizeof(p_callerinfo));
                memcpy(&p_redirinfo, &param->setup.redirinfo, sizeof(p_redirinfo));
                /* link relation */
                memcpy(&p_callerinfo, &param->setup.callerinfo, sizeof(p_callerinfo));
                memcpy(&p_redirinfo, &param->setup.redirinfo, sizeof(p_redirinfo));
                /* link relation */
@@ -254,7 +254,7 @@ int VBoxPort::message_epoint(unsigned long epoint_id, int message_id, union para
                }
 
                /* copy setup infos to port */
                }
 
                /* copy setup infos to port */
-               SCPY(p_vbox_extension, param->setup.dialinginfo.number);
+               SCPY(p_vbox_extension, param->setup.dialinginfo.id);
 
                /* create connect info */
                SCPY(p_connectinfo.id, p_vbox_extension);
 
                /* create connect info */
                SCPY(p_connectinfo.id, p_vbox_extension);