compiles, runs, but not enough debugged
This commit is contained in:
Super User 2007-07-07 17:13:20 +02:00
parent e9daaa4ef7
commit 3754d8f73f
33 changed files with 958 additions and 849 deletions

View File

@ -1,6 +1,6 @@
#*****************************************************************************\
#* **
#* PBX4Linux **
#* Linux Call Router **
#* **
#*---------------------------------------------------------------------------**
#* 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
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
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
@ -30,9 +30,9 @@ CURSES = -lncurses
CC = g++
LD = $(CC)
WIZZARD = ./wizzard
PBX = ./pbx
PBXADMIN = ./pbxadmin
PBXWATCH = ./pbxwatch
LCR = ./lcr
LCRADMIN = ./lcradmin
LCRWATCH = ./lcrwatch
GEN = ./gentones
GENW = ./genwave
GENRC = ./genrc
@ -55,14 +55,14 @@ endif
# @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'
@echo "All PBX binaries done"
@echo "All LCR binaries done"
@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
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
#
@ -173,7 +158,7 @@ trace.o: trace.c *.h Makefile
# $(CC) $(LIBDIR) $(CFLAGS) -lm wizzard.c \
# -o $(WIZZARD)
$(PBX): main.o \
$(LCR): main.o \
options.o \
interface.o \
extension.o \
@ -226,15 +211,15 @@ $(PBX): main.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 \
-o $(PBXADMIN)
-o $(LCRADMIN)
$(PBXWATCH): watch.c *.h Makefile
$(LCRWATCH): watch.c *.h Makefile
$(CC) $(LIBDIR) $(CFLAGS) -lm watch.c \
-o $(PBXWATCH)
-o $(LCRWATCH)
$(GEN): gentones.c *.h Makefile
$(CC) $(LIBDIR) $(CFLAGS) -lm gentones.c \
@ -257,10 +242,10 @@ $(GENEXT): options.o extension.o genext.o
# @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)
@ -291,7 +276,7 @@ install:
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
@ -299,22 +284,22 @@ 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
-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
-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
-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

