From 618acf9d53ed4762e325ed05f81f72dd43b87222 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Tue, 3 Nov 2009 17:19:20 +0000 Subject: [PATCH] Unknown IE 50 (cs5, Unknown Information Element) Add code to recognize the code set 5 ie 50 (calling party category) to suppress the unknown IE message. (closes issue #13828) Reported by: fdecher Patches: libpri_ie50_cs5-trunk.diff3.txt uploaded by alecdavis (license 585) Tested by: alecdavis git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1261 2fbb986a-6c06-0410-b554-c9c1f0a7f128 --- pri_q931.h | 1 + q931.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/pri_q931.h b/pri_q931.h index 95995a0..b1e1800 100644 --- a/pri_q931.h +++ b/pri_q931.h @@ -146,6 +146,7 @@ typedef struct q931_ie { #define Q931_CHANNEL_IDENT 0x18 #define Q931_PROGRESS_INDICATOR 0x1e #define Q931_NETWORK_SPEC_FAC 0x20 +#define Q931_CALLING_PARTY_CATEGORY (0x32 | Q931_CODESET(5)) #define Q931_INFORMATION_RATE 0x40 #define Q931_TRANSIT_DELAY 0x42 #define Q931_TRANS_DELAY_SELECT 0x43 diff --git a/q931.c b/q931.c index a1a8b0f..11f2c26 100644 --- a/q931.c +++ b/q931.c @@ -1510,6 +1510,30 @@ static char *subaddrtype2str(int plan) return code2str(plan, plans, sizeof(plans) / sizeof(plans[0])); } +/* Calling Party Category (Definitions from Q.763) */ +static char *cpc2str(int plan) +{ + static struct msgtype plans[] = { + { 0, "Unknown Source" }, + { 1, "Operator French" }, + { 2, "Operator English" }, + { 3, "Operator German" }, + { 4, "Operator Russian" }, + { 5, "Operator Spanish" }, + { 6, "Mut Agree Chinese" }, + { 7, "Mut Agreement" }, + { 8, "Mut Agree Japanese" }, + { 9, "National Operator" }, + { 10, "Ordinary Toll Caller" }, + { 11, "Priority Toll Caller" }, + { 12, "Data Call" }, + { 13, "Test Call" }, + { 14, "Spare" }, + { 15, "Pay Phone" }, + }; + return code2str(plan, plans, ARRAY_LEN(plans)); +} + char *pri_pres2str(int pres) { static struct msgtype press[] = { @@ -1656,6 +1680,12 @@ static void dump_calling_party_subaddr(int full_ie, struct pri *ctrl, q931_ie *i dump_subaddr_helper(full_ie, ctrl, ie, 1 , len, len - 3, prefix, "Calling"); } +static void dump_calling_party_category(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix) +{ + pri_message(ctrl, "%c Calling Party Category (len=%2d) [ Ext: %d Cat: %s (%d) ]\n", + prefix, len, ie->data[0] >> 7, cpc2str(ie->data[0] & 0x0F), ie->data[0] & 0x0F); +} + static void dump_redirecting_number(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix) { unsigned char cnum[256]; @@ -3177,6 +3207,8 @@ static struct ie ies[] = { { 1, Q931_SENDING_COMPLETE, "Sending Complete", dump_sending_complete, receive_sending_complete, transmit_sending_complete }, /* Codeset 4 - Q.SIG specific */ { 1, QSIG_IE_TRANSIT_COUNT | Q931_CODESET(4), "Transit Count", dump_transit_count }, + /* Codeset 5 - National specific (ETSI PISN specific) */ + { 1, Q931_CALLING_PARTY_CATEGORY, "Calling Party Category", dump_calling_party_category }, /* Codeset 6 - Network specific */ { 1, Q931_IE_ORIGINATING_LINE_INFO, "Originating Line Information", dump_line_information, receive_line_information, transmit_line_information }, { 1, Q931_IE_FACILITY | Q931_CODESET(6), "Facility", dump_facility, receive_facility, transmit_facility },