New routing macht rule to filter second caller id.
Fixed extensions directory path.
"make clean" now cleans ".po" files.
Fixed unititialized variable bugs and compiler warnings.
modified: Makefile.am
modified: Makefile.in
modified: action.cpp
modified: apppbx.cpp
modified: callerid.c
modified: chan_lcr.c
modified: dss1.cpp
modified: dss1.h
modified: extension.c
modified: gentones.c
modified: ie.cpp
modified: mISDN.cpp
modified: message.h
modified: port.cpp
modified: route.c
modified: route.h
modified: socket_server.c
modified: tones.c
modified: trace.c
-DCONFIG_DATA="\"$(CONFIGdir)\"" \
-DSHARE_DATA="\"$(SHAREdir)\"" \
-DLOG_DIR="\"$(LOGdir)\"" \
- -DEXTENSION_DATA="\"$(EXTENSIONdir)/extensions\""
+ -DEXTENSION_DATA="\"$(EXTENSIONdir)\""
INCLUDES = $(all_includes) -I/usr/include/mISDNuser $(INSTALLATION_DEFINES)
echo "NOTE: special efi tones already exists, not overwritten." ; else \
cp -a tones_efi $(SHAREdir) ; fi
+clean-generic:
+ rm -f *.po
+
# test rule, nothing important
#echo:
# -echo $(all_libraries) >&2
-DCONFIG_DATA="\"$(CONFIGdir)\"" \
-DSHARE_DATA="\"$(SHAREdir)\"" \
-DLOG_DIR="\"$(LOGdir)\"" \
- -DEXTENSION_DATA="\"$(EXTENSIONdir)/extensions\""
+ -DEXTENSION_DATA="\"$(EXTENSIONdir)\""
INCLUDES = $(all_includes) -I/usr/include/mISDNuser $(INSTALLATION_DEFINES)
@ENABLE_ASTERISK_CHANNEL_DRIVER_TRUE@chan_lcr_so_SOURCES =
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
-clean-generic:
-
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@if test -a $(SHAREdir)/tones_efi ; then \
echo "NOTE: special efi tones already exists, not overwritten." ; else \
cp -a tones_efi $(SHAREdir) ; fi
+
+clean-generic:
+ rm -f *.po
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
struct port_list *portlist = ea_endpoint->ep_portlist;
struct lcr_msg *message;
double value1, value2, v, sign1;
- int komma1, komma2, k, state, mode, first;
+ int komma1, komma2, k, state, mode = 0, first;
char *p;
portlist = ea_endpoint->ep_portlist;
}
/* display if callerid is anonymouse but available due anon-ignore */
- if (e_ext.display_fake && screen==INFO_SCREEN_USER && present!=INFO_PRESENT_NULL)
+ if (e_ext.display_fake && screen==INFO_SCREEN_USER && ntype!=INFO_NTYPE_NOTPRESENT)
{
if (!display[0])
{
//terminal SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
/* handle restricted caller ids */
apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+ apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id2, &message->param.setup.callerinfo.ntype2, &message->param.setup.callerinfo.present2, &message->param.setup.callerinfo.screen2, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
apply_callerid_restriction(&e_ext, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
/* display callerid if desired for extension */
SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
SCAT(message->param.setup.callerinfo.id, numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype, options.national, options.international));
message->param.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
}
+ if (message->param.setup.callerinfo.id2[0] && e_ext.clip_prefix[0])
+ {
+ SCPY(message->param.setup.callerinfo.id2, e_ext.clip_prefix);
+ SCAT(message->param.setup.callerinfo.id2, numberrize_callerinfo(e_callerinfo.id2,e_callerinfo.ntype2, options.national, options.international));
+ message->param.setup.callerinfo.ntype2 = INFO_NTYPE_UNKNOWN;
+ }
/* use internal caller id */
if (e_callerinfo.extension[0] && (message->param.setup.callerinfo.present!=INFO_PRESENT_RESTRICTED || e_ext.anon_ignore))
{
SCPY(message->param.setup.callerinfo.id, e_callerinfo.extension);
message->param.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
+ message->param.setup.callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT;
}
message_put(message);
logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
if (e_ext.anon_ignore && e_callerinfo.id[0])
{
e_callerinfo.present = INFO_PRESENT_ALLOWED;
+ e_callerinfo.present2 = INFO_PRESENT_ALLOWED;
}
}
SCPY(message->param.setup.callerinfo.extension, e_ext.number);
message->param.setup.callerinfo.ntype = e_ext.callerid_type;
message->param.setup.callerinfo.present = e_ext.callerid_present;
+ message->param.setup.callerinfo.ntype = INFO_NTYPE_NOTPRESENT;
}
memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
//terminal SCPY(message->param.setup.from_terminal, e_ext.number);
//terminal SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
/* handle restricted caller ids */
apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+ apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id2, &message->param.setup.callerinfo.ntype2, &message->param.setup.callerinfo.present2, &message->param.setup.callerinfo.screen2, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
apply_callerid_restriction(&e_ext, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
/* display callerid if desired for extension */
SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
//terminal SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
/* handle restricted caller ids */
apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+ apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id2, &message->param.setup.callerinfo.ntype2, &message->param.setup.callerinfo.present2, &message->param.setup.callerinfo.screen2, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
apply_callerid_restriction(&e_ext, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
/* display callerid if desired for extension */
SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
}
interface = interface->next;
}
- if (interface)
+ if (interface) {
do_screen(0, e_callerinfo.id, sizeof(e_callerinfo.id), &e_callerinfo.ntype, &e_callerinfo.present, interface);
+ do_screen(0, e_callerinfo.id2, sizeof(e_callerinfo.id2), &e_callerinfo.ntype2, &e_callerinfo.present2, interface);
+ }
/* process extension */
if (e_callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
else e_callerinfo.present = e_ext.callerid_present;
e_callerinfo.ntype = e_ext.callerid_type;
}
+ e_callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT;
/* extension is written */
if (writeext)
/* other calls with no caller id (or not available for the extension) and force colp */
if ((e_connectinfo.id[0]=='\0' || (e_connectinfo.present==INFO_PRESENT_RESTRICTED && !e_ext.anon_ignore))&& e_ext.colp==COLP_FORCE)
{
- e_connectinfo.present = INFO_PRESENT_NOTAVAIL;
+ e_connectinfo.ntype = INFO_NTYPE_NOTPRESENT;
if (portlist->port_type==PORT_TYPE_DSS1_TE_OUT || portlist->port_type==PORT_TYPE_DSS1_NT_OUT) /* external extension answered */
{
port = find_port_id(portlist->port_id);
e_callerinfo.present = e_ext.callerid_present;
e_callerinfo.ntype = e_ext.callerid_type;
}
+ e_callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT;
e_connectedmode = 1; /* dtmf-hangup & disconnect prevention */
e_dtmf = 1;
void EndpointAppPBX::ea_message_port(unsigned int port_id, int message_type, union parameter *param)
{
struct port_list *portlist;
- struct lcr_msg *message;
portlist = ea_endpoint->ep_portlist;
while(portlist)
default:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: %d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: %d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message_type);
}
/* Note: this endpoint may be destroyed, so we MUST return */
break;
default:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: #%d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: #%d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message_type);
}
}
default:
add_trace("caller id", "present", "not available");
}
+ if (param->setup.callerinfo.ntype2)
+ {
+ add_trace("caller id2", "number", "%s", numberrize_callerinfo(param->setup.callerinfo.id2, param->setup.callerinfo.ntype2, options.national, options.international));
+ switch(param->setup.callerinfo.present)
+ {
+ case INFO_PRESENT_RESTRICTED:
+ add_trace("caller id2", "present", "restricted");
+ break;
+ case INFO_PRESENT_ALLOWED:
+ add_trace("caller id2", "present", "allowed");
+ break;
+ default:
+ add_trace("caller id2", "present", "not available");
+ }
+ }
if (param->setup.redirinfo.id[0])
{
add_trace("redir'ing", "number", "%s", numberrize_callerinfo(param->setup.redirinfo.id, param->setup.redirinfo.ntype, options.national, options.international));
switch(ntype)
{
+ case INFO_NTYPE_NOTPRESENT:
+ return("");
+
case INFO_NTYPE_INTERNATIONAL:
strcpy(result, international);
strncat(result, string, sizeof(result)-strlen(result)-1);
}
switch(ast->cid.cid_pres & AST_PRES_RESTRICTION)
{
- case AST_PRES_ALLOWED:
- newparam.setup.callerinfo.present = INFO_PRESENT_ALLOWED;
- break;
case AST_PRES_RESTRICTED:
newparam.setup.callerinfo.present = INFO_PRESENT_RESTRICTED;
break;
case AST_PRES_UNAVAILABLE:
newparam.setup.callerinfo.present = INFO_PRESENT_NOTAVAIL;
break;
+ case AST_PRES_ALLOWED:
default:
- newparam.setup.callerinfo.present = INFO_PRESENT_NULL;
+ newparam.setup.callerinfo.present = INFO_PRESENT_ALLOWED;
}
switch(ast->cid.cid_ton)
{
void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
{
int calling_type, calling_plan, calling_present, calling_screen;
+ int calling_type2, calling_plan2, calling_present2, calling_screen2;
int called_type, called_plan;
int redir_type, redir_plan, redir_present, redir_screen, redir_reason;
int hlc_coding, hlc_presentation, hlc_interpretation, hlc_hlc, hlc_exthlc;
end_trace();
l1l2l3_trace_header(p_m_mISDNport, this, L3_SETUP_IND, DIRECTION_IN);
- dec_ie_calling_pn(l3m, &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id));
+ dec_ie_calling_pn(l3m, &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id), &calling_type2, &calling_plan2, &calling_present2, &calling_screen2, (unsigned char *)p_callerinfo.id2, sizeof(p_callerinfo.id2));
dec_ie_called_pn(l3m, &called_type, &called_plan, (unsigned char *)p_dialinginfo.id, sizeof(p_dialinginfo.id));
dec_ie_keypad(l3m, (unsigned char *)keypad, sizeof(keypad));
/* te-mode: CNIP (calling name identification presentation) */
switch (calling_type)
{
case -1:
+ p_callerinfo.ntype = INFO_NTYPE_NOTPRESENT;
+ break;
+ case 0x0:
p_callerinfo.ntype = INFO_NTYPE_UNKNOWN;
- p_callerinfo.present = INFO_PRESENT_NOTAVAIL;
- p_callerinfo.screen = INFO_SCREEN_NETWORK;
break;
case 0x1:
p_callerinfo.ntype = INFO_NTYPE_INTERNATIONAL;
p_callerinfo.isdn_port = p_m_portnum;
SCPY(p_callerinfo.interface, p_m_mISDNport->ifport->interface->name);
+ /* caller info2 */
+ switch (calling_present2)
+ {
+ case 1:
+ p_callerinfo.present2 = INFO_PRESENT_RESTRICTED;
+ break;
+ case 2:
+ p_callerinfo.present2 = INFO_PRESENT_NOTAVAIL;
+ break;
+ default:
+ p_callerinfo.present2 = INFO_PRESENT_ALLOWED;
+ break;
+ }
+ switch (calling_screen2)
+ {
+ case 0:
+ p_callerinfo.screen2 = INFO_SCREEN_USER;
+ break;
+ default:
+ p_callerinfo.screen2 = INFO_SCREEN_NETWORK;
+ break;
+ }
+ switch (calling_type2)
+ {
+ case -1:
+ p_callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT;
+ break;
+ case 0x0:
+ p_callerinfo.ntype2 = INFO_NTYPE_UNKNOWN;
+ break;
+ case 0x1:
+ p_callerinfo.ntype2 = INFO_NTYPE_INTERNATIONAL;
+ break;
+ case 0x2:
+ p_callerinfo.ntype2 = INFO_NTYPE_NATIONAL;
+ break;
+ case 0x4:
+ p_callerinfo.ntype2 = INFO_NTYPE_SUBSCRIBER;
+ break;
+ default:
+ p_callerinfo.ntype2 = INFO_NTYPE_UNKNOWN;
+ break;
+ }
+
/* dialing information */
SCAT(p_dialinginfo.id, (char *)keypad);
switch (called_type)
switch (redir_type)
{
case -1:
+ p_redirinfo.ntype = INFO_NTYPE_NOTPRESENT;
+ break;
+ case 0x0:
p_redirinfo.ntype = INFO_NTYPE_UNKNOWN;
- p_redirinfo.present = INFO_PRESENT_NULL; /* not redirecting */
- p_redirinfo.reason = INFO_REDIR_UNKNOWN;
break;
case 0x1:
p_redirinfo.ntype = INFO_NTYPE_INTERNATIONAL;
switch (type)
{
case -1:
- message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN;
- message->param.notifyinfo.present = INFO_PRESENT_NULL;
+ message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT;
break;
case 1:
message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL;
switch (type)
{
case -1:
- message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN;
- message->param.notifyinfo.present = INFO_PRESENT_NULL;
+ message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT;
break;
case 1:
message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL;
}
switch (type)
{
- case 0x0:
- p_connectinfo.present = INFO_PRESENT_NULL; /* no COLP info */
- p_connectinfo.ntype = INFO_NTYPE_UNKNOWN;
+ case -1:
+ p_connectinfo.ntype = INFO_NTYPE_NOTPRESENT;
break;
case 0x1:
p_connectinfo.ntype = INFO_NTYPE_INTERNATIONAL;
switch (type)
{
case -1:
- message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN;
- message->param.notifyinfo.present = INFO_PRESENT_NULL;
+ message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT;
break;
case 1:
message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL;
l3_msg *l3m;
int ret;
int plan, type, screen, present, reason;
+ int plan2, type2, screen2, present2;
int capability, mode, rate, coding, user, presentation, interpretation, hlc, exthlc;
int channel, exclusive;
struct epoint_list *epointlist;
// SCPY(&p_m_tones_dir, param->setup.ext.tones_dir);
/* screen outgoing caller id */
do_screen(1, p_callerinfo.id, sizeof(p_callerinfo.id), &p_callerinfo.ntype, &p_callerinfo.present, p_m_mISDNport->ifport->interface);
+ do_screen(1, p_callerinfo.id2, sizeof(p_callerinfo.id2), &p_callerinfo.ntype2, &p_callerinfo.present2, p_m_mISDNport->ifport->interface);
/* only display at connect state: this case happens if endpoint is in connected mode */
if (p_state==PORT_STATE_CONNECT)
plan = 1;
switch (p_callerinfo.ntype)
{
+ case INFO_NTYPE_UNKNOWN:
+ type = 0x0;
+ break;
case INFO_NTYPE_INTERNATIONAL:
type = 0x1;
break;
case INFO_NTYPE_SUBSCRIBER:
type = 0x4;
break;
- default: /* INFO_NTYPE_UNKNOWN */
- type = 0x0;
+ default: /* INFO_NTYPE_NOTPRESENT */
+ type = -1;
break;
}
switch (p_callerinfo.screen)
}
switch (p_callerinfo.present)
{
+ case INFO_PRESENT_ALLOWED:
+ present = 0;
+ break;
case INFO_PRESENT_RESTRICTED:
present = 1;
break;
- case INFO_PRESENT_NOTAVAIL:
+ default: /* INFO_PRESENT_NOTAVAIL */
present = 2;
break;
- default: /* INFO_PRESENT_ALLOWED */
- present = 0;
+ }
+ /* caller information 2 */
+ plan2 = 1;
+ switch (p_callerinfo.ntype2)
+ {
+ case INFO_NTYPE_UNKNOWN:
+ type2 = 0x0;
+ break;
+ case INFO_NTYPE_INTERNATIONAL:
+ type2 = 0x1;
+ break;
+ case INFO_NTYPE_NATIONAL:
+ type2 = 0x2;
+ break;
+ case INFO_NTYPE_SUBSCRIBER:
+ type2 = 0x4;
+ break;
+ default: /* INFO_NTYPE_NOTPRESENT */
+ type2 = -1;
+ break;
+ }
+ switch (p_callerinfo.screen2)
+ {
+ case INFO_SCREEN_USER:
+ screen2 = 0;
+ break;
+ default: /* INFO_SCREEN_NETWORK */
+ screen2 = 3;
+ break;
+ }
+ switch (p_callerinfo.present2)
+ {
+ case INFO_PRESENT_ALLOWED:
+ present2 = 0;
+ break;
+ case INFO_PRESENT_RESTRICTED:
+ present2 = 1;
+ break;
+ default: /* INFO_PRESENT_NOTAVAIL */
+ present2 = 2;
break;
}
if (type >= 0)
- enc_ie_calling_pn(l3m, type, plan, present, screen, (unsigned char *)p_callerinfo.id);
+ enc_ie_calling_pn(l3m, type, plan, present, screen, (unsigned char *)p_callerinfo.id, type2, plan2, present2, screen2, (unsigned char *)p_callerinfo.id2);
/* dialing information */
if (p_dialinginfo.id[0]) /* only if we have something to dial */
{
plan = 1;
switch (p_redirinfo.ntype)
{
+ case INFO_NTYPE_UNKNOWN:
+ type = 0x0;
+ break;
case INFO_NTYPE_INTERNATIONAL:
type = 0x1;
break;
case INFO_NTYPE_SUBSCRIBER:
type = 0x4;
break;
- default: /* INFO_NTYPE_UNKNOWN */
- type = 0x0;
+ default: /* INFO_NTYPE_NOTPRESENT */
+ type = -1;
break;
}
switch (p_redirinfo.screen)
}
switch (p_redirinfo.present)
{
- case INFO_PRESENT_NULL: /* no redir at all */
- present = -1;
- screen = -1;
- reason = -1;
- plan = -1;
- type = -1;
+ case INFO_PRESENT_ALLOWED:
+ present = 0;
break;
case INFO_PRESENT_RESTRICTED:
present = 1;
break;
- case INFO_PRESENT_NOTAVAIL:
+ default: /* INFO_PRESENT_NOTAVAIL */
present = 2;
break;
- default: /* INFO_PRESENT_ALLOWED */
- present = 0;
- break;
}
/* sending redirecting number only in ntmode */
if (type >= 0 && (p_m_d_ntmode || p_m_d_tespecial))
{
l3_msg *l3m;
int notify;
- int plan, type = -1, present;
+ int plan = 0, type = -1, present = 0;
if (param->notifyinfo.notify>INFO_NOTIFY_NONE)
notify = param->notifyinfo.notify & 0x7f;
plan = 1;
switch (param->notifyinfo.ntype)
{
+ case INFO_NTYPE_UNKNOWN:
+ type = 0;
+ break;
case INFO_NTYPE_INTERNATIONAL:
type = 1;
break;
type = 4;
break;
default: /* INFO_NTYPE_UNKNOWN */
- type = 0;
+ type = -1;
break;
}
switch (param->notifyinfo.present)
{
- case INFO_PRESENT_NULL: /* no redir at all */
- present = -1;
- plan = -1;
- type = -1;
+ case INFO_PRESENT_ALLOWED:
+ present = 0;
break;
case INFO_PRESENT_RESTRICTED:
present = 1;
break;
- case INFO_PRESENT_NOTAVAIL:
+ default: /* INFO_PRESENT_NOTAVAIL */
present = 2;
break;
- default: /* INFO_PRESENT_ALLOWED */
- present = 0;
- break;
}
}
plan = 1;
switch (p_connectinfo.ntype)
{
+ case INFO_NTYPE_UNKNOWN:
+ type = 0x0;
+ break;
case INFO_NTYPE_INTERNATIONAL:
type = 0x1;
break;
case INFO_NTYPE_SUBSCRIBER:
type = 0x4;
break;
- default: /* INFO_NTYPE_UNKNOWN */
- type = 0x0;
+ default: /* INFO_NTYPE_NOTPRESENT */
+ type = -1;
break;
}
switch (param->connectinfo.screen)
}
switch (p_connectinfo.present)
{
- case INFO_PRESENT_NULL: /* no colp at all */
- present = -1;
- screen = -1;
- plan = -1;
- type = -1;
+ case INFO_PRESENT_ALLOWED:
+ present = 0;
break;
case INFO_PRESENT_RESTRICTED:
present = 1;
break;
- case INFO_PRESENT_NOTAVAIL:
+ default: /* INFO_PRESENT_NOTAVAIL */
present = 2;
break;
- default: /* INFO_PRESENT_ALLOWED */
- present = 0;
- break;
}
if (type >= 0)
enc_ie_connected_pn(l3m, type, plan, present, screen, (unsigned char *)p_connectinfo.id);
*/
int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union parameter *param)
{
- struct lcr_msg *message;
-
if (PmISDN::message_epoint(epoint_id, message_id, param))
return(1);
break;
default:
- PERROR("Pdss1(%s) isdn port with (caller id %s) received a wrong message: %d\n", p_name, p_callerinfo.id, message);
+ PERROR("Pdss1(%s) isdn port with (caller id %s) received a wrong message: %d\n", p_name, p_callerinfo.id, message_id);
}
return(1);
void dec_ie_call_id(struct l3_msg *l3m, unsigned char *callid, int *callid_len);
void enc_ie_called_pn(struct l3_msg *l3m, int type, int plan, unsigned char *number);
void dec_ie_called_pn(struct l3_msg *l3m, int *type, int *plan, unsigned char *number, int number_len);
- void enc_ie_calling_pn(struct l3_msg *l3m, int type, int plan, int present, int screen, unsigned char *number);
- void dec_ie_calling_pn(struct l3_msg *l3m, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len);
+ void enc_ie_calling_pn(struct l3_msg *l3m, int type, int plan, int present, int screen, unsigned char *number, int type2, int plan2, int present2, int screen2, unsigned char *number2);
+ void dec_ie_calling_pn(struct l3_msg *l3m, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len, int *type2, int *plan2, int *present2, int *screen2, unsigned char *number2, int number_len2);
void enc_ie_connected_pn(struct l3_msg *l3m, int type, int plan, int present, int screen, unsigned char *number);
void dec_ie_connected_pn(struct l3_msg *l3m, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len);
void enc_ie_cause(struct l3_msg *l3m, int location, int cause);
if (!(fp = fopen(filename, "r")))
{
+ printf("the given extension doesn't exist: \"%s\"\n", filename);
PDEBUG(DEBUG_CONFIG, "the given extension doesn't exist: \"%s\"\n", filename);
return(0);
}
unsigned char encode_isdn(short sample, char law)
{
- int best=-1;
+ int best = -1;
int i,diff;
- int best_diff;
+ int best_diff = 9999;
i=0;
while(i<256)
struct fmt *fmt;
FILE *wfp;
signed int i;
- int channels, bytes;
+ int channels = 0, bytes = 0;
short sample, sample2;
signed int size, chunk;
int gotfmt = 0, gotdata = 0;
/* IE_CALLING_PN */
-void Pdss1::enc_ie_calling_pn(struct l3_msg *l3m, int type, int plan, int present, int screen, unsigned char *number)
+void Pdss1::enc_ie_calling_pn(struct l3_msg *l3m, int type, int plan, int present, int screen, unsigned char *number, int type2, int plan2, int present2, int screen2, unsigned char *number2)
{
unsigned char p[256];
int l;
UNCPY((char *)p+3, (char *)number, strlen((char *)number));
}
add_layer3_ie(l3m, p[0], p[1], p+2);
+
+ /* second calling party number */
+ if (type2 < 0)
+ return;
+
+ if (type2>7)
+ {
+ PERROR("type2(%d) is out of range.\n", type2);
+ return;
+ }
+ if (plan2<0 || plan2>15)
+ {
+ PERROR("plan2(%d) is out of range.\n", plan2);
+ return;
+ }
+ if (present2>3)
+ {
+ PERROR("present2(%d) is out of range.\n", present2);
+ return;
+ }
+ if (present2 >= 0) if (screen2<0 || screen2>3)
+ {
+ PERROR("screen2(%d) is out of range.\n", screen2);
+ return;
+ }
+
+ add_trace("call_pn 2", "type", "%d", type2);
+ add_trace("call_pn 2", "plan", "%d", plan2);
+ add_trace("call_pn 2", "present", "%d", present2);
+ add_trace("call_pn 2", "screen", "%d", screen2);
+ add_trace("call_pn 2", "number", "%s", number2);
+
+ l = 1;
+ if (number2) if (number2[0])
+ l += strlen((char *)number2);
+ if (present2 >= 0)
+ l += 1;
+ p[0] = IE_CALLING_PN;
+ p[1] = l;
+ if (present2 >= 0)
+ {
+ p[2] = 0x00 + (type2<<4) + plan2;
+ p[3] = 0x80 + (present2<<5) + screen2;
+ if (number2) if (number2[0])
+ UNCPY((char *)p+4, (char *)number2, strlen((char *)number2));
+ } else
+ {
+ p[2] = 0x80 + (type2<<4) + plan2;
+ if (number2) if (number2[0])
+ UNCPY((char *)p+3, (char *)number2, strlen((char *)number2));
+ }
+ add_layer3_ie(l3m, p[0], p[1], p+2);
}
-void Pdss1::dec_ie_calling_pn(struct l3_msg *l3m, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len)
+void Pdss1::dec_ie_calling_pn(struct l3_msg *l3m, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len, int *type2, int *plan2, int *present2, int *screen2, unsigned char *number2, int number_len2)
{
*type = -1;
*plan = -1;
*present = -1;
*screen = -1;
*number = '\0';
+ *type2 = -1;
+ *plan2 = -1;
+ *present2 = -1;
+ *screen2 = -1;
+ *number2 = '\0';
+ unsigned int numextra = sizeof(l3m->extra) / sizeof(struct m_extie);
+ unsigned int i;
unsigned char *p = l3m->calling_nr;
if (!p)
add_trace("calling_pn", "present", "%d", *present);
add_trace("calling_pn", "screen", "%d", *screen);
add_trace("calling_pn", "number", "%s", number);
+
+ /* second calling party number */
+ p = NULL;
+ i = 0;
+ while(i < numextra)
+ {
+ if (!l3m->extra[i].val)
+ break;
+ if (l3m->extra[i].ie == IE_CALLING_PN)
+ {
+ p = l3m->extra[i].val;
+ break;
+ }
+ i++;
+ }
+ if (!p)
+ return;
+ if (p[0] < 1)
+ {
+ add_trace("calling_pn2", "error", "IE too short (len=%d)", p[0]);
+ return;
+ }
+
+ *type2 = (p[1]&0x70) >> 4;
+ *plan2 = p[1] & 0xf;
+ if (!(p[1] & 0x80))
+ {
+ if (p[0] < 2)
+ {
+ add_trace("calling_pn2", "error", "IE too short (len=%d)", p[0]);
+ return;
+ }
+ *present2 = (p[2]&0x60) >> 5;
+ *screen2 = p[2] & 0x3;
+ strnncpy(number2, p+3, p[0]-2, number_len2);
+ } else
+ {
+ strnncpy(number2, p+2, p[0]-1, number_len2);
+ }
+
+ add_trace("call_pn 2", "type", "%d", *type2);
+ add_trace("call_pn 2", "plan", "%d", *plan2);
+ add_trace("call_pn 2", "present", "%d", *present2);
+ add_trace("call_pn 2", "screen", "%d", *screen2);
+ add_trace("call_pn 2", "number", "%s", number2);
}
*/
void PmISDN::set_tone(const char *dir, const char *tone)
{
- int id;
+ int id = TONE_OFF;
if (!tone)
tone = "";
};
enum { /* number types */
- INFO_NTYPE_UNKNOWN = 0,
+ INFO_NTYPE_NOTPRESENT = 0,
+ INFO_NTYPE_UNKNOWN,
INFO_NTYPE_SUBSCRIBER,
INFO_NTYPE_NATIONAL,
INFO_NTYPE_INTERNATIONAL
};
enum { /* number presentation */
- INFO_PRESENT_NULL = 0,
+ INFO_PRESENT_NOTAVAIL,
INFO_PRESENT_ALLOWED,
- INFO_PRESENT_RESTRICTED,
- INFO_PRESENT_NOTAVAIL
+ INFO_PRESENT_RESTRICTED
};
enum { /* number presentation */
int present; /* presentation */
int screen; /* who provided the number */
char display[84]; /* display information */
+ char id2[32]; /* second callerid */
+ int ntype2; /* second type of number */
+ int present2; /* second presentation */
+ int screen2; /* second who provided the number */
};
/* call-info structure DIALING */
*/
void Port::set_vbox_play(const char *name, int offset)
{
- signed int size;
struct lcr_msg *message;
/* use ser_box_tone() */
{
message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_TONE_COUNTER);
message->param.counter.current = offset;
- message->param.counter.max = size;
+ message->param.counter.max = p_tone_size;
message_put(message);
}
}
*/
int Port::read_audio(unsigned char *buffer, int length)
{
- int l,len;
+ int l = 0,len;
int nodata=0; /* to detect 0-length files and avoid endless reopen */
char filename[128];
int tone_left_before; /* temp variable to determine the change in p_tone_left */
void Port::close_record(int beep, int mute)
{
static signed short beep_mono[256];
- unsigned int size, wsize;
+ unsigned int size = 0, wsize = 0;
struct fmt fmt;
char filename[512], indexname[512];
FILE *fp;
"interface=<interface>[,...]", "Matches if call is received from given interface(s). NOT PORTS!"},
{ "callerid", MATCH_CALLERID, COND_TYPE_STRING,
"callerid=<digits>[-<digits>][,...]", "Matches if caller ID matches or begins with the given (range(s) of) prefixes(s)."},
+ { "callerid2", MATCH_CALLERID2,COND_TYPE_STRING,
+ "callerid2=<digits>[-<digits>][,...]", "Matches the second caller ID (network provided)."},
{ "extension", MATCH_EXTENSION,COND_TYPE_STRING,
"extension=<digits>[-<digits>][,...]", "Matches if caller calls from given (range(s) of) extension(s)."},
{ "dialing", MATCH_DIALING, COND_TYPE_STRING,
struct route_action *action = NULL;
unsigned long comp_len;
int j, jj;
- char callerid[64], redirid[64];
+ char callerid[64], callerid2[64], redirid[64];
int integer;
char *string;
FILE *tfp;
e_match_to_action = NULL;
SCPY(callerid, numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype, options.national, options.international));
+ SCPY(callerid2, numberrize_callerinfo(e_callerinfo.id2, e_callerinfo.ntype2, options.national, options.international));
SCPY(redirid, numberrize_callerinfo(e_redirinfo.id, e_redirinfo.ntype, options.national, options.international));
PDEBUG(DEBUG_ROUTE, "parsing ruleset '%s'\n", ruleset->name);
string = callerid;
goto match_string_prefix;
+ case MATCH_CALLERID2:
+ string = callerid2;
+ goto match_string_prefix;
+
case MATCH_EXTENSION:
string = e_ext.name;
goto match_string;
break;
case MATCH_REDIRECTED:
- if (e_redirinfo.present != INFO_PRESENT_NULL)
+ if (e_redirinfo.ntype != INFO_NTYPE_NOTPRESENT)
istrue = 1;
break;
case MATCH_DIRECT:
- if (e_redirinfo.present == INFO_PRESENT_NULL)
+ if (e_redirinfo.ntype == INFO_NTYPE_NOTPRESENT)
istrue = 1;
break;
MATCH_PORT,
MATCH_INTERFACE,
MATCH_CALLERID,
+ MATCH_CALLERID2,
MATCH_EXTENSION,
MATCH_DIALING,
MATCH_ENBLOCK,
response->am[0].u.x.portnum = portnum;
/* search for port */
+ ifport = NULL;
interface = interface_first;
while(interface)
{
char linkname[256];
unsigned char buffer[256];
struct fmt *fmt;
- int channels, bytes;
+ int channels = 0, bytes = 0;
unsigned int size, chunk;
int gotfmt = 0;
struct stat _stat;
*/
int read_tone(int fh, unsigned char *buffer, int codec, int len, signed int size, signed int *left, int speed)
{
- int l;
+ int l = 0;
int offset;
signed short buffer16[len], *buf16 = buffer16;
signed short buffer32[len<<1], *buf32 = buffer32;
struct trace trace;
char trace_string[MAX_TRACE_ELEMENTS * 100 + 400];
-static const char *spaces[11] = {
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "",
-};
+static const char *spaces = " ";
/*
* initializes a new trace
i = 0;
while(i < trace.elements)
{
- SPRINT(buffer, " %s%s", trace.element[i].name, spaces[strlen(trace.element[i].name)]);
+ SPRINT(buffer, " %s%s", trace.element[i].name, &spaces[strlen(trace.element[i].name)]);
if (i) if (!strcmp(trace.element[i].name, trace.element[i-1].name))
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)]);
+ SPRINT(buffer, " : %s%s = ", trace.element[i].sub, &spaces[strlen(trace.element[i].sub)]);
else
SPRINT(buffer, " : ");
SCAT(trace_string, buffer);