View 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));
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)))
SCPY(dialinginfo.number, rparam->string_value);
SCPY(dialinginfo.id, rparam->string_value);
/* 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 */
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);
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, "");
@ -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);
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, "");
@ -203,7 +203,7 @@ void EndpointAppPBX::action_dialing_internal(void)
/* 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));
@ -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));
dialinginfo.itype = INFO_ITYPE_EXTERN;
dialinginfo.itype = INFO_ITYPE_ISDN;
dialinginfo.sending_complete = 0;
SCPY(dialinginfo.number, e_extdialing);
SCPY(dialinginfo.id, e_extdialing);
/* 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)))
SCPY(dialinginfo.number, rparam->string_value);
SCPY(dialinginfo.id, rparam->string_value);
dialinginfo.sending_complete = 1;
/* process number type */
@ -338,7 +338,7 @@ void EndpointAppPBX::action_dialing_external(void)
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)
{
@ -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 */
@ -369,7 +369,7 @@ void EndpointAppPBX::action_dialing_external(void)
/* 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();
@ -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;
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])
{
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_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));
@ -557,7 +557,7 @@ void EndpointAppPBX::action_init_partyline(void)
/* 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;
@ -581,34 +581,34 @@ void EndpointAppPBX::action_hangup_call(void)
/* 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)))
{
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;
}
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;
}
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 */
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--;
}
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);
@ -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 */
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 */
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);
@ -700,8 +700,8 @@ void EndpointAppPBX::action_dialing_login(void)
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;
@ -716,8 +716,8 @@ void EndpointAppPBX::action_dialing_login(void)
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");
}
}
@ -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();
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;
@ -1117,7 +1117,7 @@ void EndpointAppPBX::action_dialing_powerdial(void)
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;
@ -1281,8 +1281,8 @@ void EndpointAppPBX::action_dialing_abbrev(void)
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();
}
@ -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);
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;
@ -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 */
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 */
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);
@ -1680,19 +1679,19 @@ void EndpointAppPBX::action_dialing_calculator(void)
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 */
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 */
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 */
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;
}
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')
@ -1787,7 +1786,7 @@ void EndpointAppPBX::_action_goto_menu(int mode)
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;
}
@ -1795,27 +1794,27 @@ void EndpointAppPBX::_action_goto_menu(int 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)
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);
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)))
{
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();
@ -1915,7 +1914,7 @@ void EndpointAppPBX::action_dialing_help(void)
/* 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;
@ -1925,15 +1924,15 @@ void EndpointAppPBX::action_dialing_help(void)
return;
/* scroll menu */
if (strchr(e_dialinginfo.number,'*'))
if (strchr(e_dialinginfo.id,'*'))
{
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_dialinginfo.number[0] = '\0';
e_dialinginfo.id[0] = '\0';
}
/* 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 (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
//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;
@ -2011,7 +2010,7 @@ void EndpointAppPBX::action_hangup_execute(void)
{
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 */
@ -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[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);
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);
}
@ -2106,7 +2104,7 @@ void EndpointAppPBX::action_init_pick(void)
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);
}
@ -2165,8 +2163,8 @@ void EndpointAppPBX::action_dialing_password(void)
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");
}
@ -2259,13 +2257,13 @@ void EndpointAppPBX::process_dialing(void)
#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 */
{
e_dialinginfo.number[0] = '\0';
e_dialinginfo.id[0] = '\0';
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 */
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 */
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 */
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 */
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;
}
@ -2331,7 +2329,7 @@ void EndpointAppPBX::process_dialing(void)
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;
@ -2343,7 +2341,7 @@ void EndpointAppPBX::process_dialing(void)
{
//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);
@ -2456,7 +2454,7 @@ void EndpointAppPBX::process_dialing(void)
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);
@ -2492,20 +2490,20 @@ void EndpointAppPBX::process_hangup(int cause, int location)
} 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:
SPRINT(dialingtext, "chan:%s", e_dialinginfo.number);
SPRINT(dialingtext, "chan:%s", e_dialinginfo.id);
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:
SPRINT(dialingtext, "vbox:%s", e_dialinginfo.number);
SPRINT(dialingtext, "vbox:%s", e_dialinginfo.id);
break;
default:
SPRINT(dialingtext, "%s", e_dialinginfo.number);
SPRINT(dialingtext, "%s", e_dialinginfo.id);
}
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");
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 */
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_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]))

View 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");
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;

11
admin.h
View File

