Allow the reception of 1 byte Call Reference value

git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@63 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Martin Pycko
2003-10-13 22:34:05 +00:00
parent cb01262a54
commit f63cc76a94

18
q931.c
View File

@@ -1251,9 +1251,21 @@ static inline int q931_cr(q931_h *h)
pri_error("Call Reference Length Too long: %d\n", h->crlen);
return -1;
}
for (x=0;x<h->crlen;x++) {
cr <<= 8;
cr |= h->crv[x];
switch (h->crlen) {
case 2:
for (x=0;x<h->crlen;x++) {
cr <<= 8;
cr |= h->crv[x];
}
break;
case 1:
cr = h->crv[0];
if (cr & 0x80) {
cr &= ~0x80;
cr |= 0x8000;
}
default:
pri_error("Call Reference Length not supported: %d\n", h->crlen);
}
return cr;
}