From 8c4f87a9e0a70ce7da2f84cea402e4cd189d3491 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Fri, 16 Jul 2010 16:37:07 +0000 Subject: [PATCH] Calling name not successfully processed on inbound QSIG PRI calls from Mitel PBX The alternate form of the Q.SIG Name sequence that allows manufacturer extensions for CallingName, CalledName, ConnectedName, and BusyName was not consuming the next ASN.1 tag. The code that processed the ASN.1 Name structure was then using a stale tag value. The stale tag value was then rejected with the "Did not expect" message. I have added a test case using the supplied PRI debug output to the rosetest utility to verify that this alternate encoding is tested in the future. (closes issue #17619) Reported by: jims8650 Patches: issue17619_v1.4.11.3.patch uploaded by rmudgett (license 664) Tested by: rmudgett git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1828 2fbb986a-6c06-0410-b554-c9c1f0a7f128 --- rose_qsig_name.c | 1 + rosetest.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/rose_qsig_name.c b/rose_qsig_name.c index 195f625..58c3823 100644 --- a/rose_qsig_name.c +++ b/rose_qsig_name.c @@ -382,6 +382,7 @@ static const unsigned char *rose_dec_qsig_PartyName_ARG_Backend(struct pri *ctrl ASN1_CALL(pos, asn1_dec_length(pos, end, &length)); ASN1_END_SETUP(seq_end, seq_offset, length, pos, end); + ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag)); ASN1_CALL(pos, rose_dec_qsig_Name(ctrl, "name", tag, pos, seq_end, &party->name)); diff --git a/rosetest.c b/rosetest.c index 390f57b..141105a 100644 --- a/rosetest.c +++ b/rosetest.c @@ -2799,6 +2799,44 @@ static unsigned char rose_qsig_multiple_msg[] = { /* *INDENT-ON* */ }; +static unsigned char rose_qsig_name_alt_encode_msg[] = { +/* *INDENT-OFF* */ +/* + * Context Specific/C [10 0x0A] Len:6 <06> + * Context Specific [0 0x00] <80> Len:1 <01> + * <00> - "~" + * Context Specific [2 0x02] <82> Len:1 <01> + * <00> - "~" + * Context Specific [11 0x0B] <8B> Len:1 <01> + * <00> - "~" + * Context Specific/C [1 0x01] Len:21 <15> + * Integer(2 0x02) <02> Len:1 <01> + * <1D> - "~" + * Integer(2 0x02) <02> Len:1 <01> + * <00> - "~" + * Sequence/C(48 0x30) <30> Len:13 <0D> + * Context Specific [0 0x00] <80> Len:11 <0B> + * <55 54 49 4C 49 54 59 20-54 45 4C> - "UTILITY TEL" + */ + 0x9F, + 0xAA, 0x06, + 0x80, 0x01, + 0x00, + 0x82, 0x01, + 0x00, + 0x8B, 0x01, + 0x00, + 0xA1, 0x15, + 0x02, 0x01, + 0x1D, + 0x02, 0x01, + 0x00, + 0x30, 0x0D, + 0x80, 0x0B, + 0x55, 0x54, 0x49, 0x4C, 0x49, 0x54, 0x59, 0x20, 0x54, 0x45, 0x4C +/* *INDENT-ON* */ +}; + static const struct rose_message rose_dms100_msgs[] = { /* *INDENT-OFF* */ @@ -3087,6 +3125,9 @@ int main(int argc, char *argv[]) rose_test_exception(&dummy_ctrl, "Multiple component messages", rose_qsig_multiple_msg, sizeof(rose_qsig_multiple_msg)); + rose_test_exception(&dummy_ctrl, "Alternate name encoded messages", + rose_qsig_name_alt_encode_msg, sizeof(rose_qsig_name_alt_encode_msg)); + /* ------------------------------------------------------------------- */ pri_message(&dummy_ctrl, "\n\n"