aboutsummaryrefslogtreecommitdiffstats
path: root/channels/iax2-parser.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-10-02 01:56:08 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-10-02 01:56:08 +0000
commitf01f076e6db68ee2c429ab2eaf96bc6ea22409a4 (patch)
tree3fa35d5b85db5c4cfded6403f497e02659d963f8 /channels/iax2-parser.c
parent8c00c4e642dacfd3e0d2a19c9f6d1d336ab117ac (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/iax2-parser.c')
-rwxr-xr-xchannels/iax2-parser.c33
1 files changed, 31 insertions, 2 deletions
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);