@ -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 */
@ -22,6 +22,8 @@ enum { /* messages */
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,
@ -44,6 +46,8 @@ enum { /* messages */
struct admin_response_cmd {
int error; /* error code 0 = ok*/
char message[256]; /* info / response text */
int block;
int portnum;
};
struct admin_response_state {
@ -57,12 +61,13 @@ struct admin_response_state {
};
struct admin_response_interface {
int portnum;
char interface_name[32];
int portnum;
int block;
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) */

View File

@ -1,6 +1,6 @@
/*****************************************************************************\
** **
** PBX4Linux **
** LCR **
** **
**---------------------------------------------------------------------------**
** Copyright: Andreas Eversberg **
@ -26,9 +26,9 @@
#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;
@ -42,6 +42,9 @@ enum {
MODE_ROUTE,
MODE_DIAL,
MODE_RELEASE,
MODE_UNBLOCK,
MODE_BLOCK,
MODE_UNLOAD,
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;
// printf("sizeof=%d\n",sizeof(msg));
// printf("sizeof=%d\n",sizeof(msg));fflush(stdout);
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.");
}
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;
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;
@ -633,112 +640,125 @@ readagain:
/* 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)
{
/* show all channels */
if (show_interfaces>2 || m[i].u.i.busy[j]>0)
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)
{
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)
{
/* show all channels */
if (show_interfaces>2 || m[i].u.i.busy[j]>0)
{
color(cyan);
/* show left side / right side */
if ((k & 1) && (COLS > 70))
{
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)
{
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++;
}
}
if (line+2 >= LINES)
{
if (ltee)
{
color(cyan);
move(line>1?line:1, 1);
LLCORNER
}
goto end;
}
}
j++;
}
if (ltee)
{
color(cyan);
/* show left side / right side */
if ((k & 1) && (COLS > 70))
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 && m[i].u.i.block==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");
color(green);
SPRINT(buffer,"all %d channels free", m[i].u.i.channels);
} 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)
{
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++;
}
}
if (line+2 >= LINES)
{
if (ltee)
{
color(cyan);
move(line>1?line:1, 1);
LLCORNER
}
goto end;
SPRINT(buffer,"all %d channels blocked", m[i].u.i.channels);
}
addstr(buffer);
}
j++;
if (line+2 >= LINES) goto end;
}
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)
{
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);
}
if (line+2 >= LINES) goto end;
}
i++;
anything = 1;
@ -905,7 +925,7 @@ readagain:
{
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);
@ -933,7 +953,7 @@ readagain:
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)
{
@ -946,7 +966,7 @@ readagain:
/* displeay head line */
move(1, 0);
color(blue);
hline(/*ACS_HLINE*/'q', COLS);
hline(ACS_HLINE, COLS);
if (offset)
{
move(1, 1);
@ -957,7 +977,7 @@ readagain:
/* 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]);
@ -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;
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))
@ -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;
case MODE_UNBLOCK:
case MODE_BLOCK:
case MODE_UNLOAD:
if (msg.message != ADMIN_RESPONSE_CMD_BLOCK)
return("Response not valid.");
break;
}
/* 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("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");
@ -1330,6 +1374,24 @@ int main(int argc, char *argv[])
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)
@ -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);
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);
}
@ -1378,6 +1440,9 @@ int main(int argc, char *argv[])
break;
case MODE_RELEASE:
case MODE_UNBLOCK:
case MODE_BLOCK:
case MODE_UNLOAD:
ret = admin_cmd(sock, mode, NULL, argv[2]);
break;

View File

@ -164,7 +164,7 @@ int admin_interface(struct admin_queue **responsep)
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;
@ -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,
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,
apppbx->e_serial,
apppbx->ea_endpoint->ep_serial,
"KICK (reload routing)");
}
@ -277,7 +277,7 @@ int admin_route(struct admin_queue **responsep)
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;
@ -307,7 +307,7 @@ int admin_dial(struct admin_queue **responsep, char *message)
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;
@ -339,6 +339,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
*/
@ -353,7 +454,7 @@ int admin_release(struct admin_queue **responsep, char *message)
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;
@ -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;
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;
@ -461,7 +562,7 @@ void admin_call_response(int adminid, int message, char *connected, int cause, i
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;
@ -488,6 +589,8 @@ int admin_state(struct admin_queue **responsep)
class EndpointAppPBX *apppbx;
class Call *call;
class Pdss1 *pdss1;
struct interface *interface;
struct interface_port *ifport;
struct mISDNport *mISDNport;
int i;
int num;
@ -499,7 +602,7 @@ int admin_state(struct admin_queue **responsep)
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;
@ -510,12 +613,17 @@ int admin_state(struct admin_queue **responsep)
/* log file */
SCPY(response->am[0].u.s.logfile, options.log);
/* interface count */
mISDNport = mISDNport_first;
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 */
@ -537,8 +645,8 @@ int admin_state(struct admin_queue **responsep)
}
response->am[0].u.s.epoints = i;
/* port count */
port = port_first;
i = 0;
port = port_first;
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);
if (num == 0)
return(0);
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;
mISDNport = mISDNport_first;
interface = interface_first;
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 */
@ -673,7 +796,7 @@ int admin_state(struct admin_queue **responsep)
/* 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);
@ -918,16 +1041,25 @@ int admin_handle(void)
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);
response_error:
*adminp = admin->next;
free_connection(admin);
admin = *adminp;
continue;
goto response_error;
}
#endif
#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);
goto response_error;
response_error:
*adminp = admin->next;
free_connection(admin);
admin = *adminp;
continue;
}
break;

File diff suppressed because it is too large Load Diff

View File

@ -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);
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 */
@ -352,7 +353,7 @@ class EndpointAppPBX : public EndpointApp
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);

2
call.h
View File

@ -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
*

View 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");
c_type = CALL_TYPE_CHAN;
c_type = CALL_TYPE_ASTERISK;
c_epoint_id = epoint->ep_serial;
PDEBUG(DEBUG_CALL, "Constructor(new call)");

