diff --git a/pridump.c b/pridump.c index c9076f0..c1c46d3 100755 --- a/pridump.c +++ b/pridump.c @@ -72,7 +72,7 @@ static void dump_packet(char *buf, int len, int txrx) q921_h *h = (q921_h *)buf; q921_dump(h, len, 1, txrx); if (!((h->h.data[0] & Q921_FRAMETYPE_MASK) & 0x3)) { - q931_dump((q931_h *)(h->i.data), len - 4, txrx); + q931_dump((q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx); } fflush(stdout); fflush(stderr); diff --git a/q931.c b/q931.c index 009e023..c794958 100755 --- a/q931.c +++ b/q931.c @@ -1782,7 +1782,7 @@ void q931_dump(q931_h *h, int len, int txrx) int codeset; c = txrx ? '>' : '<'; pri_message("%c Protocol Discriminator: %s (%d) len=%d\n", c, disc2str(h->pd), h->pd, len); - pri_message("%c Call Ref: len=%2d (reference %d/0x%X) (%s)\n", c, h->crlen, q931_cr(h), q931_cr(h), (h->crv[0] & 0x80) ? "Terminator" : "Originator"); + pri_message("%c Call Ref: len=%2d (reference %d/0x%X) (%s)\n", c, h->crlen, q931_cr(h) & 0x7FFF, q931_cr(h) & 0x7FFF, (h->crv[0] & 0x80) ? "Terminator" : "Originator"); /* Message header begins at the end of the call reference number */ mh = (q931_mh *)(h->contents + h->crlen); pri_message("%c Message type: %s (%d)\n", c, msg2str(mh->msg), mh->msg);