Add iax2 parsing for TNS/TON/PRES

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Mark Spencer 21 years ago
parent 856a9a528c
commit 15c6bf0860

@ -1,3 +1,6 @@
-- Deprecate pbx_wilcalu and app_qcall in favor of pbx_spool
-- Remove old chan_iax and chan_vofr
-- Major Caller*ID Restructuring
Asterisk 1.0.1
-- Added AGI over TCP support
-- Add ability to purge callers from queue if no agents are logged in

@ -473,6 +473,9 @@ struct chan_iax2_pvt {
int authid; /* Authentication rejection ID */
int authfail; /* Reason to report failure */
int initid; /* Initial peer auto-congest ID (based on qualified peers) */
int calling_ton;
int calling_tns;
int calling_pres;
char dproot[AST_MAX_EXTENSION];
char accountcode[20];
int amaflags;
@ -3607,6 +3610,12 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
strncpy(iaxs[callno]->language, ies->language, sizeof(iaxs[callno]->language)-1);
if (ies->username)
strncpy(iaxs[callno]->username, ies->username, sizeof(iaxs[callno]->username)-1);
if (ies->calling_ton > -1)
iaxs[callno]->calling_ton = ies->calling_ton;
if (ies->calling_tns > -1)
iaxs[callno]->calling_tns = ies->calling_tns;
if (ies->calling_pres > -1)
iaxs[callno]->calling_pres = ies->calling_pres;
if (ies->format)
iaxs[callno]->peerformat = ies->format;
if (ies->adsicpe)

@ -3694,8 +3694,10 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, char *cmd, c
snprintf(p->lastmsg, sizeof(p->lastmsg), "Init: %s", cmd);
l = p->owner->cid.cid_num;
n = p->owner->cid.cid_name;
if (p->owner) {
l = p->owner->cid.cid_num;
n = p->owner->cid.cid_name;
}
if (!l || !ast_isphonenumber(l))
l = default_callerid;
/* if user want's his callerid restricted */

@ -3,9 +3,9 @@
*
* Implementation of Inter-Asterisk eXchange
*
* Copyright (C) 2003, Digium
* Copyright (C) 2003-2004, Digium
*
* Mark Spencer <markster@linux-support.net>
* Mark Spencer <markster@digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@ -158,6 +158,9 @@ static struct iax2_ie {
{ IAX_IE_FWBLOCKDESC, "FW BLOCK DESC", dump_int },
{ IAX_IE_FWBLOCKDATA, "FW BLOCK DATA" },
{ IAX_IE_PROVVER, "PROVISIONG VER", dump_int },
{ IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte },
{ IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte },
{ IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short },
};
static struct iax2_ie prov_ies[] = {
@ -481,6 +484,9 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
memset(ies, 0, (int)sizeof(struct iax_ies));
ies->msgcount = -1;
ies->firmwarever = -1;
ies->calling_ton = -1;
ies->calling_tns = -1;
ies->calling_pres = -1;
while(datalen >= 2) {
ie = data[0];
len = data[1];
@ -658,6 +664,29 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
ies->provver = ntohl(*((unsigned int *)(data + 2)));
}
break;
case IAX_IE_CALLINGPRES:
if (len == 1)
ies->calling_pres = data[2];
else {
snprintf(tmp, (int)sizeof(tmp), "Expected single byte callingpres, but was %d long\n", len);
errorf(tmp);
}
break;
case IAX_IE_CALLINGTON:
if (len == 1)
ies->calling_ton = data[2];
else {
snprintf(tmp, (int)sizeof(tmp), "Expected single byte callington, but was %d long\n", len);
errorf(tmp);
}
break;
case IAX_IE_CALLINGTNS:
if (len != (int)sizeof(unsigned short)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
ies->calling_tns = ntohs(*((unsigned short *)(data + 2)));
break;
default:
snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
outputf(tmp);

@ -5,7 +5,7 @@
*
* Copyright (C) 2003, Digium
*
* Mark Spencer <markster@linux-support.net>
* Mark Spencer <markster@digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@ -19,6 +19,9 @@ struct iax_ies {
char *calling_number;
char *calling_ani;
char *calling_name;
int calling_ton;
int calling_tns;
int calling_pres;
char *called_context;
char *username;
char *password;

@ -112,6 +112,9 @@
#define IAX_IE_FWBLOCKDESC 35 /* Firmware block description -- u32 */
#define IAX_IE_FWBLOCKDATA 36 /* Firmware block of data -- raw */
#define IAX_IE_PROVVER 37 /* Provisioning Version (u32) */
#define IAX_IE_CALLINGPRES 38 /* Calling presentation (u8) */
#define IAX_IE_CALLINGTON 39 /* Calling type of number (u8) */
#define IAX_IE_CALLINGTNS 40 /* Calling transit network select (u16) */
#define IAX_AUTH_PLAINTEXT (1 << 0)
#define IAX_AUTH_MD5 (1 << 1)

@ -13,13 +13,17 @@
PBX_LIBS=pbx_config.so pbx_wilcalu.so pbx_spool.so # pbx_gtkconsole.so pbx_kdeconsole.so
PBX_LIBS=pbx_config.so pbx_spool.so # pbx_gtkconsole.so pbx_kdeconsole.so
# Add GTK console if appropriate
PBX_LIBS+=$(shell gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so")
# Add KDE Console if appropriate
#PBX_LIBS+=$(shell [ "$$QTDIR" != "" ] && echo "pbx_kdeconsole.so")
#
# Obsolete modules
#
#PBX_LIBS+=pbx_wilcalu.so
GTK_FLAGS=`gtk-config --cflags gthread`
GTK_LIBS=`gtk-config --libs gthread`
@ -63,6 +67,7 @@ endif
install: all
for x in $(PBX_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
if ! [ -f pbx_wilcalu.so ]; then rm -f $(DESTDIR)$(MODULES_DIR)/pbx_wilcalu.so; fi
depend: .depend

Loading…
Cancel
Save