Fix debugging of calling party number when no presentation specified (bug #1677)

git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@97 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Mark Spencer 2004-05-19 22:02:40 +00:00
parent 7aac157b7f
commit baefdcb18d

5
q931.c
View File

@ -759,9 +759,12 @@ static void dump_called_party_subaddr(q931_ie *ie, int len, char prefix)
static void dump_calling_party_number(q931_ie *ie, int len, char prefix) static void dump_calling_party_number(q931_ie *ie, int len, char prefix)
{ {
char cnum[256]; char cnum[256];
if (ie->data[2] & 0x80)
q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4); q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
else
q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
pri_message("%c Calling Number (len=%2d) [ Ext: %d TON: %s (%d) NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f); pri_message("%c Calling Number (len=%2d) [ Ext: %d TON: %s (%d) NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
if (ie->data[2] & 0x80)
pri_message("%c Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum); pri_message("%c Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum);
} }