View 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->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;
@ -597,6 +597,9 @@ int callpbx_countrelations(unsigned long call_id)
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;
@ -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;
class Endpoint *epoint;
char *number;
char *number, *numbers;
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:
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
@ -938,8 +941,8 @@ int CallPBX::out_setup(unsigned long epoint_id, int message_type, union paramete
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;
@ -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)
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);
}
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

View File

@ -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) */
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 */

View File

@ -1832,8 +1832,8 @@ void EndpointAppPBX::encrypt_shared(void)
}
/* 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])

View File

@ -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)
{
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;
@ -469,7 +469,7 @@ int Pdss1::hunt_bchannel(int channel, int exclusive)
}
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);
}
@ -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));
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) */
@ -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 */
SCAT(p_dialinginfo.number, (char *)keypad);
SCAT(p_dialinginfo.id, (char *)keypad);
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);
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();
SCAT(p_dialinginfo.number, (char *)keypad);
SCAT(p_dialinginfo.id, (char *)keypad);
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);
/* 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);
@ -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 */
if (p_m_mISDNport->is_earlyb)
if (p_m_mISDNport->earlyb)
{
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);
}
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);
@ -2032,7 +2036,7 @@ int Pdss1::handler(void)
{
int ret;
if ((ret = Port::handler()))
if ((ret = PmISDN::handler()))
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;
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);
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);
}
@ -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 (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)
@ -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_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);
@ -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_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);
@ -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_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);
@ -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 */
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 */
@ -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_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);
@ -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_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);

View 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)
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");

View 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_voip; /* display h323 caller ids */
int display_fake; /* display fake caller ids */
int display_anon; /* display anonymouse caller ids */
int display_menu; /* display menu */

View File

@ -1,6 +1,6 @@
/*****************************************************************************\
** **
** PBX4Linux **
** LCR **
** **
**---------------------------------------------------------------------------**
** Copyright: Andreas Eversberg **

12
genrc.c
View File

@ -1,6 +1,6 @@
/*****************************************************************************\
** **
** PBX4Linux **
** LCR **
** **
**---------------------------------------------------------------------------**
** 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");
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 */
{
@ -67,7 +67,7 @@ int main(void)
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;
@ -152,16 +152,16 @@ int main(void)
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"))
SCPY(input, "/usr/local/pbx/modules");
SCPY(input, "/usr/local/lcr/modules");
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")))
{

2
ie.cpp
View File

@ -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", "number", "%s", *number);
add_trace("calling_pn", "number", "%s", number);
}

View 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 *searchport;
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)
{
searchport = searchif->ifport;
ifport = searchif->ifport;
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 */
interface = interface_first;
interface = interface_newlist;
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;
continue;
break;
}
ifparam++;
}
if (ifparam->name)
continue;
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)
{
/* 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;
}
}
/*
* 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
*/
@ -1151,4 +1166,3 @@ void doc_interface(void)
}
}

View 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);
void load_port(struct interface_port *ifport);
void doc_interface(void);

View File

