diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-02 01:56:08 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-02 01:56:08 +0000 |
commit | f01f076e6db68ee2c429ab2eaf96bc6ea22409a4 (patch) | |
tree | 3fa35d5b85db5c4cfded6403f497e02659d963f8 /channels | |
parent | 8c00c4e642dacfd3e0d2a19c9f6d1d336ab117ac (diff) |
Add iax2 parsing for TNS/TON/PRES
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3877 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_iax2.c | 9 | ||||
-rwxr-xr-x | channels/chan_sip.c | 6 | ||||
-rwxr-xr-x | channels/iax2-parser.c | 33 | ||||
-rwxr-xr-x | channels/iax2-parser.h | 5 | ||||
-rwxr-xr-x | channels/iax2.h | 3 |
5 files changed, 51 insertions, 5 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index d644dfd6c..eb7aa8f3e 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -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) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index c2b2f5450..a9a2c3fb3 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -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 */ diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c index c54af66a5..81d92a175 100755 --- a/channels/iax2-parser.c +++ b/channels/iax2-parser.c @@ -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); diff --git a/channels/iax2-parser.h b/channels/iax2-parser.h index f17fb1b39..70bbdc781 100755 --- a/channels/iax2-parser.h +++ b/channels/iax2-parser.h @@ -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; diff --git a/channels/iax2.h b/channels/iax2.h index afc4424e8..2b1e4276e 100755 --- a/channels/iax2.h +++ b/channels/iax2.h @@ -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) |