@ -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,
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?port->p_dialinginfo.number:NULL,
port?port->p_dialinginfo.id:NULL,
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,
port?port->p_dialinginfo.number:NULL,
port?port->p_dialinginfo.id:NULL,
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;
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])
{
PERROR("Error: stack already created");
return(-1);
PERROR("Error: stack already created for index %d\n", i);
return(0);
}
/* 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));
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();
return(0);
return(1);
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));
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]);
@ -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];
printf("event=%d state=%d\n", event, state);
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)
@ -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 */
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)
@ -793,13 +794,14 @@ int PmISDN::handler(void)
}
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;
unsigned char *p = buf+mISDN_HEADER_LEN;
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);
/*
@ -810,6 +812,7 @@ int PmISDN::handler(void)
*/
if (inbuffer)
{
printf("nix\n");
/* 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)
{
printf("nix2\n");
/* send pending message */
int tosend;
@ -853,7 +857,7 @@ int PmISDN::handler(void)
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)
{
@ -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;
memcpy(&frm->data.p, buf, length);
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
&& !p_m_mISDNport->is_tones)
&& !p_m_mISDNport->tones)
return;
#if 0
@ -1501,6 +1504,10 @@ int mISDN_handler(void)
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);
@ -1525,6 +1532,7 @@ int mISDN_handler(void)
/* global prim */
switch(frm->prim)
{
case MGR_DELLAYER | 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)
*/
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];
@ -1911,7 +1919,7 @@ struct mISDNport *mISDNport_open(int port, int ptp, int ptmp)
/* add mISDNport structure */
mISDNportp = &mISDNport_first;
while(*mISDNportp)
mISDNportp = &mISDNport->next;
mISDNportp = &((*mISDNportp)->next);
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,
mISDNport->ifport->interface,
interface,
NULL,
NULL,
DIRECTION_NONE,
@ -2126,21 +2134,25 @@ void mISDNport_close(struct mISDNport *mISDNport)
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)
{
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);
@ -2171,9 +2183,8 @@ void mISDNport_close(struct mISDNport *mISDNport)
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 */
@ -2183,12 +2194,13 @@ void mISDNport_close(struct mISDNport *mISDNport)
if (*mISDNportp == mISDNport)
{
*mISDNportp = (*mISDNportp)->next;
mISDNportp = NULL;
break;
}
mISDNportp = &((*mISDNportp)->next);
}
if (!(*mISDNportp))
if (mISDNportp)
{
PERROR("software error, mISDNport not in list\n");
exit(-1);

View File

@ -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 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;
@ -79,7 +79,7 @@ calls with no bchannel (call waiting, call on hold).
/* 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);

49
main.c
View File

@ -66,7 +66,7 @@ int last_debug = 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)
@ -169,7 +169,7 @@ void sighandler(int sigset)
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);
}
}
@ -178,18 +178,8 @@ void sighandler(int sigset)
/*
* 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[])
{
#endif
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 */
if (ARGC <= 1)
if (argc <= 1)
{
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("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");
@ -266,7 +256,7 @@ int main(int argc, char *argv[])
created_mutexe = 1;
/* show interface */
if (!(strcasecmp(ARGV(1),"interface")))
if (!(strcasecmp(argv[1],"interface")))
{
doc_interface();
ret = 0;
@ -274,18 +264,18 @@ int main(int argc, char *argv[])
}
/* show rules */
if (!(strcasecmp(ARGV(1),"rules")))
if (!(strcasecmp(argv[1],"rules")))
{
if (ARGC <= 2)
if (argc <= 2)
doc_rules(NULL);
else
doc_rules(ARGV(2));
doc_rules(argv[2]);
ret = 0;
goto free;
}
/* query available isdn ports */
if (!(strcasecmp(ARGV(1),"query")))
if (!(strcasecmp(argv[1],"query")))
{
mISDN_port_info();
ret = 0;
@ -327,7 +317,7 @@ int main(int argc, char *argv[])
#if 0
/* query available isdn ports */
if (!(strcasecmp(ARGV(1),"route")))
if (!(strcasecmp(argv[1],"route")))
{
ruleset_debug(ruleset_first);
ret = 0;
@ -336,7 +326,7 @@ int main(int argc, char *argv[])
#endif
/* do fork in special cases */
if (!(strcasecmp(ARGV(1),"fork")))
if (!(strcasecmp(argv[1],"fork")))
{
pid_t pid;
@ -365,27 +355,27 @@ int main(int argc, char *argv[])
}
if (pid != 0)
{
printf("PBX: Starting daemon.\n");
printf("LCR: Starting daemon.\n");
exit(0);
}
nooutput = 1;
} else
/* if not start */
if (!!strcasecmp(ARGV(1),"start"))
if (!!strcasecmp(argv[1],"start"))
{
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)
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;
}
@ -417,7 +407,6 @@ int main(int argc, char *argv[])
}
relink_interfaces();
interface_first = interface_newlist;
free_interfaces(interface_newlist);
interface_newlist = NULL;
/* locking memory paging */
@ -693,7 +682,7 @@ BUDETECT
idletime += 4000;
}
}
printf("PBX terminated\n");
printf("LCR terminated\n");
ret=0;
/* free all */
@ -811,7 +800,7 @@ free:
/* take me out */
if (ret)
printf("PBX: Exit (code %d)\n", ret);
printf("LCR: Exit (code %d)\n", ret);
#ifdef VOIP
return;
#else

7
main.h
View File

@ -1,6 +1,6 @@
/*****************************************************************************\
** **
** PBX4Linux **
** LCR **
** **
**---------------------------------------------------------------------------**
** Copyright: Andreas Eversberg **
@ -9,11 +9,11 @@
** **
\*****************************************************************************/
#define NAME "PBX4Linux"
#define NAME "LCR"
#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;
@ -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, ...);
void debug(const char *function, int line, char *prefix, char *buffer);
#define DEBUG_CONFIG 0x0001
#define DEBUG_MSG 0x0002

View File

@ -141,7 +141,7 @@ struct caller_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 */
@ -151,7 +151,6 @@ struct dialing_info {
/* 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) */
@ -173,8 +172,7 @@ struct disconnect_info {
/* 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 */
@ -196,8 +194,7 @@ struct capa_info {
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 */

View File

@ -15,7 +15,7 @@
#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,

View File

@ -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));
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')
{

View File

@ -2047,7 +2047,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset)
goto match_string;
case MATCH_DIALING:
string = e_dialinginfo.number;
string = e_dialinginfo.id;
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;
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)
@ -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;
e_extdialing = e_dialinginfo.number + dialing_required;
e_extdialing = e_dialinginfo.id + dialing_required;
break;
}
if (match == 2)

View File

@ -20,6 +20,13 @@ display message during nothing/play
Port -> Channel
Call -> Link
connect_acknowledge
maybe:
delay - per param setzen, lokal als mISDNsignal und remote mittels setup
old stuff....

125
trace.c
View File

@ -11,9 +11,8 @@
#include "main.h"
trace auch ein printdebug
struct trace trace;
char trace_string[MX_TRACE_ELEMENTS * 100 + 400];
char trace_string[MAX_TRACE_ELEMENTS * 100 + 400];
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);
memset(trace, 0, sizeof(struct trace));
memset(&trace, 0, sizeof(struct trace));
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])
@ -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
*/
void add_trace(char *name, char *sub, const char *fmt, ...);
void add_trace(char *name, char *sub, const char *fmt, ...)
{
va_list args;
@ -73,7 +72,7 @@ void add_trace(char *name, char *sub, const char *fmt, ...);
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;
}
@ -84,7 +83,7 @@ void add_trace(char *name, char *sub, const char *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);
}
@ -93,52 +92,34 @@ 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
*/
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];
time_t ti = trace.sec;
struct tm *tm;
struct mISDNport *mISDNport;
int i;
trace_string[0] = '\0'; // always clear string
if (detail < 1)
return;
return(NULL);
/* 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)
@ -149,12 +130,12 @@ static char *print_trace(int detail, int port, char *interface, char *caller, ch
mISDNport = mISDNport_first;
while(mISDNport)
{
if (mISDNport->number == trace.port)
if (mISDNport->portnum == trace.port)
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);
@ -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" */
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)
@ -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])
SPRINT(buffer, " %s=", trace.element[i].sub, value);
SPRINT(buffer, " %s=", trace.element[i].sub);
else
SPRINT(buffer, " ", value);
SPRINT(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
SPRINT(buffer, "%s", value);
SPRINT(buffer, "%s", trace.element[i].value);
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, " : %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
SPRINT(buffer, " : ", value);
SPRINT(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
SPRINT(buffer, "%s\n", value);
SPRINT(buffer, "%s\n", trace.element[i].value);
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");
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

View File

@ -10,8 +10,8 @@
\*****************************************************************************/
struct trace_element {
char name[10];
char sub[10];
char name[11];
char sub[11];
char value[64];
};
@ -26,7 +26,7 @@ struct trace {
unsigned long sec, usec;
/* type */
char category[4];
int category;
int serial;
char name[64];

View File

@ -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 */
if ((c = strchr(param->setup.dialinginfo.number, ',')))
if ((c = strchr(param->setup.dialinginfo.id, ',')))
{
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);
}
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 */
@ -254,7 +254,7 @@ int VBoxPort::message_epoint(unsigned long epoint_id, int message_id, union para
}
/* 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);