Don't guard col_set_str (COL_PROTOCOL) with col_check
[obnox/wireshark/wip.git] / epan / dissectors / packet-isup.c
1 /* packet-isup.c
2  * Routines for ISUP dissection
3  * Copyright 2001, Martina Obermeier <martina.obermeier@icn.siemens.de>
4  *
5  * Copyright 2004-2005, Anders Broman <anders.broman@ericsson.com>
6  * Modified 2003-09-10 by Anders Broman
7  *              <anders.broman@ericsson.com>
8  * Inserted routines for BICC dissection according to Q.765.5 Q.1902 Q.1970 Q.1990,
9  * calling SDP dissector for RFC2327 decoding.
10  * Modified 2004-01-10 by Anders Broman to add abillity to dissect
11  * Content type application/ISUP RFC 3204 used in SIP-T
12  *
13  * $Id$
14  *
15  * Wireshark - Network traffic analyzer
16  * By Gerald Combs <gerald@wireshark.org>
17  * Copyright 1998 Gerald Combs
18  *
19  * Copied from README.developer
20  *
21  * This program is free software; you can redistribute it and/or
22  * modify it under the terms of the GNU General Public License
23  * as published by the Free Software Foundation; either version 2
24  * of the License, or (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  * GNU General Public License for more details.
30  *
31  * You should have received a copy of the GNU General Public License
32  * along with this program; if not, write to the Free Software
33  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34  * References:
35  * ISUP:
36  * http://www.itu.int/rec/recommendation.asp?type=products&lang=e&parent=T-REC-Q
37  * Q.763-199912, Q.763-200212Amd2
38  * ITU-T Q.763/Amd.1 (03/2001)
39  */
40
41 #ifdef HAVE_CONFIG_H
42 # include "config.h"
43 #endif
44
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <string.h>
48
49 #include <glib.h>
50
51 #include <epan/packet.h>
52 #include <epan/stats_tree.h>
53 #include <epan/asn1.h>
54 #include <prefs.h>
55 #include "packet-q931.h"
56 #include "packet-isup.h"
57 #include "packet-e164.h"
58 #include "packet-charging_ase.h"
59 #include <epan/sctpppids.h>
60 #include <epan/emem.h>
61 #include <epan/circuit.h>
62 #include <epan/reassemble.h>
63 #include <packet-mtp3.h>
64
65 static gint isup_standard = ITU_STANDARD;
66
67 #define MTP3_ISUP_SERVICE_INDICATOR     5
68 #define MTP3_BICC_SERVICE_INDICATOR     13
69 #define ASCII_NUMBER_DELTA              0x30
70 #define ASCII_LETTER_DELTA              0x37
71
72 /* Definition of protocol field values und lengths */
73
74 /* Definition of Message Types */
75 #define MESSAGE_TYPE_INITIAL_ADDR       1
76 #define MESSAGE_TYPE_SUBSEQ_ADDR        2
77 #define MESSAGE_TYPE_INFO_REQ           3
78 #define MESSAGE_TYPE_INFO               4
79 #define MESSAGE_TYPE_CONTINUITY         5
80 #define MESSAGE_TYPE_ADDR_CMPL          6
81 #define MESSAGE_TYPE_CONNECT            7
82 #define MESSAGE_TYPE_FORW_TRANS         8
83 #define MESSAGE_TYPE_ANSWER             9
84 #define MESSAGE_TYPE_RELEASE           12
85 #define MESSAGE_TYPE_SUSPEND           13
86 #define MESSAGE_TYPE_RESUME            14
87 #define MESSAGE_TYPE_REL_CMPL          16
88 #define MESSAGE_TYPE_CONT_CHECK_REQ    17
89 #define MESSAGE_TYPE_RESET_CIRCUIT     18
90 #define MESSAGE_TYPE_BLOCKING          19
91 #define MESSAGE_TYPE_UNBLOCKING        20
92 #define MESSAGE_TYPE_BLOCK_ACK         21
93 #define MESSAGE_TYPE_UNBLOCK_ACK       22
94 #define MESSAGE_TYPE_CIRC_GRP_RST      23
95 #define MESSAGE_TYPE_CIRC_GRP_BLCK     24
96 #define MESSAGE_TYPE_CIRC_GRP_UNBL     25
97 #define MESSAGE_TYPE_CIRC_GRP_BL_ACK   26
98 #define MESSAGE_TYPE_CIRC_GRP_UNBL_ACK 27
99 #define MESSAGE_TYPE_FACILITY_REQ      31
100 #define MESSAGE_TYPE_FACILITY_ACC      32
101 #define MESSAGE_TYPE_FACILITY_REJ      33
102 #define MESSAGE_TYPE_LOOP_BACK_ACK     36
103 #define MESSAGE_TYPE_PASS_ALONG        40
104 #define MESSAGE_TYPE_CIRC_GRP_RST_ACK  41
105 #define MESSAGE_TYPE_CIRC_GRP_QRY      42
106 #define MESSAGE_TYPE_CIRC_GRP_QRY_RSP  43
107 #define MESSAGE_TYPE_CALL_PROGRSS      44
108 #define MESSAGE_TYPE_USER2USER_INFO    45
109 #define MESSAGE_TYPE_UNEQUIPPED_CIC    46
110 #define MESSAGE_TYPE_CONFUSION         47
111 #define MESSAGE_TYPE_OVERLOAD          48
112 #define MESSAGE_TYPE_CHARGE_INFO       49
113 #define MESSAGE_TYPE_NETW_RESRC_MGMT   50
114 #define MESSAGE_TYPE_FACILITY          51
115 #define MESSAGE_TYPE_USER_PART_TEST    52
116 #define MESSAGE_TYPE_USER_PART_AVAIL   53
117 #define MESSAGE_TYPE_IDENT_REQ         54
118 #define MESSAGE_TYPE_IDENT_RSP         55
119 #define MESSAGE_TYPE_SEGMENTATION      56
120 #define MESSAGE_TYPE_LOOP_PREVENTION   64
121 #define MESSAGE_TYPE_APPLICATION_TRANS 65
122 #define MESSAGE_TYPE_PRE_RELEASE_INFO  66
123 #define MESSAGE_TYPE_SUBSEQUENT_DIR_NUM 67
124
125 #define ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES_ACK                          0xE9
126 #define ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES                                      0xEA
127 #define ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST_RSP                         0xEB
128 #define ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST                                     0xEC
129 #define ANSI_ISUP_MESSAGE_TYPE_EXIT                                                     0xED
130
131 const value_string isup_message_type_value[] = {
132   { MESSAGE_TYPE_INITIAL_ADDR,          "Initial address"},
133   { MESSAGE_TYPE_SUBSEQ_ADDR,           "Subsequent address"},
134   { MESSAGE_TYPE_INFO_REQ,              "Information request (national use)"},
135   { MESSAGE_TYPE_INFO,                  "Information (national use)"},
136   { MESSAGE_TYPE_CONTINUITY,            "Continuity"},
137   { MESSAGE_TYPE_ADDR_CMPL,             "Address complete"},
138   { MESSAGE_TYPE_CONNECT,               "Connect"},
139   { MESSAGE_TYPE_FORW_TRANS,            "Forward transfer"},
140   { MESSAGE_TYPE_ANSWER,                "Answer"},
141   { MESSAGE_TYPE_RELEASE,               "Release"},
142   { MESSAGE_TYPE_SUSPEND,               "Suspend"},
143   { MESSAGE_TYPE_RESUME,                "Resume"},
144   { MESSAGE_TYPE_REL_CMPL,              "Release complete"},
145   { MESSAGE_TYPE_CONT_CHECK_REQ,        "Continuity check request"},
146   { MESSAGE_TYPE_RESET_CIRCUIT,         "Reset Circuit"},
147   { MESSAGE_TYPE_BLOCKING,              "Blocking"},
148   { MESSAGE_TYPE_UNBLOCKING,            "Unblocking"},
149   { MESSAGE_TYPE_BLOCK_ACK,             "Blocking acknowledgement"},
150   { MESSAGE_TYPE_UNBLOCK_ACK,           "Unblocking acknowledgment"},
151   { MESSAGE_TYPE_CIRC_GRP_RST,          "Circuit group reset"},
152   { MESSAGE_TYPE_CIRC_GRP_BLCK,         "Circuit group blocking"},
153   { MESSAGE_TYPE_CIRC_GRP_UNBL,         "Circuit group unblocking"},
154   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,       "Circuit group blocking acknowledgement"},
155   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,     "Circuit group unblocking acknowledgement"},
156   { MESSAGE_TYPE_FACILITY_REQ,          "Facility request"},
157   { MESSAGE_TYPE_FACILITY_ACC,          "Facility accepted"},
158   { MESSAGE_TYPE_FACILITY_REJ,          "Facility reject"},
159   { MESSAGE_TYPE_LOOP_BACK_ACK,         "Loop back acknowledgement (national use)"},
160   { MESSAGE_TYPE_PASS_ALONG,            "Pass-along (national use)"},
161   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,      "Circuit group reset acknowledgement"},
162   { MESSAGE_TYPE_CIRC_GRP_QRY,          "Circuit group query (national use)"},
163   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,      "Circuit group query response (national use)"},
164   { MESSAGE_TYPE_CALL_PROGRSS,          "Call progress"},
165   { MESSAGE_TYPE_USER2USER_INFO,        "User-to-user information"},
166   { MESSAGE_TYPE_UNEQUIPPED_CIC,        "Unequipped CIC (national use)"},
167   { MESSAGE_TYPE_CONFUSION,             "Confusion"},
168   { MESSAGE_TYPE_OVERLOAD,              "Overload (national use)"},
169   { MESSAGE_TYPE_CHARGE_INFO,           "Charge information (national use)"},
170   { MESSAGE_TYPE_NETW_RESRC_MGMT,       "Network resource management"},
171   { MESSAGE_TYPE_FACILITY,              "Facility"},
172   { MESSAGE_TYPE_USER_PART_TEST,        "User part test"},
173   { MESSAGE_TYPE_USER_PART_AVAIL,       "User part available"},
174   { MESSAGE_TYPE_IDENT_REQ,             "Identification request"},
175   { MESSAGE_TYPE_IDENT_RSP,             "Identification response"},
176   { MESSAGE_TYPE_SEGMENTATION,          "Segmentation"},
177   { MESSAGE_TYPE_LOOP_PREVENTION,       "Loop prevention"},
178   { MESSAGE_TYPE_APPLICATION_TRANS,             "Application transport"},
179   { MESSAGE_TYPE_PRE_RELEASE_INFO,              "Pre-release information"},
180   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,    "Subsequent Directory Number (national use)"},
181   { 0,                                  NULL}};
182
183  static const value_string ansi_isup_message_type_value[] = {
184   { MESSAGE_TYPE_INITIAL_ADDR,          "Initial address"},
185   { MESSAGE_TYPE_SUBSEQ_ADDR,           "Subsequent address"},
186   { MESSAGE_TYPE_INFO_REQ,              "Information request (national use)"},
187   { MESSAGE_TYPE_INFO,                  "Information (national use)"},
188   { MESSAGE_TYPE_CONTINUITY,            "Continuity"},
189   { MESSAGE_TYPE_ADDR_CMPL,             "Address complete"},
190   { MESSAGE_TYPE_CONNECT,               "Connect"},
191   { MESSAGE_TYPE_FORW_TRANS,            "Forward transfer"},
192   { MESSAGE_TYPE_ANSWER,                "Answer"},
193   { MESSAGE_TYPE_RELEASE,               "Release"},
194   { MESSAGE_TYPE_SUSPEND,               "Suspend"},
195   { MESSAGE_TYPE_RESUME,                "Resume"},
196   { MESSAGE_TYPE_REL_CMPL,              "Release complete"},
197   { MESSAGE_TYPE_CONT_CHECK_REQ,        "Continuity check request"},
198   { MESSAGE_TYPE_RESET_CIRCUIT,         "Reset Circuit"},
199   { MESSAGE_TYPE_BLOCKING,              "Blocking"},
200   { MESSAGE_TYPE_UNBLOCKING,            "Unblocking"},
201   { MESSAGE_TYPE_BLOCK_ACK,             "Blocking acknowledgement"},
202   { MESSAGE_TYPE_UNBLOCK_ACK,           "Unblocking acknowledgment"},
203   { MESSAGE_TYPE_CIRC_GRP_RST,          "Circuit group reset"},
204   { MESSAGE_TYPE_CIRC_GRP_BLCK,         "Circuit group blocking"},
205   { MESSAGE_TYPE_CIRC_GRP_UNBL,         "Circuit group unblocking"},
206   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,       "Circuit group blocking acknowledgement"},
207   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,     "Circuit group unblocking acknowledgement"},
208   { MESSAGE_TYPE_FACILITY_REQ,          "Facility request"},
209   { MESSAGE_TYPE_FACILITY_ACC,          "Facility accepted"},
210   { MESSAGE_TYPE_FACILITY_REJ,          "Facility reject"},
211   { MESSAGE_TYPE_LOOP_BACK_ACK,         "Loop back acknowledgement (national use)"},
212   { MESSAGE_TYPE_PASS_ALONG,            "Pass-along (national use)"},
213   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,      "Circuit group reset acknowledgement"},
214   { MESSAGE_TYPE_CIRC_GRP_QRY,          "Circuit group query (national use)"},
215   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,      "Circuit group query response (national use)"},
216   { MESSAGE_TYPE_CALL_PROGRSS,          "Call progress"},
217   { MESSAGE_TYPE_USER2USER_INFO,        "User-to-user information"},
218   { MESSAGE_TYPE_UNEQUIPPED_CIC,        "Unequipped CIC (national use)"},
219   { MESSAGE_TYPE_CONFUSION,             "Confusion"},
220   { MESSAGE_TYPE_OVERLOAD,              "Overload (national use)"},
221   { MESSAGE_TYPE_CHARGE_INFO,           "Charge information (national use)"},
222   { MESSAGE_TYPE_NETW_RESRC_MGMT,       "Network resource management"},
223   { MESSAGE_TYPE_FACILITY,              "Facility"},
224   { MESSAGE_TYPE_USER_PART_TEST,        "User part test"},
225   { MESSAGE_TYPE_USER_PART_AVAIL,       "User part available"},
226   { MESSAGE_TYPE_IDENT_REQ,             "Identification request"},
227   { MESSAGE_TYPE_IDENT_RSP,             "Identification response"},
228   { MESSAGE_TYPE_SEGMENTATION,          "Segmentation"},
229   { MESSAGE_TYPE_LOOP_PREVENTION,       "Loop prevention"},
230   { MESSAGE_TYPE_APPLICATION_TRANS,             "Application transport"},
231   { MESSAGE_TYPE_PRE_RELEASE_INFO,              "Pre-release information"},
232   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,    "Subsequent Directory Number (national use)"},
233   { ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES_ACK,             "Circuit Reservation Acknowledge"},
234   { ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES,                 "Circuit Reservation"},
235   { ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST_RSP,    "Circuit Validation Test Response"},
236   { ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST,                "Circuit Validation Test"},
237   { ANSI_ISUP_MESSAGE_TYPE_EXIT,                                "Exit"},
238   { 0,                                  NULL}};
239 /* Same as above but in acronym form (for the Info column) */
240 const value_string isup_message_type_value_acro[] = {
241   { MESSAGE_TYPE_INITIAL_ADDR,          "IAM"},
242   { MESSAGE_TYPE_SUBSEQ_ADDR,           "SAM"},
243   { MESSAGE_TYPE_INFO_REQ,              "INR"},
244   { MESSAGE_TYPE_INFO,                  "INF"},
245   { MESSAGE_TYPE_CONTINUITY,            "COT"},
246   { MESSAGE_TYPE_ADDR_CMPL,             "ACM"},
247   { MESSAGE_TYPE_CONNECT,               "CON"},
248   { MESSAGE_TYPE_FORW_TRANS,            "FOT"},
249   { MESSAGE_TYPE_ANSWER,                "ANM"},
250   { MESSAGE_TYPE_RELEASE,               "REL"},
251   { MESSAGE_TYPE_SUSPEND,               "SUS"},
252   { MESSAGE_TYPE_RESUME,                "RES"},
253   { MESSAGE_TYPE_REL_CMPL,              "RLC"},
254   { MESSAGE_TYPE_CONT_CHECK_REQ,        "CCR"},
255   { MESSAGE_TYPE_RESET_CIRCUIT,         "RSC"},
256   { MESSAGE_TYPE_BLOCKING,              "BLO"},
257   { MESSAGE_TYPE_UNBLOCKING,            "UBL"},
258   { MESSAGE_TYPE_BLOCK_ACK,             "BLA"},
259   { MESSAGE_TYPE_UNBLOCK_ACK,           "UBLA"},
260   { MESSAGE_TYPE_CIRC_GRP_RST,          "GRS"},
261   { MESSAGE_TYPE_CIRC_GRP_BLCK,         "CGB"},
262   { MESSAGE_TYPE_CIRC_GRP_UNBL,         "CGU"},
263   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,       "CGBA"},
264   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,     "CGUA"},
265   { MESSAGE_TYPE_FACILITY_REQ,          "FAR"},
266   { MESSAGE_TYPE_FACILITY_ACC,          "FAA"},
267   { MESSAGE_TYPE_FACILITY_REJ,          "FRJ"},
268   { MESSAGE_TYPE_LOOP_BACK_ACK,         "LPA"},
269   { MESSAGE_TYPE_PASS_ALONG,            "PAM"},
270   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,      "GRA"},
271   { MESSAGE_TYPE_CIRC_GRP_QRY,          "CQM"},
272   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,      "CQR"},
273   { MESSAGE_TYPE_CALL_PROGRSS,          "CPG"},
274   { MESSAGE_TYPE_USER2USER_INFO,        "UUI"},
275   { MESSAGE_TYPE_UNEQUIPPED_CIC,        "UCIC"},
276   { MESSAGE_TYPE_CONFUSION,             "CFN"},
277   { MESSAGE_TYPE_OVERLOAD,              "OLM"},
278   { MESSAGE_TYPE_CHARGE_INFO,           "CRG"},
279   { MESSAGE_TYPE_NETW_RESRC_MGMT,       "NRM"},
280   { MESSAGE_TYPE_FACILITY,              "FAC"},
281   { MESSAGE_TYPE_USER_PART_TEST,        "UPT"},
282   { MESSAGE_TYPE_USER_PART_AVAIL,       "UPA"},
283   { MESSAGE_TYPE_IDENT_REQ,             "IDR"},
284   { MESSAGE_TYPE_IDENT_RSP,             "IDS"},
285   { MESSAGE_TYPE_SEGMENTATION,          "SGM"},
286   { MESSAGE_TYPE_LOOP_PREVENTION,       "LOP"},
287   { MESSAGE_TYPE_APPLICATION_TRANS,             "APM"},
288   { MESSAGE_TYPE_PRE_RELEASE_INFO,              "PRI"},
289   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,    "SDN"},
290   { 0,                                  NULL}};
291
292   /* Same as above but in acronym form (for the Info column) */
293 static const value_string ansi_isup_message_type_value_acro[] = {
294   { MESSAGE_TYPE_INITIAL_ADDR,          "IAM"},
295   { MESSAGE_TYPE_SUBSEQ_ADDR,           "SAM"},
296   { MESSAGE_TYPE_INFO_REQ,              "INR"},
297   { MESSAGE_TYPE_INFO,                  "INF"},
298   { MESSAGE_TYPE_CONTINUITY,            "COT"},
299   { MESSAGE_TYPE_ADDR_CMPL,             "ACM"},
300   { MESSAGE_TYPE_CONNECT,               "CON"},
301   { MESSAGE_TYPE_FORW_TRANS,            "FOT"},
302   { MESSAGE_TYPE_ANSWER,                "ANM"},
303   { MESSAGE_TYPE_RELEASE,               "REL"},
304   { MESSAGE_TYPE_SUSPEND,               "SUS"},
305   { MESSAGE_TYPE_RESUME,                "RES"},
306   { MESSAGE_TYPE_REL_CMPL,              "RLC"},
307   { MESSAGE_TYPE_CONT_CHECK_REQ,        "CCR"},
308   { MESSAGE_TYPE_RESET_CIRCUIT,         "RSC"},
309   { MESSAGE_TYPE_BLOCKING,              "BLO"},
310   { MESSAGE_TYPE_UNBLOCKING,            "UBL"},
311   { MESSAGE_TYPE_BLOCK_ACK,             "BLA"},
312   { MESSAGE_TYPE_UNBLOCK_ACK,           "UBLA"},
313   { MESSAGE_TYPE_CIRC_GRP_RST,          "GRS"},
314   { MESSAGE_TYPE_CIRC_GRP_BLCK,         "CGB"},
315   { MESSAGE_TYPE_CIRC_GRP_UNBL,         "CGU"},
316   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,       "CGBA"},
317   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,     "CGUA"},
318   { MESSAGE_TYPE_FACILITY_REQ,          "FAR"},
319   { MESSAGE_TYPE_FACILITY_ACC,          "FAA"},
320   { MESSAGE_TYPE_FACILITY_REJ,          "FRJ"},
321   { MESSAGE_TYPE_LOOP_BACK_ACK,         "LPA"},
322   { MESSAGE_TYPE_PASS_ALONG,            "PAM"},
323   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,      "GRA"},
324   { MESSAGE_TYPE_CIRC_GRP_QRY,          "CQM"},
325   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,      "CQR"},
326   { MESSAGE_TYPE_CALL_PROGRSS,          "CPG"},
327   { MESSAGE_TYPE_USER2USER_INFO,        "UUI"},
328   { MESSAGE_TYPE_UNEQUIPPED_CIC,        "UCIC"},
329   { MESSAGE_TYPE_CONFUSION,             "CFN"},
330   { MESSAGE_TYPE_OVERLOAD,              "OLM"},
331   { MESSAGE_TYPE_CHARGE_INFO,           "CRG"},
332   { MESSAGE_TYPE_NETW_RESRC_MGMT,       "NRM"},
333   { MESSAGE_TYPE_FACILITY,              "FAC"},
334   { MESSAGE_TYPE_USER_PART_TEST,        "UPT"},
335   { MESSAGE_TYPE_USER_PART_AVAIL,       "UPA"},
336   { MESSAGE_TYPE_IDENT_REQ,             "IDR"},
337   { MESSAGE_TYPE_IDENT_RSP,             "IDS"},
338   { MESSAGE_TYPE_SEGMENTATION,          "SGM"},
339   { MESSAGE_TYPE_LOOP_PREVENTION,       "LOP"},
340   { MESSAGE_TYPE_APPLICATION_TRANS,             "APM"},
341   { MESSAGE_TYPE_PRE_RELEASE_INFO,              "PRI"},
342   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,    "SDN"},
343   { ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES_ACK,             "CRA"},
344   { ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES,                 "CRM"},
345   { ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST_RSP,    "CVR"},
346   { ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST,                "CVT"},
347   { ANSI_ISUP_MESSAGE_TYPE_EXIT,                                "EXIT"},
348   { 0,                                  NULL}};
349
350 const value_string isup_parameter_type_value[] = {
351 { PARAM_TYPE_END_OF_OPT_PARAMS,        "End of optional parameters"},
352   { PARAM_TYPE_CALL_REF,               "Call Reference (national use)"},
353   { PARAM_TYPE_TRANSM_MEDIUM_REQU,     "Transmission medium requirement"},
354   { PARAM_TYPE_ACC_TRANSP,             "Access transport"},
355   { PARAM_TYPE_CALLED_PARTY_NR,        "Called party number"},
356   { PARAM_TYPE_SUBSQT_NR,              "Subsequent number"},
357   { PARAM_TYPE_NATURE_OF_CONN_IND,     "Nature of connection indicators"},
358   { PARAM_TYPE_FORW_CALL_IND,          "Forward call indicators"},
359   { PARAM_TYPE_OPT_FORW_CALL_IND,      "Optional forward call indicators"},
360   { PARAM_TYPE_CALLING_PRTY_CATEG,     "Calling party's category"},
361   { PARAM_TYPE_CALLING_PARTY_NR,       "Calling party number"},
362   { PARAM_TYPE_REDIRECTING_NR,         "Redirecting number"},
363   { PARAM_TYPE_REDIRECTION_NR,         "Redirection number"},
364   { PARAM_TYPE_CONNECTION_REQ,         "Connection request"},
365   { PARAM_TYPE_INFO_REQ_IND,           "Information request indicators (national use)"},
366   { PARAM_TYPE_INFO_IND,               "Information indicators (national use)"},
367   { PARAM_TYPE_CONTINUITY_IND,         "Continuity request"},
368   { PARAM_TYPE_BACKW_CALL_IND,         "Backward call indicators"},
369   { PARAM_TYPE_CAUSE_INDICATORS,       "Cause indicators"},
370   { PARAM_TYPE_REDIRECTION_INFO,       "Redirection information"},
371   { PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE,   "Circuit group supervision message type"},
372   { PARAM_TYPE_RANGE_AND_STATUS,       "Range and Status"},
373   { PARAM_TYPE_FACILITY_IND,           "Facility indicator"},
374   { PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD,  "Closed user group interlock code"},
375   { PARAM_TYPE_USER_SERVICE_INFO,      "User service information"},
376   { PARAM_TYPE_SIGNALLING_POINT_CODE,  "Signalling point code (national use)"},
377   { PARAM_TYPE_USER_TO_USER_INFO,      "User-to-user information"},
378   { PARAM_TYPE_CONNECTED_NR,           "Connected number"},
379   { PARAM_TYPE_SUSP_RESUME_IND,        "Suspend/Resume indicators"},
380   { PARAM_TYPE_TRANSIT_NETW_SELECT,    "Transit network selection (national use)"},
381   { PARAM_TYPE_EVENT_INFO,             "Event information"},
382   { PARAM_TYPE_CIRC_ASSIGN_MAP,        "Circuit assignment map"},
383   { PARAM_TYPE_CIRC_STATE_IND,         "Circuit state indicator (national use)"},
384   { PARAM_TYPE_AUTO_CONG_LEVEL,        "Automatic congestion level"},
385   { PARAM_TYPE_ORIG_CALLED_NR,         "Original called number"},
386   { PARAM_TYPE_OPT_BACKW_CALL_IND,     "Backward call indicators"},
387   { PARAM_TYPE_USER_TO_USER_IND,       "User-to-user indicators"},
388   { PARAM_TYPE_ORIG_ISC_POINT_CODE,    "Origination ISC point code"},
389   { PARAM_TYPE_GENERIC_NOTIF_IND,      "Generic notification indicator"},
390   { PARAM_TYPE_CALL_HIST_INFO,         "Call history information"},
391   { PARAM_TYPE_ACC_DELIV_INFO,         "Access delivery information"},
392   { PARAM_TYPE_NETW_SPECIFIC_FACLTY,   "Network specific facility (national use)"},
393   { PARAM_TYPE_USER_SERVICE_INFO_PR,   "User service information prime"},
394   { PARAM_TYPE_PROPAG_DELAY_COUNTER,   "Propagation delay counter"},
395   { PARAM_TYPE_REMOTE_OPERATIONS,      "Remote operations (national use)"},
396   { PARAM_TYPE_SERVICE_ACTIVATION,     "Service activation"},
397   { PARAM_TYPE_USER_TELESERV_INFO,     "User teleservice information"},
398   { PARAM_TYPE_TRANSM_MEDIUM_USED,     "Transmission medium used"},
399   { PARAM_TYPE_CALL_DIV_INFO,          "Call diversion information"},
400   { PARAM_TYPE_ECHO_CTRL_INFO,         "Echo control information"},
401   { PARAM_TYPE_MSG_COMPAT_INFO,        "Message compatibility information"},
402   { PARAM_TYPE_PARAM_COMPAT_INFO,      "Parameter compatibility information"},
403   { PARAM_TYPE_MLPP_PRECEDENCE,        "MLPP precedence"},
404   { PARAM_TYPE_MCID_REQ_IND,           "MCID request indicators"},
405   { PARAM_TYPE_MCID_RSP_IND,           "MCID response indicators"},
406   { PARAM_TYPE_HOP_COUNTER,            "Hop counter"},
407   { PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR,  "Transmission medium requirement prime"},
408   { PARAM_TYPE_LOCATION_NR,            "Location number"},
409   { PARAM_TYPE_REDIR_NR_RSTRCT,        "Redirection number restriction"},
410   { PARAM_TYPE_CALL_TRANS_REF,         "Call transfer reference"},
411   { PARAM_TYPE_LOOP_PREV_IND,          "Loop prevention indicators"},
412   { PARAM_TYPE_CALL_TRANS_NR,          "Call transfer number"},
413   { PARAM_TYPE_CCSS,                   "CCSS"},
414   { PARAM_TYPE_FORW_GVNS,              "Forward GVNS"},
415   { PARAM_TYPE_BACKW_GVNS,             "Backward GVNS"},
416   { PARAM_TYPE_REDIRECT_CAPAB,         "Redirect capability (reserved for national use)"},
417   { PARAM_TYPE_NETW_MGMT_CTRL,         "Network management controls"},
418   { PARAM_TYPE_CORRELATION_ID,         "Correlation id"},
419   { PARAM_TYPE_SCF_ID,                 "SCF id"},
420   { PARAM_TYPE_CALL_DIV_TREAT_IND,     "Call diversion treatment indicators"},
421   { PARAM_TYPE_CALLED_IN_NR,           "Called IN number"},
422   { PARAM_TYPE_CALL_OFF_TREAT_IND,     "Call offering treatment indicators"},
423   { PARAM_TYPE_CHARGED_PARTY_IDENT,    "Charged party identification (national use)"},
424   { PARAM_TYPE_CONF_TREAT_IND,         "Conference treatment indicators"},
425   { PARAM_TYPE_DISPLAY_INFO,           "Display information"},
426   { PARAM_TYPE_UID_ACTION_IND,         "UID action indicators"},
427   { PARAM_TYPE_UID_CAPAB_IND,          "UID capability indicators"},
428   { PARAM_TYPE_REDIRECT_COUNTER,       "Redirect counter (reserved for national use)"},
429   { PARAM_TYPE_COLLECT_CALL_REQ,       "Collect call request"},
430   { PARAM_TYPE_GENERIC_NR,             "Generic number"},
431   { PARAM_TYPE_GENERIC_DIGITS,         "Generic digits (national use)"},
432   { PARAM_TYPE_APPLICATON_TRANS,       "Application transport"},
433   { 0,                                 NULL}};
434
435 static const value_string ansi_isup_parameter_type_value[] = {
436 { PARAM_TYPE_END_OF_OPT_PARAMS,        "End of optional parameters"},
437   { PARAM_TYPE_CALL_REF,               "Call Reference (national use)"},
438   { PARAM_TYPE_TRANSM_MEDIUM_REQU,     "Transmission medium requirement"},
439   { PARAM_TYPE_ACC_TRANSP,             "Access transport"},
440   { PARAM_TYPE_CALLED_PARTY_NR,        "Called party number"},
441   { PARAM_TYPE_SUBSQT_NR,              "Subsequent number"},
442   { PARAM_TYPE_NATURE_OF_CONN_IND,     "Nature of connection indicators"},
443   { PARAM_TYPE_FORW_CALL_IND,          "Forward call indicators"},
444   { PARAM_TYPE_OPT_FORW_CALL_IND,      "Optional forward call indicators"},
445   { PARAM_TYPE_CALLING_PRTY_CATEG,     "Calling party's category"},
446   { PARAM_TYPE_CALLING_PARTY_NR,       "Calling party number"},
447   { PARAM_TYPE_REDIRECTING_NR,         "Redirecting number"},
448   { PARAM_TYPE_REDIRECTION_NR,         "Redirection number"},
449   { PARAM_TYPE_CONNECTION_REQ,         "Connection request"},
450   { PARAM_TYPE_INFO_REQ_IND,           "Information request indicators (national use)"},
451   { PARAM_TYPE_INFO_IND,               "Information indicators (national use)"},
452   { PARAM_TYPE_CONTINUITY_IND,         "Continuity request"},
453   { PARAM_TYPE_BACKW_CALL_IND,         "Backward call indicators"},
454   { PARAM_TYPE_CAUSE_INDICATORS,       "Cause indicators"},
455   { PARAM_TYPE_REDIRECTION_INFO,       "Redirection information"},
456   { PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE,   "Circuit group supervision message type"},
457   { PARAM_TYPE_RANGE_AND_STATUS,       "Range and Status"},
458   { PARAM_TYPE_FACILITY_IND,           "Facility indicator"},
459   { PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD,  "Closed user group interlock code"},
460   { PARAM_TYPE_USER_SERVICE_INFO,      "User service information"},
461   { PARAM_TYPE_SIGNALLING_POINT_CODE,  "Signalling point code (national use)"},
462   { PARAM_TYPE_USER_TO_USER_INFO,      "User-to-user information"},
463   { PARAM_TYPE_CONNECTED_NR,           "Connected number"},
464   { PARAM_TYPE_SUSP_RESUME_IND,        "Suspend/Resume indicators"},
465   { PARAM_TYPE_TRANSIT_NETW_SELECT,    "Transit network selection (national use)"},
466   { PARAM_TYPE_EVENT_INFO,             "Event information"},
467   { PARAM_TYPE_CIRC_ASSIGN_MAP,        "Circuit assignment map"},
468   { PARAM_TYPE_CIRC_STATE_IND,         "Circuit state indicator (national use)"},
469   { PARAM_TYPE_AUTO_CONG_LEVEL,        "Automatic congestion level"},
470   { PARAM_TYPE_ORIG_CALLED_NR,         "Original called number"},
471   { PARAM_TYPE_OPT_BACKW_CALL_IND,     "Backward call indicators"},
472   { PARAM_TYPE_USER_TO_USER_IND,       "User-to-user indicators"},
473   { PARAM_TYPE_ORIG_ISC_POINT_CODE,    "Origination ISC point code"},
474   { PARAM_TYPE_GENERIC_NOTIF_IND,      "Generic notification indicator"},
475   { PARAM_TYPE_CALL_HIST_INFO,         "Call history information"},
476   { PARAM_TYPE_ACC_DELIV_INFO,         "Access delivery information"},
477   { PARAM_TYPE_NETW_SPECIFIC_FACLTY,   "Network specific facility (national use)"},
478   { PARAM_TYPE_USER_SERVICE_INFO_PR,   "User service information prime"},
479   { PARAM_TYPE_PROPAG_DELAY_COUNTER,   "Propagation delay counter"},
480   { PARAM_TYPE_REMOTE_OPERATIONS,      "Remote operations (national use)"},
481   { PARAM_TYPE_SERVICE_ACTIVATION,     "Service activation"},
482   { PARAM_TYPE_USER_TELESERV_INFO,     "User teleservice information"},
483   { PARAM_TYPE_TRANSM_MEDIUM_USED,     "Transmission medium used"},
484   { PARAM_TYPE_CALL_DIV_INFO,          "Call diversion information"},
485   { PARAM_TYPE_ECHO_CTRL_INFO,         "Echo control information"},
486   { PARAM_TYPE_MSG_COMPAT_INFO,        "Message compatibility information"},
487   { PARAM_TYPE_PARAM_COMPAT_INFO,      "Parameter compatibility information"},
488   { PARAM_TYPE_MLPP_PRECEDENCE,        "MLPP precedence"},
489   { PARAM_TYPE_MCID_REQ_IND,           "MCID request indicators"},
490   { PARAM_TYPE_MCID_RSP_IND,           "MCID response indicators"},
491   { PARAM_TYPE_HOP_COUNTER,            "Hop counter"},
492   { PARAM_TYPE_ORIG_LINE_INFO,         "Originating line info"},
493   { PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR,  "Transmission medium requirement prime"},
494   { PARAM_TYPE_LOCATION_NR,            "Location number"},
495   { PARAM_TYPE_REDIR_NR_RSTRCT,        "Redirection number restriction"},
496   { PARAM_TYPE_CALL_TRANS_REF,         "Call transfer reference"},
497   { PARAM_TYPE_LOOP_PREV_IND,          "Loop prevention indicators"},
498   { PARAM_TYPE_CALL_TRANS_NR,          "Call transfer number"},
499   { PARAM_TYPE_CCSS,                   "CCSS"},
500   { PARAM_TYPE_FORW_GVNS,              "Forward GVNS"},
501   { PARAM_TYPE_BACKW_GVNS,             "Backward GVNS"},
502   { PARAM_TYPE_REDIRECT_CAPAB,         "Redirect capability (reserved for national use)"},
503   { PARAM_TYPE_NETW_MGMT_CTRL,         "Network management controls"},
504   { PARAM_TYPE_CORRELATION_ID,         "Correlation id"},
505   { PARAM_TYPE_SCF_ID,                 "SCF id"},
506   { PARAM_TYPE_CALL_DIV_TREAT_IND,     "Call diversion treatment indicators"},
507   { PARAM_TYPE_CALLED_IN_NR,           "Called IN number"},
508   { PARAM_TYPE_CALL_OFF_TREAT_IND,     "Call offering treatment indicators"},
509   { PARAM_TYPE_CHARGED_PARTY_IDENT,    "Charged party identification (national use)"},
510   { PARAM_TYPE_CONF_TREAT_IND,         "Conference treatment indicators"},
511   { PARAM_TYPE_DISPLAY_INFO,           "Display information"},
512   { PARAM_TYPE_UID_ACTION_IND,         "UID action indicators"},
513   { PARAM_TYPE_UID_CAPAB_IND,          "UID capability indicators"},
514   { PARAM_TYPE_REDIRECT_COUNTER,       "Redirect counter (reserved for national use)"},
515   { PARAM_TYPE_COLLECT_CALL_REQ,       "Collect call request"},
516   { PARAM_TYPE_CALLING_GEODETIC_LOCATION,       "Calling geodetic location"},
517   { PARAM_TYPE_GENERIC_NR,             "Generic number"},
518   { PARAM_TYPE_JURISDICTION,           "Jurisdiction"},
519   { PARAM_TYPE_GENERIC_NAME,           "Generic name"},
520   { PARAM_TYPE_GENERIC_DIGITS,         "Generic digits (national use)"},
521   { PARAM_TYPE_APPLICATON_TRANS,       "Application transport"},
522   { ANSI_ISUP_PARAM_TYPE_OPER_SERV_INF, "Operator Services information"},
523   { ANSI_ISUP_PARAM_TYPE_EGRESS,                "Egress"},
524   { ANSI_ISUP_PARAM_TYPE_JURISDICTION,  "Jurisdiction"},
525   { ANSI_ISUP_PARAM_TYPE_CARRIER_ID,    "Carrier identification"},
526   { ANSI_ISUP_PARAM_TYPE_BUSINESS_GRP,  "Business group"},
527   { ANSI_ISUP_PARAM_TYPE_GENERIC_NAME,  "Generic name"},
528   { ANSI_ISUP_PARAM_TYPE_NOTIF_IND,             "Notification indicator"},
529   { ANSI_ISUP_PARAM_TYPE_CG_CHAR_IND,   "Circuit group characteristic indicator"},
530   { ANSI_ISUP_PARAM_TYPE_CVR_RESP_IND,  "Circuit validation response indicator"},
531   { ANSI_ISUP_PARAM_TYPE_OUT_TRK_GRP_NM,"Outgoing trunk group number"},
532   { ANSI_ISUP_PARAM_TYPE_CI_NAME_IND,   "Circuit identification name"},
533   { ANSI_ISUP_PARAM_CLLI_CODE,                  "COMMON LANGUAGE location identification (CLLI) code"},
534   { ANSI_ISUP_PARAM_ORIG_LINE_INF,              "Originating line information"},
535   { ANSI_ISUP_PARAM_CHRG_NO,                    "Charge number"},
536   { ANSI_ISUP_PARAM_SERV_CODE_IND,              "Service code indicator"},
537   { ANSI_ISUP_PARAM_SPEC_PROC_REQ,              "Special processing request"},
538   { ANSI_ISUP_PARAM_CARRIER_SEL_INF,    "Carrier selection information"},
539   { ANSI_ISUP_PARAM_NET_TRANS,                  "Network transport"},
540   { 0,                                 NULL}};
541
542 #define CIC_LENGTH                             2
543 #define BICC_CIC_LENGTH                        4
544 #define MESSAGE_TYPE_LENGTH                    1
545 #define COMMON_HEADER_LENGTH                   (CIC_LENGTH + MESSAGE_TYPE_LENGTH)
546 #define BICC_COMMON_HEADER_LENGTH              (BICC_CIC_LENGTH + MESSAGE_TYPE_LENGTH)
547
548 #define MAXDIGITS                              32 /* Max number of address digits */
549 #define MAXGNAME                               15 /* Max number of characters in generic name */
550
551 #define PARAMETER_TYPE_LENGTH                  1
552 #define PARAMETER_POINTER_LENGTH               1
553 #define PARAMETER_LENGTH_IND_LENGTH            1
554
555 /* All following parameter length definitions are WITHOUT the parameter type byte and length indicator for optional parameters*/
556 #define PARAMETER_NAME_LENGTH                  1
557 #define PARAMETER_LENGTH_IND_LENGTH            1
558 #define ACCESS_DELIVERY_INFO_LENGTH            1
559 #define AUTO_CONGEST_LEVEL_LENGTH              1
560 #define BACKWARD_CALL_IND_LENGTH               2
561 #define BACKWARD_GVNS_LENGTH                   1
562 #define CALL_DIV_INFO_LENGTH                   1
563 #define CALL_DIV_TREATMENT_IND_LENGTH          1
564 #define CALL_HISTORY_INFO_LENGTH               2
565 #define CALL_OFFERING_TREATMENT_IND_LENGTH     1
566 #define CALL_REFERENCE_LENGTH                  5
567 #define CALL_TRANSFER_REF_LENGTH               1
568 #define CALLING_PRTYS_CATEGORY_LENGTH          1
569 #define CCSS_LENGTH                            1
570 #define CIRCUIT_ASSIGNMENT_MAP_LENGTH          5
571 #define CIRC_GRP_SV_MSG_TYPE_LENGTH            1
572 #define CLOSED_USR_GRP_INTERLOCK_CODE_LENGTH   4
573 #define COLLECT_CALL_REQUEST_LENGTH            1
574 #define CONFERENCE_TREATMENT_IND_LENGTH        1
575 #define CONNECTION_REQUEST_LENGTH              7
576 #define CONTINUITY_IND_LENGTH                  1
577 #define ECHO_CONTROL_INFO_LENGTH               1
578 #define END_OF_OPT_PART_LENGTH                 1
579 #define EVENT_INFO_LENGTH                      1
580 #define FACILITY_IND_LENGTH                    1
581 #define FORWARD_CALL_IND_LENGTH                2
582 #define GENERIC_NOTIFICATION_IND_LENGTH        1
583 #define HOP_COUNTER_LENGTH                     1
584 #define ORIG_LINE_INFO_LENGTH                  1
585 #define INFO_IND_LENGTH                        2
586 #define INFO_REQUEST_IND_LENGTH                2
587 #define LOOP_PREVENTION_IND_LENGTH             1
588 #define MCID_REQUEST_IND_LENGTH                1
589 #define MCID_RESPONSE_IND_LENGTH               1
590 #define MLPP_PRECEDENCE_LENGTH                 1
591 #define NATURE_OF_CONNECTION_IND_LENGTH        1
592 #define NETWORK_MANAGEMENT_CONTROLS_LENGTH     1
593 #define OPTIONAL_BACKWARD_CALL_IND_LENGTH      1
594 #define OPTIONAL_FORWARD_CALL_IND_LENGTH       1
595 #define ORIGINAL_ISC_POINT_CODE_LENGTH         2
596 #define PROPAGATION_DELAY_COUNT_LENGTH         2
597 #define REDIRECTION_NUMBER_LENGTH              2
598 #define REDIRECTION_INFO_LENGTH                2
599 #define REDIRECTION_NUMBER_RESTRICTION_LENGTH  1
600 #define SIGNALLING_POINT_CODE_LENGTH           2
601 #define SUSPEND_RESUME_IND_LENGTH              1
602 #define TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH 1
603 #define TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH  1
604 #define TRANSMISSION_MEDIUM_USED_LENGTH        1
605 #define UID_ACTION_IND_LENGTH                  1
606 #define UID_CAPABILITY_IND_LENGTH              1
607 #define USER_TELESERVICE_INFO_LENGTH           2
608 #define USER_TO_USER_IND_LENGTH                1
609 #define RANGE_LENGTH                           1
610
611 #define CVR_RESP_IND_LENGTH                                             1
612 #define CG_CHAR_IND_LENGTH                                              1
613 #define CI_NAME_IND                                                             28
614 #define CLLI_CODE_LENGTH                                                13
615
616 #define CALL_ID_LENGTH        3 /* for parameter Call Reference */
617 #define SPC_LENGTH            2 /* for parameter Call Reference, Connection request */
618 #define LOCAL_REF_LENGTH      3 /* for parameter Connection request */
619 #define PROTOCOL_CLASS_LENGTH 1 /* for parameter Connection request */
620 #define CREDIT_LENGTH         1 /* for parameter Connection request */
621
622 #define CIC_OFFSET            0
623 #define BICC_CIC_OFFSET       0
624
625 #define NO_SATELLITE_CIRCUIT_IN_CONNECTION   0
626 #define ONE_SATELLITE_CIRCUIT_IN_CONNECTION  1
627 #define TWO_SATELLITE_CIRCUIT_IN_CONNECTION  2
628 static const value_string isup_satellite_ind_value[] = {
629   { NO_SATELLITE_CIRCUIT_IN_CONNECTION,          "No Satellite circuit in connection"},
630   { ONE_SATELLITE_CIRCUIT_IN_CONNECTION,         "One Satellite circuit in connection"},
631   { TWO_SATELLITE_CIRCUIT_IN_CONNECTION,         "Two Satellite circuits in connection"},
632   { 0,                                 NULL}};
633
634 #define CONTINUITY_CHECK_NOT_REQUIRED           0
635 #define CONTINUITY_CHECK_REQUIRED               1
636 #define CONTINUITY_CHECK_ON_A_PREVIOUS_CIRCUIT  2
637 static const value_string isup_continuity_check_ind_value[] = {
638   { CONTINUITY_CHECK_NOT_REQUIRED,               "Continuity check not required"},
639   { CONTINUITY_CHECK_REQUIRED,                   "Continuity check required on this circuit"},
640   { CONTINUITY_CHECK_ON_A_PREVIOUS_CIRCUIT ,     "Continuity check performed on a previous circuit"},
641   { 0,                                 NULL}};
642
643 static const true_false_string isup_echo_control_device_ind_value = {
644   "Echo control device included",
645   "Echo control device not included"
646 };
647
648 static const true_false_string isup_natnl_inatnl_call_ind_value = {
649   "Call to be treated as international call",
650   "Call to be treated as national call"
651 };
652
653 #define NO_END_TO_END_METHOD_AVAILABLE       0
654 #define PASS_ALONG_METHOD_AVAILABLE          1
655 #define SCCP_METHOD_AVAILABLE                2
656 #define PASS_ALONG_AND_SCCP_METHOD_AVAILABLE 3
657 static const value_string isup_end_to_end_method_ind_value[] = {
658   { NO_END_TO_END_METHOD_AVAILABLE,          "No End-to-end method available (only link-by-link method available)"},
659   { PASS_ALONG_METHOD_AVAILABLE,             "Pass-along method available (national use)"},
660   { SCCP_METHOD_AVAILABLE,                   "SCCP method available"},
661   { PASS_ALONG_AND_SCCP_METHOD_AVAILABLE,    "pass-along and SCCP method available (national use)"},
662   { 0,                                 NULL}};
663
664 static const true_false_string isup_interworking_ind_value = {
665   "interworking encountered",
666   "no interworking encountered (No.7 signalling all the way)"
667 };
668
669 static const true_false_string isup_end_to_end_info_ind_value = {
670   "end-to-end information available",
671   "no end-to-end information available"
672 };
673
674 static const true_false_string isup_ISDN_user_part_ind_value = {
675   "ISDN user part used all the way",
676   "ISDN user part not used all the way"
677 };
678
679 #define ISUP_PREFERRED_ALL_THE_WAY              0
680 #define ISUP_NOT_REQUIRED_ALL_THE_WAY           1
681 #define ISUP_REQUIRED_ALL_WAY                   2
682 #define ISUP_ISDN_USER_PART_IND_SPARE           3
683 static const value_string isup_preferences_ind_value[] = {
684   { ISUP_PREFERRED_ALL_THE_WAY,                  "ISDN user part preferred all the way"},
685   { ISUP_NOT_REQUIRED_ALL_THE_WAY,               "ISDN user part not required all the way"},
686   { ISUP_REQUIRED_ALL_WAY,                       "ISDN user part required all the way"},
687   { ISUP_ISDN_USER_PART_IND_SPARE,               "spare"},
688   { 0,                                 NULL}};
689
690 static const true_false_string isup_ISDN_originating_access_ind_value = {
691   "originating access ISDN",
692   "originating access non-ISDN"
693 };
694
695 static const true_false_string isup_ISDN_ported_num_trans_ind_value = {
696   "number translated",
697   "number not translated"
698 };
699
700 static const true_false_string isup_ISDN_qor_attempt_ind_value = {
701   "QoR routing attempt in progress",
702   "no QoR routing attempt in progress"
703 };
704
705 #define NO_INDICATION                                0
706 #define CONNECTIONLESS_METHOD_AVAILABLE              1
707 #define CONNECITON_ORIENTED_METHOD_AVAILABLE         2
708 #define CONNECTIONLESS_AND_ORIENTED_METHOD_AVAILABLE 3
709 static const value_string isup_SCCP_method_ind_value[] = {
710   { NO_INDICATION,                                  "No indication"},
711   { CONNECTIONLESS_METHOD_AVAILABLE,                "Connectionless method available (national use)"},
712   { CONNECITON_ORIENTED_METHOD_AVAILABLE,           "Connection oriented method available"},
713   { CONNECTIONLESS_AND_ORIENTED_METHOD_AVAILABLE,   "Connectionless and -oriented method available (national use)"},
714   { 0,                                 NULL}};
715
716 #define UNKNOWN_AT_THIS_TIME                 0
717 #define OPERATOR_FRENCH                      1
718 #define OPERATOR_ENGLISH                     2
719 #define OPERATOR_GERMAN                      3
720 #define OPERATOR_RUSSIAN                     4
721 #define OPERATOR_SPANISH                     5
722 #define ORDINARY_CALLING_SUBSCRIBER         10
723 #define CALLING_SUBSCRIBER_WITH_PRIORITY    11
724 #define DATA_CALL                           12
725 #define TEST_CALL                           13
726 #define PAYPHONE                            15
727 const value_string isup_calling_partys_category_value[] = {
728   { UNKNOWN_AT_THIS_TIME,               "Category unknown at this time (national use)"},
729   { OPERATOR_FRENCH,                    "operator, language French"},
730   { OPERATOR_ENGLISH,                   "operator, language English"},
731   { OPERATOR_GERMAN,                    "operator, language German"},
732   { OPERATOR_RUSSIAN,                   "operator, language Russian"},
733   { OPERATOR_SPANISH,                   "operator, language Spanish"},
734   { ORDINARY_CALLING_SUBSCRIBER,        "ordinary calling subscriber"},
735   { CALLING_SUBSCRIBER_WITH_PRIORITY,   "calling subscriber with priority"},
736   { DATA_CALL,                          "data call (voice band data)"},
737   { TEST_CALL,                          "test call"},
738   /* q.763-200212Amd2 */
739   { 14,                                                                 "IEPS call marking for preferential call set up"},
740   { PAYPHONE,                           "payphone"},
741   { 0,                                 NULL}};
742
743 #define CVR_RSP_IND_FAILURE             0
744 #define CVR_RSP_IND_SUCCESS             1
745
746 const value_string isup_cvr_rsp_ind_value[ ] = {
747         { CVR_RSP_IND_FAILURE, "CVR Response Fail" },
748         { CVR_RSP_IND_SUCCESS, "CVR Response Success" },
749         { 0,                                    NULL }
750 };
751
752 #define CVR_CG_IND_DOUBLE_SEIZE_NONE 0
753 #define CVR_CG_IND_DOUBLE_SEIZE_ODD  1
754 #define CVR_CG_IND_DOUBLE_SEIZE_EVEN 2
755 #define CVR_CG_IND_DOUBLE_SEIZE_ALL  3
756
757 const value_string isup_cvr_cg_double_seize_value[ ] = {
758         { CVR_CG_IND_DOUBLE_SEIZE_NONE, "Double Seize control NONE" },
759         { CVR_CG_IND_DOUBLE_SEIZE_ODD, "Double Seize control odd circuits"},
760         { CVR_CG_IND_DOUBLE_SEIZE_EVEN, "Double Seize control even circuits"},
761         { CVR_CG_IND_DOUBLE_SEIZE_ALL, "Double Seize control all circuits"},
762         {0, NULL }
763 };
764
765 #define CVR_CG_IND_CAR_IND_UNKNOWN              0
766 #define CVR_CG_IND_CAR_IND_ANALOG               1
767 #define CVR_CG_IND_CAR_IND_DIGITAL              2
768 #define CVR_CG_IND_CAR_IND_ANALOG_DIG   3
769
770 const value_string isup_cvr_cg_car_ind_value[ ] = {
771 { CVR_CG_IND_CAR_IND_UNKNOWN   , "Carrier Type Unknown" },
772 { CVR_CG_IND_CAR_IND_ANALOG    ,   "Carrier Type Analog" },
773 { CVR_CG_IND_CAR_IND_DIGITAL   ,   "Carrier Type Digital"},
774 { CVR_CG_IND_CAR_IND_ANALOG_DIG, "Carrier Type Digital And Analog"},
775 { 0, NULL }
776 };
777
778 #define CVR_CG_IND_ALARM_CAR_IND_UNKNOWN        0
779 #define CVR_CG_IND_ALARM_CAR_IND_SOFTWARE       1
780 #define CVR_CG_IND_ALARM_CAR_IND_HARDWARE       2
781 #define CVR_CG_IND_ALARM_CAR_IND_SPARE          3
782
783 const value_string isup_cvr_alarm_car_ind_value[ ] = {
784         { CVR_CG_IND_ALARM_CAR_IND_UNKNOWN    , "Alarm Carrier Ind Default"},
785         { CVR_CG_IND_ALARM_CAR_IND_SOFTWARE   , "Alarm Carrier Ind Software"},
786         { CVR_CG_IND_ALARM_CAR_IND_HARDWARE   , "Alarm Carrier Ind Hardware"},
787         { CVR_CG_IND_ALARM_CAR_IND_SPARE          , "Alarm Carrier Ind Spare"},
788         { 0, NULL }
789 };
790
791 #define CVR_CG_IND_CONT_CHK_UNKNOWN  0
792 #define CVR_CG_IND_CONT_CHK_NONE         1
793 #define CVR_CG_IND_CONT_CHK_STAT         2
794 #define CVR_CG_IND_CONT_CHK_PER_CALL 3
795
796 const value_string isup_cvr_cont_chk_ind_value[ ] = {
797
798         { CVR_CG_IND_CONT_CHK_UNKNOWN  , "Continuity Check Unknown"},
799         { CVR_CG_IND_CONT_CHK_NONE     , "Continuity Check NONE"},
800         { CVR_CG_IND_CONT_CHK_STAT     ,"Continuity Check Statistical"},
801         { CVR_CG_IND_CONT_CHK_PER_CALL  ,"Continuity Check Per Call"},
802         { 0, NULL }
803 };
804
805 #define MEDIUM_SPEECH                        0
806 #define MEDIUM_64KBS                         2
807 #define MEDIUM_3_1_KHZ_AUDIO                 3
808 #define MEDIUM_RESERVED_SERVICE2_1           4
809 #define MEDIUM_RESERVED_SERVICE1_2           5
810 #define MEDIUM_64KBS_PREFERRED               6
811 #define MEDIUM_2_64KBS                       7
812 #define MEDIUM_384KBS                        8
813 #define MEDIUM_1536KBS                       9
814 #define MEDIUM_1920KBS                      10
815 #define MEDIUM_3_64KBS                      16
816 #define MEDIUM_4_64KBS                      17
817 #define MEDIUM_5_64KBS                      18
818 #define MEDIUM_7_64KBS                      20
819 #define MEDIUM_8_64KBS                      21
820 #define MEDIUM_9_64KBS                      22
821 #define MEDIUM_10_64KBS                     23
822 #define MEDIUM_11_64KBS                     24
823 #define MEDIUM_12_64KBS                     25
824 #define MEDIUM_13_64KBS                     26
825 #define MEDIUM_14_64KBS                     27
826 #define MEDIUM_15_64KBS                     28
827 #define MEDIUM_16_64KBS                     29
828 #define MEDIUM_17_64KBS                     30
829 #define MEDIUM_18_64KBS                     31
830 #define MEDIUM_19_64KBS                     32
831 #define MEDIUM_20_64KBS                     33
832 #define MEDIUM_21_64KBS                     34
833 #define MEDIUM_22_64KBS                     35
834 #define MEDIUM_23_64KBS                     36
835 #define MEDIUM_25_64KBS                     38
836 #define MEDIUM_26_64KBS                     39
837 #define MEDIUM_27_64KBS                     40
838 #define MEDIUM_28_64KBS                     41
839 #define MEDIUM_29_64KBS                     42
840
841 const value_string isup_transmission_medium_requirement_value[] = {
842   { MEDIUM_SPEECH,                       "speech"},
843   { MEDIUM_64KBS,                        "64 kbit/s unrestricted"},
844   { MEDIUM_3_1_KHZ_AUDIO,                "3.1 kHz audio"},
845   { MEDIUM_RESERVED_SERVICE2_1,          "reserved for alternate speech (service 2)/64 kbit/s unrestricted (service 1)"},
846   { MEDIUM_RESERVED_SERVICE1_2,          "reserved for alternate 64 kbit/s unrestricted (service 1)/speech (service 2)"},
847   { MEDIUM_64KBS_PREFERRED,              "64 kbit/s preferred"},
848   { MEDIUM_2_64KBS,                      "2x64 kbit/s unrestricted"},
849   { MEDIUM_384KBS,                       "384 kbit/s unrestricted"},
850   { MEDIUM_1536KBS,                      "1536 kbit/s unrestricted"},
851   { MEDIUM_1920KBS,                      "1920 kbit/s unrestricted"},
852   { MEDIUM_3_64KBS,                      "3x64 kbit/s unrestricted"},
853   { MEDIUM_4_64KBS,                      "4x64 kbit/s unrestricted"},
854   { MEDIUM_5_64KBS,                      "5x64 kbit/s unrestricted"},
855   { MEDIUM_7_64KBS,                      "7x64 kbit/s unrestricted"},
856   { MEDIUM_8_64KBS,                      "8x64 kbit/s unrestricted"},
857   { MEDIUM_9_64KBS,                      "9x64 kbit/s unrestricted"},
858   { MEDIUM_10_64KBS,                     "10x64 kbit/s unrestricted"},
859   { MEDIUM_11_64KBS,                     "11x64 kbit/s unrestricted"},
860   { MEDIUM_12_64KBS,                     "12x64 kbit/s unrestricted"},
861   { MEDIUM_13_64KBS,                     "13x64 kbit/s unrestricted"},
862   { MEDIUM_14_64KBS,                     "14x64 kbit/s unrestricted"},
863   { MEDIUM_15_64KBS,                     "15x64 kbit/s unrestricted"},
864   { MEDIUM_16_64KBS,                     "16x64 kbit/s unrestricted"},
865   { MEDIUM_17_64KBS,                     "17x64 kbit/s unrestricted"},
866   { MEDIUM_18_64KBS,                     "18x64 kbit/s unrestricted"},
867   { MEDIUM_19_64KBS,                     "19x64 kbit/s unrestricted"},
868   { MEDIUM_20_64KBS,                     "20x64 kbit/s unrestricted"},
869   { MEDIUM_21_64KBS,                     "21x64 kbit/s unrestricted"},
870   { MEDIUM_22_64KBS,                     "22x64 kbit/s unrestricted"},
871   { MEDIUM_23_64KBS,                     "23x64 kbit/s unrestricted"},
872   { MEDIUM_25_64KBS,                     "25x64 kbit/s unrestricted"},
873   { MEDIUM_26_64KBS,                     "26x64 kbit/s unrestricted"},
874   { MEDIUM_27_64KBS,                     "27x64 kbit/s unrestricted"},
875   { MEDIUM_28_64KBS,                     "28x64 kbit/s unrestricted"},
876   { MEDIUM_29_64KBS,                     "29x64 kbit/s unrestricted"},
877   { 0,                                 NULL}};
878 static const value_string isup_transmission_medium_requirement_prime_value[] = {
879   { MEDIUM_SPEECH,                       "speech"},
880   { MEDIUM_64KBS,                        "reserved for 64 kbit/s unrestricted"},
881   { MEDIUM_3_1_KHZ_AUDIO,                "3.1 kHz audio"},
882   { MEDIUM_RESERVED_SERVICE2_1,          "reserved for alternate speech (service 2)/64 kbit/s unrestricted (service 1)"},
883   { MEDIUM_RESERVED_SERVICE1_2,          "reserved for alternate 64 kbit/s unrestricted (service 1)/speech (service 2)"},
884   { MEDIUM_64KBS_PREFERRED,              "reserved for 64 kbit/s preferred"},
885   { MEDIUM_2_64KBS,                      "reserved for 2x64 kbit/s unrestricted"},
886   { MEDIUM_384KBS,                       "reserved for 384 kbit/s unrestricted"},
887   { MEDIUM_1536KBS,                      "reserved for 1536 kbit/s unrestricted"},
888   { MEDIUM_1920KBS,                      "reserved for 1920 kbit/s unrestricted"},
889   { 0,                                 NULL}};
890
891
892 /* Definitions for Called and Calling Party number */
893 #define ISUP_ODD_EVEN_MASK                       0x80
894 #define ISUP_NATURE_OF_ADDRESS_IND_MASK          0x7F
895 #define ISUP_INN_MASK                            0x80
896 #define ISUP_NI_MASK                             0x80
897 #define ISUP_NUMBERING_PLAN_IND_MASK             0x70
898 #define ISUP_ADDRESS_PRESENTATION_RESTR_IND_MASK 0x0C
899 #define ISUP_SCREENING_IND_MASK                  0x03
900 #define ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK       0x0F
901 #define ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK      0xF0
902
903 static const true_false_string isup_odd_even_ind_value = {
904   "odd number of address signals",
905   "even number of address signals"
906 };
907
908 #define ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR  1
909 #define ISUP_CALLED_PARTY_NATURE_UNKNOWN        2
910 #define ISUP_CALLED_PARTY_NATURE_NATIONAL_NR    3
911 #define ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR  4
912 #define ISUP_CALLED_PARTY_NATURE_NETW_SPEC_NR   5
913
914 #define ISUP_CHARGE_NATURE_ANI_CGPA_SUB_NR              1
915 #define ISUP_CHARGE_NATURE_ANI_NA                               2
916 #define ISUP_CHARGE_NATURE_ANI_CGPA_NAT_NR              3
917 #define ISUP_CHARGE_NATURE_ANI_CDPA_SUB_NR              5
918 #define ISUP_CHARGE_NATURE_ANI_CDPA_NO_NR               6
919 #define ISUP_CHARGE_NATURE_ANI_CDPA_NAT_NR              7
920
921 static const value_string isup_called_party_nature_of_address_ind_value[] = {
922   { ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR,     "subscriber number (national use)"},
923   { ISUP_CALLED_PARTY_NATURE_UNKNOWN,           "unknown (national use)"},
924   { ISUP_CALLED_PARTY_NATURE_NATIONAL_NR,       "national (significant) number"},
925   { ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR,     "international number"},
926   { ISUP_CALLED_PARTY_NATURE_NETW_SPEC_NR,      "network-specific number (national use)"},
927   { 0,                                 NULL}};
928
929 static const value_string isup_calling_party_nature_of_address_ind_value[] = {
930   { ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR,     "subscriber number (national use)"},
931   { ISUP_CALLED_PARTY_NATURE_UNKNOWN,           "unknown (national use)"},
932   { ISUP_CALLED_PARTY_NATURE_NATIONAL_NR,       "national (significant) number"},
933   { ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR,     "international number"},
934   { 0,                                 NULL}};
935
936 static const value_string isup_charge_number_nature_of_address_ind_value[] = {
937   { ISUP_CHARGE_NATURE_ANI_CGPA_SUB_NR,         "ANI of the calling party; subscriber number"},
938   { ISUP_CHARGE_NATURE_ANI_NA,                          "ANI not available or not provided"},
939   { ISUP_CHARGE_NATURE_ANI_CGPA_NAT_NR,     "ANI of the calling party; national number"},
940   { ISUP_CHARGE_NATURE_ANI_CDPA_SUB_NR,     "ANI of the called party; subscriber number"},
941   { ISUP_CHARGE_NATURE_ANI_CDPA_NO_NR,          "ANI of the called party; no number present"},
942   { ISUP_CHARGE_NATURE_ANI_CDPA_NAT_NR,     "ANI of the called party; national number"},
943   { 0,                                 NULL}};
944
945 #define ISUP_GENERIC_NAME_PRESENTATION_ALLOWED          0
946 #define ISUP_GENERIC_NAME_PRESENTATION_RESTRICT         1
947 #define ISUP_GENERIC_NAME_PRESENTATION_BLOCK_TOGGLE     2
948 #define ISUP_GENERIC_NAME_PRESENTATION_NO_INDIC         3
949 #define ISUP_GENERIC_NAME_TYPE_SPARE                            0
950 #define ISUP_GENERIC_NAME_TYPE_CALLING                          1
951 #define ISUP_GENERIC_NAME_TYPE_ORIG_CALLED                      2
952 #define ISUP_GENERIC_NAME_TYPE_REDIRECTING                      3
953 #define ISUP_GENERIC_NAME_TYPE_CONNECTED                        4
954
955 static const value_string isup_generic_name_presentation_value[] = {
956   { ISUP_GENERIC_NAME_PRESENTATION_ALLOWED,                     "presentation allowed"},
957   { ISUP_GENERIC_NAME_PRESENTATION_RESTRICT,            "presentation restricted"},
958   { ISUP_GENERIC_NAME_PRESENTATION_BLOCK_TOGGLE,        "blocking toggle"},
959   { ISUP_GENERIC_NAME_PRESENTATION_NO_INDIC,            "no indication"},
960   { 0,                                 NULL}};
961
962 static const true_false_string isup_generic_name_availability_value = {
963   "name not available",
964   "name available/unknown"
965 };
966
967 static const value_string isup_generic_name_type_value[] = {
968   { ISUP_GENERIC_NAME_TYPE_SPARE,                       "spare"},
969   { ISUP_GENERIC_NAME_TYPE_CALLING,                     "calling name"},
970   { ISUP_GENERIC_NAME_TYPE_ORIG_CALLED,         "original called name"},
971   { ISUP_GENERIC_NAME_TYPE_REDIRECTING,         "redirecting name"},
972   { ISUP_GENERIC_NAME_TYPE_CONNECTED,           "connected name"},
973   { 5,                                                                          "spare"},
974   { 6,                                                                          "spare"},
975   { 7,                                                                          "spare"},
976   { 0,                                 NULL}};
977
978 static const true_false_string isup_INN_ind_value = {
979   "routing to internal network number not allowed",
980   "routing to internal network number allowed "
981 };
982 static const true_false_string isup_NI_ind_value = {
983   "incomplete",
984   "complete"
985 };
986
987 static const value_string isup_location_presentation_restricted_ind_value[] = {
988   { 0,                                 "presentation allowed"},
989   { 1,                                 "presentation restricted"},
990   { 2,                                 "location not available"},
991   { 3,                                 "spare"},
992   { 0,                                 NULL}};
993
994 static const value_string isup_location_type_of_shape_value[] = {
995   { 0,          "ellipsoid point"},
996   { 1,          "ellipsoid point with uncertainty"},
997   { 2,          "point with altitude and uncertainty"},
998   { 3,          "ellipse on the ellipsoid"},
999   { 4,          "ellipsoid circle sector"},
1000   { 5,          "polygon"},
1001   { 0,          NULL}};
1002
1003 #define ISDN_NUMBERING_PLAN                     1
1004 #define DATA_NUMBERING_PLAN                     3
1005 #define TELEX_NUMBERING_PLAN                    4
1006 static const value_string isup_numbering_plan_ind_value[] = {
1007   { ISDN_NUMBERING_PLAN,     "ISDN (Telephony) numbering plan"},
1008   { DATA_NUMBERING_PLAN,     "Data numbering plan (national use)"},
1009   { TELEX_NUMBERING_PLAN,    "Telex numbering plan (national use)"},
1010   { 5,                       "Reserved for national use"},
1011   { 6,                       "Reserved for national use"},
1012   { 0,                                 NULL}};
1013
1014 #define ADDRESS_PRESETATION_ALLOWED      0
1015 #define ADDRESS_PRESETATION_RESTRICTED   1
1016 #define ADDRESS_NOT_AVAILABLE            2
1017 static const value_string isup_address_presentation_restricted_ind_value[] = {
1018   { ADDRESS_PRESETATION_ALLOWED,     "presentation allowed"},
1019   { ADDRESS_PRESETATION_RESTRICTED,  "presentation restricted"},
1020   { ADDRESS_NOT_AVAILABLE,           "address not available (national use)"},
1021   { 3,                                 "spare"},
1022   { 0,                                 NULL}};
1023
1024 static const value_string isup_screening_ind_value[] = {
1025   { 0,     "reserved"},
1026   { 1,     "user provided, verified and passed"},
1027   { 2,     "reserved"},
1028   { 3,     "network provided"},
1029   { 0,     NULL}};
1030
1031 static const value_string isup_screening_ind_enhanced_value[] = {
1032   { 0,     "user provided, not verified"},
1033   { 1,     "user provided, verified and passed"},
1034   { 2,     "user provided, verified and failed"},
1035   { 3,     "network provided"},
1036   { 0,     NULL}};
1037
1038 static const value_string isup_called_party_address_digit_value[] = {
1039   { 0,  "0"},
1040   { 1,  "1"},
1041   { 2,  "2"},
1042   { 3,  "3"},
1043   { 4,  "4"},
1044   { 5,  "5"},
1045   { 6,  "6"},
1046   { 7,  "7"},
1047   { 8,  "8"},
1048   { 9,  "9"},
1049   { 10, "spare"},
1050   { 11, "code 11 "},
1051   { 12, "code 12"},
1052   { 15, "Stop sending"},
1053   { 0,  NULL}};
1054
1055 static const value_string isup_calling_party_address_digit_value[] = {
1056   { 0,  "0"},
1057   { 1,  "1"},
1058   { 2,  "2"},
1059   { 3,  "3"},
1060   { 4,  "4"},
1061   { 5,  "5"},
1062   { 6,  "6"},
1063   { 7,  "7"},
1064   { 8,  "8"},
1065   { 9,  "9"},
1066   { 10, "spare"},
1067   { 11, "code 11 "},
1068   { 12, "code 12"},
1069   { 15, "spare"},
1070   { 0,  NULL}};
1071
1072 /*End of Called/Calling party address definitions */
1073
1074
1075 static const true_false_string isup_calling_party_address_request_ind_value = {
1076   "calling party address requested",
1077   "calling party address not requested"
1078 };
1079 static const true_false_string isup_holding_ind_value = {
1080   "holding requested",
1081   "holding not requested"
1082 };
1083 static const true_false_string isup_calling_partys_category_request_ind_value = {
1084   "Calling Party's category requested",
1085   "Calling Party's category not requested",
1086 };
1087 static const true_false_string isup_charge_information_request_ind_value = {
1088   "Charge Information requested",
1089   "Charge Information not requested"
1090 };
1091 static const true_false_string isup_malicious_call_identification_request_ind_value = {
1092   "Malicious call identification requested",
1093   "Malicious call identification not requested"
1094 };
1095
1096 #define CALLING_PARTY_ADDRESS_NOT_INCLUDED             0
1097 #define CALLING_PARTY_ADDRESS_NOT_AVAILABLE            1
1098 #define CALLING_PARTY_ADDRESS_INCLUDED                 3
1099 static const value_string isup_calling_party_address_response_ind_value[] = {
1100   { CALLING_PARTY_ADDRESS_NOT_INCLUDED, "Calling party address not included"},
1101   { CALLING_PARTY_ADDRESS_NOT_AVAILABLE,"Calling party address not available"},
1102   { 4,                                  "spare"},
1103   { CALLING_PARTY_ADDRESS_INCLUDED,     "Calling party address included"},
1104   { 0,                                 NULL}};
1105
1106 static const true_false_string isup_hold_provided_ind_value = {
1107   "hold provided",
1108   "hold not provided"
1109 };
1110 static const true_false_string isup_calling_partys_category_response_ind_value = {
1111   "Calling Party's category included",
1112   "Calling Party's category not included",
1113 };
1114 static const true_false_string isup_charge_information_response_ind_value = {
1115   "Charge Information included",
1116   "Charge Information not included"
1117 };
1118 static const true_false_string isup_solicited_information_ind_value = {
1119   "unsolicited",
1120   "solicited"
1121 };
1122
1123 static const true_false_string isup_continuity_ind_value = {
1124   "Continuity check successful",
1125   "Continuity ckec failed"
1126 };
1127
1128 #define CHARGE_NO_IND       0
1129 #define CHARGE_NO_CHARGE    1
1130 #define CHARGE_CHARGE       2
1131 static const value_string isup_charge_ind_value[] = {
1132   { CHARGE_NO_IND,    "No indication"},
1133   { CHARGE_NO_CHARGE, "No charge"},
1134   { CHARGE_CHARGE,    "Charge"},
1135   { 3,                "spare"},
1136   { 0,                NULL}};
1137
1138 #define CALLED_PARTYS_STATUS_NO_IND            0
1139 #define CALLED_PARTYS_STATUS_SUBSCR_FREE       1
1140 #define CALLED_PARTYS_STATUS_CONNECT_WHEN_FREE 2
1141 static const value_string isup_called_partys_status_ind_value[] = {
1142   { CALLED_PARTYS_STATUS_NO_IND,            "No indication"},
1143   { CALLED_PARTYS_STATUS_SUBSCR_FREE,       "Subscriber free"},
1144   { CALLED_PARTYS_STATUS_CONNECT_WHEN_FREE, "Connect when free (national use)"},
1145   { 3,                                      "spare"},
1146   { 0,                NULL}};
1147
1148 #define CALLED_PARTYS_CATEGORY_NO_IND            0
1149 #define CALLED_PARTYS_CATEGORY_ORDINARY_SUBSCR   1
1150 #define CALLED_PARTYS_CATEGORY_PAYPHONE          2
1151 static const value_string isup_called_partys_category_ind_value[] = {
1152   { CALLED_PARTYS_CATEGORY_NO_IND,             "No indication"},
1153   { CALLED_PARTYS_CATEGORY_ORDINARY_SUBSCR,    "Ordinary subscriber"},
1154   { CALLED_PARTYS_CATEGORY_PAYPHONE,           "Payphone"},
1155   { 3,                                         "spare"},
1156   { 0,                NULL}};
1157
1158 static const true_false_string isup_ISDN_terminating_access_ind_value = {
1159   "terminating access ISDN",
1160   "terminating access non-ISDN"
1161 };
1162
1163 static const true_false_string isup_suspend_resume_ind_value = {
1164   "network initiated",
1165   "ISDN subscriber initiated"
1166 };
1167 #define MAINTENANCE            0
1168 #define HARDWARE_FAILURE       1
1169 #define RES_FOR_NATNL_USE      2
1170 static const value_string isup_cgs_message_type_value[] = {
1171   { MAINTENANCE,            "maintenance oriented"},
1172   { HARDWARE_FAILURE,       "hardware failure oriented"},
1173   { RES_FOR_NATNL_USE,      "reserved for national use (ISUP'84)"},
1174   { 3,                      "spare"},
1175   { 0,                NULL}};
1176
1177 #define USER_TO_USER_SERVICE      2
1178 static const value_string isup_facility_ind_value[] = {
1179   { USER_TO_USER_SERVICE,     "user-to-user service"},
1180   { 0,                NULL}};
1181
1182 #define MTC_BLCK_STATE_TRANSIENT  0
1183 #define MTC_BLCK_STATE_UNEQUIPPED 3
1184 static const value_string isup_mtc_blocking_state_DC00_value[] = {
1185   {  MTC_BLCK_STATE_TRANSIENT,  "transient"},
1186   { 1,                          "spare"},
1187   { 2,                          "spare"},
1188   {  MTC_BLCK_STATE_UNEQUIPPED, "unequipped"},
1189   { 0,                NULL}};
1190
1191 #define MTC_BLCK_NO_BLOCKING      0
1192 #define MTC_LOCALLY_BLOCKED       1
1193 #define MTC_REMOTELY_BLOCKED      2
1194 #define MTC_LOCAL_REMOTE_BLOCKED  3
1195 static const value_string isup_mtc_blocking_state_DCnot00_value[] = {
1196   {  MTC_BLCK_NO_BLOCKING,     "no blocking (active)"},
1197   {  MTC_LOCALLY_BLOCKED,      "locally blocked"},
1198   {  MTC_REMOTELY_BLOCKED,     "remotely blocked"},
1199   {  MTC_LOCAL_REMOTE_BLOCKED, "locally and remotely blocked"},
1200   {  0,                NULL}};
1201
1202 #define CALL_PROC_INCOMING_BUSY 1
1203 #define CALL_PROC_OUTGOING_BUSY 2
1204 #define CALL_PROC_IDLE          3
1205 static const value_string isup_call_processing_state_value[] = {
1206   {  CALL_PROC_INCOMING_BUSY,     "circuit incoming busy"},
1207   {  CALL_PROC_OUTGOING_BUSY,     "circuit outgoing busy"},
1208   {  CALL_PROC_IDLE,              "idle"},
1209   {  0,                NULL}};
1210
1211 #define HW_BLCK_NO_BLOCKING          0
1212 #define HW_LOCALLY_BLOCKED           1
1213 #define HW_REMOTELY_BLOCKED          2
1214 #define HW_LOCAL_REMOTE_BLOCKED      3
1215 static const value_string isup_HW_blocking_state_value[] = {
1216   {  HW_BLCK_NO_BLOCKING,     "no blocking (active)"},
1217   {  HW_LOCALLY_BLOCKED,      "locally blocked"},
1218   {  HW_REMOTELY_BLOCKED,     "remotely blocked"},
1219   {  HW_LOCAL_REMOTE_BLOCKED, "locally and remotely blocked"},
1220   {  0,                NULL}};
1221
1222 #define EVENT_ALERTING      1
1223 #define EVENT_PROGRESS      2
1224 #define EVENT_INBAND_INFO   3
1225 #define EVENT_ON_BUSY       4
1226 #define EVENT_ON_NO_REPLY   5
1227 #define EVENT_UNCONDITIONAL 6
1228 static const value_string isup_event_ind_value[] = {
1229   /* according 3.21/Q.763 */
1230   {  EVENT_ALERTING,     "ALERTING"},
1231   {  EVENT_PROGRESS,     "PROGRESS"},
1232   {  EVENT_INBAND_INFO,  "in-band information or an appropriate pattern is now available"},
1233   {  EVENT_ON_BUSY,      "call forwarded on busy (national use)"},
1234   {  EVENT_ON_NO_REPLY,  "call forwarded on no reply (national use)"},
1235   {  EVENT_UNCONDITIONAL,"call forwarded unconditional (national use)"},
1236   {  0,                NULL}};
1237
1238 static const true_false_string isup_event_presentation_restricted_ind_value = {
1239   /* according 3.21/Q.763 */
1240   "presentation restricted",
1241   "no indication"
1242 };
1243 #define CUG_NON_CUG_CALL                      0
1244 #define CUG_CALL_OUTGOING_ACCESS_ALLOWED      2
1245 #define CUG_CALL_OUTGOING_ACCESS_NOT_ALLOWED  3
1246 static const value_string isup_CUG_call_ind_value[] = {
1247   /* according 3.38/Q.763 */
1248   {  CUG_NON_CUG_CALL,                     "non-CUG call"},
1249   {  1,                                    "spare"},
1250   {  CUG_CALL_OUTGOING_ACCESS_ALLOWED,     "closed user group call, outgoing access allowed"},
1251   {  CUG_CALL_OUTGOING_ACCESS_NOT_ALLOWED, "closed user group call, outgoing access not allowed"},
1252   {  0,                NULL}};
1253
1254
1255 static const true_false_string isup_simple_segmentation_ind_value = {
1256   /* according 3.38/Q.763 */
1257   "additional information will be sent in a segmentation message",
1258   "no additional information will be sent"
1259 };
1260
1261 static const true_false_string isup_connected_line_identity_request_ind_value = {
1262   /* according 3.38/Q.763 */
1263   "requested",
1264   "not requested"
1265 };
1266
1267 static const value_string isup_redirecting_ind_value[] = {
1268   /* according 3.45/Q.763 */
1269   {  0,        "no redirection (national use)"},
1270   {  1,        "call rerouted (national use)"},
1271   {  2,        "call rerouted, all redirection information presentation restricted (national use)"},
1272   {  3,        "call diverted"},
1273   {  4,        "call diverted, all redirection information presentation restricted"},
1274   {  5,        "call rerouted, redirection number presentation restricted (national use)"},
1275   {  6,        "call diversion, redirection number presentation restricted (national use)"},
1276   {  7,        "spare"},
1277   {  0,         NULL}};
1278
1279 static const value_string isup_original_redirection_reason_value[] = {
1280   /* according 3.45/Q.763 */
1281   {  0,        "unknown/not available"},
1282   {  1,        "user busy (national use)"},
1283   {  2,        "no reply (national use)"},
1284   {  3,        "unconditional (national use)"},
1285   {  0,         NULL}};
1286
1287 static const value_string isup_redirection_reason_value[] = {
1288   /* according 3.45/Q.763 */
1289   {  0,        "unknown/not available"},
1290   {  1,        "user busy (national use)"},
1291   {  2,        "no reply (national use)"},
1292   {  3,        "unconditional (national use)"},
1293   {  4,        "deflection during alerting"},
1294   {  5,        "deflection immediate response"},
1295   {  6,        "mobile subscriber not reachable"},
1296   {  0,         NULL}};
1297
1298 static const value_string isup_type_of_network_identification_value[] = {
1299   /* according 3.53/Q.763 */
1300   {  0,        "CCITT/ITU-T-standardized identification"},
1301   {  2,        "national network identification"},
1302   {  0,         NULL}};
1303
1304 static const value_string isup_network_identification_plan_value[] = {
1305   /* according 3.53/Q.763 */
1306   {  0,        "if CCITT/ITU-T id - unknown"},
1307   {  3,        "if CCITT/ITU-T id - public data network id code (X.121)"},
1308   {  6,        "if CCITT/ITU-T id - public land Mobile Network id code (E.211)"},
1309   {  0,         NULL}};
1310
1311 static const value_string isup_map_type_value[] = {
1312   /* according 3.69/Q.763 */
1313   {  1,        "1544 kbit/s digital path map format (64 kbit/s base rate"},
1314   {  2,        "2048 kbit/s digital path map format (64 kbit/s base rate"},
1315   {  0,         NULL}};
1316
1317 static const value_string isup_auto_congestion_level_value[] = {
1318   /* according 3.4/Q.763 */
1319   {  1,        "Congestion level 1 exceeded"},
1320   {  2,        "Congestion level 2 exceeded"},
1321   {  0,         NULL}};
1322
1323 static const true_false_string isup_inband_information_ind_value = {
1324   /* according 3.37/Q.763 */
1325   "in-band information or an appropriate pattern is now available",
1326   "no indication"
1327 };
1328 static const true_false_string isup_call_diversion_may_occur_ind_value = {
1329   /* according 3.37/Q.763 */
1330   "call diversion may occur",
1331   "no indication"
1332 };
1333 static const true_false_string isup_MLPP_user_ind_value = {
1334   /* according 3.37/Q.763 */
1335   "MLPP user",
1336   "no indication"
1337 };
1338
1339 static const true_false_string isup_access_delivery_ind_value = {
1340   /* according 3.2/Q.763 */
1341   "No set-up message generated",
1342   "Set-up message generated"
1343 };
1344
1345 static const value_string isup_loop_prevention_response_ind_value[] = {
1346   /* according 3.67/Q.763 */
1347   {  0,        "insufficient information"},
1348   {  1,        "no loop exists"},
1349   {  2,        "simultaneous transfer"},
1350   {  0,         NULL}};
1351
1352 static const true_false_string isup_temporary_alternative_routing_ind_value = {
1353   /* according 3.68/Q.763 */
1354   "TAR controlled call",
1355   "no indication"
1356 };
1357 static const true_false_string isup_extension_ind_value = {
1358   /* according 3.68/Q.763 */
1359   "last octet",
1360   "information continues through the next octet"
1361 };
1362
1363
1364
1365 static const value_string isup_call_to_be_diverted_ind_value[] = {
1366   /* according 3.72/Q.763 */
1367   {  0,        "no indication"},
1368   {  1,        "call diversion allowed"},
1369   {  2,        "call diversion not allowed"},
1370   {  3,        "spare"},
1371   {  0,         NULL}};
1372
1373 static const value_string isup_call_to_be_offered_ind_value[] = {
1374   /* according 3.72/Q.763 */
1375   {  0,        "no indication"},
1376   {  1,        "call offering not allowed"},
1377   {  2,        "call offering allowed"},
1378   {  3,        "spare"},
1379   {  0,         NULL}};
1380
1381 static const value_string isup_conference_acceptance_ind_value[] = {
1382   /* according 3.76/Q.763 */
1383   {  0,        "no indication"},
1384   {  1,        "accept conference request"},
1385   {  2,        "reject conference request"},
1386   {  3,        "spare"},
1387   {  0,         NULL}};
1388
1389 static const value_string isup_application_transport_parameter_value[] = {
1390   /* according 3.82/Q.763 */
1391   {  0,         "Unidentified Context and Error Handling (UCEH) ASE"},
1392   {  1,         "PSS1 ASE (VPN)"},
1393   {  2,         "spare"},
1394   {  3,         "Charging ASE"},
1395   {  4,         "GAT"},
1396   {  5,         "BAT ASE"},
1397   {  6,         "Enhanced Unidentified Context and Error Handling ASE (EUCEH ASE)"},
1398   {  0,         NULL}};
1399
1400 static const true_false_string isup_Release_call_indicator_value = {
1401   "release call",
1402   "do not release call"
1403 };
1404
1405 static const true_false_string isup_Send_notification_ind_value = {
1406   "send notification",
1407   "do not send notification"
1408 };
1409 static const value_string isup_APM_segmentation_ind_value[] = {
1410
1411   {  0x00,                     "final segment"},
1412   {  0x01,                     "number of following segments"},
1413   {  0x02,                     "number of following segments"},
1414   {  0x03,                     "number of following segments"},
1415   {  0x04,                     "number of following segments"},
1416   {  0x05,                     "number of following segments"},
1417   {  0x06,                     "number of following segments"},
1418   {  0x07,                     "number of following segments"},
1419   {  0x08,                     "number of following segments"},
1420   {  0x09,                     "number of following segments"},
1421   {  0,                NULL}};
1422
1423 static const true_false_string isup_Sequence_ind_value = {
1424   "new sequence",
1425   "subsequent segment to first segment"
1426 };
1427
1428
1429 /* Generalized bit masks for 8 and 16 bits fields */
1430 #define A_8BIT_MASK  0x01
1431 #define B_8BIT_MASK  0x02
1432 #define C_8BIT_MASK  0x04
1433 #define D_8BIT_MASK  0x08
1434 #define E_8BIT_MASK  0x10
1435 #define F_8BIT_MASK  0x20
1436 #define G_8BIT_MASK  0x40
1437 #define H_8BIT_MASK  0x80
1438
1439 #define BA_8BIT_MASK 0x03
1440 #define CB_8BIT_MASK 0x06
1441 #define DC_8BIT_MASK 0x0C
1442 #define ED_8BIT_MASK 0x18
1443 #define FE_8BIT_MASK 0x30
1444 #define GF_8BIT_MASK 0x60
1445 #define HG_8BIT_MASK 0xC0
1446 #define GFE_8BIT_MASK 0x70
1447 #define HGF_8BIT_MASK 0xE0
1448 #define DCBA_8BIT_MASK 0x0F
1449 #define EDCBA_8BIT_MASK 0x1F
1450 #define HGFE_8BIT_MASK 0xF0
1451 #define GFEDCBA_8BIT_MASK 0x7F
1452 #define FEDCBA_8BIT_MASK 0x3F
1453
1454 #define A_16BIT_MASK  0x0100
1455 #define B_16BIT_MASK  0x0200
1456 #define C_16BIT_MASK  0x0400
1457 #define D_16BIT_MASK  0x0800
1458 #define E_16BIT_MASK  0x1000
1459 #define F_16BIT_MASK  0x2000
1460 #define G_16BIT_MASK  0x4000
1461 #define H_16BIT_MASK  0x8000
1462 #define I_16BIT_MASK  0x0001
1463 #define J_16BIT_MASK  0x0002
1464 #define K_16BIT_MASK  0x0004
1465 #define L_16BIT_MASK  0x0008
1466 #define M_16BIT_MASK  0x0010
1467 #define N_16BIT_MASK  0x0020
1468 #define O_16BIT_MASK  0x0040
1469 #define P_16BIT_MASK  0x0080
1470
1471 #define BA_16BIT_MASK 0x0300
1472 #define CB_16BIT_MASK 0x0600
1473 #define DC_16BIT_MASK 0x0C00
1474 #define FE_16BIT_MASK 0x3000
1475 #define HG_16BIT_MASK 0xC000
1476 #define KJ_16BIT_MASK 0x0006
1477 #define PO_16BIT_MASK 0x00C0
1478
1479 #define CBA_16BIT_MASK 0x0700
1480 #define KJI_16BIT_MASK 0x0007
1481 #define HGFE_16BIT_MASK 0xF000
1482 #define PONM_16BIT_MASK 0x00F0
1483
1484 /* Initialize the protocol and registered fields */
1485 static int proto_isup = -1;
1486 static int proto_bicc = -1;
1487 static module_t *isup_module;
1488
1489 static gboolean isup_show_cic_in_info = TRUE;
1490
1491 static int hf_isup_called = -1;
1492 static int hf_isup_calling = -1;
1493 static int hf_isup_redirecting = -1;
1494
1495 static int hf_isup_cic = -1;
1496 static int hf_bicc_cic = -1;
1497
1498 static int isup_tap = -1;
1499
1500 static int hf_isup_message_type = -1;
1501 static int hf_isup_parameter_type = -1;
1502 static int hf_isup_parameter_length = -1;
1503 static int hf_isup_mandatory_variable_parameter_pointer = -1;
1504 static int hf_isup_pointer_to_start_of_optional_part = -1;
1505
1506 static int hf_isup_cvr_rsp_ind = -1;
1507 static int hf_isup_cvr_cg_car_ind = -1;
1508 static int hf_isup_cvr_cg_double_seize = -1;
1509 static int hf_isup_cvr_cg_alarm_car_ind = -1;
1510 static int hf_isup_cvr_cont_chk_ind = -1;
1511
1512 static int hf_isup_satellite_indicator = -1;
1513 static int hf_isup_continuity_check_indicator = -1;
1514 static int hf_isup_echo_control_device_indicator = -1;
1515
1516 static int hf_isup_forw_call_natnl_inatnl_call_indicator = -1;
1517 static int hf_isup_forw_call_end_to_end_method_indicator = -1;
1518 static int hf_isup_forw_call_interworking_indicator = -1;
1519 static int hf_isup_forw_call_end_to_end_info_indicator = -1;
1520 static int hf_isup_forw_call_isdn_user_part_indicator = -1;
1521 static int hf_isup_forw_call_preferences_indicator = -1;
1522 static int hf_isup_forw_call_isdn_access_indicator = -1;
1523 static int hf_isup_forw_call_ported_num_trans_indicator = -1;
1524 static int hf_isup_forw_call_qor_attempt_indicator = -1;
1525 static int hf_isup_forw_call_sccp_method_indicator = -1;
1526
1527 static int hf_isup_calling_partys_category = -1;
1528
1529 static int hf_isup_transmission_medium_requirement = -1;
1530
1531 static int hf_isup_odd_even_indicator = -1;
1532 static int hf_isup_called_party_nature_of_address_indicator = -1;
1533 static int hf_isup_calling_party_nature_of_address_indicator = -1;
1534 static int hf_isup_inn_indicator = -1;
1535 static int hf_isup_ni_indicator = -1;
1536 static int hf_isup_numbering_plan_indicator = -1;
1537 static int hf_isup_address_presentation_restricted_indicator = -1;
1538 static int hf_isup_screening_indicator = -1;
1539 static int hf_isup_screening_indicator_enhanced = -1;
1540 static int hf_isup_called_party_odd_address_signal_digit = -1;
1541 static int hf_isup_calling_party_odd_address_signal_digit = -1;
1542 static int hf_isup_called_party_even_address_signal_digit               = -1;
1543 static int hf_isup_calling_party_even_address_signal_digit              = -1;
1544
1545 static int hf_isup_generic_name_presentation  = -1;
1546 static int hf_isup_generic_name_availability  = -1;
1547 static int hf_isup_generic_name_type          = -1;
1548 static int hf_isup_generic_name_ia5           = -1;
1549
1550 static int hf_isup_OECD_inf_ind                                         = -1;
1551 static int hf_isup_IECD_inf_ind                                         = -1;
1552 static int hf_isup_OECD_req_ind                                         = -1;
1553 static int hf_isup_IECD_req_ind                                         = -1;
1554
1555 static int hf_isup_calling_party_address_request_indicator = -1;
1556 static int hf_isup_info_req_holding_indicator = -1;
1557 static int hf_isup_calling_partys_category_request_indicator = -1;
1558 static int hf_isup_charge_information_request_indicator = -1;
1559 static int hf_isup_charge_number_nature_of_address_indicator = -1;
1560 static int hf_isup_malicious_call_identification_request_indicator = -1;
1561
1562 static int hf_isup_calling_party_address_response_indicator = -1;
1563 static int hf_isup_hold_provided_indicator = -1;
1564 static int hf_isup_calling_partys_category_response_indicator = -1;
1565 static int hf_isup_charge_information_response_indicator = -1;
1566 static int hf_isup_solicited_indicator = -1;
1567
1568 static int hf_isup_continuity_indicator = -1;
1569
1570 static int hf_isup_backw_call_charge_ind = -1 ;
1571 static int hf_isup_backw_call_called_partys_status_ind = -1;
1572 static int hf_isup_backw_call_called_partys_category_ind = -1;
1573 static int hf_isup_backw_call_end_to_end_method_ind = -1;
1574 static int hf_isup_backw_call_interworking_ind = -1;
1575 static int hf_isup_backw_call_end_to_end_info_ind = -1;
1576 static int hf_isup_backw_call_isdn_user_part_ind = -1;
1577 static int hf_isup_backw_call_holding_ind = -1;
1578 static int hf_isup_backw_call_isdn_access_ind = -1;
1579 static int hf_isup_backw_call_echo_control_device_ind = -1;
1580 static int hf_isup_backw_call_sccp_method_ind = -1;
1581
1582 static int hf_isup_cause_indicator = -1;
1583 static int hf_ansi_isup_cause_indicator = -1;
1584
1585 static int hf_isup_suspend_resume_indicator = -1;
1586
1587 static int hf_isup_range_indicator = -1;
1588 static int hf_isup_cgs_message_type = -1;
1589
1590 static int hf_isup_mtc_blocking_state1 = -1;
1591 static int hf_isup_mtc_blocking_state2 = -1;
1592 static int hf_isup_call_proc_state = -1;
1593 static int hf_isup_hw_blocking_state = -1;
1594
1595 static int hf_isup_event_ind = -1;
1596 static int hf_isup_event_presentation_restricted_ind = -1;
1597
1598 static int hf_isup_cug_call_ind = -1;
1599 static int hf_isup_simple_segmentation_ind = -1;
1600 static int hf_isup_connected_line_identity_request_ind = -1;
1601
1602 static int hf_isup_redirecting_ind = -1;
1603 static int hf_isup_original_redirection_reason = -1;
1604 static int hf_isup_redirection_counter = -1;
1605 static int hf_isup_redirection_reason = -1;
1606
1607 static int hf_isup_type_of_network_identification = -1;
1608 static int hf_isup_network_identification_plan = -1;
1609
1610 static int hf_isup_map_type = -1;
1611
1612 static int hf_isup_automatic_congestion_level                           = -1;
1613
1614 static int hf_isup_inband_information_ind                                       = -1;
1615 static int hf_isup_call_diversion_may_occur_ind                         = -1;
1616 static int hf_isup_mlpp_user_ind                                                        = -1;
1617
1618 static int hf_isup_UUI_type                                                                     = -1;
1619 static int hf_isup_UUI_req_service1                                                     = -1;
1620 static int hf_isup_UUI_req_service2                                                     = -1;
1621 static int hf_isup_UUI_req_service3                                                     = -1;
1622 static int hf_isup_UUI_res_service1                                                     = -1;
1623 static int hf_isup_UUI_res_service2                                                     = -1;
1624 static int hf_isup_UUI_res_service3                                                     = -1;
1625 static int hf_isup_UUI_network_discard_ind                                      = -1;
1626 static int hf_isup_access_delivery_ind                                          = -1;
1627
1628 static int hf_isup_transmission_medium_requirement_prime        = -1;
1629
1630 static int hf_isup_loop_prevention_response_ind                         = -1;
1631
1632 static int hf_isup_temporary_alternative_routing_ind            = -1;
1633 static int hf_isup_extension_ind                                                        = -1;
1634
1635 static int hf_isup_call_to_be_diverted_ind                                      = -1;
1636
1637 static int hf_isup_call_to_be_offered_ind                                       = -1;
1638
1639 static int hf_isup_conference_acceptance_ind                            = -1;
1640
1641 static int hf_isup_transit_at_intermediate_exchange_ind         = -1;
1642 static int hf_isup_Release_call_ind                                             = -1;
1643 static int hf_isup_Send_notification_ind                                        = -1;
1644 static int hf_isup_Discard_message_ind_value                            = -1;
1645 static int hf_isup_Discard_parameter_ind                                        = -1;
1646 static int hf_isup_Pass_on_not_possible_indicator                       = -1;
1647 static int hf_isup_pass_on_not_possible_indicator2                      = -1;
1648 static int hf_isup_Broadband_narrowband_interworking_ind        = -1;
1649 static int hf_isup_Broadband_narrowband_interworking_ind2       = -1;
1650
1651 static int hf_isup_app_cont_ident                                       = -1;
1652 static int hf_isup_app_Send_notification_ind            = -1;
1653 static int hf_isup_apm_segmentation_ind                         = -1;
1654 static int hf_isup_apm_si_ind                                           = -1;
1655 static int hf_isup_apm_slr                                                      = -1;
1656 static int hf_isup_orig_addr_len                                        = -1;
1657 static int hf_isup_dest_addr_len                                        = -1;
1658 static int hf_isup_app_Release_call_ind                         = -1;
1659 static int hf_isup_cause_location                                       = -1;
1660
1661 static int hf_ansi_isup_coding_standard                         = -1;
1662
1663 static int hf_length_indicator                                          = -1;
1664 static int hf_afi                                                                       = -1;
1665 static int hf_bicc_nsap_dsp                                                     = -1;
1666 static int hf_bat_ase_identifier                                        = -1;
1667
1668 static int hf_Action_Indicator                                          = -1;
1669
1670 static int hf_Instruction_ind_for_general_action                                = -1;
1671
1672 static int hf_Send_notification_ind_for_general_action                  = -1;
1673
1674 static int hf_Instruction_ind_for_pass_on_not_possible                  = -1;
1675
1676 static int hf_Send_notification_ind_for_pass_on_not_possible    = -1;
1677 static int hf_BCTP_Version_Indicator                                    = -1;
1678 static int hf_Tunnelled_Protocol_Indicator                              = -1;
1679 static int hf_TPEI                                                      = -1;
1680 static int hf_BVEI                                                      = -1;
1681 static int hf_bncid                                                     = -1;
1682 static int hf_bat_ase_biwfa                                             = -1;
1683 static int hf_characteristics                                           = -1;
1684
1685 static int hf_Organization_Identifier                                   = -1;
1686 static int hf_codec_type                                                = -1;
1687 static int hf_etsi_codec_type                                           = -1;
1688 static int hf_active_code_set  = -1;
1689 static int hf_active_code_set_12_2  = -1;
1690 static int hf_active_code_set_10_2  = -1;
1691 static int hf_active_code_set_7_95  = -1;
1692 static int hf_active_code_set_7_40  = -1;
1693 static int hf_active_code_set_6_70  = -1;
1694 static int hf_active_code_set_5_90  = -1;
1695 static int hf_active_code_set_5_15  = -1;
1696 static int hf_active_code_set_4_75  = -1;
1697 static int hf_supported_code_set  = -1;
1698 static int hf_supported_code_set_12_2  = -1;
1699 static int hf_supported_code_set_10_2  = -1;
1700 static int hf_supported_code_set_7_95  = -1;
1701 static int hf_supported_code_set_7_40  = -1;
1702 static int hf_supported_code_set_6_70  = -1;
1703 static int hf_supported_code_set_5_90  = -1;
1704 static int hf_supported_code_set_5_15  = -1;
1705 static int hf_supported_code_set_4_75  = -1;
1706 static int hf_optimisation_mode  = -1;
1707 static int hf_max_codec_modes  = -1;
1708 static int hf_bearer_control_tunneling                  = -1;
1709 static int hf_Local_BCU_ID                                              = -1;
1710 static int hf_late_cut_trough_cap_ind                   = -1;
1711 static int hf_bat_ase_signal                                    = -1;
1712 static int hf_bat_ase_duration                                  = -1;
1713 static int hf_bat_ase_bearer_redir_ind                  = -1;
1714 static int hf_BAT_ASE_Comp_Report_Reason                = -1;
1715 static int hf_BAT_ASE_Comp_Report_ident                 = -1;
1716 static int hf_BAT_ASE_Comp_Report_diagnostic    = -1;
1717 static int hf_nsap_ipv4_addr                                    = -1;
1718 static int hf_nsap_ipv6_addr                                    = -1;
1719 static int hf_iana_icp                                                  = -1;
1720
1721 static int hf_isup_geo_loc_presentation_restricted_ind  = -1;
1722 static int hf_isup_geo_loc_screening_ind                = -1;
1723
1724 static int hf_isup_apm_msg_fragments = -1;
1725 static int hf_isup_apm_msg_fragment = -1;
1726 static int hf_isup_apm_msg_fragment_overlap = -1;
1727 static int hf_isup_apm_msg_fragment_overlap_conflicts = -1;
1728 static int hf_isup_apm_msg_fragment_multiple_tails = -1;
1729 static int hf_isup_apm_msg_fragment_too_long_fragment = -1;
1730 static int hf_isup_apm_msg_fragment_error = -1;
1731 static int hf_isup_apm_msg_reassembled_in = -1;
1732
1733 /* Initialize the subtree pointers */
1734 static gint ett_isup                                                    = -1;
1735 static gint ett_isup_parameter                                  = -1;
1736 static gint ett_isup_address_digits                     = -1;
1737 static gint ett_isup_pass_along_message                 = -1;
1738 static gint ett_isup_circuit_state_ind                  = -1;
1739 static gint ett_bat_ase                                                 = -1;
1740 static gint ett_bicc                                                    = -1;
1741 static gint ett_bat_ase_element                                 = -1;
1742 static gint ett_bat_ase_iwfa                                    = -1;
1743 static gint ett_acs                                                             = -1;
1744 static gint ett_scs                                                             = -1;
1745
1746 static gint ett_isup_apm_msg_fragment = -1;
1747 static gint ett_isup_apm_msg_fragments = -1;
1748
1749
1750 static dissector_handle_t sdp_handle = NULL;
1751 static dissector_handle_t q931_ie_handle = NULL;
1752
1753 /* Declarations to desegment APM Messages */
1754 static gboolean isup_apm_desegment = TRUE;
1755
1756 static const fragment_items isup_apm_msg_frag_items = {
1757         /* Fragment subtrees */
1758         &ett_isup_apm_msg_fragment,
1759         &ett_isup_apm_msg_fragments,
1760         /* Fragment fields */
1761         &hf_isup_apm_msg_fragments,
1762         &hf_isup_apm_msg_fragment,
1763         &hf_isup_apm_msg_fragment_overlap,
1764         &hf_isup_apm_msg_fragment_overlap_conflicts,
1765         &hf_isup_apm_msg_fragment_multiple_tails,
1766         &hf_isup_apm_msg_fragment_too_long_fragment,
1767         &hf_isup_apm_msg_fragment_error,
1768         /* Reassembled in field */
1769         &hf_isup_apm_msg_reassembled_in,
1770         /* Tag */
1771         "ISUP APM Message fragments"
1772 };
1773
1774 static GHashTable *isup_apm_msg_fragment_table = NULL;
1775 static GHashTable *isup_apm_msg_reassembled_table = NULL;
1776
1777
1778 static void
1779 isup_apm_defragment_init(void)
1780 {
1781         fragment_table_init (&isup_apm_msg_fragment_table);
1782         reassembled_table_init(&isup_apm_msg_reassembled_table);
1783 }
1784
1785 /* Info for the tap that must be passed between procedures */
1786 gchar *tap_called_number = NULL;
1787 gchar *tap_calling_number = NULL;
1788 guint8 tap_cause_value = 0;
1789
1790 /* ------------------------------------------------------------------
1791   Mapping number to ASCII-character
1792  ------------------------------------------------------------------ */
1793 static char number_to_char(int number)
1794 {
1795   if (number < 10)
1796     return ((char) number + ASCII_NUMBER_DELTA);
1797   else
1798     return ((char) number + ASCII_LETTER_DELTA);
1799 }
1800
1801 /* ------------------------------------------------------------------ */
1802 /* Dissectors for all used parameter types                            */
1803 /* ------------------------------------------------------------------ */
1804 /* argument tvbuff_t contains only parameter-specific length          */
1805 /* length indicator is already dissected in dissect_isup_message() or */
1806 /* dissect_isup_optional_parameter()                                  */
1807 /* ------------------------------------------------------------------ */
1808 /* ------------------------------------------------------------------
1809  Dissector Parameter circuit validation response indicator
1810  */
1811
1812 static void
1813 dissect_isup_cvr_response_ind_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1814 {
1815         guint8 cvr_response_ind;
1816
1817         cvr_response_ind = tvb_get_guint8(parameter_tvb, 0);
1818         proto_tree_add_uint(parameter_tree, hf_isup_cvr_rsp_ind, parameter_tvb, 0, CVR_RESP_IND_LENGTH, cvr_response_ind );
1819         proto_item_set_text(parameter_item, "Circuit Validation Test Response Indicator: 0x%x", cvr_response_ind );
1820
1821 }
1822
1823 /* ------------------------------------------------------------------
1824  Dissector Parameter circuit validation response - circuit group
1825  characters
1826  */
1827 static void
1828 dissect_isup_circuit_group_char_ind_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1829 {
1830         guint8 cvr_cg_char_ind;
1831
1832         cvr_cg_char_ind = tvb_get_guint8(parameter_tvb, 0);
1833         proto_tree_add_uint(parameter_tree, hf_isup_cvr_cg_car_ind, parameter_tvb, 0, CG_CHAR_IND_LENGTH, cvr_cg_char_ind );
1834         proto_tree_add_uint(parameter_tree, hf_isup_cvr_cg_double_seize, parameter_tvb, 0, CG_CHAR_IND_LENGTH, cvr_cg_char_ind );
1835         proto_tree_add_uint(parameter_tree, hf_isup_cvr_cg_alarm_car_ind, parameter_tvb, 0, CG_CHAR_IND_LENGTH, cvr_cg_char_ind );
1836         proto_tree_add_uint(parameter_tree, hf_isup_cvr_cont_chk_ind, parameter_tvb, 0, CG_CHAR_IND_LENGTH, cvr_cg_char_ind );
1837
1838         proto_item_set_text(parameter_item, "Circuit Validation Test Response Circuit Group Characteristics: 0x%x", cvr_cg_char_ind );
1839 }
1840
1841 /* ------------------------------------------------------------------
1842  Dissector Parameter nature of connection flags
1843  */
1844 static void
1845 dissect_isup_nature_of_connection_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1846 {
1847   guint8 nature_of_connection_ind;
1848
1849   nature_of_connection_ind = tvb_get_guint8(parameter_tvb, 0);
1850   proto_tree_add_uint(parameter_tree, hf_isup_satellite_indicator, parameter_tvb, 0,NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1851   proto_tree_add_uint(parameter_tree, hf_isup_continuity_check_indicator, parameter_tvb, 0,NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1852   proto_tree_add_boolean(parameter_tree, hf_isup_echo_control_device_indicator, parameter_tvb, 0,  NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1853
1854   proto_item_set_text(parameter_item, "Nature of Connection Indicators: 0x%x", nature_of_connection_ind);
1855 }
1856
1857 /* ------------------------------------------------------------------
1858  Dissector Parameter Forward Call Indicators
1859  */
1860 static void
1861 dissect_isup_forward_call_indicators_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
1862 {
1863   guint16 forward_call_ind;
1864
1865   forward_call_ind = tvb_get_ntohs(parameter_tvb, 0);
1866   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_natnl_inatnl_call_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1867   proto_tree_add_uint(parameter_tree, hf_isup_forw_call_end_to_end_method_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1868   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_interworking_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1869   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_end_to_end_info_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1870   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_isdn_user_part_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1871   proto_tree_add_uint(parameter_tree, hf_isup_forw_call_preferences_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1872   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_isdn_access_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1873   proto_tree_add_uint(parameter_tree, hf_isup_forw_call_sccp_method_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1874   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_ported_num_trans_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1875   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_qor_attempt_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1876
1877   proto_item_set_text(parameter_item, "Forward Call Indicators: 0x%x", forward_call_ind );
1878 }
1879
1880 /* ------------------------------------------------------------------
1881  Dissector Parameter Calling Party's Category
1882  */
1883 static void
1884 dissect_isup_calling_partys_category_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
1885 {
1886   guint8 calling_partys_category;
1887
1888   calling_partys_category = tvb_get_guint8(parameter_tvb, 0);
1889   proto_tree_add_uint(parameter_tree, hf_isup_calling_partys_category, parameter_tvb, 0, CALLING_PRTYS_CATEGORY_LENGTH, calling_partys_category);
1890
1891   proto_item_set_text(parameter_item, "Calling Party's category: 0x%x (%s)", calling_partys_category, val_to_str(calling_partys_category, isup_calling_partys_category_value, "reserved/spare"));
1892 }
1893
1894
1895 /* ------------------------------------------------------------------
1896   Dissector Parameter Transmission medium requirement
1897  */
1898 static void
1899 dissect_isup_transmission_medium_requirement_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1900 {
1901   guint8 transmission_medium_requirement;
1902
1903   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
1904   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement, parameter_tvb, 0, TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH,transmission_medium_requirement);
1905
1906   proto_item_set_text(parameter_item, "Transmission medium requirement: %u (%s)",  transmission_medium_requirement, val_to_str(transmission_medium_requirement, isup_transmission_medium_requirement_value, "spare"));
1907 }
1908 /* ------------------------------------------------------------------
1909   Dissector Parameter Called party number
1910  */
1911 void
1912 dissect_isup_called_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1913 {
1914   proto_item *address_digits_item;
1915   proto_tree *address_digits_tree;
1916   proto_item *hidden_item;
1917   guint8 indicators1, indicators2;
1918   guint8 address_digit_pair=0;
1919   gint offset=0;
1920   gint i=0;
1921   gint length;
1922   char called_number[MAXDIGITS + 1]="";
1923   e164_info_t e164_info;
1924   gint number_plan;
1925
1926   indicators1 = tvb_get_guint8(parameter_tvb, 0);
1927   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
1928   proto_tree_add_uint(parameter_tree, hf_isup_called_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
1929   indicators2 = tvb_get_guint8(parameter_tvb, 1);
1930   number_plan = (indicators2 & 0x70)>> 4;
1931   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
1932   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
1933   offset = 2;
1934
1935   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
1936                                             offset, -1,
1937                                             "Called Party Number");
1938   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
1939
1940   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
1941           address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
1942           proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
1943           called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
1944                 if (i > MAXDIGITS)
1945                         THROW(ReportedBoundsError);
1946                 if ((length - 1) > 0 ){
1947                         proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
1948                         called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
1949                         if (i > MAXDIGITS)
1950                                 THROW(ReportedBoundsError);
1951                         }
1952                 offset++;
1953                 }
1954   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
1955                 proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
1956                 called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
1957                 if (i > MAXDIGITS)
1958                         THROW(ReportedBoundsError);
1959   }
1960
1961   called_number[i++] = '\0';
1962   proto_item_set_text(address_digits_item, "Called Party Number: %s", called_number);
1963   proto_item_set_text(parameter_item, "Called Party Number: %s", called_number);
1964   if ( number_plan == 1 ) {
1965                 e164_info.e164_number_type = CALLED_PARTY_NUMBER;
1966                 e164_info.nature_of_address = indicators1 & 0x7f;
1967                 e164_info.E164_number_str = called_number;
1968                 e164_info.E164_number_length = i - 1;
1969                 dissect_e164_number(parameter_tvb, address_digits_tree, 2, (offset - 2), e164_info);
1970                 hidden_item = proto_tree_add_string(address_digits_tree, hf_isup_called, parameter_tvb,
1971                                                         offset - length, length, called_number);
1972                 PROTO_ITEM_SET_HIDDEN(hidden_item);
1973   } else {
1974                 proto_tree_add_string(address_digits_tree, hf_isup_called, parameter_tvb,
1975                         offset - length, length, called_number);
1976   }
1977   tap_called_number = ep_strdup(called_number);
1978 }
1979 /* ------------------------------------------------------------------
1980   Dissector Parameter  Subsequent number
1981  */
1982 static void
1983 dissect_isup_subsequent_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1984 {
1985   proto_item *address_digits_item;
1986   proto_tree *address_digits_tree;
1987   guint8 indicators1;
1988   guint8 address_digit_pair=0;
1989   gint offset=0;
1990   gint i=0;
1991   gint length;
1992   char called_number[MAXDIGITS + 1]="";
1993
1994   indicators1 = tvb_get_guint8(parameter_tvb, 0);
1995   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
1996   offset = 1;
1997
1998   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
1999                                             offset, -1,
2000                                             "Subsequent Number");
2001   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
2002
2003   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
2004     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
2005     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
2006     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
2007     if (i > MAXDIGITS)
2008       THROW(ReportedBoundsError);
2009     if ((length - 1) > 0 ){
2010       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
2011       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
2012       if (i > MAXDIGITS)
2013         THROW(ReportedBoundsError);
2014     }
2015     offset++;
2016   }
2017
2018   if (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
2019       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
2020       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
2021       if (i > MAXDIGITS)
2022         THROW(ReportedBoundsError);
2023   }
2024   called_number[i++] = '\0';
2025
2026   proto_item_set_text(address_digits_item, "Subsequent Number: %s", called_number);
2027   proto_item_set_text(parameter_item, "Subsequent Number: %s", called_number);
2028
2029 }
2030 /* ------------------------------------------------------------------
2031   Dissector Parameter Information Request Indicators
2032  */
2033 static void
2034 dissect_isup_information_request_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2035 {
2036   guint16 information_request_indicators;
2037
2038   information_request_indicators = tvb_get_ntohs(parameter_tvb, 0);
2039   proto_tree_add_boolean(parameter_tree, hf_isup_calling_party_address_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2040   proto_tree_add_boolean(parameter_tree, hf_isup_info_req_holding_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2041   proto_tree_add_boolean(parameter_tree, hf_isup_calling_partys_category_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2042   proto_tree_add_boolean(parameter_tree, hf_isup_charge_information_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2043   proto_tree_add_boolean(parameter_tree, hf_isup_malicious_call_identification_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2044
2045
2046   proto_item_set_text(parameter_item, "Information request indicators: 0x%x", information_request_indicators);
2047 }
2048 /* ------------------------------------------------------------------
2049   Dissector Parameter Information Indicators
2050  */
2051 static void
2052 dissect_isup_information_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2053 {
2054   guint16 information_indicators;
2055
2056   information_indicators = tvb_get_ntohs(parameter_tvb, 0);
2057   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_address_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2058   proto_tree_add_boolean(parameter_tree, hf_isup_hold_provided_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2059   proto_tree_add_boolean(parameter_tree, hf_isup_calling_partys_category_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2060   proto_tree_add_boolean(parameter_tree, hf_isup_charge_information_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2061   proto_tree_add_boolean(parameter_tree, hf_isup_solicited_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2062
2063
2064   proto_item_set_text(parameter_item, "Information indicators: 0x%x", information_indicators);
2065 }
2066 /* ------------------------------------------------------------------
2067   Dissector Parameter Continuity Indicators
2068  */
2069 static void
2070 dissect_isup_continuity_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2071 {
2072   guint8 continuity_indicators;
2073
2074   continuity_indicators = tvb_get_guint8(parameter_tvb, 0);
2075   proto_tree_add_boolean(parameter_tree, hf_isup_continuity_indicator, parameter_tvb, 0, CONTINUITY_IND_LENGTH,  continuity_indicators);
2076
2077   proto_item_set_text(parameter_item, "Continuity indicators: 0x%x", continuity_indicators);
2078 }
2079 /* ------------------------------------------------------------------
2080  Dissector Parameter Backward Call Indicators
2081  */
2082 static void
2083 dissect_isup_backward_call_indicators_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
2084 {
2085   guint16 backward_call_ind;
2086
2087   backward_call_ind = tvb_get_ntohs(parameter_tvb, 0);
2088
2089
2090   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_charge_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2091   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_called_partys_status_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2092   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_called_partys_category_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2093   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_end_to_end_method_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2094   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_interworking_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2095   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_end_to_end_info_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2096   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_isdn_user_part_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2097   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_holding_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH,  backward_call_ind);
2098   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_isdn_access_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2099   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_echo_control_device_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2100   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_sccp_method_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2101
2102   proto_item_set_text(parameter_item, "Backward Call Indicators: 0x%x", backward_call_ind);
2103 }
2104 /* ------------------------------------------------------------------
2105   Dissector Parameter Cause Indicators - no detailed dissection since defined in Rec. Q.850
2106  */
2107
2108 /*
2109  * Cause codes for Cause.
2110  * The decoding of cause indicators parameter field are defined in ITU-T
2111  * Recommendation Q.850; those are different from the ones in the Q.931
2112  * dissector, as that has some values not specified by the standard but
2113  * that appear to be used for purposes other than the ones in Q.850.
2114  */
2115 const value_string q850_cause_code_vals[] = {
2116         { 0x00, "Valid cause code not yet received" },
2117         { 0x01, "Unallocated (unassigned) number" },
2118         { 0x02, "No route to specified transit network" },
2119         { 0x03, "No route to destination" },
2120         { 0x04, "Send special information tone" },
2121         { 0x05, "Misdialled trunk prefix" },
2122         { 0x06, "Channel unacceptable" },
2123         { 0x07, "Call awarded and being delivered in an established channel" },
2124         { 0x08, "Preemption" },
2125         { 0x09, "Preemption - circuit reserved for reuse" },
2126         { 0x0E, "QoR: ported number" },
2127         { 0x10, "Normal call clearing" },
2128         { 0x11, "User busy" },
2129         { 0x12, "No user responding" },
2130         { 0x13, "No answer from user (user alerted)" },
2131         { 0x14, "Subscriber absent" },
2132         { 0x15, "Call rejected" },
2133         { 0x16, "Number changed" },
2134         { 0x17, "Redirection to new destination" },
2135         { 0x18, "Call rejected due to feature at the destination" },
2136         { 0x19, "Exchange routing error" },
2137         { 0x1A, "Non-selected user clearing" },
2138         { 0x1B, "Destination out of order" },
2139         { 0x1C, "Invalid number format (address incomplete)" },
2140         { 0x1D, "Facility rejected" },
2141         { 0x1E, "Response to STATUS ENQUIRY" },
2142         { 0x1F, "Normal unspecified" },
2143         { 0x21, "Circuit out of order" },
2144         { 0x22, "No circuit/channel available" },
2145         { 0x26, "Network out of order" },
2146         { 0x27, "Permanent frame mode connection out of service" },
2147         { 0x28, "Permanent frame mode connection operational" },
2148         { 0x29, "Temporary failure" },
2149         { 0x2A, "Switching equipment congestion" },
2150         { 0x2B, "Access information discarded" },
2151         { 0x2C, "Requested circuit/channel not available" },
2152         { 0x2E, "Precedence call blocked" },
2153         { 0x2F, "Resources unavailable, unspecified" },
2154         { 0x31, "Quality of service unavailable" },
2155         { 0x32, "Requested facility not subscribed" },
2156         { 0x35, "Outgoing calls barred within CUG" },
2157         { 0x37, "Incoming calls barred within CUG" },
2158         { 0x38, "Call waiting not subscribed" },
2159         { 0x39, "Bearer capability not authorized" },
2160         { 0x3A, "Bearer capability not presently available" },
2161         { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
2162         { 0x3F, "Service or option not available, unspecified" },
2163         { 0x41, "Bearer capability not implemented" },
2164         { 0x42, "Channel type not implemented" },
2165         { 0x45, "Requested facility not implemented" },
2166         { 0x46, "Only restricted digital information bearer capability is available" },
2167         { 0x4F, "Service or option not implemented, unspecified" },
2168         { 0x51, "Invalid call reference value" },
2169         { 0x52, "Identified channel does not exist" },
2170         { 0x53, "Call identity does not exist for suspended call" },
2171         { 0x54, "Call identity in use" },
2172         { 0x55, "No call suspended" },
2173         { 0x56, "Call having the requested call identity has been cleared" },
2174         { 0x57, "Called user not member of CUG" },
2175         { 0x58, "Incompatible destination" },
2176         { 0x5A, "Non-existing CUG" },
2177         { 0x5B, "Invalid transit network selection (national use)" },
2178         { 0x5F, "Invalid message, unspecified" },
2179         { 0x60, "Mandatory information element is missing" },
2180         { 0x61, "Message type non-existent or not implemented" },
2181         { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
2182         { 0x63, "Information element nonexistent or not implemented" },
2183         { 0x64, "Invalid information element contents" },
2184         { 0x65, "Message not compatible with call state" },
2185         { 0x66, "Recovery on timer expiry" },
2186         { 0x67, "Parameter non-existent or not implemented - passed on" },
2187         { 0x6E, "Message with unrecognized parameter discarded" },
2188         { 0x6F, "Protocol error, unspecified" },
2189         { 0x7F, "Internetworking, unspecified" },
2190         { 0,    NULL }
2191 };
2192
2193 static const value_string ansi_isup_cause_code_vals[] = {
2194         { 0x00, "Valid cause code not yet received" },
2195         { 0x01, "Unallocated (unassigned) number" },
2196         { 0x02, "No route to specified transit network" },
2197         { 0x03, "No route to destination" },
2198         { 0x04, "Send special information tone" },
2199         { 0x05, "Misdialled trunk prefix" },
2200         { 0x06, "Channel unacceptable" },
2201         { 0x07, "Call awarded and being delivered in an established channel" },
2202         { 0x08, "Preemption" },
2203         { 0x09, "Preemption - circuit reserved for reuse" },
2204         { 0x0E, "QoR: ported number" },
2205         { 0x10, "Normal call clearing" },
2206         { 0x11, "User busy" },
2207         { 0x12, "No user responding" },
2208         { 0x13, "No answer from user (user alerted)" },
2209         { 0x14, "Subscriber absent" },
2210         { 0x15, "Call rejected" },
2211         { 0x16, "Number changed" },
2212         { 23,   "Unallocated destination number" },
2213         { 24,   "Undefined business group" },
2214         { 0x19, "Exchange routing error" },
2215         { 0x1A, "Non-selected user clearing" },
2216         { 0x1B, "Destination out of order" },
2217         { 0x1C, "Invalid number format (address incomplete)" },
2218         { 0x1D, "Facility rejected" },
2219         { 0x1E, "Response to STATUS ENQUIRY" },
2220         { 0x1F, "Normal unspecified" },
2221         { 0x21, "Circuit out of order" },
2222         { 0x22, "No circuit/channel available" },
2223         { 0x26, "Network out of order" },
2224         { 0x27, "Permanent frame mode connection out of service" },
2225         { 0x28, "Permanent frame mode connection operational" },
2226         { 0x29, "Temporary failure" },
2227         { 0x2A, "Switching equipment congestion" },
2228         { 0x2B, "Access information discarded" },
2229         { 0x2C, "Requested circuit/channel not available" },
2230         { 45,   "Preemption" },
2231         { 0x2E, "Precedence call blocked" },
2232         { 0x2F, "Resources unavailable, unspecified" },
2233         { 0x31, "Quality of service unavailable" },
2234         { 0x32, "Requested facility not subscribed" },
2235         { 51,   "Call type incompatible with service request" },
2236         { 0x35, "Outgoing calls barred within CUG" },
2237         { 54,   "Call blocked due to group restriction" },
2238         { 0x37, "Incoming calls barred within CUG" },
2239         { 0x38, "Call waiting not subscribed" },
2240         { 0x39, "Bearer capability not authorized" },
2241         { 0x3A, "Bearer capability not presently available" },
2242         { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
2243         { 0x3F, "Service or option not available, unspecified" },
2244         { 0x41, "Bearer capability not implemented" },
2245         { 0x42, "Channel type not implemented" },
2246         { 0x45, "Requested facility not implemented" },
2247         { 0x46, "Only restricted digital information bearer capability is available" },
2248         { 0x4F, "Service or option not implemented, unspecified" },
2249         { 0x51, "Invalid call reference value" },
2250         { 0x52, "Identified channel does not exist" },
2251         { 0x53, "Call identity does not exist for suspended call" },
2252         { 0x54, "Call identity in use" },
2253         { 0x55, "No call suspended" },
2254         { 0x56, "Call having the requested call identity has been cleared" },
2255         { 0x57, "Called user not member of CUG" },
2256         { 0x58, "Incompatible destination" },
2257         { 0x5A, "Non-existing CUG" },
2258         { 0x5B, "Invalid transit network selection (national use)" },
2259         { 0x5F, "Invalid message, unspecified" },
2260         { 0x60, "Mandatory information element is missing" },
2261         { 0x61, "Message type non-existent or not implemented" },
2262         { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
2263         { 0x63, "Information element nonexistent or not implemented" },
2264         { 0x64, "Invalid information element contents" },
2265         { 0x65, "Message not compatible with call state" },
2266         { 0x66, "Recovery on timer expiry" },
2267         { 0x67, "Parameter non-existent or not implemented - passed on" },
2268         { 0x6E, "Message with unrecognized parameter discarded" },
2269         { 0x6F, "Protocol error, unspecified" },
2270         { 0x7F, "Internetworking, unspecified" },
2271         { 0,    NULL }
2272 };
2273
2274 static const value_string ansi_isup_coding_standard_vals[] = {
2275         { 0, "CCITT Standard" },
2276         { 1, "Reserved for other international standards" },
2277         { 2, "ANSI Standard" },
2278         { 3, "Reserved" },
2279         { 0,    NULL }
2280 };
2281 void
2282 dissect_isup_cause_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2283 { guint length = tvb_reported_length(parameter_tvb);
2284   proto_tree_add_text(parameter_tree, parameter_tvb,0, -1, "Cause indicators (-> Q.850)");
2285   dissect_q931_cause_ie(parameter_tvb,0,length,
2286                                             parameter_tree,
2287                                             hf_isup_cause_indicator, &tap_cause_value, isup_parameter_type_value);
2288   proto_item_set_text(parameter_item, "Cause indicators, see Q.850 (%u byte%s length)", length , plurality(length, "", "s"));
2289 }
2290
2291 static void
2292 dissect_ansi_isup_cause_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2293 {
2294         guint8 coding_standard;
2295         guint8 cause_value;
2296         int offset = 0;
2297         guint length = tvb_reported_length(parameter_tvb);
2298
2299         coding_standard = (tvb_get_guint8(parameter_tvb, offset)&0x60)>>5;
2300
2301         switch (coding_standard) {
2302         case 0:
2303                 /*CCITT*/
2304                 proto_tree_add_item(parameter_tree, hf_isup_cause_location, parameter_tvb, offset, 1, FALSE);
2305                 proto_tree_add_item(parameter_tree, hf_ansi_isup_coding_standard, parameter_tvb, offset, 1, FALSE);
2306                 proto_tree_add_item(parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE);
2307                 offset ++;
2308                 length--;
2309                 if (length == 0)
2310                         return;
2311                 proto_tree_add_item(parameter_tree, hf_isup_cause_indicator, parameter_tvb, offset, 1, FALSE);
2312                 cause_value=tvb_get_guint8(parameter_tvb, offset)&0x7f;
2313                 offset ++;
2314                 length--;
2315                 proto_item_set_text(parameter_item, "Cause indicators: %s (%u)", val_to_str(cause_value, q850_cause_code_vals, "spare"),cause_value );
2316                 if (length == 0) {
2317                         return;
2318                 }
2319                 proto_tree_add_text(parameter_tree, parameter_tvb, offset,
2320                     length, "Diagnostic: %s",
2321                     tvb_bytes_to_str(parameter_tvb, offset, length));
2322                 return;
2323         case 2:
2324                 /*ANSI*/
2325                 proto_tree_add_item(parameter_tree, hf_isup_cause_location, parameter_tvb, offset, 1, FALSE);
2326                 proto_tree_add_item(parameter_tree, hf_ansi_isup_coding_standard, parameter_tvb, offset, 1, FALSE);
2327                 proto_tree_add_item(parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE);
2328                 offset ++;
2329                 length--;
2330                 if (length == 0)
2331                         return;
2332                 proto_tree_add_item(parameter_tree, hf_ansi_isup_cause_indicator, parameter_tvb, offset, 1, FALSE);
2333                 cause_value=tvb_get_guint8(parameter_tvb, offset)&0x7f;
2334                 proto_item_set_text(parameter_item, "Cause indicators: %s (%u)", val_to_str(cause_value, ansi_isup_cause_code_vals, "spare"),cause_value );
2335                 offset ++;
2336                 length--;
2337                 if (length == 0) {
2338                         return;
2339                 }
2340                 proto_tree_add_text(parameter_tree, parameter_tvb, offset,
2341                     length, "Diagnostic: %s",
2342                     tvb_bytes_to_str(parameter_tvb, offset, length));
2343                 return;
2344         default:
2345                 proto_tree_add_item(parameter_tree, hf_ansi_isup_coding_standard, parameter_tvb, offset, 1, FALSE);
2346                 proto_tree_add_item(parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE);
2347                 break;
2348         }
2349         proto_item_set_text(parameter_item, "Cause indicators(%u byte%s length)", length , plurality(length, "", "s"));
2350 }
2351
2352 /* ------------------------------------------------------------------
2353   Dissector Parameter Suspend/Resume Indicators
2354  */
2355 static void
2356 dissect_isup_suspend_resume_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2357 {
2358   guint8 indicators;
2359
2360   indicators = tvb_get_guint8(parameter_tvb, 0);
2361   proto_tree_add_boolean(parameter_tree, hf_isup_suspend_resume_indicator, parameter_tvb, 0, SUSPEND_RESUME_IND_LENGTH,  indicators);
2362
2363   proto_item_set_text(parameter_item, "Suspend/Resume indicator: 0x%x", indicators);
2364 }
2365 /* ------------------------------------------------------------------
2366   Dissector Parameter Range and Status Indicators
2367  */
2368 static void
2369 dissect_isup_range_and_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2370 {
2371   guint8 range, actual_status_length;
2372
2373   range = tvb_get_guint8(parameter_tvb, 0);
2374   proto_tree_add_uint_format(parameter_tree, hf_isup_range_indicator, parameter_tvb, 0, RANGE_LENGTH, range, "Range: %u", range);
2375   actual_status_length = tvb_reported_length_remaining(parameter_tvb, RANGE_LENGTH);
2376   if (actual_status_length > 0)
2377     proto_tree_add_text(parameter_tree, parameter_tvb , RANGE_LENGTH, -1, "Status subfield");
2378   else
2379     proto_tree_add_text(parameter_tree, parameter_tvb , 0, 0, "Status subfield is not present with this message type");
2380
2381
2382   proto_item_set_text(parameter_item, "Range (%u) and status", range);
2383 }
2384 /* ------------------------------------------------------------------
2385   Dissector Parameter Circuit group supervision message type
2386  */
2387 static void
2388 dissect_isup_circuit_group_supervision_message_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2389 {
2390   guint8 cgs_message_type;
2391
2392   cgs_message_type = tvb_get_guint8(parameter_tvb, 0);
2393   proto_tree_add_uint(parameter_tree, hf_isup_cgs_message_type, parameter_tvb, 0, CIRC_GRP_SV_MSG_TYPE_LENGTH, cgs_message_type);
2394
2395   proto_item_set_text(parameter_item, "Circuit group supervision message type: %s (%u)"  ,val_to_str(cgs_message_type, isup_cgs_message_type_value,"unknown"), cgs_message_type);
2396 }
2397 /* ------------------------------------------------------------------
2398   Dissector Parameter Facility indicator parameter
2399  */
2400 static void
2401 dissect_isup_facility_ind_parameter(tvbuff_t *parameter_tvb, proto_item *parameter_item)
2402 {
2403   guint8 indicator;
2404
2405   indicator = tvb_get_guint8(parameter_tvb, 0);
2406
2407   proto_item_set_text(parameter_item, "Facility indicator: %s (%u)"  ,val_to_str(indicator, isup_facility_ind_value,"spare"), indicator);
2408 }
2409 /* ------------------------------------------------------------------
2410   Dissector Parameter Circuit state indicator
2411  */
2412 static void
2413 dissect_isup_circuit_state_ind_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2414 {
2415   proto_item *circuit_state_item;
2416   proto_tree *circuit_state_tree;
2417   guint8 circuit_state;
2418   gint offset=0;
2419   gint i=0;
2420   gint length;
2421
2422   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
2423     circuit_state_item = proto_tree_add_text(parameter_tree, parameter_tvb,
2424                                              offset, -1,
2425                                              "Circuit# CIC+%u state", i);
2426     circuit_state_tree = proto_item_add_subtree(circuit_state_item, ett_isup_circuit_state_ind);
2427     circuit_state = tvb_get_guint8(parameter_tvb, offset);
2428     if ((circuit_state & DC_8BIT_MASK) == 0){
2429       proto_tree_add_uint(circuit_state_tree, hf_isup_mtc_blocking_state1, parameter_tvb, offset, 1, circuit_state);
2430       proto_item_set_text(circuit_state_item, "Circuit# CIC+%u state: %s", i++, val_to_str(circuit_state&BA_8BIT_MASK, isup_mtc_blocking_state_DC00_value, "unknown"));
2431     }
2432     else {
2433       proto_tree_add_uint(circuit_state_tree, hf_isup_mtc_blocking_state2, parameter_tvb, offset, 1, circuit_state);
2434       proto_tree_add_uint(circuit_state_tree, hf_isup_call_proc_state, parameter_tvb, offset, 1, circuit_state);
2435       proto_tree_add_uint(circuit_state_tree, hf_isup_hw_blocking_state, parameter_tvb, offset, 1, circuit_state);
2436       proto_item_set_text(circuit_state_item, "Circuit# CIC+%u state: %s", i++, val_to_str(circuit_state&BA_8BIT_MASK, isup_mtc_blocking_state_DCnot00_value, "unknown"));
2437     }
2438     offset++;
2439   }
2440   proto_item_set_text(parameter_item, "Circuit state indicator (national use)");
2441 }
2442 /* ------------------------------------------------------------------
2443   Dissector Parameter Event information
2444  */
2445 static void
2446 dissect_isup_event_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2447 {
2448   guint8 indicators;
2449
2450   indicators = tvb_get_guint8(parameter_tvb, 0);
2451   proto_tree_add_uint_format(parameter_tree, hf_isup_event_ind, parameter_tvb, 0, EVENT_INFO_LENGTH, indicators, "Event indicator: %s (%u)", val_to_str(indicators & GFEDCBA_8BIT_MASK, isup_event_ind_value, "spare"), indicators & GFEDCBA_8BIT_MASK);
2452   proto_tree_add_boolean(parameter_tree, hf_isup_event_presentation_restricted_ind, parameter_tvb, 0, EVENT_INFO_LENGTH, indicators);
2453
2454   proto_item_set_text(parameter_item,"Event information: %s (%u)", val_to_str(indicators & GFEDCBA_8BIT_MASK, isup_event_ind_value, "spare"),indicators );
2455 }
2456 /* ------------------------------------------------------------------
2457   Dissector Parameter User-to-user information- no detailed dissection since defined in Rec. Q.931
2458  */
2459 static void
2460 dissect_isup_user_to_user_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2461 { guint length = tvb_reported_length(parameter_tvb);
2462   proto_tree_add_text(parameter_tree, parameter_tvb, 0, -1,
2463           "User-to-user info (-> Q.931)");
2464   dissect_q931_user_user_ie(parameter_tvb, 0, length,
2465     parameter_tree );
2466   proto_item_set_text(parameter_item, "User-to-user information,(%u byte%s length)",
2467         length , plurality(length, "", "s"));
2468 }
2469 /* ------------------------------------------------------------------
2470   Dissector Parameter Call Reference
2471  */
2472 static void
2473 dissect_isup_call_reference_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2474 {
2475   guint32 call_id;
2476   guint16 spc;
2477
2478   call_id = tvb_get_ntoh24(parameter_tvb, 0);
2479   spc = tvb_get_letohs(parameter_tvb, CALL_ID_LENGTH) & 0x3FFF; /*since 1st 2 bits spare */
2480   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_ID_LENGTH, "Call identity: %u", call_id);
2481   proto_tree_add_text(parameter_tree, parameter_tvb, CALL_ID_LENGTH, SPC_LENGTH, "Signalling Point Code: %u", spc);
2482
2483   proto_item_set_text(parameter_item, "Call Reference: Call ID = %u, SPC = %u", call_id, spc);
2484 }
2485 /* ------------------------------------------------------------------
2486   Dissector Parameter Access Transport - no detailed dissection since defined in Rec. Q.931
2487  */
2488 static void
2489 dissect_isup_access_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree,
2490                          proto_item *parameter_item, packet_info *pinfo)
2491 { guint length = tvb_reported_length(parameter_tvb);
2492
2493   proto_tree_add_text(parameter_tree, parameter_tvb, 0, -1,
2494           "Access transport parameter field (-> Q.931)");
2495
2496   if (q931_ie_handle)
2497     call_dissector(q931_ie_handle, parameter_tvb, pinfo, parameter_tree);
2498
2499   proto_item_set_text(parameter_item, "Access transport (%u byte%s length)",
2500           length , plurality(length, "", "s"));
2501 }
2502
2503 /* dissect x.213 NSAP coded Address */
2504
2505 static const value_string x213_afi_value[] = {
2506         { 0x34, "IANA ICP"},
2507         { 0x35, "IANA ICP"},
2508         { 0x36, "X.121"},
2509         { 0x37, "X.121"},
2510         { 0x38, "ISO DCC"},
2511         { 0x39, "ISO DCC"},
2512         { 0x40, "F.69"},
2513         { 0x41, "F.69"},
2514         { 0x42, "E.163"},
2515         { 0x43, "E.163"},
2516         { 0x44, "E.164"},
2517         { 0x45, "E.164"},
2518         { 0x46, "ISO 6523-ICD"},
2519         { 0x47, "ISO 6523-ICD"},
2520         { 0x48, "Local"},
2521         { 0x49, "Local"},
2522         { 0x50, "Local ISO/IEC 646 character "},
2523         { 0x51, "Local ( National character )"},
2524         { 0x52, "X.121"},
2525         { 0x53, "X.121"},
2526         { 0x54, "F.69"},
2527         { 0x55, "F.69"},
2528         { 0x56, "E.163"},
2529         { 0x57, "E.163"},
2530         { 0x58, "E.164"},
2531         { 0x59, "E.164"},
2532
2533         { 0x76, "ITU-T IND"},
2534         { 0x77, "ITU-T IND"},
2535
2536         { 0xb8, "IANA ICP Group no"},
2537         { 0xb9, "IANA ICP Group no"},
2538         { 0xba, "X.121 Group no"},
2539         { 0xbb, "X.121 Group no"},
2540         { 0xbc, "ISO DCC Group no"},
2541         { 0xbd, "ISO DCC Group no"},
2542         { 0xbe, "F.69 Group no"},
2543         { 0xbf, "F.69 Group no"},
2544         { 0xc0, "E.163 Group no"},
2545         { 0xc1, "E.163 Group no"},
2546         { 0xc2, "E.164 Group no"},
2547         { 0xc3, "E.164 Group no"},
2548         { 0xc4, "ISO 6523-ICD Group no"},
2549         { 0xc5, "ISO 6523-ICD Group no"},
2550         { 0xc6, "Local Group no"},
2551         { 0xc7, "Local Group no"},
2552         { 0xc8, "Local ISO/IEC 646 character Group no"},
2553         { 0xc9, "Local ( National character ) Group no"},
2554         { 0xca, "X.121 Group no"},
2555         { 0xcb, "X.121 Group no"},
2556         { 0xcd, "F.69 Group no"},
2557         { 0xce, "F.69 Group no"},
2558         { 0xcf, "E.163 Group no"},
2559         { 0xde, "E.163 Group no"},
2560         { 0xd0, "E.164 Group no"},
2561         { 0xd1, "E.164 Group no"},
2562
2563         { 0xe2, "ITU-T IND Group no"},
2564         { 0xe3, "ITU-T IND Group no"},
2565         { 0,    NULL }
2566 };
2567
2568
2569 /* Up-to-date information on the allocated ICP values can be found in   */
2570 /*draft-gray-rfc1888bis-01 at                                           */
2571 /*http://www.ietf.org/internet-drafts/draft-gray-rfc1888bis-01.txt      */
2572 static const value_string iana_icp_values[] = {
2573         {   0x0, "IP Version 6 Address"},
2574         {   0x1, "IP Version 4 Address"},
2575         { 0,    NULL }
2576 };
2577
2578 /*
2579  * XXX - shouldn't there be a centralized routine for dissecting NSAPs?
2580  * See also "dissect_atm_nsap()" in epan/dissectors/packet-arp.c and
2581  * "print_nsap_net_buf()" and "print_nsap_net()" in epan/osi_utils.c.
2582  */
2583 void
2584 dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter_tree)
2585 {
2586         guint8 afi;
2587         guint8 length = 0;
2588         guint icp, cc_offset;
2589
2590         afi = tvb_get_guint8(parameter_tvb, offset);
2591
2592         switch ( afi ) {
2593                 case 0x35:      /* IANA ICP Binary fortmat*/
2594                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, 3,
2595                             "IDP = %s", tvb_bytes_to_str(parameter_tvb, offset, 3));
2596
2597                         proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, 1, afi );
2598                         offset = offset + 1;
2599                         icp = tvb_get_ntohs(parameter_tvb, offset);
2600                         proto_tree_add_uint(parameter_tree, hf_iana_icp, parameter_tvb, offset, 1, icp );
2601                         if ( icp == 0 ){ /* IPv6 addr */
2602                                 proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2 , 17,
2603                                     "DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
2604                                 proto_tree_add_item(parameter_tree, hf_nsap_ipv6_addr, parameter_tvb, offset + 2,
2605                                     16, FALSE);
2606
2607                         }
2608                         else { /* IPv4 addr */
2609                                 /* XXX - this is really only for ICP 1 */
2610                                 proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2, 17,
2611                                     "DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
2612                                 proto_tree_add_item(parameter_tree, hf_nsap_ipv4_addr, parameter_tvb, offset + 2, 4, FALSE);
2613                         }
2614
2615                         break;
2616                 case 0x45:      /* E.164 ATM format */
2617                 case 0xC3:      /* E.164 ATM group format */
2618                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, 9,
2619                             "IDP = %s", tvb_bytes_to_str(parameter_tvb, offset, 9));
2620
2621                         proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, 1, afi );
2622
2623                         proto_tree_add_text(parameter_tree, parameter_tvb, offset + 1, 8,
2624                             "IDI = %s", tvb_bytes_to_str(parameter_tvb, offset + 1, 8));
2625                         offset = offset +1;
2626                         /* Dissect country code */
2627                         cc_offset = offset;
2628                         dissect_e164_cc(parameter_tvb, parameter_tree, 3, TRUE);
2629                         
2630                         proto_tree_add_text(parameter_tree,parameter_tvb, cc_offset, length,"DSP length %u(len %u -9 )",(len-9),len );
2631
2632                         proto_tree_add_item(parameter_tree, hf_bicc_nsap_dsp, parameter_tvb, offset + 8, (len - 9),FALSE);
2633
2634                         break;
2635                 default:
2636                         proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, len, afi );
2637                 }/* end switch afi */
2638
2639 }
2640
2641
2642 #define  ACTION_INDICATOR                               0x01
2643 #define  BACKBONE_NETWORK_CONNECTION_IDENTIFIER         0x02
2644 #define  INTERWORKING_FUNCTION_ADDRESS                  0x03
2645 #define  CODEC_LIST                                     0x04
2646 #define  CODEC                                          0x05
2647 #define  BAT_COMPATIBILITY_REPORT                       0x06
2648 #define  BEARER_NETWORK_CONNECTION_CHARACTERISTICS      0x07
2649 #define  BEARER_CONTROL_INFORMATION                     0x08
2650 #define  BEARER_CONTROL_TUNNELLING                      0x09
2651 #define  BEARER_CONTROL_UNIT_IDENTIFIER                 0x0A
2652 #define  SIGNAL                                                 0x0B
2653 #define  BEARER_REDIRECTION_CAPABILITY                  0x0C
2654 #define  BEARER_REDIRECTION_INDICATORS                  0x0D
2655 #define  SIGNAL_TYPE                                0x0E
2656 #define  DURATION                                       0x0F
2657
2658
2659 static const value_string bat_ase_list_of_Identifiers_vals[] = {
2660
2661         { 0x00                                          ,       "spare" },
2662         { ACTION_INDICATOR                              ,       "Action Indicator" },
2663         { BACKBONE_NETWORK_CONNECTION_IDENTIFIER        ,       "Backbone Network Connection Identifier" },
2664         { INTERWORKING_FUNCTION_ADDRESS                 ,       "Interworking Function Address" },
2665         { CODEC_LIST                                    ,       "Codec List" },
2666         { CODEC                                         ,       "Codec" },
2667         { BAT_COMPATIBILITY_REPORT                      ,       "BAT Compatibility Report" },
2668         { BEARER_NETWORK_CONNECTION_CHARACTERISTICS     ,       "Bearer Network Connection Characteristics" },
2669         { BEARER_CONTROL_INFORMATION                    ,       "Bearer Control Information"},
2670         { BEARER_CONTROL_TUNNELLING                     ,       "Bearer Control Tunnelling"},
2671         { BEARER_CONTROL_UNIT_IDENTIFIER                ,       "Bearer Control Unit Identifier" },
2672         { SIGNAL                                                        ,       "Signal"},
2673         { BEARER_REDIRECTION_CAPABILITY                 ,       "Bearer Redirection Capability"},
2674         { BEARER_REDIRECTION_INDICATORS                 ,       "Bearer Redirection Indicators"},
2675         { SIGNAL_TYPE                                   ,       "Signal Type"},
2676         { DURATION                                      ,       "Duration" },
2677         { 0,    NULL }
2678 };
2679
2680 /*ITU-T Q.765.5 (06/2000) 13*/
2681 static const value_string Instruction_indicator_for_general_action_vals[] =
2682 {
2683   { 0,     "Pass on information element"},
2684   { 1,     "Discard information element"},
2685   { 2,     "Discard BICC data"},
2686   { 3,     "Release call"},
2687   { 0,     NULL}};
2688
2689 static const value_string Instruction_indicator_for_pass_on_not_possible_vals[] = {
2690   { 0,     "Release call"},
2691   { 1,     "Discard information element"},
2692   { 2,     "Discard BICC data"},
2693   { 3,     "reserved (interpreted as 00)"},
2694   { 0,     NULL}};
2695
2696 static const value_string bat_ase_action_indicator_field_vals[] = {
2697
2698         { 0x00, "no indication"},
2699         { 0x01, "connect backward"},
2700         { 0x02, "connect forward"},
2701         { 0x03, "connect forward, no notification"},
2702         { 0x04, "connect forward, plus notification"},
2703         { 0x05, "connect forward, no notification + selected codec"},
2704         { 0x06, "connect forward, plus notification + selected codec"},
2705         { 0x07, "use idle"},
2706         { 0x08, "connected"},
2707         { 0x09, "switched"},
2708         { 0x0a, "selected codec"},
2709         { 0x0b, "modify codec"},
2710         { 0x0c, "successful codec modification"},
2711         { 0x0d, "codec modification failure"},
2712         { 0x0e, "mid-call codec negotiation"},
2713         { 0x0f, "modify to selected codec information"},
2714         { 0x10, "mid-call codec negotiation failure"},
2715         { 0x11, "start signal, notify"},
2716         { 0x12, "start signal, no notify"},
2717         { 0x13, "stop signal, notify"},
2718         { 0x14, "stop signal, no notify"},
2719         { 0x15, "start signal acknowledge"},
2720         { 0x16, "start signal reject"},
2721         { 0x17, "stop signal acknowledge"},
2722         { 0x18, "bearer redirect"},
2723         { 0,    NULL }
2724 };
2725
2726 static const true_false_string BCTP_BVEI_value  = {
2727   "Version Error Indication, BCTP version not supported",
2728   "No indication"
2729 };
2730
2731 static const value_string BCTP_Tunnelled_Protocol_Indicator_vals[] = {
2732
2733         { 0x20, "IPBCP (text encoded)"},
2734         { 0x21, "spare (text encoded protocol)"},
2735         { 0x22, "not used"},
2736         { 0,    NULL }
2737 };
2738
2739 static const true_false_string BCTP_TPEI_value  = {
2740   "Protocol Error Indication, Bearer Control Protocol not supported",
2741   "No indication"
2742 };
2743
2744
2745 #define  ITU_T                                  0x01
2746 #define  ETSI                                   0x02
2747
2748 static const value_string bat_ase_organization_identifier_subfield_vals[] = {
2749
2750         { 0x00, "no indication"},
2751         { 0x01, "ITU-T"},
2752         { 0x02, "ETSI (refer to TS 26.103)"},
2753         { 0,    NULL }
2754 };
2755
2756 #define G_711_64_A                                              0x01
2757 #define G_711_64_U                                              0x02
2758 #define G_711_56_A                                              0x03
2759 #define G_711_56_U                                              0x04
2760 #define G_722_SB_ADPCM                                  0x05
2761 #define G_723_1                                                 0x06
2762 #define G_723_1_Annex_A                                 0x07
2763 #define G_726_ADPCM                                             0x08
2764 #define G_727_Embedded_ADPCM                    0x09
2765 #define G_728                                                   0x0a
2766 #define G_729_CS_ACELP                                  0x0b
2767 #define G_729_Annex_B                                   0x0c
2768
2769 static const value_string ITU_T_codec_type_subfield_vals[] = {
2770
2771         { 0x00,                                 "no indication"},
2772         { G_711_64_A,                   "G.711 64 kbit/s A-law"},
2773         { G_711_64_U,                   "G.711 64 kbit/s -law"},
2774         { G_711_56_A,                   "G.711 56 kbit/s A-law"},
2775         { G_711_56_U,                   "G.711 56 kbit/s -law"},
2776         { G_722_SB_ADPCM,               "G.722 (SB-ADPCM)"},
2777         { G_723_1,                              "G.723.1"},
2778         { G_723_1_Annex_A,              "G.723.1 Annex A (silence suppression)"},
2779         { G_726_ADPCM,                  "G.726 (ADPCM)"},
2780         { G_727_Embedded_ADPCM, "G.727 (Embedded ADPCM)"},
2781         { G_728,                                "G.728"},
2782         { G_729_CS_ACELP,               "G.729 (CS-ACELP)"},
2783         { G_729_Annex_B,                "G.729 Annex B (silence suppression)"},
2784         { 0,    NULL }
2785 };
2786
2787 static const value_string ETSI_codec_type_subfield_vals[] = {
2788
2789         { 0x00, "GSM Full Rate (13.0 kBit/s)( GSM FR )"},
2790         { 0x01, "GSM Half Rate (5.6 kBit/s) ( GSM HR )"},
2791         { 0x02, "GSM Enhanced Full Rate (12.2 kBit/s)( GSM EFR )"},
2792         { 0x03, "Full Rate Adaptive Multi-Rate ( FR AMR )"},
2793         { 0x04, "Half Rate Adaptive Multi-Rate ( HR AMR )"},
2794         { 0x05, "UMTS Adaptive Multi-Rate ( UMTS AMR )"},
2795         { 0x06, "UMTS Adaptive Multi-Rate 2 ( UMTS AMR 2 )"},
2796         { 0x07, "TDMA Enhanced Full Rate (7.4 kBit/s) ( TDMA EFR )"},
2797         { 0x08, "PDC Enhanced Full Rate (6.7 kBit/s) ( PDC EFR )"},
2798         { 0x09, "Full Rate Adaptive Multi-Rate WideBand ( FR AMR-WB )"},
2799         { 0x0a, "UMTS Adaptive Multi-Rate WideBand ( UMTS AMR-WB )"},
2800         { 0x0b, "8PSK Half Rate Adaptive Multi-Rate ( OHR AMR )"},
2801         { 0x0c, "8PSK Full Rate Adaptive Multi-Rate WideBand  ( OFR AMR-WB )"},
2802         { 0x0d, "8PSK Half Rate Adaptive Multi-Rate WideBand ( OHR AMR-WB )"},
2803         { 0xfe, "Reserved for future use."},
2804         { 0xff, "Reserved for MuMe dummy Codec Type ( MuMe )"},
2805         { 0,    NULL }
2806 };
2807
2808 static const value_string bat_initial_codec_mode_vals[] = {
2809         {0x7, "12.2 kbps"},
2810         {0x6, "10.2 kbps"},
2811         {0x5, "7.95 kbps"},
2812         {0x4, "7.40 kbps"},
2813         {0x3, "6.70 kbps"},
2814         {0x2, "5.90 kbps"},
2815         {0x1, "5.15 kbps"},
2816         {0x0, "4.75 kbps"},
2817         {0, NULL}
2818 };
2819
2820 static const value_string optimisation_mode_vals[] = {
2821         { 0,    "Optimisation of the ACS not supported,"},
2822         { 1,    "Optimisation of the ACS supported,"},
2823         { 0,    NULL }
2824 };
2825
2826 const value_string bearer_network_connection_characteristics_vals[] = {
2827
2828         { 0x00, "no indication"},
2829         { 0x01, "AAL type 1"},
2830         { 0x02, "AAL type 2"},
2831         { 0x03, "Structured AAL type 1"},
2832         { 0x04, "IP/RTP"},
2833         { 0x05, "TDM (reserved for use by ITU-T Rec. Q.1950)"},
2834         { 0,    NULL }
2835 };
2836
2837 static const true_false_string Bearer_Control_Tunnelling_ind_value  = {
2838   "Tunnelling to be used",
2839   "No indication"
2840 };
2841
2842 static const true_false_string late_cut_trough_cap_ind_value  = {
2843   "Late Cut-through supported",
2844   "Late Cut-through not supported"
2845 };
2846 /*  ITU-T Rec. Q.765.5/Amd.1 (07/2001) */
2847 static const value_string Bearer_Redirection_Indicator_vals[] = {
2848         { 0x00, " no indication"},
2849         { 0x01, "late cut-through request"},
2850         { 0x02, "redirect temporary reject"},
2851         { 0x03, "redirect backwards request"},
2852         { 0x04, "redirect forwards request"},
2853         { 0x05, "redirect bearer release request"},
2854         { 0x06, "redirect bearer release proceed"},
2855         { 0x07, "redirect bearer release complete"},
2856         { 0x08, "redirect cut-through request"},
2857         { 0x09, "redirect bearer connected indication"},
2858         { 0x0a, "redirect failure"},
2859         { 0x0b, "new connection identifier"},
2860         { 0,    NULL }
2861 };
2862
2863 /*26/Q.765.5 - Signal Type */
2864 static const value_string BAt_ASE_Signal_Type_vals[] = {
2865         { 0x00, "DTMF 0"},
2866         { 0x01, "DTMF 1"},
2867         { 0x02, "DTMF 2"},
2868         { 0x03, "DTMF 3"},
2869         { 0x04, "DTMF 4"},
2870         { 0x05, "DTMF 5"},
2871         { 0x06, "DTMF 6"},
2872         { 0x07, "DTMF 7"},
2873         { 0x08, "DTMF 8"},
2874         { 0x09, "DTMF 9"},
2875         { 0x0a, "DTMF *"},
2876         { 0x0b, "DTMF #"},
2877         { 0x0c, "DTMF A"},
2878         { 0x0d, "DTMF B"},
2879         { 0x0e, "DTMF C"},
2880         { 0x1f, "DTMF D"},
2881         { 0x40, "dial tone"},
2882         { 0x41, "PABX internal dial tone"},
2883         { 0x42, "special dial tone"},
2884         { 0x43, "second dial tone"},
2885         { 0x44, "ringing tone"},
2886         { 0x45, "special ringing tone"},
2887         { 0x46, "busy tone"},
2888         { 0x47, "congestion tone"},
2889         { 0x48, "special information tone"},
2890         { 0x49, "warning tone"},
2891         { 0x4a, "intrusion tone"},
2892         { 0x4b, "call waiting tone"},
2893         { 0x4c, "pay tone"},
2894         { 0x4d, "payphone recognition tone"},
2895         { 0x4e, "comfort tone"},
2896         { 0x4f, "tone on hold"},
2897         { 0x50, "record tone"},
2898         { 0x51, "Caller waiting tone"},
2899         { 0x52, "positive indication tone"},
2900         { 0x53, "negative indication tone"},
2901         { 0,    NULL }
2902 };
2903
2904 static const value_string BAT_ASE_Report_Reason_vals[] = {
2905
2906         { 0x00, "no indication"},
2907         { 0x01, "information element non-existent or not implemented"},
2908         { 0x02, "BICC data with unrecognized information element, discarded"},
2909         { 0,    NULL }
2910 };
2911 /* This routine should bve called with offset at Organization_Identifier not the lengh indicator
2912  * because of use from other disectors.
2913  */
2914 extern int dissect_codec_mode(proto_tree *tree, tvbuff_t *tvb, int offset, int len) {
2915         guint8 tempdata;
2916         proto_tree *scs_item, *acs_item;
2917         proto_tree *scs_tree, *acs_tree;
2918
2919
2920         tempdata = tvb_get_guint8(tvb, offset);
2921         proto_tree_add_uint(tree, hf_Organization_Identifier , tvb, offset, 1, tempdata );
2922         switch ( tempdata ){
2923                 case ITU_T :
2924                         offset = offset + 1;
2925                         tempdata = tvb_get_guint8(tvb, offset);
2926                         proto_tree_add_uint(tree, hf_codec_type , tvb, offset, 1, tempdata );
2927                         offset = offset + 1;
2928                         switch ( tempdata ) {
2929                                 case G_711_64_A :
2930                                 case G_711_64_U :
2931                                 case G_711_56_A :
2932                                 case G_711_56_U :
2933                                 case G_722_SB_ADPCM :
2934                                 case G_723_1 :
2935                                 case G_723_1_Annex_A :
2936                                         /* These codecs have no configuration data */
2937                                         break;
2938                                 case G_726_ADPCM :
2939                                 case G_727_Embedded_ADPCM :
2940                                         /* four bit config data, TODO decode config */
2941                                         if ( len > 2 ) {
2942                                                 tempdata = tvb_get_guint8(tvb, offset);
2943                                                 proto_tree_add_text(tree, tvb, offset, 1, "Configuration data : 0x%x", tempdata);
2944                                                 offset = offset + 1;
2945                                         }
2946                                         break;
2947                                 case G_728 :
2948                                 case G_729_CS_ACELP :
2949                                 case G_729_Annex_B :
2950                                         /* three bit config data, TODO decode config */
2951                                         if ( len > 2 ) {
2952                                                 tempdata = tvb_get_guint8(tvb, offset);
2953                                                 proto_tree_add_text(tree, tvb, offset, 1 , "Configuration data : 0x%x", tempdata);
2954                                                 offset = offset + 1;
2955                                         }
2956                                         break;
2957                                 default:
2958                                         break;
2959
2960                         }
2961                                 break;
2962                 case ETSI:
2963                         offset = offset + 1;
2964                         tempdata = tvb_get_guint8(tvb, offset);
2965                         proto_tree_add_uint(tree, hf_etsi_codec_type , tvb, offset, 1, tempdata );
2966                         if ( len > 2 )  {
2967                                 offset = offset + 1;
2968                                 tempdata = tvb_get_guint8(tvb, offset);
2969
2970                                 acs_item = proto_tree_add_item(tree, hf_active_code_set, tvb, offset, 1, TRUE);
2971                                 acs_tree = proto_item_add_subtree(acs_item,ett_acs);
2972                                 proto_tree_add_item(acs_tree, hf_active_code_set_12_2, tvb, offset, 1, TRUE);
2973                                 proto_tree_add_item(acs_tree, hf_active_code_set_10_2, tvb, offset, 1, TRUE);
2974                                 proto_tree_add_item(acs_tree, hf_active_code_set_7_95, tvb, offset, 1, TRUE);
2975                                 proto_tree_add_item(acs_tree, hf_active_code_set_7_40, tvb, offset, 1, TRUE);
2976                                 proto_tree_add_item(acs_tree, hf_active_code_set_6_70, tvb, offset, 1, TRUE);
2977                                 proto_tree_add_item(acs_tree, hf_active_code_set_5_90, tvb, offset, 1, TRUE);
2978                                 proto_tree_add_item(acs_tree, hf_active_code_set_5_15, tvb, offset, 1, TRUE);
2979                                 proto_tree_add_item(acs_tree, hf_active_code_set_4_75, tvb, offset, 1, TRUE);
2980
2981                         }
2982                         if ( len > 3 )  {
2983                                 offset = offset + 1;
2984                                 tempdata = tvb_get_guint8(tvb, offset);
2985
2986                                 scs_item = proto_tree_add_item(tree, hf_supported_code_set, tvb, offset, 1, TRUE);
2987                                 scs_tree = proto_item_add_subtree(scs_item,ett_scs);
2988                                 proto_tree_add_item(scs_tree, hf_supported_code_set_12_2, tvb, offset, 1, TRUE);
2989                                 proto_tree_add_item(scs_tree, hf_supported_code_set_10_2, tvb, offset, 1, TRUE);
2990                                 proto_tree_add_item(scs_tree, hf_supported_code_set_7_95, tvb, offset, 1, TRUE);
2991                                 proto_tree_add_item(scs_tree, hf_supported_code_set_7_40, tvb, offset, 1, TRUE);
2992                                 proto_tree_add_item(scs_tree, hf_supported_code_set_6_70, tvb, offset, 1, TRUE);
2993                                 proto_tree_add_item(scs_tree, hf_supported_code_set_5_90, tvb, offset, 1, TRUE);
2994                                 proto_tree_add_item(scs_tree, hf_supported_code_set_5_15, tvb, offset, 1, TRUE);
2995                                 proto_tree_add_item(scs_tree, hf_supported_code_set_4_75, tvb, offset, 1, TRUE);
2996                         }
2997                         if ( len > 4 )  {
2998                                 offset = offset + 1;
2999                                 proto_tree_add_item(tree, hf_optimisation_mode, tvb, offset, 1, TRUE);
3000                                 proto_tree_add_item(tree, hf_max_codec_modes, tvb, offset, 1, TRUE);
3001                         }
3002                         offset = offset + 1;
3003                         break;
3004                 default:
3005                         offset = offset + 1;
3006                         tempdata = tvb_get_guint8(tvb, offset);
3007                         proto_tree_add_text(tree, tvb, offset, len ,
3008                                                                 "Unknown organisation Identifier ( Non ITU-T/ETSI codec ) %u", tempdata);
3009                         offset = offset + len - 1;
3010                         break;
3011         }
3012         /* switch OID */
3013
3014         return offset;
3015 }
3016
3017 static int
3018 dissect_codec(tvbuff_t *parameter_tvb, proto_tree *bat_ase_element_tree, gint length_indicator, gint offset,gint identifier)
3019 {
3020 /* offset is at length indicator e.g 1 step past identifier */
3021 guint8 compatibility_info;
3022
3023         proto_tree_add_uint(bat_ase_element_tree , hf_bat_ase_identifier , parameter_tvb, offset - 1, 1, identifier );
3024         proto_tree_add_uint(bat_ase_element_tree , hf_length_indicator  , parameter_tvb, offset, 1, length_indicator );
3025         offset = offset + 1;
3026         compatibility_info = tvb_get_guint8(parameter_tvb, offset);
3027         proto_tree_add_uint(bat_ase_element_tree, hf_Instruction_ind_for_general_action , parameter_tvb, offset, 1, compatibility_info );
3028         proto_tree_add_boolean(bat_ase_element_tree, hf_Send_notification_ind_for_general_action , parameter_tvb, offset, 1, compatibility_info );
3029         proto_tree_add_uint(bat_ase_element_tree, hf_Instruction_ind_for_pass_on_not_possible , parameter_tvb, offset, 1, compatibility_info );
3030         proto_tree_add_boolean(bat_ase_element_tree, hf_Send_notification_ind_for_pass_on_not_possible , parameter_tvb, offset, 1, compatibility_info );
3031         proto_tree_add_boolean(bat_ase_element_tree, hf_isup_extension_ind , parameter_tvb, offset, 1, compatibility_info );
3032
3033         offset = dissect_codec_mode(bat_ase_element_tree, parameter_tvb, offset+1,length_indicator-1);
3034 return offset;
3035 }
3036
3037 /* Dissect BAT ASE message according to Q.765.5 200006 and Amendment 1 200107
3038  * Layout of message            Length                  Octet
3039  *      Element name
3040  *      Identifier                                      1                       1
3041  *      Length indicator                        1                       2
3042  *      Compatibility information       1                       3
3043  *      Contents                                        1                       4
3044  *      Identifier                                      n                       m
3045  *      Length indicator                        n
3046  *      Compatibility information       n
3047  *      Contents                                        n                       p
3048  */
3049
3050 static void
3051 dissect_bat_ase_Encapsulated_Application_Information(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, gint offset)
3052 {
3053         gint            length = tvb_reported_length_remaining(parameter_tvb, offset), list_end;
3054         tvbuff_t        *next_tvb;
3055         proto_tree      *bat_ase_tree, *bat_ase_element_tree, *bat_ase_iwfa_tree;
3056         proto_item      *bat_ase_item, *bat_ase_element_item, *bat_ase_iwfa_item;
3057         guint8 identifier,content, BCTP_Indicator_field_1, BCTP_Indicator_field_2;
3058         guint8 tempdata, element_no, number_of_indicators;
3059         guint16 sdp_length;
3060         guint8 diagnostic_len;
3061         guint8 length_ind_len;
3062         guint tempdata16;
3063         guint content_len, length_indicator;
3064         guint duration;
3065         guint diagnostic;
3066         guint32 bncid, Local_BCU_ID;
3067         element_no = 0;
3068
3069         bat_ase_item = proto_tree_add_text(parameter_tree,parameter_tvb, offset, -1,
3070                 "Bearer Association Transport (BAT) Application Service Element (ASE) Encapsulated Application Information:");
3071         bat_ase_tree = proto_item_add_subtree(bat_ase_item , ett_bat_ase);
3072
3073         proto_tree_add_text(bat_ase_tree, parameter_tvb, offset, -1,
3074                 "BAT ASE Encapsulated Application Information, (%u byte%s length)", length, plurality(length, "", "s"));
3075         while(tvb_reported_length_remaining(parameter_tvb, offset) > 0){
3076                 element_no = element_no + 1;
3077                 identifier = tvb_get_guint8(parameter_tvb, offset);
3078
3079                 /* length indicator may be 11 bits long                         */
3080                 offset = offset + 1;
3081                 proto_tree_add_item( bat_ase_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
3082                 tempdata = tvb_get_guint8(parameter_tvb, offset);
3083                 if ( tempdata & 0x80 ) {
3084                         length_indicator = tempdata & 0x7f;
3085                         length_ind_len = 1;
3086                 }
3087                 else {
3088                         offset = offset + 1;
3089                         tempdata16 = ( tempdata & 0x7f );
3090                         length_indicator = tvb_get_guint8(parameter_tvb, offset)& 0x0f;
3091                         length_indicator = length_indicator << 7;
3092                         length_indicator = length_indicator + tempdata16;
3093                         length_ind_len = 2;
3094                 }
3095
3096                 bat_ase_element_item = proto_tree_add_text(bat_ase_tree,parameter_tvb,
3097                         ( offset - length_ind_len),(length_indicator + 2),"BAT ASE Element %u, Identifier: %s",element_no,
3098                                         val_to_str(identifier,bat_ase_list_of_Identifiers_vals,"unknown (%u)"));
3099                 bat_ase_element_tree = proto_item_add_subtree(bat_ase_element_item ,
3100                         ett_bat_ase_element);
3101                 if ( identifier != CODEC ) {
3102                 /* identifier, length indicator and compabillity info must be printed inside CODEC */
3103                 /* dissection in order to use dissect_codec routine for codec list */
3104                 proto_tree_add_uint(bat_ase_element_tree , hf_bat_ase_identifier , parameter_tvb,
3105                         offset - length_ind_len, 1, identifier );
3106                 proto_tree_add_uint(bat_ase_element_tree , hf_length_indicator  , parameter_tvb,
3107                         offset - length_ind_len + 1, length_ind_len, length_indicator );
3108
3109                 offset = offset + 1;
3110                 proto_tree_add_item( bat_ase_element_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
3111                 proto_tree_add_item( bat_ase_element_tree, hf_Send_notification_ind_for_pass_on_not_possible, parameter_tvb, offset, 1, FALSE );
3112                 proto_tree_add_item( bat_ase_element_tree, hf_Instruction_ind_for_pass_on_not_possible, parameter_tvb, offset, 1, FALSE );
3113                 proto_tree_add_item( bat_ase_element_tree, hf_Send_notification_ind_for_general_action, parameter_tvb, offset, 1, FALSE );
3114                 proto_tree_add_item( bat_ase_element_tree, hf_Instruction_ind_for_general_action, parameter_tvb, offset, 1, FALSE );
3115                 offset = offset + 1;
3116                 }
3117                 content_len = length_indicator - 1 ; /* exclude the treated Compatibility information */
3118
3119                 /* content will be different depending on identifier */
3120                 switch ( identifier ){
3121
3122                         case ACTION_INDICATOR :
3123
3124                                 content = tvb_get_guint8(parameter_tvb, offset);
3125                                 proto_tree_add_uint(bat_ase_element_tree, hf_Action_Indicator , parameter_tvb, offset, 1, content );
3126                                 proto_item_append_text(bat_ase_element_item, " - %s",
3127                                                  val_to_str(content,bat_ase_action_indicator_field_vals, "unknown (%u)"));
3128                                 offset = offset + 1;
3129                                 break;
3130                         case BACKBONE_NETWORK_CONNECTION_IDENTIFIER :
3131
3132                                 bncid = tvb_get_ntohl(parameter_tvb, offset);
3133                                 switch ( content_len ){
3134                                 case 1:
3135                                                 bncid = bncid & 0x000000ff;
3136                                                 break;
3137                                 case 2:
3138                                                 bncid = bncid & 0x0000ffff;
3139                                                 break;
3140                                 case 3:
3141                                                 bncid = bncid & 0x00ffffff;
3142                                                 break;
3143                                 case 4:;
3144                                 default:;
3145                                 }
3146                                 proto_tree_add_uint_format(bat_ase_element_tree, hf_bncid, parameter_tvb, offset, content_len, bncid, "BNCId: 0x%08x", bncid);
3147                                 proto_item_append_text(bat_ase_element_item, " - 0x%08x",bncid);
3148                                 offset = offset + content_len;
3149
3150                         break;
3151                         case INTERWORKING_FUNCTION_ADDRESS :
3152                                 bat_ase_iwfa_item = proto_tree_add_item(bat_ase_element_tree, hf_bat_ase_biwfa, parameter_tvb, offset, content_len,
3153                                                             FALSE);
3154                                 bat_ase_iwfa_tree = proto_item_add_subtree(bat_ase_iwfa_item , ett_bat_ase_iwfa);
3155                                 dissect_nsap(parameter_tvb, offset, content_len, bat_ase_iwfa_tree);
3156
3157                                 offset = offset + content_len;
3158                         break;
3159                         case CODEC_LIST :
3160                                 list_end = offset + content_len;
3161                                 while ( offset < ( list_end - 1 )) {
3162                                         identifier = tvb_get_guint8(parameter_tvb, offset);
3163                                         offset = offset + 1;
3164                                         tempdata = tvb_get_guint8(parameter_tvb, offset);
3165                                                 if ( tempdata & 0x80 ) {
3166                                                         length_indicator = tempdata & 0x7f;
3167                                                 }
3168                                                 else {
3169                                                         offset = offset +1;
3170                                                         length_indicator = tvb_get_guint8(parameter_tvb, offset);
3171                                                         length_indicator = length_indicator << 7;
3172                                                         length_indicator = length_indicator & ( tempdata & 0x7f );
3173                                                 }
3174                                         offset = dissect_codec(parameter_tvb, bat_ase_element_tree, length_indicator , offset, identifier);
3175                                 }
3176                         break;
3177                         case CODEC :
3178                                 /* offset is at length indicator in this case */
3179                                 offset = dissect_codec(parameter_tvb, bat_ase_element_tree, length_indicator , offset, identifier);
3180                                 break;/* case codec */
3181                         case BAT_COMPATIBILITY_REPORT :
3182                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
3183                                 proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_Reason, parameter_tvb, offset, 1, tempdata );
3184                                 offset = offset + 1;
3185
3186                                 diagnostic_len = content_len - 1;
3187                                 while ( diagnostic_len > 0 ) {
3188                                         tempdata = tvb_get_guint8(parameter_tvb, offset);
3189                                         proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_ident, parameter_tvb, offset, 1, tempdata );
3190                                         offset = offset + 1;
3191                                         diagnostic = tvb_get_letohs(parameter_tvb, offset);
3192                                         proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_diagnostic, parameter_tvb, offset, 2, diagnostic);
3193                                         offset = offset + 2;
3194                                         diagnostic_len = diagnostic_len - 3;
3195                                 }
3196                         break;
3197                         case BEARER_NETWORK_CONNECTION_CHARACTERISTICS :
3198                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
3199                                 proto_tree_add_uint(bat_ase_element_tree, hf_characteristics , parameter_tvb,
3200                                                  offset, 1, tempdata );
3201                                 proto_item_append_text(bat_ase_element_item, " - %s",
3202                                                  val_to_str(tempdata,bearer_network_connection_characteristics_vals, "unknown (%u)"));
3203
3204                                 offset = offset + content_len;
3205                         break;
3206 /* The Bearer Control Information information element contains the bearer control tunnelling protocol */
3207 /* ITU-T Q.1990 (2001), BICC bearer control tunnelling protocol. */
3208
3209                         case BEARER_CONTROL_INFORMATION :
3210                                 BCTP_Indicator_field_1 = tvb_get_guint8(parameter_tvb, offset);
3211                                 proto_tree_add_uint(bat_ase_element_tree, hf_BCTP_Version_Indicator,
3212                                         parameter_tvb, offset, 1, BCTP_Indicator_field_1 );
3213
3214                                 proto_tree_add_boolean(bat_ase_element_tree, hf_BVEI,
3215                                         parameter_tvb, offset, 1, BCTP_Indicator_field_1 );
3216                                 offset = offset + 1;
3217
3218                                 BCTP_Indicator_field_2 = tvb_get_guint8(parameter_tvb, offset);
3219
3220                                 proto_tree_add_uint(bat_ase_element_tree, hf_Tunnelled_Protocol_Indicator ,
3221                                         parameter_tvb, offset, 1, BCTP_Indicator_field_2 );
3222
3223                                 proto_tree_add_boolean(bat_ase_element_tree, hf_TPEI,
3224                                         parameter_tvb, offset, 1, BCTP_Indicator_field_2 );
3225                                 offset = offset + 1;
3226
3227                                 sdp_length = ( length_indicator ) - 3;
3228
3229                                 if(sdp_length > tvb_length_remaining(parameter_tvb,offset)){
3230                                         /* If this is a segmented message we may not have all the data */
3231                                         next_tvb = tvb_new_subset(parameter_tvb, offset, -1, -1);
3232                                 }else{
3233                                         next_tvb = tvb_new_subset(parameter_tvb, offset, sdp_length, sdp_length);
3234                                 }
3235                                 call_dissector(sdp_handle, next_tvb, pinfo, bat_ase_element_tree);
3236                                 offset = offset + sdp_length;
3237
3238
3239                         break;
3240                         case BEARER_CONTROL_TUNNELLING :
3241
3242                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
3243                                 proto_tree_add_boolean(bat_ase_element_tree, hf_bearer_control_tunneling , parameter_tvb, offset, 1, ( tempdata & 0x01 ) );
3244                                 if ( tempdata & 0x01 )
3245                                         proto_item_append_text(bat_ase_element_item, " - Tunnelling to be used ");
3246
3247                                 offset = offset + content_len;
3248                         break;
3249                         case BEARER_CONTROL_UNIT_IDENTIFIER :
3250                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
3251                                 proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset, 1, "Network ID Length indicator= %u",tempdata);
3252                                 if ( tempdata > 0 ) {
3253                                         offset = offset +1;
3254
3255 /* Q.765.5 amd 1
3256         Network ID
3257         The coding of the Network ID field is identical to the coding of the Network ID field in the
3258         Global Call Reference parameter as specified in clause 6/Q.1902.3 (see [3]).
3259         NOTE .When used inside a network domain, the Network ID may be omitted by setting the
3260         Network ID Length indicator to the value "0".
3261         Q.1902.3
3262         The following codes are used in the subfields of the global call reference parameter field:
3263         a) Network ID
3264         The Network ID contains the value field (coded according to ASN.1 BER) of an object
3265         identifier identifying the network. This means that the tag and length fields are omitted.
3266         An example of such an object identifier can be the following:
3267         .{itu-t (0) administration (2) national regulatory authority (x) network (y)}
3268         The value for x is the value of the national regulatory authority (one of the Data Country
3269         Codes associated to the country as specified in ITU-T X.121 shall be used for "national
3270         regulatory authority"), the value for y is under the control of the national regulatory
3271         authority concerned.
3272         b) Node ID
3273         A binary number that uniquely identifies within the network the node which generates the
3274         call reference.
3275         c) Call Reference ID
3276         A binary number used for the call reference of the call. This is generated by the node for
3277         each call.
3278
3279 */
3280                                         proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset, tempdata , "Network ID: %s",
3281                                                             tvb_bytes_to_str(parameter_tvb, offset, tempdata));
3282                                         offset = offset + tempdata;
3283                                 } /* end if */
3284
3285                                 Local_BCU_ID = tvb_get_letohl(parameter_tvb, offset);
3286                                 proto_tree_add_uint_format(bat_ase_element_tree, hf_Local_BCU_ID , parameter_tvb, offset, 4, Local_BCU_ID , "Local BCU ID : 0x%08x", Local_BCU_ID );
3287                                 offset = offset + 4;
3288                         break;
3289                         case SIGNAL :
3290                                 /* As type is Constructor new elements follow, return to main loop */
3291                         break;
3292                         case BEARER_REDIRECTION_CAPABILITY :
3293                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
3294                                 proto_tree_add_boolean(bat_ase_element_tree, hf_late_cut_trough_cap_ind , parameter_tvb, offset, 1, tempdata );
3295                                 offset = offset + content_len;
3296                         break;
3297                         case BEARER_REDIRECTION_INDICATORS :
3298                                 number_of_indicators = 0;
3299                                 while ( number_of_indicators < content_len ) {
3300                                         tempdata = tvb_get_guint8(parameter_tvb, offset);
3301                                         proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_bearer_redir_ind , parameter_tvb, offset, 1, tempdata );
3302                                         offset = offset + 1;
3303                                         number_of_indicators = number_of_indicators + 1;
3304                                 }
3305                         break;
3306                         case SIGNAL_TYPE :
3307                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
3308                                 proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_signal , parameter_tvb, offset, 1, tempdata );
3309                                 offset = offset + content_len;
3310                         break;
3311                         case DURATION :
3312                                 duration = tvb_get_letohs(parameter_tvb, offset);
3313                                 proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_duration , parameter_tvb, offset, 2, duration );
3314                                 offset = offset + content_len;
3315                         break;
3316                         default :
3317                                 proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset,content_len , "Default ?, (%u byte%s length)", (content_len), plurality(content_len, "", "s"));
3318                                 offset = offset + content_len;
3319                         }
3320         }
3321
3322 }
3323
3324
3325
3326 /*
3327 Octet
3328         -------------------------------------------
3329 1       | ext. Application context identifier lsb
3330         -------------------------------------------
3331 1a      | ext. msb
3332         -------------------------------------------
3333 2       | ext. spare                                            SNI RCI
3334         -------------------------------------------
3335 3       | ext. SI APM segmentation indicator
3336         -------------------------------------------
3337 3a      | ext. Segmentation local reference
3338         -------------------------------------------
3339 4a      |
3340 :       |       APM-user information
3341 4n      |
3342         +-------------------------------------------
3343
3344         Figure 77/Q.763 . Application transport parameter field
3345   */
3346 static void
3347 dissect_isup_application_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
3348 {
3349
3350         guint8 application_transport_instruction_ind;
3351         guint8 si_and_apm_seg_ind;
3352         guint8 apm_Segmentation_local_ref = 0;
3353         guint16 aci16;
3354         gint offset = 0;
3355         guint8 octet;
3356         guint length = tvb_reported_length(parameter_tvb);
3357
3358         gboolean more_frag;
3359         gboolean   save_fragmented;
3360         tvbuff_t* new_tvb = NULL;
3361         tvbuff_t* next_tvb = NULL;
3362         fragment_data *frag_msg = NULL;
3363
3364         proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "Application transport parameter fields:");
3365         proto_item_set_text(parameter_item, "Application transport, (%u byte%s length)", length , plurality(length, "", "s"));
3366         aci16 = tvb_get_guint8(parameter_tvb, offset);
3367
3368         if ( (aci16 & H_8BIT_MASK) == 0x80) {
3369                 /* Octet 1 */
3370                 aci16 = aci16 & 0x7f;
3371                 proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
3372                 proto_tree_add_uint(parameter_tree, hf_isup_app_cont_ident , parameter_tvb, offset, 1, aci16);
3373                 offset = offset + 1;
3374                 }
3375         /* Octet 1a */
3376         else {
3377                 aci16 = (aci16<<8) | (tvb_get_guint8(parameter_tvb, offset) & 0x7f);
3378                 proto_tree_add_uint(parameter_tree, hf_isup_app_cont_ident , parameter_tvb, offset, 2, aci16);
3379                 offset = offset + 2;
3380         }
3381
3382         /* Octet 2 */
3383         proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "Application transport instruction indicators: ");
3384         application_transport_instruction_ind = tvb_get_guint8(parameter_tvb, offset);
3385         proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
3386         proto_tree_add_item( parameter_tree, hf_isup_app_Send_notification_ind, parameter_tvb, offset, 1, FALSE );
3387         proto_tree_add_item( parameter_tree, hf_isup_app_Release_call_ind, parameter_tvb, offset, 1, FALSE );
3388         offset = offset + 1;
3389
3390         /* Octet 3*/
3391         proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1, "APM segmentation indicator:");
3392         si_and_apm_seg_ind  = tvb_get_guint8(parameter_tvb, offset);
3393         proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
3394         proto_tree_add_item( parameter_tree, hf_isup_apm_si_ind, parameter_tvb, offset, 1, FALSE );
3395         proto_tree_add_item( parameter_tree, hf_isup_apm_segmentation_ind, parameter_tvb, offset, 1, FALSE );
3396         offset = offset + 1;
3397
3398         /* Octet 3a */
3399         if ( (si_and_apm_seg_ind & H_8BIT_MASK) == 0x00) {
3400                 apm_Segmentation_local_ref  = tvb_get_guint8(parameter_tvb, offset);
3401                 proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
3402                 proto_tree_add_item( parameter_tree, hf_isup_apm_slr, parameter_tvb, offset, 1, FALSE );
3403                 offset = offset + 1;
3404         }
3405         /* For APM'98'-user applications. ( aci 0 - 3 ), APM-user information field starts at octet 4 */
3406         if (aci16 > 3) {
3407                 /* Octet 4 Originating Address length */
3408                 octet = tvb_get_guint8(parameter_tvb,offset);
3409                 proto_tree_add_item( parameter_tree, hf_isup_orig_addr_len, parameter_tvb, offset, 1, FALSE );
3410                 offset++;
3411                 if ( octet != 0){
3412                         /* 4b */
3413                         proto_tree_add_item( parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, offset, 1, FALSE );
3414                         /* nature of address indicator */
3415                         offset++;
3416                         proto_tree_add_item( parameter_tree, hf_isup_inn_indicator, parameter_tvb, offset, 1, FALSE );
3417                         proto_tree_add_item( parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, offset, 1, FALSE );
3418                         offset++;
3419                         /* Address digits */
3420                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, octet - 2, "Address digits");
3421                         offset = offset + octet - 2;
3422                 }
3423                 /* Octet 5 Destination Address length */
3424                 octet = tvb_get_guint8(parameter_tvb,offset);
3425                 proto_tree_add_item( parameter_tree, hf_isup_dest_addr_len, parameter_tvb, offset, 1, FALSE );
3426                 offset++;
3427                 if ( octet != 0){
3428                         /* 4b */
3429                         proto_tree_add_item( parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, offset, 1, FALSE );
3430                         /* nature of address indicator */
3431                         offset++;
3432                         proto_tree_add_item( parameter_tree, hf_isup_inn_indicator, parameter_tvb, offset, 1, FALSE );
3433                         proto_tree_add_item( parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, offset, 1, FALSE );
3434                         offset++;
3435                         /* Address digits */
3436                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, octet - 2, "Address digits");
3437                         offset = offset + octet - 2;
3438                 }
3439         }
3440         /*
3441          * Defragment ?
3442          *
3443          */
3444         if (isup_apm_desegment){
3445                 if ((si_and_apm_seg_ind != 0xc0) && ((si_and_apm_seg_ind & H_8BIT_MASK)!=0x80)){
3446                         /* debug g_warning("got here Frame %u",pinfo->fd->num); */
3447                         /* Segmented message */
3448                         save_fragmented = pinfo->fragmented;
3449                         pinfo->fragmented = TRUE;
3450                         more_frag = TRUE;
3451                         if ((si_and_apm_seg_ind == 0))
3452                                 more_frag = FALSE;
3453
3454                         frag_msg = fragment_add_seq_next(parameter_tvb, offset, pinfo,
3455                                         (apm_Segmentation_local_ref & 0x7f),                    /* ID for fragments belonging together */
3456                                         isup_apm_msg_fragment_table,                                    /* list of message fragments */
3457                                         isup_apm_msg_reassembled_table,                                 /* list of reassembled messages */
3458                                         tvb_length_remaining(parameter_tvb, offset),    /* fragment length - to the end */
3459                                         more_frag);                                                                             /* More fragments? */
3460
3461                         if ((si_and_apm_seg_ind & 0x3f) !=0 && (si_and_apm_seg_ind &0x40) !=0){
3462                                 /* First fragment set number of fragments */
3463                                 fragment_set_tot_len(pinfo, apm_Segmentation_local_ref & 0x7f, isup_apm_msg_fragment_table, (si_and_apm_seg_ind & 0x3f));
3464                         }
3465
3466                         new_tvb = process_reassembled_data(parameter_tvb, offset, pinfo,
3467                                 "Reassembled Message", frag_msg, &isup_apm_msg_frag_items,
3468                                 NULL, parameter_tree);
3469
3470                         if (frag_msg) { /* Reassembled */
3471                                 if (check_col(pinfo->cinfo, COL_INFO))
3472                                         col_append_str(pinfo->cinfo, COL_INFO,
3473                                         " (Message Reassembled)");
3474                         } else { /* Not last packet of reassembled Short Message */
3475                                 if (check_col(pinfo->cinfo, COL_INFO))
3476                                         col_append_str(pinfo->cinfo, COL_INFO,
3477                                         " (Message fragment )");
3478                         }
3479
3480                         pinfo->fragmented = save_fragmented;
3481                 }
3482         }/*isup_apm_desegment*/
3483
3484         if ( offset == (gint)length){
3485                 /* No data */
3486                 proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Empty APM-user information field"  );
3487                 return;
3488         }
3489         if (new_tvb) { /* take it all */
3490                 next_tvb = new_tvb;
3491         } else { /* make a new subset */
3492                 next_tvb = tvb_new_subset(parameter_tvb, offset, -1, -1);
3493         }
3494
3495         proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1,
3496                 "APM-user information field (%u Bytes)",tvb_length_remaining(parameter_tvb, offset));
3497         
3498         switch(aci16 & 0x7fff){
3499                 case 3:
3500                         /* Charging ASE */
3501                         dissect_charging_ase_ChargingMessageType_PDU(next_tvb, pinfo, parameter_tree);
3502                         break;
3503                 case 5:
3504                         /* dissect BAT ASE element, without transparent data ( Q.765.5-200006) */
3505                         dissect_bat_ase_Encapsulated_Application_Information(next_tvb, pinfo, parameter_tree, 0);
3506                         break;
3507                 default:
3508                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "No further dissection of APM-user information field");
3509                         break;
3510         }
3511 }
3512
3513
3514
3515 /* ------------------------------------------------------------------
3516   Dissector Parameter Optional Forward Call indicators
3517  */
3518 static void
3519 dissect_isup_optional_forward_call_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3520 {
3521   guint8 indicators;
3522
3523   indicators = tvb_get_guint8(parameter_tvb, 0);
3524   proto_tree_add_uint(parameter_tree, hf_isup_cug_call_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3525   proto_tree_add_boolean(parameter_tree, hf_isup_simple_segmentation_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3526   proto_tree_add_boolean(parameter_tree, hf_isup_connected_line_identity_request_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3527
3528
3529   proto_item_set_text(parameter_item,"Optional forward call indicators: %s (%u)", val_to_str(indicators & BA_8BIT_MASK, isup_CUG_call_ind_value, "spare"),indicators );
3530 }
3531 /* ------------------------------------------------------------------
3532   Dissector Parameter calling party number
3533  */
3534 void
3535 dissect_isup_calling_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3536 {
3537   proto_item *address_digits_item;
3538   proto_tree *address_digits_tree;
3539   proto_item *hidden_item;
3540   guint8 indicators1, indicators2;
3541   guint8 address_digit_pair=0;
3542   gint offset=0;
3543   gint i=0;
3544   gint length;
3545   char calling_number[MAXDIGITS + 1]="";
3546   e164_info_t e164_info;
3547   gint number_plan;
3548
3549   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3550   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3551   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3552   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3553   number_plan = (indicators2 & 0x70)>> 4;
3554   proto_tree_add_boolean(parameter_tree, hf_isup_ni_indicator, parameter_tvb, 1, 1, indicators2);
3555   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3556   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3557   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
3558   offset = 2;
3559
3560   length = tvb_length_remaining(parameter_tvb, offset);
3561   if (length > 0) {
3562     address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3563                                               offset, -1,
3564                                               "Calling Party Number");
3565     address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3566
3567     while(length > 0){
3568       address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3569       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3570       calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3571       if (i > MAXDIGITS)
3572         THROW(ReportedBoundsError);
3573       if ((length - 1) > 0 ){
3574         proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3575         calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3576         if (i > MAXDIGITS)
3577           THROW(ReportedBoundsError);
3578       }
3579       offset++;
3580       length = tvb_length_remaining(parameter_tvb, offset);
3581     }
3582
3583     if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3584       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3585       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3586       if (i > MAXDIGITS)
3587         THROW(ReportedBoundsError);
3588     }
3589     proto_item_set_text(address_digits_item, "Calling Party Number: %s", calling_number);
3590     calling_number[i++] = '\0';
3591     if ( number_plan == 1 ) {
3592       e164_info.e164_number_type = CALLING_PARTY_NUMBER;
3593       e164_info.nature_of_address = indicators1 & 0x7f;
3594       e164_info.E164_number_str = calling_number;
3595       e164_info.E164_number_length = i - 1;
3596       dissect_e164_number(parameter_tvb, address_digits_tree, 2, (offset - 2), e164_info);
3597       hidden_item = proto_tree_add_string(address_digits_tree, hf_isup_calling, parameter_tvb,
3598             offset - length, length, calling_number);
3599       PROTO_ITEM_SET_HIDDEN(hidden_item);
3600     } else {
3601       proto_tree_add_string(address_digits_tree, hf_isup_calling, parameter_tvb,
3602           offset - length, length, calling_number);
3603     }
3604   }
3605   proto_item_set_text(parameter_item, "Calling Party Number: %s", calling_number);
3606   tap_calling_number = ep_strdup(calling_number);
3607 }
3608 /* ------------------------------------------------------------------
3609   Dissector Parameter Original called  number
3610  */
3611 void
3612 dissect_isup_original_called_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3613 {
3614   proto_item *address_digits_item;
3615   proto_tree *address_digits_tree;
3616   guint8 indicators1, indicators2;
3617   guint8 address_digit_pair=0;
3618   gint offset=0;
3619   gint i=0;
3620   gint length;
3621   char calling_number[MAXDIGITS + 1]="";
3622
3623   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3624   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3625   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3626   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3627   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3628   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3629   offset = 2;
3630
3631   length = tvb_length_remaining(parameter_tvb, offset);
3632
3633   if (length == 0) {
3634     proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Original Called Number (empty)");
3635     proto_item_set_text(parameter_item, "Original Called Number: (empty)");
3636     return;
3637   }
3638
3639   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3640                                             offset, -1,
3641                                             "Original Called Number");
3642   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3643
3644   length = tvb_length_remaining(parameter_tvb, offset);
3645   while(length > 0){
3646     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3647     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3648     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3649     if (i > MAXDIGITS)
3650       THROW(ReportedBoundsError);
3651     if ((length - 1) > 0 ){
3652       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3653       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3654       if (i > MAXDIGITS)
3655         THROW(ReportedBoundsError);
3656     }
3657     offset++;
3658     length = tvb_length_remaining(parameter_tvb, offset);
3659   }
3660
3661   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3662       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3663       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3664       if (i > MAXDIGITS)
3665         THROW(ReportedBoundsError);
3666   }
3667   calling_number[i++] = '\0';
3668
3669   proto_item_set_text(address_digits_item, "Original Called Number: %s", calling_number);
3670   proto_item_set_text(parameter_item, "Original Called Number: %s", calling_number);
3671
3672 }
3673 /* ------------------------------------------------------------------
3674   Dissector Parameter Redirecting number
3675  */
3676 void
3677 dissect_isup_redirecting_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3678 {
3679   proto_item *address_digits_item;
3680   proto_tree *address_digits_tree;
3681   guint8 indicators1, indicators2;
3682   guint8 address_digit_pair=0;
3683   gint offset=0;
3684   gint i=0;
3685   gint length;
3686   char calling_number[MAXDIGITS + 1]="";
3687
3688   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3689   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3690   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3691   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3692   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3693   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3694   offset = 2;
3695
3696   length = tvb_length_remaining(parameter_tvb, offset);
3697
3698   if (length == 0) {
3699     proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Redirecting Number (empty)");
3700     proto_item_set_text(parameter_item, "Redirecting Number: (empty)");
3701         return;
3702   }
3703
3704   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3705                                             offset, -1,
3706                                             "Redirecting Number");
3707   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3708
3709   length = tvb_length_remaining(parameter_tvb, offset);
3710   while(length > 0){
3711     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3712     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3713     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3714     if (i > MAXDIGITS)
3715       THROW(ReportedBoundsError);
3716     if ((length - 1) > 0 ){
3717       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3718       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3719       if (i > MAXDIGITS)
3720         THROW(ReportedBoundsError);
3721     }
3722     offset++;
3723     length = tvb_length_remaining(parameter_tvb, offset);
3724   }
3725
3726   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3727       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3728       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3729       if (i > MAXDIGITS)
3730         THROW(ReportedBoundsError);
3731   }
3732   calling_number[i++] = '\0';
3733
3734   proto_item_set_text(address_digits_item, "Redirecting Number: %s", calling_number);
3735   proto_tree_add_string(address_digits_tree, hf_isup_redirecting, parameter_tvb, offset - length, length, calling_number);
3736   proto_item_set_text(parameter_item, "Redirecting Number: %s", calling_number);
3737 }
3738 /* ------------------------------------------------------------------
3739   Dissector Parameter Redirection number
3740  */
3741 static void
3742 dissect_isup_redirection_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3743 {
3744   proto_item *address_digits_item;
3745   proto_tree *address_digits_tree;
3746   guint8 indicators1, indicators2;
3747   guint8 address_digit_pair=0;
3748   gint offset=0;
3749   gint i=0;
3750   gint length;
3751   char called_number[MAXDIGITS + 1]="";
3752
3753   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3754   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3755   proto_tree_add_uint(parameter_tree, hf_isup_called_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3756   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3757   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
3758   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3759   offset = 2;
3760
3761   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3762                                             offset, -1,
3763                                             "Redirection Number");
3764   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3765
3766   length = tvb_length_remaining(parameter_tvb, offset);
3767   while(length > 0){
3768     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3769     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3770     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3771     if (i > MAXDIGITS)
3772       THROW(ReportedBoundsError);
3773     if ((length - 1) > 0 ){
3774       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3775       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3776       if (i > MAXDIGITS)
3777         THROW(ReportedBoundsError);
3778     }
3779     offset++;
3780     length = tvb_length_remaining(parameter_tvb, offset);
3781   }
3782
3783   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3784       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3785       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3786       if (i > MAXDIGITS)
3787         THROW(ReportedBoundsError);
3788   }
3789   called_number[i++] = '\0';
3790
3791   proto_item_set_text(address_digits_item, "Redirection Number: %s", called_number);
3792   proto_item_set_text(parameter_item, "Redirection Number: %s", called_number);
3793 }
3794 /* ------------------------------------------------------------------
3795   Dissector Parameter Connection request
3796  */
3797 static void
3798 dissect_isup_connection_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3799 {
3800   guint32 local_ref;
3801   guint16 spc;
3802   guint8 protocol_class, credit, offset=0;
3803
3804   local_ref = tvb_get_ntoh24(parameter_tvb, 0);
3805   proto_tree_add_text(parameter_tree, parameter_tvb, offset, LOCAL_REF_LENGTH, "Local Reference: %u", local_ref);
3806   offset = LOCAL_REF_LENGTH;
3807   spc = tvb_get_letohs(parameter_tvb,offset) & 0x3FFF; /*since 1st 2 bits spare */
3808   proto_tree_add_text(parameter_tree, parameter_tvb, offset, SPC_LENGTH, "Signalling Point Code: %u", spc);
3809   offset += SPC_LENGTH;
3810   protocol_class = tvb_get_guint8(parameter_tvb, offset);
3811   proto_tree_add_text(parameter_tree, parameter_tvb, offset, PROTOCOL_CLASS_LENGTH, "Protocol Class: %u", protocol_class);
3812   offset += PROTOCOL_CLASS_LENGTH;
3813   credit = tvb_get_guint8(parameter_tvb, offset);
3814   proto_tree_add_text(parameter_tree, parameter_tvb, offset, CREDIT_LENGTH, "Credit: %u", credit);
3815   offset += CREDIT_LENGTH;
3816
3817   proto_item_set_text(parameter_item, "Connection request: Local Reference = %u, SPC = %u, Protocol Class = %u, Credit = %u", local_ref, spc, protocol_class, credit);
3818 }
3819 /* ------------------------------------------------------------------
3820   Dissector Parameter Redirection information
3821  */
3822 void
3823 dissect_isup_redirection_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3824 {
3825   if (tvb_length(parameter_tvb) == 2){
3826     guint16 indicators;
3827     indicators = tvb_get_ntohs(parameter_tvb, 0);
3828     proto_tree_add_uint(parameter_tree, hf_isup_redirecting_ind, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
3829     proto_tree_add_uint(parameter_tree, hf_isup_original_redirection_reason, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
3830     proto_tree_add_uint(parameter_tree, hf_isup_redirection_counter, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
3831     proto_tree_add_uint(parameter_tree, hf_isup_redirection_reason, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
3832     proto_item_set_text(parameter_item, "Redirection Information");
3833   }
3834   else { /* ISUP'88 (blue book) */
3835     guint16 indicators;
3836     indicators = tvb_get_guint8(parameter_tvb, 0) * 0x100; /*since 2nd octet isn't present*/
3837     proto_tree_add_uint(parameter_tree, hf_isup_redirecting_ind, parameter_tvb, 0, 1, indicators);
3838     proto_tree_add_uint(parameter_tree, hf_isup_original_redirection_reason, parameter_tvb,0 , 1, indicators);
3839     proto_item_set_text(parameter_item, "Redirection Information (2nd octet not present since ISUP '88)");
3840   }
3841 }
3842 /* ------------------------------------------------------------------
3843   Dissector Parameter Closed user group interlock code
3844  */
3845 static void
3846 dissect_isup_closed_user_group_interlock_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3847 {
3848   char NI_digits[5]="";
3849   guint8 digit_pair;
3850   guint16 bin_code;
3851
3852   digit_pair = tvb_get_guint8(parameter_tvb, 0);
3853   NI_digits[0] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
3854   NI_digits[1] = number_to_char(digit_pair & DCBA_8BIT_MASK);
3855   digit_pair = tvb_get_guint8(parameter_tvb, 1);
3856   NI_digits[2] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
3857   NI_digits[3] = number_to_char(digit_pair & DCBA_8BIT_MASK);
3858   NI_digits[4] = '\0';
3859   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 2, "Network Identity: %s", NI_digits);
3860   bin_code = tvb_get_ntohs(parameter_tvb, 2);
3861   proto_tree_add_text(parameter_tree, parameter_tvb, 3, 2, "Binary Code: 0x%x", bin_code);
3862   proto_item_set_text(parameter_item, "Closed user group interlock code: NI = %s, Binary code = 0x%x", NI_digits, bin_code);
3863 }
3864 /* ------------------------------------------------------------------
3865   Dissector Parameter User service information- no detailed dissection since defined in Rec. Q.931
3866  */
3867 static void
3868 dissect_isup_user_service_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3869 { guint length = tvb_length(parameter_tvb);
3870   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
3871           "User service information (-> Q.931 Bearer_capability)");
3872   proto_item_set_text(parameter_item, "User service information, (%u byte%s length)",
3873           length , plurality(length, "", "s"));
3874   dissect_q931_bearer_capability_ie(parameter_tvb,
3875                                             0, length,
3876                                             parameter_tree);
3877 }
3878 /* ------------------------------------------------------------------
3879   Dissector Parameter Signalling point code
3880  */
3881 static void
3882 dissect_isup_signalling_point_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3883 {
3884   guint16 spc;
3885
3886   spc = tvb_get_letohs(parameter_tvb, 0) & 0x3FFF; /*since 1st 2 bits spare */
3887   proto_tree_add_text(parameter_tree, parameter_tvb, 0, SIGNALLING_POINT_CODE_LENGTH, "Signalling Point Code: %u", spc);
3888
3889   proto_item_set_text(parameter_item, "Signalling point code: %u", spc);
3890 }
3891 /* ------------------------------------------------------------------
3892   Dissector Parameter Connected number
3893  */
3894 static void
3895 dissect_isup_connected_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3896 {
3897   proto_item *address_digits_item;
3898   proto_tree *address_digits_tree;
3899   guint8 indicators1, indicators2;
3900   guint8 address_digit_pair=0;
3901   gint offset=0;
3902   gint i=0;
3903   gint length;
3904   char calling_number[MAXDIGITS + 1]="";
3905
3906   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3907   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3908   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3909   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3910   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3911   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3912   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
3913   offset = 2;
3914
3915   length = tvb_length_remaining(parameter_tvb, offset);
3916   if (length == 0)
3917         return; /* empty connected number */
3918   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3919                                             offset, -1,
3920                                             "Connected Number");
3921   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3922
3923   while(length > 0){
3924     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3925     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3926     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3927     if (i > MAXDIGITS)
3928       THROW(ReportedBoundsError);
3929     if ((length - 1) > 0 ){
3930       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3931       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3932       if (i > MAXDIGITS)
3933         THROW(ReportedBoundsError);
3934     }
3935     offset++;
3936     length = tvb_length_remaining(parameter_tvb, offset);
3937   }
3938
3939   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3940       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3941       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3942       if (i > MAXDIGITS)
3943         THROW(ReportedBoundsError);
3944   }
3945   calling_number[i++] = '\0';
3946
3947   proto_item_set_text(address_digits_item, "Connected Number: %s", calling_number);
3948   proto_item_set_text(parameter_item, "Connected Number: %s", calling_number);
3949
3950 }
3951 /* ------------------------------------------------------------------
3952   Dissector Transit network selection
3953  */
3954 static void
3955 dissect_isup_transit_network_selection_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3956 {
3957   proto_item *address_digits_item;
3958   proto_tree *address_digits_tree;
3959   guint8 indicators;
3960   guint8 address_digit_pair=0;
3961   gint offset=0;
3962   gint i=0;
3963   gint length;
3964   char network_id[MAXDIGITS + 1]="";
3965
3966   indicators = tvb_get_guint8(parameter_tvb, 0);
3967   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators);
3968   proto_tree_add_uint(parameter_tree, hf_isup_type_of_network_identification, parameter_tvb, 0, 1, indicators);
3969   proto_tree_add_uint(parameter_tree, hf_isup_network_identification_plan, parameter_tvb, 0, 1, indicators);
3970   offset = 1;
3971
3972   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3973                                             offset, -1,
3974                                             "Network identification");
3975   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3976
3977   length = tvb_length_remaining(parameter_tvb, offset);
3978   while(length > 0){
3979     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3980     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3981     network_id[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3982     if (i > MAXDIGITS)
3983       THROW(ReportedBoundsError);
3984     if ((length - 1) > 0 ){
3985       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3986       network_id[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3987       if (i > MAXDIGITS)
3988         THROW(ReportedBoundsError);
3989     }
3990     offset++;
3991     length = tvb_length_remaining(parameter_tvb, offset);
3992   }
3993
3994   if  (((indicators & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3995       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3996       network_id[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3997       if (i > MAXDIGITS)
3998         THROW(ReportedBoundsError);
3999   }
4000   network_id[i++] = '\0';
4001
4002   proto_item_set_text(address_digits_item, "Network identification: %s", network_id);
4003   proto_item_set_text(parameter_item, "Transit network selection: %s", network_id);
4004
4005 }
4006 /* ------------------------------------------------------------------
4007   Dissector Parameter Circuit assignment map
4008  */
4009 static void
4010 dissect_isup_circuit_assignment_map_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4011 { guint8 map_type;
4012
4013   map_type = tvb_get_guint8(parameter_tvb, 0);
4014   proto_tree_add_uint(parameter_tree, hf_isup_map_type, parameter_tvb, 0, 1, map_type);
4015   proto_tree_add_text(parameter_tree, parameter_tvb, 1, 5, "Circuit assignment map (bit position indicates usage of corresponding circuit->3.69/Q.763)");
4016   proto_item_set_text(parameter_item, "Circuit assignment map");
4017 }
4018 /* ------------------------------------------------------------------
4019   Dissector Parameter Automatic congestion level
4020  */
4021 static void
4022 dissect_isup_automatic_congestion_level_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4023 { guint8 congestion_level;
4024
4025   congestion_level = tvb_get_guint8(parameter_tvb, 0);
4026   proto_tree_add_uint(parameter_tree, hf_isup_automatic_congestion_level, parameter_tvb, 0, AUTO_CONGEST_LEVEL_LENGTH, congestion_level);
4027   proto_item_set_text(parameter_item, "Automatic congestion level: %s (%u)", val_to_str(congestion_level, isup_auto_congestion_level_value, "spare"), congestion_level);
4028 }
4029 /* ------------------------------------------------------------------
4030   Dissector Parameter Optional backward Call indicators
4031  */
4032 static void
4033 dissect_isup_optional_backward_call_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4034 {
4035   guint8 indicators;
4036
4037   indicators = tvb_get_guint8(parameter_tvb, 0);
4038   proto_tree_add_boolean(parameter_tree, hf_isup_inband_information_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
4039   proto_tree_add_boolean(parameter_tree, hf_isup_call_diversion_may_occur_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
4040   proto_tree_add_boolean(parameter_tree, hf_isup_simple_segmentation_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
4041   proto_tree_add_boolean(parameter_tree, hf_isup_mlpp_user_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
4042
4043
4044   proto_item_set_text(parameter_item,"Optional backward call indicators: 0x%x", indicators );
4045 }
4046 /* ------------------------------------------------------------------
4047   Dissector Parameter User-to-user indicators
4048  */
4049 static const true_false_string isup_UUI_type_value = {
4050   "Response",
4051   "Request"
4052 };
4053 static const value_string isup_UUI_request_service_values[] = {
4054   { 0,  "No information"},
4055   { 1,  "Spare"},
4056   { 2,  "Request, not essential"},
4057   { 3,  "Request,essential"},
4058   { 0,  NULL}
4059 };
4060
4061 static const value_string isup_UUI_response_service_values[] = {
4062   { 0,  "No information"},
4063   { 1,  "Not provided"},
4064   { 2,  "Provided"},
4065   { 3,  "Spare"},
4066   { 0,  NULL}
4067 };
4068 static const true_false_string isup_UUI_network_discard_ind_value= {
4069   "User-to-user information discarded by the network",
4070   "No information"
4071 };
4072
4073 static void
4074 dissect_isup_user_to_user_indicators_parameter(tvbuff_t *parameter_tvb,
4075                                                                                            proto_tree *parameter_tree,
4076                                                                                            proto_item *parameter_item)
4077 {
4078   guint8 indicators;
4079
4080   indicators = tvb_get_guint8(parameter_tvb, 0);
4081   proto_tree_add_boolean(parameter_tree, hf_isup_UUI_type, parameter_tvb, 0, 1, indicators);
4082   if ( (indicators & 0x01) == 0 ){
4083           /* Request */
4084           proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service1, parameter_tvb, 0, 1, indicators);
4085           proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service2, parameter_tvb, 0, 1, indicators);
4086           proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service3, parameter_tvb, 0, 1, indicators);
4087   }
4088   else {
4089           /* Response */
4090           proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service1, parameter_tvb, 0, 1, indicators);
4091           proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service2, parameter_tvb, 0, 1, indicators);
4092           proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service3, parameter_tvb, 0, 1, indicators);
4093           proto_tree_add_boolean(parameter_tree, hf_isup_UUI_network_discard_ind, parameter_tvb, 0, 1, indicators);
4094
4095   }
4096   proto_item_set_text(parameter_item,"User-to-user indicators: 0x%x", indicators );
4097 }
4098 /* ------------------------------------------------------------------
4099   Dissector Parameter Original ISC point code
4100  */
4101 static void
4102 dissect_isup_original_isc_point_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4103 {
4104   guint16 spc;
4105
4106   spc = tvb_get_letohs(parameter_tvb, 0) & 0x3FFF; /*since 1st 2 bits spare */
4107   proto_tree_add_text(parameter_tree, parameter_tvb, 0, ORIGINAL_ISC_POINT_CODE_LENGTH, "Origination ISC Point Code: %u", spc);
4108
4109   proto_item_set_text(parameter_item, "Origination ISC point code: %u", spc);
4110 }
4111 /* ------------------------------------------------------------------
4112   Dissector Parameter Generic notification indicator
4113  */
4114 static void
4115 dissect_isup_generic_notification_indicator_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4116 {
4117   guint8 indicators;
4118
4119   indicators = tvb_get_guint8(parameter_tvb, 0);
4120   proto_tree_add_text(parameter_tree, parameter_tvb, 0, GENERIC_NOTIFICATION_IND_LENGTH, "Generic notification indicator: 0x%x (refer to 3.25/Q.763 for detailed decoding)", indicators );
4121   proto_item_set_text(parameter_item,"Generic notification indicator: 0x%x", indicators );
4122 }
4123 /* ------------------------------------------------------------------
4124   Dissector Parameter Call history information
4125  */
4126 static void
4127 dissect_isup_call_history_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4128 {
4129   guint16 info;
4130
4131   info = tvb_get_ntohs(parameter_tvb, 0);
4132   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_HISTORY_INFO_LENGTH, "Call history info: propagation delay = %u ms", info);
4133   proto_item_set_text(parameter_item,"Call history info: propagation delay = %u ms", info);
4134 }
4135 /* ------------------------------------------------------------------
4136   Dissector Parameter Access delivery information
4137  */
4138 static void
4139 dissect_isup_access_delivery_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4140 { guint8 indicator;
4141
4142   indicator = tvb_get_guint8(parameter_tvb, 0);
4143   proto_tree_add_boolean(parameter_tree, hf_isup_access_delivery_ind, parameter_tvb, 0, ACCESS_DELIVERY_INFO_LENGTH, indicator);
4144   proto_item_set_text(parameter_item, "Access delivery information: 0x%x", indicator);
4145 }
4146 /* ------------------------------------------------------------------
4147   Dissector Parameter Network specific facility
4148  */
4149 static void
4150 dissect_isup_network_specific_facility_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4151 { guint length = tvb_length(parameter_tvb);
4152   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Network specific facility (refer to 3.36/Q.763 for detailed decoding)");
4153   proto_item_set_text(parameter_item, "Network specific facility (%u byte%s length)", length , plurality(length, "", "s"));
4154 }
4155 /* ------------------------------------------------------------------
4156   Dissector Parameter User service information prime
4157  */
4158 static void
4159 dissect_isup_user_service_information_prime_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4160 { guint length = tvb_length(parameter_tvb);
4161   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4162           "User service information prime (-> Q.931 Bearer capability information IE)");
4163   dissect_q931_bearer_capability_ie(parameter_tvb,
4164                                             0, length,
4165                                             parameter_tree);
4166
4167   proto_item_set_text(parameter_item, "User service information prime, (%u byte%s length)",
4168           length , plurality(length, "", "s"));
4169 }
4170 /* ------------------------------------------------------------------
4171   Dissector Parameter Propagation delay counter
4172  */
4173 static void
4174 dissect_isup_propagation_delay_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4175 {
4176   guint16 info;
4177
4178   info = tvb_get_ntohs(parameter_tvb, 0);
4179   proto_tree_add_text(parameter_tree, parameter_tvb, 0, PROPAGATION_DELAY_COUNT_LENGTH, "Propagation delay counter = %u ms", info);
4180   proto_item_set_text(parameter_item,"Propagation delay counter = %u ms", info);
4181 }
4182 /* ------------------------------------------------------------------
4183   Dissector Parameter Remote operations
4184  */
4185 static void
4186 dissect_isup_remote_operations_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4187 { guint length = tvb_length(parameter_tvb);
4188   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Remote operations");
4189   proto_item_set_text(parameter_item, "Remote operations (%u byte%s length)", length , plurality(length, "", "s"));
4190 }
4191 /* ------------------------------------------------------------------
4192   Dissector Parameter Service activation
4193  */
4194 static void
4195 dissect_isup_service_activation_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4196 {
4197   guint i;
4198   guint8 feature_code;
4199   guint length = tvb_length(parameter_tvb);
4200   for (i=0; i< length; i++){
4201     feature_code = tvb_get_guint8(parameter_tvb, i);
4202     proto_tree_add_text(parameter_tree, parameter_tvb, i, 1, "Feature Code %u: %u", i+1, feature_code);
4203   }
4204   proto_item_set_text(parameter_item, "Service Activation (%u byte%s length)", length , plurality(length, "", "s"));
4205 }
4206 /* ------------------------------------------------------------------
4207   Dissector Parameter User service information prime - no detailed dissection since defined in Rec. Q.931
4208  */
4209 static void
4210 dissect_isup_user_teleservice_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4211 {
4212   guint length = tvb_length(parameter_tvb);
4213   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4214           "User teleservice information (-> Q.931 High Layer Compatibility IE)");
4215
4216   dissect_q931_high_layer_compat_ie(parameter_tvb, 0, length, parameter_tree);
4217
4218   proto_item_set_text(parameter_item,
4219           "User teleservice information");
4220 }
4221 /* ------------------------------------------------------------------
4222   Dissector Parameter Transmission medium requirement used
4223  */
4224 static void
4225 dissect_isup_transmission_medium_used_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4226 {
4227   guint8 transmission_medium_requirement;
4228
4229   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
4230   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement_prime, parameter_tvb, 0, TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH,transmission_medium_requirement);
4231
4232   proto_item_set_text(parameter_item, "Transmission medium used: %u (%s)",  transmission_medium_requirement, val_to_str(transmission_medium_requirement, isup_transmission_medium_requirement_prime_value, "spare/reserved"));
4233 }
4234 /* ------------------------------------------------------------------
4235   Dissector Parameter Call diversion information
4236  */
4237 static void
4238 dissect_isup_call_diversion_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4239 { guint8 indicator;
4240
4241   indicator = tvb_get_guint8(parameter_tvb, 0);
4242   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_DIV_INFO_LENGTH, "Call diversion information: 0x%x (refer to 3.6/Q.763 for detailed decoding)", indicator);
4243   proto_item_set_text(parameter_item, "Call diversion information: 0x%x", indicator);
4244 }
4245 /* ------------------------------------------------------------------
4246   Dissector Parameter Echo control  information
4247  */
4248 static const value_string OECD_inf_ind_vals[] = {
4249         {0x00, "no information"},
4250         {0x01, "outgoing echo control device not included and not available"},
4251         {0x02, "outgoing echo control device included"},
4252         {0x03, "outgoing echo control device not included but available"},
4253         { 0,    NULL }
4254 };
4255 static const value_string IECD_inf_ind_vals[] = {
4256         {0x00, "no information"},
4257         {0x01, "incoming echo control device not included and not available"},
4258         {0x02, "incoming echo control device included"},
4259         {0x03, "incoming echo control device not included but available"},
4260         { 0,    NULL }
4261 };
4262
4263 static const value_string OECD_req_ind_vals[] = {
4264         {0x00, "no information"},
4265         {0x01, "outgoing echo control device activation request"},
4266         {0x02, "outgoing echo control device deactivation request"},
4267         {0x03, "spare"},
4268         { 0,    NULL }
4269 };
4270
4271 static const value_string IECD_req_ind_vals[] = {
4272         {0x00, "no information"},
4273         {0x01, "incoming echo control device activation request"},
4274         {0x02, "incoming echo control device deactivation request"},
4275         {0x03, "spare"},
4276         { 0,    NULL }
4277 };
4278
4279 static void
4280 dissect_isup_echo_control_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4281 { guint8 indicator;
4282   gint offset = 0;
4283   indicator = tvb_get_guint8(parameter_tvb, 0);
4284   proto_tree_add_text(parameter_tree, parameter_tvb, 0, ECHO_CONTROL_INFO_LENGTH,
4285           "Echo control information: 0x%x", indicator);
4286
4287   proto_tree_add_uint(parameter_tree, hf_isup_OECD_inf_ind,
4288                 parameter_tvb, offset, 1, indicator );
4289
4290   proto_tree_add_uint(parameter_tree, hf_isup_IECD_inf_ind,
4291                 parameter_tvb, offset, 1, indicator );
4292
4293   proto_tree_add_uint(parameter_tree, hf_isup_OECD_req_ind,
4294                 parameter_tvb, offset, 1, indicator );
4295
4296   proto_tree_add_uint(parameter_tree, hf_isup_IECD_req_ind,
4297                 parameter_tvb, offset, 1, indicator );
4298
4299   proto_item_set_text(parameter_item, "Echo control information: 0x%x", indicator);
4300 }
4301 /* ------------------------------------------------------------------
4302   Dissector Parameter Message compatibility information
4303  */
4304
4305 static const true_false_string isup_pass_on_not_possible_indicator_value = {
4306         "discard information",
4307         "release call",
4308 };
4309
4310 static void
4311 dissect_isup_message_compatibility_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4312 {
4313  guint length = tvb_length(parameter_tvb);
4314  guint instruction_indicators;
4315  gint offset = 0;
4316  instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
4317
4318  proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4319           "Message compatibility information");
4320
4321  proto_tree_add_boolean(parameter_tree, hf_isup_transit_at_intermediate_exchange_ind,
4322                 parameter_tvb, offset, 1, instruction_indicators );
4323
4324  proto_tree_add_boolean(parameter_tree, hf_isup_Release_call_ind,
4325          parameter_tvb, offset, 1, instruction_indicators );
4326
4327  proto_tree_add_boolean(parameter_tree, hf_isup_Send_notification_ind,
4328          parameter_tvb, offset, 1, instruction_indicators );
4329
4330  proto_tree_add_boolean(parameter_tree, hf_isup_Discard_message_ind_value,
4331          parameter_tvb, offset, 1, instruction_indicators );
4332
4333  proto_tree_add_boolean(parameter_tree, hf_isup_pass_on_not_possible_indicator2,
4334          parameter_tvb, offset, 1,instruction_indicators);
4335
4336  proto_tree_add_uint(parameter_tree, hf_isup_Broadband_narrowband_interworking_ind2,
4337          parameter_tvb, offset, 1,instruction_indicators);
4338
4339  proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind ,
4340          parameter_tvb, offset, 1, instruction_indicators );
4341
4342   proto_item_set_text(parameter_item, "Message compatibility information (%u byte%s length)",
4343           length , plurality(length, "", "s"));
4344 }
4345 /* ------------------------------------------------------------------
4346   Dissector Parameter compatibility information
4347  */
4348 static const true_false_string isup_transit_at_intermediate_exchange_ind_value  = {
4349   "End node interpretation",
4350   "Transit interpretation"
4351 };
4352
4353
4354 static const true_false_string isup_Discard_message_ind_value = {
4355         "Discard message",
4356         "Do not discard message (pass on)",
4357 };
4358
4359 static const true_false_string isup_Discard_parameter_ind_value = {
4360         "Discard parameter",
4361         "Do not discard parameter (pass on)",
4362 };
4363
4364 static const value_string isup_Pass_on_not_possible_indicator_vals[] = {
4365         { 0x00, "Release call" },
4366         { 0x01, "Discard message" },
4367         { 0x02, "Discard parameter" },
4368         { 0x03, "Reserved (interpreted as 00)" },
4369         { 0, NULL },
4370 };
4371 static const value_string ISUP_Broadband_narrowband_interworking_indicator_vals[] = {
4372         { 0x00, "Pass on" },
4373         { 0x01, "Discard message" },
4374         { 0x02, "Release call" },
4375         { 0x03, "Discard parameter" },
4376         { 0, NULL },
4377 };
4378
4379 static void
4380 dissect_isup_parameter_compatibility_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4381 {
4382   guint  length = tvb_length(parameter_tvb);
4383   guint  len = length;
4384   guint8 upgraded_parameter, upgraded_parameter_no;
4385   guint8 offset;
4386   guint8 instruction_indicators;
4387   offset = 0;
4388   upgraded_parameter_no = 0;
4389
4390   proto_item_set_text(parameter_item, "Parameter compatibility information (%u byte%s length)", length , plurality(length, "", "s"));
4391 /* etxrab Decoded as per Q.763 section 3.41 */
4392
4393   while ( len > 0 ) {
4394   upgraded_parameter_no = upgraded_parameter_no + 1;
4395   upgraded_parameter = tvb_get_guint8(parameter_tvb, offset);
4396
4397   proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1,
4398             "Upgraded parameter no: %u = %s", upgraded_parameter_no,
4399             val_to_str(upgraded_parameter, isup_parameter_type_value, "unknown (%u)"));
4400   offset += 1;
4401   len -= 1;
4402   instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
4403
4404   proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1,
4405                     "Instruction indicators: 0x%x ",
4406                     instruction_indicators);
4407
4408  proto_tree_add_boolean(parameter_tree, hf_isup_transit_at_intermediate_exchange_ind,
4409                 parameter_tvb, offset, 1, instruction_indicators );
4410
4411  proto_tree_add_boolean(parameter_tree, hf_isup_Release_call_ind, parameter_tvb, offset, 1, instruction_indicators );
4412
4413  proto_tree_add_boolean(parameter_tree, hf_isup_Send_notification_ind, parameter_tvb, offset, 1, instruction_indicators );
4414
4415  proto_tree_add_boolean(parameter_tree, hf_isup_Discard_message_ind_value, parameter_tvb, offset, 1, instruction_indicators );
4416
4417  proto_tree_add_boolean(parameter_tree, hf_isup_Discard_parameter_ind, parameter_tvb, offset, 1, instruction_indicators );
4418
4419  proto_tree_add_uint(parameter_tree, hf_isup_Pass_on_not_possible_indicator, parameter_tvb, offset, 1,instruction_indicators);
4420
4421  proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind , parameter_tvb, offset, 1, instruction_indicators );
4422
4423   offset += 1;
4424   len -= 1;
4425   if (!(instruction_indicators & H_8BIT_MASK)) {
4426                 if (len == 0)
4427                         return;
4428                   instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
4429                  proto_tree_add_uint(parameter_tree, hf_isup_Broadband_narrowband_interworking_ind, parameter_tvb, offset, 1,instruction_indicators);
4430                  offset += 1;
4431                   len -= 1;
4432                   }
4433    if (len == 0)
4434    return;
4435   ;
4436  }
4437 /* etxrab */
4438
4439 }
4440 /* ------------------------------------------------------------------
4441   Dissector Parameter MLPP precedence
4442  */
4443 static void
4444 dissect_isup_mlpp_precedence_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4445 {
4446   char NI_digits[5]="";
4447   char *temp_text = "";
4448   guint8 indicators, digit_pair;
4449   guint32 bin_code;
4450
4451   indicators = tvb_get_guint8(parameter_tvb, 0);
4452   switch ((indicators & 0x60) >> 5) {
4453     case 0x0:
4454       temp_text = "Allowed";
4455       break;
4456     case 0x1:
4457       temp_text = "Not Allowed";
4458       break;
4459     case 0x2:
4460           temp_text = "Path reserved";
4461       break;
4462     case 0x3:
4463       temp_text = "Spare";
4464       break;
4465   }
4466   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 1, "Look forward busy: %s", temp_text);
4467   switch (indicators & 0xf) {
4468     case 0x0:
4469       temp_text = "Flash Override";
4470       break;
4471     case 0x1:
4472       temp_text = "Flash";
4473       break;
4474     case 0x2:
4475       temp_text = "Immediate";
4476       break;
4477     case 0x3:
4478       temp_text = "Priority";
4479       break;
4480     case 0x4:
4481       temp_text = "Routine";
4482       break;
4483     default:
4484       temp_text = "Spare";
4485       break;
4486   }
4487
4488
4489   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 1, "Precedence Level: %s",temp_text);
4490   digit_pair = tvb_get_guint8(parameter_tvb, 1);
4491   NI_digits[0] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
4492   NI_digits[1] = number_to_char(digit_pair & DCBA_8BIT_MASK);
4493   digit_pair = tvb_get_guint8(parameter_tvb, 2);
4494   NI_digits[2] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
4495   NI_digits[3] = number_to_char(digit_pair & DCBA_8BIT_MASK);
4496   NI_digits[4] = '\0';
4497   proto_tree_add_text(parameter_tree, parameter_tvb, 1, 2, "Network Identity: %s", NI_digits);
4498   bin_code = tvb_get_ntoh24(parameter_tvb, 3);
4499   proto_tree_add_text(parameter_tree, parameter_tvb, 3, 3, "MLPP service domain: 0x%x", bin_code);
4500   proto_item_set_text(parameter_item, "MLPP precedence: Prec = %s, NI = %s, MLPP service domain = 0x%x", temp_text, NI_digits, bin_code);
4501 }
4502 /* ------------------------------------------------------------------
4503   Dissector Parameter MCID request indicators
4504  */
4505 static void
4506 dissect_isup_mcid_request_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4507 { guint8 indicator;
4508
4509   indicator = tvb_get_guint8(parameter_tvb, 0);
4510   proto_tree_add_text(parameter_tree, parameter_tvb, 0,MCID_REQUEST_IND_LENGTH, "MCID request indicators: 0x%x (MCID requested by Bit1=1, Holding requested by Bit2=1 see 3.31/Q.763)", indicator);
4511   proto_item_set_text(parameter_item, "MCID request indicators: 0x%x", indicator);
4512 }
4513 /* ------------------------------------------------------------------
4514   Dissector Parameter MCID response indicators
4515  */
4516 static void
4517 dissect_isup_mcid_response_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4518 { guint8 indicator;
4519
4520   indicator = tvb_get_guint8(parameter_tvb, 0);
4521   proto_tree_add_text(parameter_tree, parameter_tvb, 0,MCID_RESPONSE_IND_LENGTH, "MCID response indicators: 0x%x (MCID included if Bit1=1, Holding provided if Bit2=1 see 3.32/Q.763)", indicator);
4522   proto_item_set_text(parameter_item, "MCID response indicators: 0x%x", indicator);
4523 }
4524 /* ------------------------------------------------------------------
4525   Dissector Parameter Hop counter
4526  */
4527 static void
4528 dissect_isup_hop_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4529 { guint8 counter;
4530
4531   counter = tvb_get_guint8(parameter_tvb, 0) & EDCBA_8BIT_MASK; /* since bits H,G and F are spare */
4532   proto_tree_add_text(parameter_tree, parameter_tvb, 0, HOP_COUNTER_LENGTH, "Hop counter: %u", counter);
4533   proto_item_set_text(parameter_item,  "Hop counter: %u", counter);
4534 }
4535 /* ------------------------------------------------------------------
4536   Dissector Parameter Originating line information
4537  */
4538 static void
4539 dissect_isup_orig_line_info_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4540 { guint8 info;
4541
4542   info = tvb_get_guint8(parameter_tvb, 0);
4543   proto_tree_add_text(parameter_tree, parameter_tvb, 0, ORIG_LINE_INFO_LENGTH, "Originating line info: %u", info);
4544   proto_item_set_text(parameter_item,  "Originating line info: %u (ANI II if < 51, reserved otherwise)", info);
4545 }
4546 /* ------------------------------------------------------------------
4547   Dissector Parameter Transmission medium requirement prime
4548  */
4549 static void
4550 dissect_isup_transmission_medium_requirement_prime_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4551 {
4552   guint8 transmission_medium_requirement;
4553
4554   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
4555   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement_prime, parameter_tvb, 0, TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH,transmission_medium_requirement);
4556
4557   proto_item_set_text(parameter_item, "Transmission medium requirement prime: %u (%s)",  transmission_medium_requirement, val_to_str(transmission_medium_requirement, isup_transmission_medium_requirement_prime_value, "spare/reserved"));
4558 }
4559
4560 /* ------------------------------------------------------------------
4561   Dissector Parameter location number
4562  */
4563 void
4564 dissect_isup_location_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4565 {
4566   proto_item *address_digits_item;
4567   proto_tree *address_digits_tree;
4568   guint8 indicators1, indicators2;
4569   guint8 address_digit_pair=0;
4570   gint offset=0;
4571   gint i=0;
4572   gint length;
4573   char calling_number[MAXDIGITS + 1]="";
4574
4575   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4576   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4577   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4578   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4579   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
4580   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4581   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
4582     proto_tree_add_text(parameter_tree, parameter_tvb, 1, 1, "Different meaning for Location Number: Numbering plan indicator = private numbering plan");
4583   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4584   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
4585
4586    /* NOTE  When the address presentation restricted indicator indicates address not available, the
4587     * subfields in items a), b), c) and d) are coded with 0's, and the screening indicator is set to 11
4588     * (network provided).
4589         * BUG 938 - Just check if there is someting more to dissect.
4590     */
4591   if (tvb_length_remaining(parameter_tvb, offset) < 3){
4592     proto_tree_add_text(parameter_tree, parameter_tvb, 1, -1, "Location number: address not available");
4593     proto_item_set_text(parameter_item, "Location number: address not available");
4594     return;
4595   }
4596
4597   offset = 2;
4598
4599   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4600                                             offset, -1,
4601                                             "Location number");
4602   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4603
4604   length = tvb_length_remaining(parameter_tvb, offset);
4605   while(length > 0){
4606     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4607     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4608     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4609     if (i > MAXDIGITS)
4610       THROW(ReportedBoundsError);
4611     if ((length - 1) > 0 ){
4612       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4613       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4614       if (i > MAXDIGITS)
4615         THROW(ReportedBoundsError);
4616     }
4617     offset++;
4618     length = tvb_length_remaining(parameter_tvb, offset);
4619   }
4620
4621   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4622       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4623       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4624       if (i > MAXDIGITS)
4625         THROW(ReportedBoundsError);
4626   }
4627   calling_number[i++] = '\0';
4628
4629   proto_item_set_text(address_digits_item, "Location number: %s", calling_number);
4630   proto_item_set_text(parameter_item, "Location number: %s", calling_number);
4631
4632 }
4633 /* ------------------------------------------------------------------
4634   Dissector Parameter Redirection number restiriction
4635  */
4636 static void
4637 dissect_isup_redirection_number_restriction_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4638 {
4639   guint8 indicator;
4640
4641   indicator = tvb_get_guint8(parameter_tvb, 0);
4642   switch (indicator & BA_8BIT_MASK) {
4643   case 0:
4644     proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: Presentation allowed");
4645     break;
4646   case 1:
4647     proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: Presentation restricted");
4648     break;
4649   default:
4650     proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: spare");
4651     break;
4652   }
4653   proto_item_set_text(parameter_item, "Redirection number restriction: 0x%x ", indicator);
4654 }
4655 /* ------------------------------------------------------------------
4656   Dissector Parameter Call transfer identity
4657  */
4658 static void
4659 dissect_isup_call_transfer_reference_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4660 { guint8 id;
4661
4662   id = tvb_get_guint8(parameter_tvb, 0);
4663   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_TRANSFER_REF_LENGTH, "Call transfer identity: %u", id);
4664   proto_item_set_text(parameter_item,  "Call transfer reference: %u", id);
4665 }
4666 /* ------------------------------------------------------------------
4667   Dissector Parameter Loop prevention
4668  */
4669 static void
4670 dissect_isup_loop_prevention_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4671 {
4672   guint8 indicator;
4673
4674   indicator = tvb_get_guint8(parameter_tvb, 0);
4675   if ((indicator & A_8BIT_MASK)==0) {
4676     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "Type: Request");
4677     proto_item_set_text(parameter_item, "Loop prevention indicators: Request (%u)", indicator);
4678   }
4679   else {
4680     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "Type: Response");
4681     proto_tree_add_uint(parameter_tree, hf_isup_loop_prevention_response_ind, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, indicator);
4682     proto_item_set_text(parameter_item, "Loop prevention indicators: Response (%u)", indicator);
4683   }
4684 }
4685 /* ------------------------------------------------------------------
4686   Dissector Parameter Call transfer number
4687  */
4688 static void
4689 dissect_isup_call_transfer_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4690 {
4691   proto_item *address_digits_item;
4692   proto_tree *address_digits_tree;
4693   guint8 indicators1, indicators2;
4694   guint8 address_digit_pair=0;
4695   gint offset=0;
4696   gint i=0;
4697   gint length;
4698   char calling_number[MAXDIGITS + 1]="";
4699
4700   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4701   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4702   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4703   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4704   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4705   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
4706     proto_tree_add_text(parameter_tree, parameter_tvb, 1, 1, "Different meaning for Call Transfer Number: Numbering plan indicator = private numbering plan");
4707   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4708   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator_enhanced, parameter_tvb, 1, 1, indicators2);
4709   offset = 2;
4710
4711   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4712                                             offset, -1,
4713                                             "Call transfer number");
4714   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4715
4716   length = tvb_length_remaining(parameter_tvb, offset);
4717   while(length > 0){
4718     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4719     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4720     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4721     if (i > MAXDIGITS)
4722       THROW(ReportedBoundsError);
4723     if ((length - 1) > 0 ){
4724       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4725       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4726       if (i > MAXDIGITS)
4727         THROW(ReportedBoundsError);
4728     }
4729     offset++;
4730     length = tvb_length_remaining(parameter_tvb, offset);
4731   }
4732
4733   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4734       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4735       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4736       if (i > MAXDIGITS)
4737         THROW(ReportedBoundsError);
4738   }
4739   calling_number[i++] = '\0';
4740
4741   proto_item_set_text(address_digits_item, "Call transfer number: %s", calling_number);
4742   proto_item_set_text(parameter_item, "Call transfer number: %s", calling_number);
4743
4744 }
4745 /* ------------------------------------------------------------------
4746   Dissector Parameter CCSS
4747  */
4748 static void
4749 dissect_isup_ccss_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4750 {
4751   guint8 indicator;
4752
4753   indicator = tvb_get_guint8(parameter_tvb, 0);
4754   if ((indicator & A_8BIT_MASK)==0) {
4755     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "CCSS call indicator: no indication");
4756     proto_item_set_text(parameter_item, "CCSS call indicator: no indication (%u)", indicator);
4757   }
4758   else {
4759     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "CCSS call indicator: CCSS call");
4760     proto_item_set_text(parameter_item, "CCSS call indicator: CCSS call (%u)", indicator);
4761   }
4762 }
4763 /* ------------------------------------------------------------------
4764  Parameter Forward GVNS
4765  */
4766 static void
4767 dissect_isup_forward_gvns_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4768 { guint length = tvb_length(parameter_tvb);
4769   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Forward GVNS (refer to 3.66/Q.763 for detailed decoding)");
4770   proto_item_set_text(parameter_item, "Forward GVNS (%u Byte%s)", length , plurality(length, "", "s"));
4771 }
4772 /* ------------------------------------------------------------------
4773  Parameter Redirect capability
4774  */
4775 static void
4776 dissect_isup_redirect_capability_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4777 { guint length = tvb_length(parameter_tvb);
4778   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Redirect capability (format is a national matter)");
4779   proto_item_set_text(parameter_item, "Redirect Capability (%u Byte%s)", length , plurality(length, "", "s"));
4780 }
4781 /* ------------------------------------------------------------------
4782   Dissector Parameter Backward GVNS
4783  */
4784 static void
4785 dissect_isup_backward_gvns_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4786 { guint8 indicator;
4787
4788   indicator = tvb_get_guint8(parameter_tvb, 0);
4789   proto_tree_add_text(parameter_tree, parameter_tvb, 0, BACKWARD_GVNS_LENGTH, "Backward GVNS: 0x%x (refer to 3.62/Q.763 for detailed decoding)", indicator);
4790   proto_item_set_text(parameter_item, "Backward GVNS: 0x%x", indicator);
4791 }
4792 /* ------------------------------------------------------------------
4793   Dissector Parameter Network management controls
4794  */
4795 static void
4796 dissect_isup_network_management_controls_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4797 { guint8 indicator;
4798
4799   indicator = tvb_get_guint8(parameter_tvb, 0);
4800   proto_tree_add_boolean(parameter_tree, hf_isup_temporary_alternative_routing_ind, parameter_tvb, 0,NETWORK_MANAGEMENT_CONTROLS_LENGTH, indicator);
4801   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0,NETWORK_MANAGEMENT_CONTROLS_LENGTH, indicator);
4802   proto_item_set_text(parameter_item, "Network management controls: 0x%x", indicator);
4803 }
4804 /* ------------------------------------------------------------------
4805   Dissector Parameter Correlation id - no detailed dissection since defined in Rec. Q.1281
4806  */
4807 static void
4808 dissect_isup_correlation_id_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4809 { guint length = tvb_length(parameter_tvb);
4810   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Correlation ID (-> Q.1281)");
4811   proto_item_set_text(parameter_item, "Correlation ID, see Q.1281 (%u Byte%s)", length , plurality(length, "", "s"));
4812 }
4813 /* ------------------------------------------------------------------
4814   Dissector Parameter SCF id - no detailed dissection since defined in Rec. Q.1281
4815  */
4816 static void
4817 dissect_isup_scf_id_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4818 { guint length = tvb_length(parameter_tvb);
4819   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "SCF ID (-> Q.1281)");
4820   proto_item_set_text(parameter_item, "SCF ID, see Q.1281 (%u Byte%s)", length , plurality(length, "", "s"));
4821 }
4822 /* ------------------------------------------------------------------
4823   Dissector Parameter Call diversion treatment indicators
4824  */
4825 static void
4826 dissect_isup_call_diversion_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4827 { guint8 indicator;
4828
4829   indicator = tvb_get_guint8(parameter_tvb, 0);
4830   proto_tree_add_uint(parameter_tree, hf_isup_call_to_be_diverted_ind, parameter_tvb, 0,CALL_DIV_TREATMENT_IND_LENGTH, indicator);
4831   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CALL_DIV_TREATMENT_IND_LENGTH, indicator);
4832   proto_item_set_text(parameter_item, "Call diversion treatment indicators: 0x%x", indicator);
4833 }
4834 /* ------------------------------------------------------------------
4835   Dissector Parameter called IN  number
4836  */
4837 static void
4838 dissect_isup_called_in_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4839 {
4840   proto_item *address_digits_item;
4841   proto_tree *address_digits_tree;
4842   guint8 indicators1, indicators2;
4843   guint8 address_digit_pair=0;
4844   gint offset=0;
4845   gint i=0;
4846   gint length;
4847   char calling_number[MAXDIGITS + 1]="";
4848
4849   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4850   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4851   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4852   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4853   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4854   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4855   offset = 2;
4856
4857   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4858                                             offset, -1,
4859                                             "Called IN Number");
4860   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4861
4862   length = tvb_length_remaining(parameter_tvb, offset);
4863   while(length > 0){
4864     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4865     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4866     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4867     if (i > MAXDIGITS)
4868       THROW(ReportedBoundsError);
4869     if ((length - 1) > 0 ){
4870       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4871       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4872       if (i > MAXDIGITS)
4873         THROW(ReportedBoundsError);
4874     }
4875     offset++;
4876     length = tvb_length_remaining(parameter_tvb, offset);
4877   }
4878
4879   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4880       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4881       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4882       if (i > MAXDIGITS)
4883         THROW(ReportedBoundsError);
4884   }
4885   calling_number[i++] = '\0';
4886
4887   proto_item_set_text(address_digits_item, "Called IN Number: %s", calling_number);
4888   proto_item_set_text(parameter_item, "Called IN Number: %s", calling_number);
4889
4890 }
4891 /* ------------------------------------------------------------------
4892   Dissector Parameter Call offering treatment indicators
4893  */
4894 static void
4895 dissect_isup_call_offering_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4896 { guint8 indicator;
4897
4898   indicator = tvb_get_guint8(parameter_tvb, 0);
4899   proto_tree_add_uint(parameter_tree, hf_isup_call_to_be_offered_ind, parameter_tvb, 0,CALL_OFFERING_TREATMENT_IND_LENGTH, indicator);
4900   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CALL_OFFERING_TREATMENT_IND_LENGTH, indicator);
4901   proto_item_set_text(parameter_item, "Call offering treatment indicators: 0x%x", indicator);
4902 }
4903 /* ------------------------------------------------------------------
4904  Parameter Charged party identification
4905  */
4906 static void
4907 dissect_isup_charged_party_identification_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4908 { guint length = tvb_length(parameter_tvb);
4909   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Charged party identification (format is national network specific)");
4910   proto_item_set_text(parameter_item, "Charged party identification (%u Byte%s)", length , plurality(length, "", "s"));
4911 }
4912 /* ------------------------------------------------------------------
4913   Dissector Parameter Conference treatment indicators
4914  */
4915 static void
4916 dissect_isup_conference_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4917 { guint8 indicator;
4918
4919   indicator = tvb_get_guint8(parameter_tvb, 0);
4920   proto_tree_add_uint(parameter_tree, hf_isup_conference_acceptance_ind, parameter_tvb, 0,CONFERENCE_TREATMENT_IND_LENGTH, indicator);
4921   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CONFERENCE_TREATMENT_IND_LENGTH, indicator);
4922   proto_item_set_text(parameter_item, "Conference treatment indicators: 0x%x", indicator);
4923 }
4924 /* ------------------------------------------------------------------
4925   Dissector Parameter Display information
4926  * TODO Output Display info :
4927  * Quote from Q.931:
4928  * 4.5.16 Display
4929  * The purpose of the Display information element is to supply display information
4930  * that may be displayed by the user. The information contained in this element is coded
4931  * in IA5 characters.
4932  * 8 7 6 5 4 3 2 1   Octet
4933  * 0 0 1 0 1 0 0 0   1      Display information element identifier
4934  *                   2      Length of display contents
4935  * 0                 3      Display information (IA5 characters)
4936  * etc.
4937  * - end - quote -
4938  * Assuming octet 2 and onwards is pased here - just output text ?
4939  */
4940 static void
4941 dissect_isup_display_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4942 { guint length = tvb_length(parameter_tvb);
4943   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4944           "Display information (-> Q.931)");
4945   proto_item_set_text(parameter_item, "Display information (%u Byte%s)",
4946           length , plurality(length, "", "s"));
4947 }
4948 /* ------------------------------------------------------------------
4949  Parameter UID action indicators
4950  */
4951 static void
4952 dissect_isup_uid_action_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4953 { guint8 indicator;
4954
4955   indicator = tvb_get_guint8(parameter_tvb, 0);
4956   proto_tree_add_text(parameter_tree, parameter_tvb, 0,UID_ACTION_IND_LENGTH, "UID action indicators: 0x%x (refer to 3.78/Q.763 for detailed decoding)", indicator);
4957   proto_item_set_text(parameter_item, "UID action indicators: 0x%x", indicator);
4958 }
4959 /* ------------------------------------------------------------------
4960  Parameter UID capability indicators
4961  */
4962 static void
4963 dissect_isup_uid_capability_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4964 { guint8 indicator;
4965
4966   indicator = tvb_get_guint8(parameter_tvb, 0);
4967   proto_tree_add_text(parameter_tree, parameter_tvb, 0,UID_CAPABILITY_IND_LENGTH, "UID capability indicators: 0x%x (refer to 3.79/Q.763 for detailed decoding)", indicator);
4968   proto_item_set_text(parameter_item, "UID capability indicators: 0x%x", indicator);
4969 }
4970 /* ------------------------------------------------------------------
4971  Parameter Redirect counter
4972  */
4973 static void
4974 dissect_isup_redirect_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4975 { guint length = tvb_length(parameter_tvb);
4976   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Redirect counter (format is a national matter)");
4977   proto_item_set_text(parameter_item, "Redirect counter (%u Byte%s)", length , plurality(length, "", "s"));
4978 }
4979 /* ------------------------------------------------------------------
4980   Dissector Parameter Collect call request
4981  */
4982 static void
4983 dissect_isup_collect_call_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4984 { guint8 indicator;
4985
4986   indicator = tvb_get_guint8(parameter_tvb, 0);
4987   if ((indicator & A_8BIT_MASK) == 0) {
4988     proto_tree_add_text(parameter_tree, parameter_tvb, 0, COLLECT_CALL_REQUEST_LENGTH, "Collect call request indicator: no indication");
4989     proto_item_set_text(parameter_item, "Collect call request: no indication (0x%x)", indicator);
4990   }
4991   else {
4992     proto_tree_add_text(parameter_tree, parameter_tvb, 0, COLLECT_CALL_REQUEST_LENGTH, "Collect call request indicator: collect call requested");
4993     proto_item_set_text(parameter_item, "Collect call request: collect call requested (0x%x)", indicator);
4994   }
4995 }
4996 /* ------------------------------------------------------------------
4997   Dissector Parameter Calling geodetic location
4998  */
4999 static void
5000 dissect_isup_calling_geodetic_location_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5001 {
5002   guint         length = tvb_length(parameter_tvb);
5003   guint8        oct, lpri;
5004
5005   oct = tvb_get_guint8(parameter_tvb, 0);
5006   lpri = (oct & 0xc0) >> 2;
5007
5008   proto_tree_add_uint(parameter_tree, hf_isup_geo_loc_presentation_restricted_ind, parameter_tvb, 0, 1, oct);
5009   proto_tree_add_uint(parameter_tree, hf_isup_geo_loc_screening_ind, parameter_tvb, 0, 1, oct);
5010
5011   oct = tvb_get_guint8(parameter_tvb, 1);
5012
5013   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 1, 1, oct);
5014   proto_tree_add_text(parameter_tree, parameter_tvb, 1, 1,
5015     "Calling geodetic location type of shape: %s (%u)",
5016     val_to_str(oct & GFEDCBA_8BIT_MASK, isup_location_type_of_shape_value, "spare/reserved"), oct);
5017
5018   if (length > 2)
5019   {
5020     if (lpri < 0x2)
5021     {
5022       proto_tree_add_text(parameter_tree, parameter_tvb, 2, length - 2,
5023         "Shape description");
5024     }
5025     else
5026     {
5027       /* not supposed to have any data if 'lpri' was 'location not available' */
5028
5029       proto_tree_add_text(parameter_tree, parameter_tvb, 2, length - 2,
5030         "Unknown (?), should not have data if LPRI is 'location not available'");
5031     }
5032   }
5033
5034   proto_item_set_text(parameter_item, "Calling geodetic location");
5035 }
5036 /* ------------------------------------------------------------------
5037   Dissector Parameter Generic number
5038  */
5039 void
5040 dissect_isup_generic_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5041 {
5042   proto_item *address_digits_item;
5043   proto_tree *address_digits_tree;
5044   guint8 indicators1, indicators2, nr_qualifier_ind;
5045   guint8 address_digit_pair=0;
5046   gint offset=0;
5047   gint i=0;
5048   gint length;
5049   char calling_number[MAXDIGITS + 1]="";
5050
5051   nr_qualifier_ind = tvb_get_guint8(parameter_tvb, 0);
5052   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 1, "Number qualifier indicator: 0x%x (refer to 3.26/Q.763 for detailed decoding)", nr_qualifier_ind);
5053   indicators1 = tvb_get_guint8(parameter_tvb, 1);
5054   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 1, 1, indicators1);
5055   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
5056   indicators2 = tvb_get_guint8(parameter_tvb, 2);
5057   proto_tree_add_boolean(parameter_tree, hf_isup_ni_indicator, parameter_tvb, 2, 1, indicators2);
5058   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 2, 1, indicators2);
5059   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
5060     proto_tree_add_text(parameter_tree, parameter_tvb, 2, 1, "Different meaning for Generic Number: Numbering plan indicator = private numbering plan");
5061   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 2, 1, indicators2);
5062   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator_enhanced, parameter_tvb, 2, 1, indicators2);
5063   offset = 3;
5064
5065   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
5066                                             offset, -1,
5067                                             "Generic number");
5068   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
5069
5070   length = tvb_length_remaining(parameter_tvb, offset);
5071   while(length > 0){
5072     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
5073     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5074     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
5075     if (i > MAXDIGITS)
5076       THROW(ReportedBoundsError);
5077     if ((length - 1) > 0 ){
5078       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5079       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5080       if (i > MAXDIGITS)
5081         THROW(ReportedBoundsError);
5082     }
5083     offset++;
5084     length = tvb_length_remaining(parameter_tvb, offset);
5085   }
5086
5087   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
5088       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
5089       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5090       if (i > MAXDIGITS)
5091         THROW(ReportedBoundsError);
5092   }
5093   calling_number[i++] = '\0';
5094
5095   /* 
5096    * Indicators1 = Nature of address 
5097    * Indicators2 = Number plan indicator
5098    */
5099   indicators1 = indicators1 & 0x7f;
5100   indicators2 = (indicators2 & 0x70)>>4; 
5101   if ((indicators1 == ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR)&&(indicators2==ISDN_NUMBERING_PLAN))
5102           dissect_e164_cc(parameter_tvb, address_digits_tree, 3, TRUE);
5103
5104   proto_item_set_text(address_digits_item, "Generic number: %s", calling_number);
5105   proto_item_set_text(parameter_item, "Generic number: %s", calling_number);
5106
5107 }
5108 /* ------------------------------------------------------------------
5109   Dissector Parameter  Jurisdiction parameter
5110  */
5111 static void
5112 dissect_isup_jurisdiction_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5113 {
5114   proto_item *address_digits_item;
5115   proto_tree *address_digits_tree;
5116   guint8 address_digit_pair=0;
5117   gint offset=0;
5118   gint i=0;
5119   gint length;
5120   char called_number[MAXDIGITS + 1]="";
5121
5122   offset = 0;
5123
5124   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
5125                                             offset, -1,
5126                                             "Jurisdiction");
5127   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
5128
5129   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
5130     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
5131     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5132     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
5133     if (i > MAXDIGITS)
5134       THROW(ReportedBoundsError);
5135     if ((length - 1) > 0 ){
5136       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5137       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5138       if (i > MAXDIGITS)
5139         THROW(ReportedBoundsError);
5140     }
5141     offset++;
5142   }
5143
5144   if (tvb_length(parameter_tvb) > 0){
5145       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
5146       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5147       if (i > MAXDIGITS)
5148         THROW(ReportedBoundsError);
5149   }
5150   called_number[i++] = '\0';
5151
5152   proto_item_set_text(address_digits_item, "Jurisdiction: %s", called_number);
5153   proto_item_set_text(parameter_item, "Jurisdiction: %s", called_number);
5154
5155 }/* ------------------------------------------------------------------
5156   Dissector Parameter Generic name
5157  */
5158 static void
5159 dissect_isup_generic_name_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5160 {
5161   guint8 indicator;
5162   gint gen_name_length;
5163   char *gen_name=NULL;
5164
5165   gen_name=ep_alloc(MAXGNAME + 1);
5166   gen_name[0] = '\0';
5167   gen_name_length = tvb_length(parameter_tvb) - 1;
5168   indicator = tvb_get_guint8(parameter_tvb, 0);
5169   proto_tree_add_uint(parameter_tree, hf_isup_generic_name_presentation, parameter_tvb, 1, 1, indicator);
5170   proto_tree_add_boolean(parameter_tree, hf_isup_generic_name_availability, parameter_tvb, 1, 1, indicator);
5171   proto_tree_add_uint(parameter_tree, hf_isup_generic_name_type, parameter_tvb, 1, 1, indicator);
5172   gen_name = tvb_get_ephemeral_string(parameter_tvb,1,gen_name_length);
5173   gen_name[gen_name_length] = '\0';
5174   proto_tree_add_string(parameter_tree, hf_isup_generic_name_ia5, parameter_tvb, 2, gen_name_length, gen_name);
5175   proto_item_set_text(parameter_item, "Generic name: %s", gen_name);
5176
5177   }
5178
5179 /* ------------------------------------------------------------------
5180  Dissector Parameter Generic digits
5181  */
5182 static void
5183 dissect_isup_generic_digits_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5184 { guint length = tvb_length(parameter_tvb);
5185   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Generic digits (refer to 3.24/Q.673 for detailed decoding)");
5186   proto_item_set_text(parameter_item, "Generic digits (%u Byte%s)", length , plurality(length, "", "s"));
5187 }
5188
5189 /* ------------------------------------------------------------------
5190   Dissector Parameter Charge number
5191  */
5192 void
5193 dissect_isup_charge_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5194 {
5195   proto_item *address_digits_item;
5196   proto_tree *address_digits_tree;
5197   guint8 indicators1, indicators2;
5198   guint8 address_digit_pair=0;
5199   gint offset=0;
5200   gint i=0;
5201   gint length;
5202   char calling_number[MAXDIGITS + 1]="";
5203
5204   indicators1 = tvb_get_guint8(parameter_tvb, 0);
5205   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
5206   proto_tree_add_uint(parameter_tree, hf_isup_charge_number_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
5207   indicators2 = tvb_get_guint8(parameter_tvb, 1);
5208   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
5209   offset = 2;
5210
5211   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
5212                                             offset, -1,
5213                                             "Charge Number");
5214   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
5215
5216   length = tvb_length_remaining(parameter_tvb, offset);
5217   while(length > 0){
5218     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
5219     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5220     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
5221     if (i > MAXDIGITS)
5222       THROW(ReportedBoundsError);
5223     if ((length - 1) > 0 ){
5224       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5225       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5226       if (i > MAXDIGITS)
5227         THROW(ReportedBoundsError);
5228     }
5229     offset++;
5230     length = tvb_length_remaining(parameter_tvb, offset);
5231   }
5232
5233   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
5234       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
5235       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5236       if (i > MAXDIGITS)
5237         THROW(ReportedBoundsError);
5238   }
5239   calling_number[i++] = '\0';
5240
5241   proto_item_set_text(address_digits_item, "Charge Number: %s", calling_number);
5242   proto_item_set_text(parameter_item, "Charge Number: %s", calling_number);
5243
5244 }
5245 /* ------------------------------------------------------------------ */
5246 static void
5247 dissect_isup_unknown_parameter(tvbuff_t *parameter_tvb, proto_item *parameter_item)
5248 { guint length = tvb_length(parameter_tvb);
5249   proto_item_set_text(parameter_item, "Parameter Type unknown/reserved (%u Byte%s)", length , plurality(length, "", "s"));
5250 }
5251 /* ------------------------------------------------------------------ */
5252
5253 /* ------------------------------------------------------------------
5254   Dissector all optional parameters
5255 */
5256 static void
5257 dissect_isup_optional_parameter(tvbuff_t *optional_parameters_tvb,packet_info *pinfo, proto_tree *isup_tree)
5258 { proto_item* parameter_item;
5259   proto_tree* parameter_tree;
5260   gint offset = 0;
5261   guint parameter_type, parameter_length, actual_length;
5262   tvbuff_t *parameter_tvb;
5263   guint8 octet;
5264
5265   /* Dissect all optional parameters while end of message isn't reached */
5266   parameter_type = 0xFF; /* Start-initializiation since parameter_type is used for while-condition */
5267
5268   while ((tvb_length_remaining(optional_parameters_tvb, offset)  >= 1) && (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS)){
5269     parameter_type = tvb_get_guint8(optional_parameters_tvb, offset);
5270
5271     if (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS){
5272       parameter_length = tvb_get_guint8(optional_parameters_tvb, offset + PARAMETER_TYPE_LENGTH);
5273
5274       parameter_item = proto_tree_add_text(isup_tree, optional_parameters_tvb,
5275                                            offset,
5276                                            parameter_length  + PARAMETER_TYPE_LENGTH + PARAMETER_LENGTH_IND_LENGTH,
5277                                            "Parameter: type %u",
5278                                            parameter_type);
5279       parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5280       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, optional_parameters_tvb, offset, PARAMETER_TYPE_LENGTH, parameter_type, "Optional Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5281       offset += PARAMETER_TYPE_LENGTH;
5282
5283           octet = tvb_get_guint8(optional_parameters_tvb,offset);
5284
5285       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, optional_parameters_tvb, offset, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
5286       offset += PARAMETER_LENGTH_IND_LENGTH;
5287           if ( octet == 0 )
5288                   continue;
5289
5290       actual_length = tvb_length_remaining(optional_parameters_tvb, offset);
5291       if (actual_length > 0){
5292                   parameter_tvb = tvb_new_subset(optional_parameters_tvb, offset, MIN(parameter_length, actual_length), parameter_length);
5293                   switch (parameter_type) {
5294                         case PARAM_TYPE_CALL_REF:
5295                                 dissect_isup_call_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
5296                                 break;
5297                         case PARAM_TYPE_TRANSM_MEDIUM_REQU:
5298                                 dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
5299                                 break;
5300                         case PARAM_TYPE_ACC_TRANSP:
5301                                 dissect_isup_access_transport_parameter(parameter_tvb, parameter_tree, parameter_item, pinfo);
5302                                 break;
5303                         case PARAM_TYPE_CALLED_PARTY_NR:
5304                                 dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5305                                 break;
5306                         case PARAM_TYPE_SUBSQT_NR:
5307                                 dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5308                                 break;
5309                         case PARAM_TYPE_NATURE_OF_CONN_IND:
5310                                 dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5311                                 break;
5312                         case PARAM_TYPE_FORW_CALL_IND:
5313                                 dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5314                                 break;
5315                         case PARAM_TYPE_OPT_FORW_CALL_IND:
5316                                 dissect_isup_optional_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5317                                 break;
5318                         case PARAM_TYPE_CALLING_PRTY_CATEG:
5319                                 dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
5320                                 break;
5321                         case PARAM_TYPE_CALLING_PARTY_NR:
5322                                 dissect_isup_calling_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5323                                 break;
5324                         case PARAM_TYPE_REDIRECTING_NR:
5325                                 dissect_isup_redirecting_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5326                                 break;
5327                         case PARAM_TYPE_REDIRECTION_NR:
5328                                 dissect_isup_redirection_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5329                                 break;
5330                         case PARAM_TYPE_CONNECTION_REQ:
5331                                 dissect_isup_connection_request_parameter(parameter_tvb, parameter_tree, parameter_item);
5332                                 break;
5333                         case PARAM_TYPE_INFO_REQ_IND:
5334                                 dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5335                                 break;
5336                         case PARAM_TYPE_INFO_IND:
5337                                 dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5338                                 break;
5339                         case PARAM_TYPE_CONTINUITY_IND:
5340                                 dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5341                                 break;
5342                         case PARAM_TYPE_BACKW_CALL_IND:
5343                                 dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5344                                 break;
5345                         case PARAM_TYPE_CAUSE_INDICATORS:
5346                                 dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5347                                 break;
5348                         case PARAM_TYPE_REDIRECTION_INFO:
5349                                 dissect_isup_redirection_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5350                                 break;
5351                         case PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE:
5352                                 dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
5353                                 break;
5354                         case PARAM_TYPE_RANGE_AND_STATUS:
5355                                 dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
5356                                 break;
5357                         case PARAM_TYPE_FACILITY_IND:
5358                                 dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
5359                                 break;
5360                         case PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD:
5361                                 dissect_isup_closed_user_group_interlock_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5362                                 break;
5363                         case PARAM_TYPE_USER_SERVICE_INFO:
5364                                 dissect_isup_user_service_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5365                                 break;
5366                         case PARAM_TYPE_SIGNALLING_POINT_CODE:
5367                                 dissect_isup_signalling_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5368                                 break;
5369                         case PARAM_TYPE_USER_TO_USER_INFO:
5370                                 dissect_isup_user_to_user_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5371                                 break;
5372                         case PARAM_TYPE_CONNECTED_NR:
5373                                 dissect_isup_connected_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5374                                 break;
5375                         case PARAM_TYPE_SUSP_RESUME_IND:
5376                                 dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5377                                 break;
5378                         case PARAM_TYPE_TRANSIT_NETW_SELECT:
5379                                 dissect_isup_transit_network_selection_parameter(parameter_tvb, parameter_tree, parameter_item);
5380                                 break;
5381                         case PARAM_TYPE_EVENT_INFO:
5382                                 dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5383                                 break;
5384                         case PARAM_TYPE_CIRC_ASSIGN_MAP:
5385                                 dissect_isup_circuit_assignment_map_parameter(parameter_tvb, parameter_tree, parameter_item);
5386                                 break;
5387                         case PARAM_TYPE_CIRC_STATE_IND:
5388                                 dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
5389                                 break;
5390                         case PARAM_TYPE_AUTO_CONG_LEVEL:
5391                                 dissect_isup_automatic_congestion_level_parameter(parameter_tvb, parameter_tree, parameter_item);
5392                                 break;
5393                         case PARAM_TYPE_ORIG_CALLED_NR:
5394                                 dissect_isup_original_called_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5395                                 break;
5396                         case PARAM_TYPE_OPT_BACKW_CALL_IND:
5397                                 dissect_isup_optional_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5398                                 break;
5399                         case PARAM_TYPE_USER_TO_USER_IND:
5400                                 dissect_isup_user_to_user_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5401                                 break;
5402                         case PARAM_TYPE_ORIG_ISC_POINT_CODE:
5403                                 dissect_isup_original_isc_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5404                                 break;
5405                         case PARAM_TYPE_GENERIC_NOTIF_IND:
5406                                 dissect_isup_generic_notification_indicator_parameter(parameter_tvb, parameter_tree, parameter_item);
5407                                 break;
5408                         case PARAM_TYPE_CALL_HIST_INFO :
5409                                 dissect_isup_call_history_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5410                                 break;
5411                         case PARAM_TYPE_ACC_DELIV_INFO:
5412                                 dissect_isup_access_delivery_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5413                                 break;
5414                         case PARAM_TYPE_NETW_SPECIFIC_FACLTY:
5415                                 dissect_isup_network_specific_facility_parameter(parameter_tvb, parameter_tree, parameter_item);
5416                                 break;
5417                         case PARAM_TYPE_USER_SERVICE_INFO_PR:
5418                                 dissect_isup_user_service_information_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
5419                                 break;
5420                         case PARAM_TYPE_PROPAG_DELAY_COUNTER:
5421                                 dissect_isup_propagation_delay_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5422                                 break;
5423                         case PARAM_TYPE_REMOTE_OPERATIONS:
5424                                 dissect_isup_remote_operations_parameter(parameter_tvb, parameter_tree, parameter_item);
5425                                 break;
5426                         case PARAM_TYPE_SERVICE_ACTIVATION:
5427                                 dissect_isup_service_activation_parameter(parameter_tvb, parameter_tree, parameter_item);
5428                                 break;
5429                         case PARAM_TYPE_USER_TELESERV_INFO:
5430                                 dissect_isup_user_teleservice_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5431                                 break;
5432                         case PARAM_TYPE_TRANSM_MEDIUM_USED:
5433                                 dissect_isup_transmission_medium_used_parameter(parameter_tvb, parameter_tree, parameter_item);
5434                                 break;
5435                         case PARAM_TYPE_CALL_DIV_INFO:
5436                                 dissect_isup_call_diversion_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5437                                 break;
5438                         case PARAM_TYPE_ECHO_CTRL_INFO:
5439                                 dissect_isup_echo_control_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5440                                 break;
5441                         case PARAM_TYPE_MSG_COMPAT_INFO:
5442                                 dissect_isup_message_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5443                                 break;
5444                         case PARAM_TYPE_PARAM_COMPAT_INFO:
5445                                 dissect_isup_parameter_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5446                                 break;
5447                         case PARAM_TYPE_MLPP_PRECEDENCE:
5448                                 dissect_isup_mlpp_precedence_parameter(parameter_tvb, parameter_tree, parameter_item);
5449                                 break;
5450                         case PARAM_TYPE_MCID_REQ_IND:
5451                                 dissect_isup_mcid_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5452                                 break;
5453                         case PARAM_TYPE_MCID_RSP_IND:
5454                                 dissect_isup_mcid_response_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5455                                 break;
5456                         case PARAM_TYPE_HOP_COUNTER:
5457                                 dissect_isup_hop_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5458                                 break;
5459                         case PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR:
5460                                 dissect_isup_transmission_medium_requirement_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
5461                                 break;
5462                         case PARAM_TYPE_LOCATION_NR:
5463                                 dissect_isup_location_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5464                                 break;
5465                         case PARAM_TYPE_REDIR_NR_RSTRCT:
5466                                 dissect_isup_redirection_number_restriction_parameter(parameter_tvb, parameter_tree, parameter_item);
5467                                 break;
5468                         case PARAM_TYPE_CALL_TRANS_REF:
5469                                 dissect_isup_call_transfer_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
5470                                 break;
5471                         case PARAM_TYPE_LOOP_PREV_IND:
5472                                 dissect_isup_loop_prevention_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5473                                 break;
5474                         case PARAM_TYPE_CALL_TRANS_NR:
5475                                 dissect_isup_call_transfer_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5476                                 break;
5477                         case PARAM_TYPE_CCSS:
5478                                 dissect_isup_ccss_parameter(parameter_tvb, parameter_tree, parameter_item);
5479                                 break;
5480                         case PARAM_TYPE_FORW_GVNS:
5481                                 dissect_isup_forward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
5482                                 break;
5483                         case PARAM_TYPE_BACKW_GVNS:
5484                                 dissect_isup_backward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
5485                                 break;
5486                         case PARAM_TYPE_REDIRECT_CAPAB:
5487                                 dissect_isup_redirect_capability_parameter(parameter_tvb, parameter_tree, parameter_item);
5488                                 break;
5489                         case PARAM_TYPE_NETW_MGMT_CTRL:
5490                                 dissect_isup_network_management_controls_parameter(parameter_tvb, parameter_tree, parameter_item);
5491                                 break;
5492                         case PARAM_TYPE_CORRELATION_ID:
5493                                 dissect_isup_correlation_id_parameter(parameter_tvb, parameter_tree, parameter_item);
5494                                 break;
5495                         case PARAM_TYPE_SCF_ID:
5496                                 dissect_isup_scf_id_parameter(parameter_tvb, parameter_tree, parameter_item);
5497                                 break;
5498                         case PARAM_TYPE_CALL_DIV_TREAT_IND:
5499                                 dissect_isup_call_diversion_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5500                                 break;
5501                         case PARAM_TYPE_CALLED_IN_NR:
5502                                 dissect_isup_called_in_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5503                                 break;
5504                         case PARAM_TYPE_CALL_OFF_TREAT_IND:
5505                                 dissect_isup_call_offering_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5506                                 break;
5507                         case PARAM_TYPE_CHARGED_PARTY_IDENT:
5508                                 dissect_isup_charged_party_identification_parameter(parameter_tvb, parameter_tree, parameter_item);
5509                                 break;
5510                         case PARAM_TYPE_CONF_TREAT_IND:
5511                                 dissect_isup_conference_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5512                                 break;
5513                         case PARAM_TYPE_DISPLAY_INFO:
5514                                 dissect_isup_display_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5515                                 break;
5516                         case PARAM_TYPE_UID_ACTION_IND:
5517                                 dissect_isup_uid_action_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5518                                 break;
5519                         case PARAM_TYPE_UID_CAPAB_IND:
5520                                 dissect_isup_uid_capability_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5521                                 break;
5522                         case PARAM_TYPE_REDIRECT_COUNTER:
5523                                 dissect_isup_redirect_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5524                                 break;
5525                         case PARAM_TYPE_COLLECT_CALL_REQ:
5526                                 dissect_isup_collect_call_request_parameter(parameter_tvb, parameter_tree, parameter_item);
5527                                 break;
5528                         case PARAM_TYPE_GENERIC_NR:
5529                                 dissect_isup_generic_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5530                                 break;
5531                         case PARAM_TYPE_GENERIC_DIGITS:
5532                                 dissect_isup_generic_digits_parameter(parameter_tvb, parameter_tree, parameter_item);
5533                                 break;
5534                         case PARAM_TYPE_APPLICATON_TRANS:
5535                                 dissect_isup_application_transport_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
5536                                 break;
5537
5538                         default:
5539                                 dissect_isup_unknown_parameter(parameter_tvb, parameter_item);
5540                                 break;
5541                         }
5542
5543
5544                         offset += MIN(parameter_length, actual_length);
5545                 }
5546
5547          }
5548     else {
5549                 /* End of optional parameters is reached */
5550                 proto_tree_add_uint_format(isup_tree, hf_isup_parameter_type, optional_parameters_tvb , offset, PARAMETER_TYPE_LENGTH, parameter_type, "End of optional parameters (%u)", parameter_type);
5551     }
5552   }
5553 }
5554
5555 /* ------------------------------------------------------------------
5556   Dissector all ANSI optional parameters
5557   TODO: Actullay make this dissect ANSI :) - It's still plain old ITU for now
5558 */
5559 static void
5560 dissect_ansi_isup_optional_parameter(tvbuff_t *optional_parameters_tvb,packet_info *pinfo, proto_tree *isup_tree)
5561 { proto_item* parameter_item;
5562   proto_tree* parameter_tree;
5563   gint offset = 0;
5564   guint parameter_type, parameter_length, actual_length;
5565   tvbuff_t *parameter_tvb;
5566   guint8 octet;
5567
5568   /* Dissect all optional parameters while end of message isn't reached */
5569   parameter_type = 0xFF; /* Start-initializiation since parameter_type is used for while-condition */
5570
5571   while ((tvb_length_remaining(optional_parameters_tvb, offset)  >= 1) && (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS)){
5572     parameter_type = tvb_get_guint8(optional_parameters_tvb, offset);
5573
5574     if (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS){
5575       parameter_length = tvb_get_guint8(optional_parameters_tvb, offset + PARAMETER_TYPE_LENGTH);
5576
5577       parameter_item = proto_tree_add_text(isup_tree, optional_parameters_tvb,
5578                                            offset,
5579                                            parameter_length  + PARAMETER_TYPE_LENGTH + PARAMETER_LENGTH_IND_LENGTH,
5580                                            "Parameter: type %u",
5581                                            parameter_type);
5582       parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5583       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, optional_parameters_tvb, offset, PARAMETER_TYPE_LENGTH, parameter_type, "Optional Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, ansi_isup_parameter_type_value,"unknown"));
5584       offset += PARAMETER_TYPE_LENGTH;
5585
5586           octet = tvb_get_guint8(optional_parameters_tvb,offset);
5587
5588       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, optional_parameters_tvb, offset, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
5589       offset += PARAMETER_LENGTH_IND_LENGTH;
5590           if ( octet == 0 )
5591                   continue;
5592
5593       actual_length = tvb_length_remaining(optional_parameters_tvb, offset);
5594       if (actual_length > 0){
5595                   parameter_tvb = tvb_new_subset(optional_parameters_tvb, offset, MIN(parameter_length, actual_length), parameter_length);
5596                   switch (parameter_type) {
5597                         case PARAM_TYPE_CALL_REF:
5598                                 dissect_isup_call_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
5599                                 break;
5600                         case PARAM_TYPE_TRANSM_MEDIUM_REQU:
5601                                 dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
5602                                 break;
5603                         case PARAM_TYPE_ACC_TRANSP:
5604                                 dissect_isup_access_transport_parameter(parameter_tvb, parameter_tree, parameter_item, pinfo);
5605                                 break;
5606                         case PARAM_TYPE_CALLED_PARTY_NR:
5607                                 dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5608                                 break;
5609                         case PARAM_TYPE_SUBSQT_NR:
5610                                 dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5611                                 break;
5612                         case PARAM_TYPE_NATURE_OF_CONN_IND:
5613                                 dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5614                                 break;
5615                         case PARAM_TYPE_FORW_CALL_IND:
5616                                 dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5617                                 break;
5618                         case PARAM_TYPE_OPT_FORW_CALL_IND:
5619                                 dissect_isup_optional_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5620                                 break;
5621                         case PARAM_TYPE_CALLING_PRTY_CATEG:
5622                                 dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
5623                                 break;
5624                         case PARAM_TYPE_CALLING_PARTY_NR:
5625                                 dissect_isup_calling_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5626                                 break;
5627                         case PARAM_TYPE_REDIRECTING_NR:
5628                                 dissect_isup_redirecting_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5629                                 break;
5630                         case PARAM_TYPE_REDIRECTION_NR:
5631                                 dissect_isup_redirection_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5632                                 break;
5633                         case PARAM_TYPE_CONNECTION_REQ:
5634                                 dissect_isup_connection_request_parameter(parameter_tvb, parameter_tree, parameter_item);
5635                                 break;
5636                         case PARAM_TYPE_INFO_REQ_IND:
5637                                 dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5638                                 break;
5639                         case PARAM_TYPE_INFO_IND:
5640                                 dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5641                                 break;
5642                         case PARAM_TYPE_CONTINUITY_IND:
5643                                 dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5644                                 break;
5645                         case PARAM_TYPE_BACKW_CALL_IND:
5646                                 dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5647                                 break;
5648                         case PARAM_TYPE_CAUSE_INDICATORS:
5649                                 dissect_ansi_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5650                                 break;
5651                         case PARAM_TYPE_REDIRECTION_INFO:
5652                                 dissect_isup_redirection_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5653                                 break;
5654                         case PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE:
5655                                 dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
5656                                 break;
5657                         case PARAM_TYPE_RANGE_AND_STATUS:
5658                                 dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
5659                                 break;
5660                         case PARAM_TYPE_FACILITY_IND:
5661                                 dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
5662                                 break;
5663                         case PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD:
5664                                 dissect_isup_closed_user_group_interlock_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5665                                 break;
5666                         case PARAM_TYPE_USER_SERVICE_INFO:
5667                                 dissect_isup_user_service_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5668                                 break;
5669                         case PARAM_TYPE_SIGNALLING_POINT_CODE:
5670                                 dissect_isup_signalling_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5671                                 break;
5672                         case PARAM_TYPE_USER_TO_USER_INFO:
5673                                 dissect_isup_user_to_user_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5674                                 break;
5675                         case PARAM_TYPE_CONNECTED_NR:
5676                                 dissect_isup_connected_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5677                                 break;
5678                         case PARAM_TYPE_SUSP_RESUME_IND:
5679                                 dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5680                                 break;
5681                         case PARAM_TYPE_TRANSIT_NETW_SELECT:
5682                                 dissect_isup_transit_network_selection_parameter(parameter_tvb, parameter_tree, parameter_item);
5683                                 break;
5684                         case PARAM_TYPE_EVENT_INFO:
5685                                 dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5686                                 break;
5687                         case PARAM_TYPE_CIRC_ASSIGN_MAP:
5688                                 dissect_isup_circuit_assignment_map_parameter(parameter_tvb, parameter_tree, parameter_item);
5689                                 break;
5690                         case PARAM_TYPE_CIRC_STATE_IND:
5691                                 dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
5692                                 break;
5693                         case PARAM_TYPE_AUTO_CONG_LEVEL:
5694                                 dissect_isup_automatic_congestion_level_parameter(parameter_tvb, parameter_tree, parameter_item);
5695                                 break;
5696                         case PARAM_TYPE_ORIG_CALLED_NR:
5697                                 dissect_isup_original_called_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5698                                 break;
5699                         case PARAM_TYPE_OPT_BACKW_CALL_IND:
5700                                 dissect_isup_optional_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5701                                 break;
5702                         case PARAM_TYPE_USER_TO_USER_IND:
5703                                 dissect_isup_user_to_user_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5704                                 break;
5705                         case PARAM_TYPE_ORIG_ISC_POINT_CODE:
5706                                 dissect_isup_original_isc_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5707                                 break;
5708                         case PARAM_TYPE_GENERIC_NOTIF_IND:
5709                                 dissect_isup_generic_notification_indicator_parameter(parameter_tvb, parameter_tree, parameter_item);
5710                                 break;
5711                         case PARAM_TYPE_CALL_HIST_INFO :
5712                                 dissect_isup_call_history_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5713                                 break;
5714                         case PARAM_TYPE_ACC_DELIV_INFO:
5715                                 dissect_isup_access_delivery_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5716                                 break;
5717                         case PARAM_TYPE_NETW_SPECIFIC_FACLTY:
5718                                 dissect_isup_network_specific_facility_parameter(parameter_tvb, parameter_tree, parameter_item);
5719                                 break;
5720                         case PARAM_TYPE_USER_SERVICE_INFO_PR:
5721                                 dissect_isup_user_service_information_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
5722                                 break;
5723                         case PARAM_TYPE_PROPAG_DELAY_COUNTER:
5724                                 dissect_isup_propagation_delay_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5725                                 break;
5726                         case PARAM_TYPE_REMOTE_OPERATIONS:
5727                                 dissect_isup_remote_operations_parameter(parameter_tvb, parameter_tree, parameter_item);
5728                                 break;
5729                         case PARAM_TYPE_SERVICE_ACTIVATION:
5730                                 dissect_isup_service_activation_parameter(parameter_tvb, parameter_tree, parameter_item);
5731                                 break;
5732                         case PARAM_TYPE_USER_TELESERV_INFO:
5733                                 dissect_isup_user_teleservice_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5734                                 break;
5735                         case PARAM_TYPE_TRANSM_MEDIUM_USED:
5736                                 dissect_isup_transmission_medium_used_parameter(parameter_tvb, parameter_tree, parameter_item);
5737                                 break;
5738                         case PARAM_TYPE_CALL_DIV_INFO:
5739                                 dissect_isup_call_diversion_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5740                                 break;
5741                         case PARAM_TYPE_ECHO_CTRL_INFO:
5742                                 dissect_isup_echo_control_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5743                                 break;
5744                         case PARAM_TYPE_MSG_COMPAT_INFO:
5745                                 dissect_isup_message_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5746                                 break;
5747                         case PARAM_TYPE_PARAM_COMPAT_INFO:
5748                                 dissect_isup_parameter_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5749                                 break;
5750                         case PARAM_TYPE_MLPP_PRECEDENCE:
5751                                 dissect_isup_mlpp_precedence_parameter(parameter_tvb, parameter_tree, parameter_item);
5752                                 break;
5753                         case PARAM_TYPE_MCID_REQ_IND:
5754                                 dissect_isup_mcid_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5755                                 break;
5756                         case PARAM_TYPE_MCID_RSP_IND:
5757                                 dissect_isup_mcid_response_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5758                                 break;
5759                         case PARAM_TYPE_HOP_COUNTER:
5760                                 dissect_isup_hop_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5761                                 break;
5762                         case PARAM_TYPE_ORIG_LINE_INFO:
5763                                 dissect_isup_orig_line_info_parameter(parameter_tvb, parameter_tree, parameter_item);
5764                                 break;
5765                         case PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR:
5766                                 dissect_isup_transmission_medium_requirement_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
5767                                 break;
5768                         case PARAM_TYPE_LOCATION_NR:
5769                                 dissect_isup_location_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5770                                 break;
5771                         case PARAM_TYPE_REDIR_NR_RSTRCT:
5772                                 dissect_isup_redirection_number_restriction_parameter(parameter_tvb, parameter_tree, parameter_item);
5773                                 break;
5774                         case PARAM_TYPE_CALL_TRANS_REF:
5775                                 dissect_isup_call_transfer_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
5776                                 break;
5777                         case PARAM_TYPE_LOOP_PREV_IND:
5778                                 dissect_isup_loop_prevention_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5779                                 break;
5780                         case PARAM_TYPE_CALL_TRANS_NR:
5781                                 dissect_isup_call_transfer_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5782                                 break;
5783                         case PARAM_TYPE_CCSS:
5784                                 dissect_isup_ccss_parameter(parameter_tvb, parameter_tree, parameter_item);
5785                                 break;
5786                         case PARAM_TYPE_FORW_GVNS:
5787                                 dissect_isup_forward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
5788                                 break;
5789                         case PARAM_TYPE_BACKW_GVNS:
5790                                 dissect_isup_backward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
5791                                 break;
5792                         case PARAM_TYPE_REDIRECT_CAPAB:
5793                                 dissect_isup_redirect_capability_parameter(parameter_tvb, parameter_tree, parameter_item);
5794                                 break;
5795                         case PARAM_TYPE_NETW_MGMT_CTRL:
5796                                 dissect_isup_network_management_controls_parameter(parameter_tvb, parameter_tree, parameter_item);
5797                                 break;
5798                         case PARAM_TYPE_CORRELATION_ID:
5799                                 dissect_isup_correlation_id_parameter(parameter_tvb, parameter_tree, parameter_item);
5800                                 break;
5801                         case PARAM_TYPE_SCF_ID:
5802                                 dissect_isup_scf_id_parameter(parameter_tvb, parameter_tree, parameter_item);
5803                                 break;
5804                         case PARAM_TYPE_CALL_DIV_TREAT_IND:
5805                                 dissect_isup_call_diversion_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5806                                 break;
5807                         case PARAM_TYPE_CALLED_IN_NR:
5808                                 dissect_isup_called_in_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5809                                 break;
5810                         case PARAM_TYPE_CALL_OFF_TREAT_IND:
5811                                 dissect_isup_call_offering_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5812                                 break;
5813                         case PARAM_TYPE_CHARGED_PARTY_IDENT:
5814                                 dissect_isup_charged_party_identification_parameter(parameter_tvb, parameter_tree, parameter_item);
5815                                 break;
5816                         case PARAM_TYPE_CONF_TREAT_IND:
5817                                 dissect_isup_conference_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5818                                 break;
5819                         case PARAM_TYPE_DISPLAY_INFO:
5820                                 dissect_isup_display_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5821                                 break;
5822                         case PARAM_TYPE_UID_ACTION_IND:
5823                                 dissect_isup_uid_action_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5824                                 break;
5825                         case PARAM_TYPE_UID_CAPAB_IND:
5826                                 dissect_isup_uid_capability_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5827                                 break;
5828                         case PARAM_TYPE_REDIRECT_COUNTER:
5829                                 dissect_isup_redirect_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5830                                 break;
5831                         case PARAM_TYPE_COLLECT_CALL_REQ:
5832                                 dissect_isup_collect_call_request_parameter(parameter_tvb, parameter_tree, parameter_item);
5833                                 break;
5834                         case PARAM_TYPE_CALLING_GEODETIC_LOCATION:
5835                                 dissect_isup_calling_geodetic_location_parameter(parameter_tvb, parameter_tree, parameter_item);
5836                                 break;
5837                         case PARAM_TYPE_GENERIC_NR:
5838                                 dissect_isup_generic_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5839                                 break;
5840                         case PARAM_TYPE_JURISDICTION:
5841                                 dissect_isup_jurisdiction_parameter(parameter_tvb, parameter_tree, parameter_item);
5842                                 break;
5843                         case PARAM_TYPE_GENERIC_NAME:
5844                                 dissect_isup_generic_name_parameter(parameter_tvb, parameter_tree, parameter_item);
5845                                 break;
5846                         case PARAM_TYPE_GENERIC_DIGITS:
5847                                 dissect_isup_generic_digits_parameter(parameter_tvb, parameter_tree, parameter_item);
5848                                 break;
5849                         case PARAM_TYPE_CHARGE_NR:
5850                                 dissect_isup_charge_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5851                                 break;
5852                         case PARAM_TYPE_APPLICATON_TRANS:
5853                                 dissect_isup_application_transport_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
5854                                 break;
5855
5856                         default:
5857                                 dissect_isup_unknown_parameter(parameter_tvb, parameter_item);
5858                                 break;
5859                         }
5860
5861
5862                         offset += MIN(parameter_length, actual_length);
5863                 }
5864
5865          }
5866     else {
5867                 /* End of optional parameters is reached */
5868                 proto_tree_add_uint_format(isup_tree, hf_isup_parameter_type, optional_parameters_tvb , offset, PARAMETER_TYPE_LENGTH, parameter_type, "End of optional parameters (%u)", parameter_type);
5869     }
5870   }
5871 }
5872 /* ------------------------------------------------------------------ */
5873 /* Dissectors for all used message types                              */
5874 /* Called by dissect_isup_message(),                                  */
5875 /* call parameter dissectors in order of mandatory parameters         */
5876 /* (since not labeled)                                                */
5877 /* ------------------------------------------------------------------
5878   Dissector Message Type Circuit Validation Test Response
5879  */
5880 static gint
5881 dissect_ansi_isup_circuit_validation_test_resp_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5882 {
5883   proto_item* parameter_item;
5884   proto_tree* parameter_tree;
5885   tvbuff_t *parameter_tvb;
5886   gint offset = 0;
5887   gint parameter_type,actual_length;
5888
5889   /* Do stuff for first mandatory fixed parameter: CVR Repsonse Indicator */
5890   parameter_type = ANSI_ISUP_PARAM_TYPE_CVR_RESP_IND;
5891   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset, CVR_RESP_IND_LENGTH, "CVR Response Indicator");
5892
5893   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5894   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"CVR Response Indicator"));
5895
5896   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5897
5898   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CVR_RESP_IND_LENGTH, actual_length), CVR_RESP_IND_LENGTH);
5899   dissect_isup_cvr_response_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
5900   offset += CVR_RESP_IND_LENGTH;
5901
5902   /* Do stuff for second mandatory fixed parameter: CG Characteristics Indicator */
5903   parameter_type = ANSI_ISUP_PARAM_TYPE_CG_CHAR_IND;
5904   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5905                                                                            CG_CHAR_IND_LENGTH,
5906                                                                        "Circuit Group Characteristics Indicators");
5907   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5908   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"Circuit Group Characters"));
5909   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5910   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CG_CHAR_IND_LENGTH, actual_length), CG_CHAR_IND_LENGTH);
5911   dissect_isup_circuit_group_char_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
5912   offset += CG_CHAR_IND_LENGTH;
5913
5914   return offset;
5915 }
5916 /* ------------------------------------------------------------------
5917   Dissector Message Type Circuit Reservation
5918  */
5919 static gint
5920 dissect_ansi_isup_circuit_reservation_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5921 { proto_item* parameter_item;
5922   proto_tree* parameter_tree;
5923   tvbuff_t *parameter_tvb;
5924   gint offset = 0;
5925   gint parameter_type, actual_length;
5926
5927   /* Do stuff for mandatory fixed parameter: Nature of Connection Indicators */
5928   parameter_type = PARAM_TYPE_NATURE_OF_CONN_IND;
5929   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5930                                        NATURE_OF_CONNECTION_IND_LENGTH,
5931                                        "Nature of Connection Indicators");
5932   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5933   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5934   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5935   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(NATURE_OF_CONNECTION_IND_LENGTH, actual_length), NATURE_OF_CONNECTION_IND_LENGTH);
5936   dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5937   offset += NATURE_OF_CONNECTION_IND_LENGTH;
5938
5939   return offset;
5940 }
5941 /* ------------------------------------------------------------------
5942   Dissector Message Type Initial address message
5943  */
5944 static gint
5945 dissect_isup_initial_address_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5946 { proto_item* parameter_item;
5947   proto_tree* parameter_tree;
5948   tvbuff_t *parameter_tvb;
5949   gint offset = 0;
5950   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5951
5952   /* Do stuff for first mandatory fixed parameter: Nature of Connection Indicators */
5953   parameter_type = PARAM_TYPE_NATURE_OF_CONN_IND;
5954   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5955                                        NATURE_OF_CONNECTION_IND_LENGTH,
5956                                        "Nature of Connection Indicators");
5957   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5958   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5959   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5960   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(NATURE_OF_CONNECTION_IND_LENGTH, actual_length), NATURE_OF_CONNECTION_IND_LENGTH);
5961   dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5962   offset += NATURE_OF_CONNECTION_IND_LENGTH;
5963
5964   /* Do stuff for 2nd mandatory fixed parameter: Forward Call Indicators */
5965   parameter_type =  PARAM_TYPE_FORW_CALL_IND;
5966   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5967                                        FORWARD_CALL_IND_LENGTH,
5968                                        "Forward Call Indicators");
5969   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5970   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5971   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5972   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FORWARD_CALL_IND_LENGTH, actual_length), FORWARD_CALL_IND_LENGTH );
5973   dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5974   offset +=  FORWARD_CALL_IND_LENGTH;
5975
5976   /* Do stuff for 3nd mandatory fixed parameter: Calling party's category */
5977   parameter_type = PARAM_TYPE_CALLING_PRTY_CATEG;
5978   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5979                                        CALLING_PRTYS_CATEGORY_LENGTH,
5980                                        "Calling Party's category");
5981   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5982   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5983   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5984   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CALLING_PRTYS_CATEGORY_LENGTH, actual_length),CALLING_PRTYS_CATEGORY_LENGTH );
5985   dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
5986   offset += CALLING_PRTYS_CATEGORY_LENGTH;
5987
5988   switch (isup_standard){
5989   case ITU_STANDARD:
5990     /* If ITU, do stuff for 4th mandatory fixed parameter: Transmission medium requirement */
5991     parameter_type = PARAM_TYPE_TRANSM_MEDIUM_REQU;
5992     parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5993                                          TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH,
5994                                          "Transmission medium requirement");
5995     parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5996     proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5997     actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5998     parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH, actual_length), TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH);
5999     dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
6000     offset += TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH;
6001     break;
6002   case ANSI_STANDARD:
6003     /* If ANSI, do stuff for the first mandatory variable parameter, USER_SERVICE_INFORMATION */
6004     parameter_type = PARAM_TYPE_USER_SERVICE_INFO;
6005     parameter_pointer = tvb_get_guint8(message_tvb, offset);
6006     parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6007     parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6008                                          offset +  parameter_pointer,
6009                                          parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6010                                          "User Service Information");
6011     parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6012     proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6013     proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6014     proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6015     actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6016     parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6017     dissect_isup_user_service_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6018     offset += PARAMETER_POINTER_LENGTH;
6019     break;
6020   }
6021
6022   /* Do stuff for mandatory variable parameter Called party number */
6023   parameter_type = PARAM_TYPE_CALLED_PARTY_NR;
6024   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6025   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6026
6027   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6028                                        offset +  parameter_pointer,
6029                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6030                                        "Called Party Number");
6031   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6032   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6033   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6034   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6035   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6036   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6037   dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6038   offset += PARAMETER_POINTER_LENGTH;
6039
6040   return offset;
6041 }
6042 /* ------------------------------------------------------------------
6043   Dissector Message Type subsequent address message
6044  */
6045 static gint dissect_isup_subsequent_address_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6046 { proto_item* parameter_item;
6047   proto_tree* parameter_tree;
6048   tvbuff_t *parameter_tvb;
6049   gint offset = 0;
6050   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6051
6052   /* Do stuff for mandatory variable parameter Subsequent number */
6053   parameter_type = PARAM_TYPE_SUBSQT_NR;
6054
6055   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6056   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6057
6058   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6059                                        offset +  parameter_pointer,
6060                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6061                                        "Subsequent Number");
6062   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6063   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6064   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6065   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6066   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6067   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6068   dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6069   offset += PARAMETER_POINTER_LENGTH;
6070
6071   return offset;
6072 }
6073
6074 /* ------------------------------------------------------------------
6075   Dissector Message Type Information request message
6076  */
6077 static gint
6078 dissect_isup_information_request_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6079 { proto_item* parameter_item;
6080   proto_tree* parameter_tree;
6081   tvbuff_t *parameter_tvb;
6082   gint offset = 0;
6083   gint parameter_type, actual_length;
6084
6085   /* Do stuff for first mandatory fixed parameter: Information request indicators*/
6086   parameter_type = PARAM_TYPE_INFO_REQ_IND;
6087   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6088                                        INFO_REQUEST_IND_LENGTH,
6089                                        "Information request indicators");
6090   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6091   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6092   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6093   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(INFO_REQUEST_IND_LENGTH, actual_length), INFO_REQUEST_IND_LENGTH);
6094   dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6095   offset += INFO_REQUEST_IND_LENGTH;
6096   return offset;
6097 }
6098 /* ------------------------------------------------------------------
6099   Dissector Message Type Information
6100  */
6101 static gint
6102 dissect_isup_information_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6103 { proto_item* parameter_item;
6104   proto_tree* parameter_tree;
6105   tvbuff_t *parameter_tvb;
6106   gint offset = 0;
6107   gint parameter_type, actual_length;
6108
6109   /* Do stuff for first mandatory fixed parameter: Information  indicators*/
6110   parameter_type = PARAM_TYPE_INFO_IND;
6111   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6112                                        INFO_IND_LENGTH,
6113                                        "Information indicators");
6114   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6115   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6116   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6117   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(INFO_IND_LENGTH, actual_length), INFO_IND_LENGTH);
6118   dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6119   offset += INFO_IND_LENGTH;
6120   return offset;
6121 }
6122 /* ------------------------------------------------------------------
6123   Dissector Message Type Continuity
6124  */
6125 static gint
6126 dissect_isup_continuity_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6127 { proto_item* parameter_item;
6128   proto_tree* parameter_tree;
6129   tvbuff_t *parameter_tvb;
6130   gint offset = 0;
6131   gint parameter_type, actual_length;
6132
6133   /* Do stuff for first mandatory fixed parameter: Continuity indicators*/
6134   parameter_type = PARAM_TYPE_CONTINUITY_IND;
6135   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6136                                        CONTINUITY_IND_LENGTH,
6137                                        "Continuity indicators");
6138   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6139   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6140   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6141   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CONTINUITY_IND_LENGTH, actual_length), CONTINUITY_IND_LENGTH);
6142   dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6143   offset += CONTINUITY_IND_LENGTH;
6144   return offset;
6145 }
6146 /* ------------------------------------------------------------------
6147   Dissector Message Type Address complete
6148  */
6149 static gint
6150 dissect_isup_address_complete_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6151 { proto_item* parameter_item;
6152   proto_tree* parameter_tree;
6153   tvbuff_t *parameter_tvb;
6154   gint offset = 0;
6155   gint parameter_type, actual_length;
6156
6157   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
6158   parameter_type = PARAM_TYPE_BACKW_CALL_IND;
6159   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6160                                        BACKWARD_CALL_IND_LENGTH,
6161                                        "Backward Call Indicators");
6162   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6163   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6164   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6165   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(BACKWARD_CALL_IND_LENGTH, actual_length), BACKWARD_CALL_IND_LENGTH);
6166   dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6167   offset += BACKWARD_CALL_IND_LENGTH;
6168   return offset;
6169 }
6170 /* ------------------------------------------------------------------
6171   Dissector Message Type Connect
6172  */
6173 static gint
6174 dissect_isup_connect_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6175 { proto_item* parameter_item;
6176   proto_tree* parameter_tree;
6177   tvbuff_t *parameter_tvb;
6178   gint offset = 0;
6179   gint parameter_type, actual_length;
6180
6181   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
6182   parameter_type = PARAM_TYPE_BACKW_CALL_IND;
6183   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6184                                        BACKWARD_CALL_IND_LENGTH,
6185                                        "Backward Call Indicators");
6186   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6187   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6188   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6189   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(BACKWARD_CALL_IND_LENGTH, actual_length), BACKWARD_CALL_IND_LENGTH);
6190   dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6191   offset += BACKWARD_CALL_IND_LENGTH;
6192   return offset;
6193 }
6194 /* ------------------------------------------------------------------
6195   Dissector Message Type release message
6196  */
6197 static gint
6198 dissect_isup_release_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6199 { proto_item* parameter_item;
6200   proto_tree* parameter_tree;
6201   tvbuff_t *parameter_tvb;
6202   gint offset = 0;
6203   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6204
6205   /* Do stuff for mandatory variable parameter Cause indicators */
6206   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
6207
6208   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6209   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6210
6211   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6212                                        offset +  parameter_pointer,
6213                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6214                                        "Cause indicators");
6215   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6216   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6217   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6218   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6219   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6220   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6221   switch (isup_standard){
6222   case ITU_STANDARD:
6223           dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6224           break;
6225   case ANSI_STANDARD:
6226           dissect_ansi_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6227           break;
6228   }
6229   offset += PARAMETER_POINTER_LENGTH;
6230
6231   return offset;
6232 }
6233 /* ------------------------------------------------------------------
6234   Dissector Message Type Resume/Suspend
6235  */
6236 static gint
6237 dissect_isup_suspend_resume_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6238 { proto_item* parameter_item;
6239   proto_tree* parameter_tree;
6240   tvbuff_t *parameter_tvb;
6241   gint offset = 0;
6242   gint parameter_type, actual_length;
6243
6244   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
6245   parameter_type = PARAM_TYPE_SUSP_RESUME_IND;
6246   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6247                                        SUSPEND_RESUME_IND_LENGTH,
6248                                        "Suspend/Resume indicator");
6249   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6250   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6251   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6252   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(SUSPEND_RESUME_IND_LENGTH, actual_length), SUSPEND_RESUME_IND_LENGTH);
6253   dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6254   offset += SUSPEND_RESUME_IND_LENGTH;
6255   return offset;
6256 }
6257 /* ------------------------------------------------------------------
6258   Dissector Message Type Circuit group reset/query message
6259  */
6260 static gint
6261 dissect_isup_circuit_group_reset_query_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6262 { proto_item* parameter_item;
6263   proto_tree* parameter_tree;
6264   tvbuff_t *parameter_tvb;
6265   gint offset = 0;
6266   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6267
6268   /* Do stuff for mandatory variable parameter range and status*/
6269   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
6270
6271   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6272   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6273
6274   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6275                                        offset +  parameter_pointer,
6276                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6277                                        "Range and status");
6278   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6279   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6280   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6281   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6282   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6283   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6284   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
6285   offset += PARAMETER_POINTER_LENGTH;
6286
6287   return offset;
6288 }
6289 /* ------------------------------------------------------------------
6290   Dissector Message Type Circuit group blocking/blocking ack/unblocking/unblocking ack messages
6291  */
6292 static gint
6293 dissect_isup_circuit_group_blocking_messages(tvbuff_t *message_tvb, proto_tree *isup_tree)
6294 { proto_item* parameter_item;
6295   proto_tree* parameter_tree;
6296   tvbuff_t *parameter_tvb;
6297   gint offset = 0;
6298   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6299
6300    /* Do stuff for first mandatory fixed parameter: circuit group supervision message type*/
6301   parameter_type = PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE;
6302   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6303                                        CIRC_GRP_SV_MSG_TYPE_LENGTH,
6304                                        "Circuit group supervision message type");
6305   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6306   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6307   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6308   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CIRC_GRP_SV_MSG_TYPE_LENGTH, actual_length), CIRC_GRP_SV_MSG_TYPE_LENGTH);
6309   dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
6310   offset += CIRC_GRP_SV_MSG_TYPE_LENGTH;
6311
6312   /* Do stuff for mandatory variable parameter range and status*/
6313   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
6314
6315   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6316   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6317
6318   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6319                                        offset +  parameter_pointer,
6320                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6321                                        "Range and status");
6322   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6323   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6324   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6325   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6326   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6327   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6328   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
6329   offset += PARAMETER_POINTER_LENGTH;
6330
6331   return offset;
6332 }
6333
6334 /* ------------------------------------------------------------------
6335   Dissector Message Type Facility request/accepted
6336  */
6337 static gint
6338 dissect_isup_facility_request_accepted_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6339 { proto_item* parameter_item;
6340   proto_tree* parameter_tree;
6341   tvbuff_t *parameter_tvb;
6342   gint offset = 0;
6343   gint parameter_type, actual_length;
6344
6345   /* Do stuff for first mandatory fixed parameter: facility indicators*/
6346   parameter_type = PARAM_TYPE_FACILITY_IND;
6347   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6348                                        FACILITY_IND_LENGTH,
6349                                        "Facility indicator");
6350   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6351   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6352   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6353   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FACILITY_IND_LENGTH, actual_length), FACILITY_IND_LENGTH);
6354   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
6355   offset += FACILITY_IND_LENGTH;
6356   return offset;
6357 }
6358 /* ------------------------------------------------------------------
6359   Dissector Message Type Facility reject
6360  */
6361 static gint
6362 dissect_isup_facility_reject_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6363 { proto_item* parameter_item;
6364   proto_tree* parameter_tree;
6365   tvbuff_t *parameter_tvb;
6366   gint offset = 0;
6367   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6368
6369   /* Do stuff for first mandatory fixed parameter: facility indicators*/
6370   parameter_type = PARAM_TYPE_FACILITY_IND;
6371   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6372                                        FACILITY_IND_LENGTH,
6373                                        "Facility indicator");
6374   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6375   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6376   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6377   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FACILITY_IND_LENGTH, actual_length), FACILITY_IND_LENGTH);
6378   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
6379   offset += FACILITY_IND_LENGTH;
6380
6381   /* Do stuff for mandatory variable parameter Cause indicators */
6382   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
6383
6384   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6385   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6386
6387   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6388                                        offset +  parameter_pointer,
6389                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6390                                        "Cause indicators, see Q.850");
6391   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6392   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6393   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6394   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6395   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6396   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6397   switch (isup_standard){
6398   case ITU_STANDARD:
6399           dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6400           break;
6401   case ANSI_STANDARD:
6402           dissect_ansi_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6403           break;
6404   }
6405   offset += PARAMETER_POINTER_LENGTH;
6406
6407   return offset;
6408 }
6409 /* ------------------------------------------------------------------
6410   Dissector Message Type Circuit group reset acknowledgement message
6411  */
6412 static gint
6413 dissect_isup_circuit_group_reset_acknowledgement_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6414 { proto_item* parameter_item;
6415   proto_tree* parameter_tree;
6416   tvbuff_t *parameter_tvb;
6417   gint offset = 0;
6418   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6419
6420   /* Do stuff for mandatory variable parameter range and status*/
6421   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
6422
6423   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6424   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6425
6426   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6427                                        offset +  parameter_pointer,
6428                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6429                                        "Range and status");
6430   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6431   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6432   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6433   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6434   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6435   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6436   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
6437   offset += PARAMETER_POINTER_LENGTH;
6438
6439   return offset;
6440 }
6441 /* ------------------------------------------------------------------
6442   Dissector Message Type Circuit group query response message
6443  */
6444 static gint
6445 dissect_isup_circuit_group_query_response_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6446 { proto_item* parameter_item;
6447   proto_tree* parameter_tree;
6448   tvbuff_t *parameter_tvb;
6449   gint offset = 0;
6450   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6451
6452   /* Do stuff for 1. mandatory variable parameter range and status*/
6453   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
6454
6455   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6456   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6457
6458   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6459                                        offset +  parameter_pointer,
6460                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6461                                        "Range and status");
6462   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6463   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6464   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6465   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6466   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6467   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6468   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
6469   offset += PARAMETER_POINTER_LENGTH;
6470
6471   /* Do stuff for 2. mandatory variable parameter Circuit state indicator*/
6472   parameter_type = PARAM_TYPE_CIRC_STATE_IND;
6473
6474   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6475   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6476
6477   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6478                                        offset +  parameter_pointer,
6479                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6480                                        "Circuit state indicator (national use)");
6481   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6482   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6483   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6484   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6485   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6486   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6487   dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
6488   offset += PARAMETER_POINTER_LENGTH;
6489
6490   return offset;
6491 }
6492 /* ------------------------------------------------------------------
6493   Dissector Message Type Call Progress
6494 */
6495 static gint
6496 dissect_isup_call_progress_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6497 { proto_item* parameter_item;
6498   proto_tree* parameter_tree;
6499   tvbuff_t *parameter_tvb;
6500   gint offset = 0;
6501   gint parameter_type, actual_length;
6502
6503   /* Do stuff for first mandatory fixed parameter: Event information*/
6504   parameter_type = PARAM_TYPE_EVENT_INFO;
6505   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6506                                        EVENT_INFO_LENGTH,
6507                                        "Event information");
6508   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6509   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6510   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6511   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(EVENT_INFO_LENGTH, actual_length), EVENT_INFO_LENGTH);
6512   dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6513   offset += EVENT_INFO_LENGTH;
6514   return offset;
6515 }
6516 /* ------------------------------------------------------------------
6517   Dissector Message Type User-to-User information
6518  */
6519 static gint
6520 dissect_isup_user_to_user_information_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6521 { proto_item* parameter_item;
6522   proto_tree* parameter_tree;
6523   tvbuff_t *parameter_tvb;
6524   gint offset = 0;
6525   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6526
6527   /* Do stuff for mandatory variable parameter User-to-user information*/
6528   parameter_type =  PARAM_TYPE_USER_TO_USER_INFO;
6529
6530   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6531   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6532
6533   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6534                                        offset +  parameter_pointer,
6535                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6536                                        "User-to-user information, see Q.931");
6537   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6538   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6539   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6540   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6541   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6542   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6543   dissect_isup_user_to_user_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6544   offset += PARAMETER_POINTER_LENGTH;
6545
6546   return offset;
6547 }
6548 /* ------------------------------------------------------------------
6549   Dissector Message Type Confusion
6550  */
6551 static gint
6552 dissect_isup_confusion_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6553 { proto_item* parameter_item;
6554   proto_tree* parameter_tree;
6555   tvbuff_t *parameter_tvb;
6556   gint offset = 0;
6557   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6558
6559   /* Do stuff for mandatory variable parameter Cause indicators */
6560   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
6561
6562   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6563   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6564
6565   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6566                                        offset +  parameter_pointer,
6567                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6568                                        "Cause indicators, see Q.850");
6569   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6570   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
6571   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6572   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6573   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6574   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6575
6576   switch (isup_standard){
6577   case ITU_STANDARD:
6578           dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6579           break;
6580   case ANSI_STANDARD:
6581           dissect_ansi_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6582           break;
6583   }
6584   offset += PARAMETER_POINTER_LENGTH;
6585
6586   return offset;
6587 }
6588 /* ------------------------------------------------------------------ */
6589 static void
6590 dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup_tree)
6591 {
6592   static isup_tap_rec_t tap_rec;
6593   tvbuff_t *parameter_tvb;
6594   tvbuff_t *optional_parameter_tvb;
6595   proto_item* pass_along_item;
6596   proto_tree* pass_along_tree;
6597   gint offset, bufferlength;
6598   guint8 message_type, opt_parameter_pointer;
6599   gint opt_part_possible = FALSE; /* default setting - for message types allowing optional
6600                                      params explicitely set to TRUE in case statement */
6601   tap_calling_number = NULL;
6602   offset = 0;
6603
6604   /* Extract message type field */
6605   message_type = tvb_get_guint8(message_tvb,0);
6606
6607   switch (isup_standard){
6608   case ITU_STANDARD:
6609           proto_tree_add_uint_format(isup_tree, hf_isup_message_type, message_tvb, 0, MESSAGE_TYPE_LENGTH, message_type, "Message type: %s (%u)", val_to_str(message_type, isup_message_type_value, "reserved"), message_type);
6610           break;
6611   case ANSI_STANDARD:
6612           proto_tree_add_uint_format(isup_tree, hf_isup_message_type, message_tvb, 0, MESSAGE_TYPE_LENGTH, message_type, "Message type: %s (%u)", val_to_str(message_type, ansi_isup_message_type_value, "reserved"), message_type);
6613           break;
6614   }
6615    offset +=  MESSAGE_TYPE_LENGTH;
6616
6617    tap_rec.message_type = message_type;
6618    tap_rec.calling_number = NULL;
6619    tap_rec.called_number = NULL;
6620
6621    parameter_tvb = tvb_new_subset(message_tvb, offset, -1, -1);
6622
6623    /* distinguish between message types:*/
6624         switch (isup_standard){
6625                 case ITU_STANDARD:
6626                         switch (message_type) {
6627                         case MESSAGE_TYPE_INITIAL_ADDR:
6628                                 offset += dissect_isup_initial_address_message(parameter_tvb, isup_tree);
6629                                 opt_part_possible = TRUE;
6630                                 break;
6631                         case MESSAGE_TYPE_SUBSEQ_ADDR:
6632                                 offset += dissect_isup_subsequent_address_message(parameter_tvb, isup_tree);
6633                                 opt_part_possible = TRUE;
6634                                 break;
6635                         case MESSAGE_TYPE_INFO_REQ:
6636                                 offset += dissect_isup_information_request_message(parameter_tvb, isup_tree);
6637                                 opt_part_possible = TRUE;
6638                                 break;
6639                         case MESSAGE_TYPE_INFO:
6640                                 offset += dissect_isup_information_message(parameter_tvb, isup_tree);
6641                                 opt_part_possible = TRUE;
6642                                 break;
6643                         case MESSAGE_TYPE_CONTINUITY:
6644                                 offset += dissect_isup_continuity_message(parameter_tvb, isup_tree);
6645                                 break;
6646                         case MESSAGE_TYPE_ADDR_CMPL:
6647                                 offset += dissect_isup_address_complete_message(parameter_tvb, isup_tree);
6648                                 opt_part_possible = TRUE;
6649                                 break;
6650                         case MESSAGE_TYPE_CONNECT:
6651                                 offset += dissect_isup_connect_message(parameter_tvb, isup_tree);
6652                                 opt_part_possible = TRUE;
6653                                 break;
6654                         case MESSAGE_TYPE_FORW_TRANS:
6655                                 /* no dissector necessary since no mandatory parameters included */
6656                                 opt_part_possible = TRUE;
6657                                 break;
6658                         case MESSAGE_TYPE_ANSWER:
6659                                 /* no dissector necessary since no mandatory parameters included */
6660                                 opt_part_possible = TRUE;
6661                                 break;
6662                         case MESSAGE_TYPE_RELEASE:
6663                                 offset += dissect_isup_release_message(parameter_tvb, isup_tree);
6664                                 opt_part_possible = TRUE;
6665                                 break;
6666                         case MESSAGE_TYPE_SUSPEND:
6667                                 offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
6668                                 opt_part_possible = TRUE;
6669                                 break;
6670                         case MESSAGE_TYPE_RESUME:
6671                                 offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
6672                                 opt_part_possible = TRUE;
6673                                 break;
6674                         case MESSAGE_TYPE_REL_CMPL:
6675                                 /* no dissector necessary since no mandatory parameters included */
6676                                 opt_part_possible = TRUE;
6677                                 break;
6678                         case MESSAGE_TYPE_CONT_CHECK_REQ:
6679                                 /* no dissector necessary since no mandatory parameters included */
6680                                 break;
6681                         case MESSAGE_TYPE_RESET_CIRCUIT:
6682                                 /* no dissector necessary since no mandatory parameters included */
6683                                 break;
6684                         case MESSAGE_TYPE_BLOCKING:
6685                                 /* no dissector necessary since no mandatory parameters included */
6686                                 break;
6687                         case MESSAGE_TYPE_UNBLOCKING:
6688                                 /* no dissector necessary since no mandatory parameters included */
6689                                 break;
6690                         case MESSAGE_TYPE_BLOCK_ACK:
6691                                 /* no dissector necessary since no mandatory parameters included */
6692                                 break;
6693                         case MESSAGE_TYPE_UNBLOCK_ACK:
6694                                 /* no dissector necessary since no mandatory parameters included */
6695                                 break;
6696                         case MESSAGE_TYPE_CIRC_GRP_RST:
6697                                 offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
6698                                 break;
6699                         case MESSAGE_TYPE_CIRC_GRP_BLCK:
6700                                 offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
6701                                 break;
6702                         case MESSAGE_TYPE_CIRC_GRP_UNBL:
6703                                 offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
6704                                 break;
6705                         case MESSAGE_TYPE_CIRC_GRP_BL_ACK:
6706                                 offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
6707                                 break;
6708                         case MESSAGE_TYPE_CIRC_GRP_UNBL_ACK:
6709                                 offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
6710                                 break;
6711                         case MESSAGE_TYPE_FACILITY_REQ:
6712                                 offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
6713                                 opt_part_possible = TRUE;
6714                                 break;
6715                         case MESSAGE_TYPE_FACILITY_ACC:
6716                                 offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
6717                                 opt_part_possible = TRUE;
6718                                 break;
6719                         case MESSAGE_TYPE_FACILITY_REJ:
6720                                 offset += dissect_isup_facility_reject_message(parameter_tvb, isup_tree);
6721                                 opt_part_possible = TRUE;
6722                                 break;
6723                         case MESSAGE_TYPE_LOOP_BACK_ACK:
6724                                 /* no dissector necessary since no mandatory parameters included */
6725                                 break;
6726                         case MESSAGE_TYPE_PASS_ALONG:
6727                                 /* call dissect_isup_message recursively */
6728                                 {       guint8 pa_message_type;
6729                                         pa_message_type = tvb_get_guint8(parameter_tvb, 0);
6730                                         pass_along_item = proto_tree_add_text(isup_tree, parameter_tvb, offset, -1, "Pass-along: %s Message (%u)", val_to_str(pa_message_type, isup_message_type_value_acro, "reserved"), pa_message_type);
6731                                         pass_along_tree = proto_item_add_subtree(pass_along_item, ett_isup_pass_along_message);
6732                                         dissect_isup_message(parameter_tvb, pinfo, pass_along_tree);
6733                                         break;
6734                                 }
6735                         case MESSAGE_TYPE_CIRC_GRP_RST_ACK:
6736                                 offset += dissect_isup_circuit_group_reset_acknowledgement_message(parameter_tvb, isup_tree);
6737                                 break;
6738                         case MESSAGE_TYPE_CIRC_GRP_QRY:
6739                                 offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
6740                                 break;
6741                         case MESSAGE_TYPE_CIRC_GRP_QRY_RSP:
6742                                 offset += dissect_isup_circuit_group_query_response_message(parameter_tvb, isup_tree);
6743                                 break;
6744                         case MESSAGE_TYPE_CALL_PROGRSS:
6745                                 offset += dissect_isup_call_progress_message(parameter_tvb, isup_tree);
6746                                 opt_part_possible = TRUE;
6747                                 break;
6748                         case MESSAGE_TYPE_USER2USER_INFO:
6749                                 offset += dissect_isup_user_to_user_information_message(parameter_tvb, isup_tree);
6750                                 opt_part_possible = TRUE;
6751                                 break;
6752                         case MESSAGE_TYPE_UNEQUIPPED_CIC:
6753                                 /* no dissector necessary since no mandatory parameters included */
6754                                 break;
6755                         case MESSAGE_TYPE_CONFUSION:
6756                                 offset += dissect_isup_confusion_message(parameter_tvb, isup_tree);
6757                                 opt_part_possible = TRUE;
6758                                 break;
6759                         case MESSAGE_TYPE_OVERLOAD:
6760                                 /* no dissector necessary since no mandatory parameters included */
6761                                 break;
6762                         case MESSAGE_TYPE_CHARGE_INFO:
6763                                 /* do nothing since format is a national matter */
6764                                 bufferlength = tvb_length_remaining(message_tvb, offset);
6765                                 if (bufferlength != 0)
6766                                         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
6767                                 break;
6768                         case MESSAGE_TYPE_NETW_RESRC_MGMT:
6769                                 /* no dissector necessary since no mandatory parameters included */
6770                                 opt_part_possible = TRUE;
6771                                 break;
6772                         case MESSAGE_TYPE_FACILITY:
6773                                 /* no dissector necessary since no mandatory parameters included */
6774                                 opt_part_possible = TRUE;
6775                                 break;
6776                         case MESSAGE_TYPE_USER_PART_TEST:
6777                                 /* no dissector necessary since no mandatory parameters included */
6778                                 opt_part_possible = TRUE;
6779                                 break;
6780                         case MESSAGE_TYPE_USER_PART_AVAIL:
6781                                 /* no dissector necessary since no mandatory parameters included */
6782                                 opt_part_possible = TRUE;
6783                                 break;
6784                         case MESSAGE_TYPE_IDENT_REQ:
6785                                 /* no dissector necessary since no mandatory parameters included */
6786                                 opt_part_possible = TRUE;
6787                                 break;
6788                         case MESSAGE_TYPE_IDENT_RSP:
6789                                 /* no dissector necessary since no mandatory parameters included */
6790                                 opt_part_possible = TRUE;
6791                                 break;
6792                         case MESSAGE_TYPE_SEGMENTATION:
6793                                 /* no dissector necessary since no mandatory parameters included */
6794                                 opt_part_possible = TRUE;
6795                                 break;
6796                         case MESSAGE_TYPE_LOOP_PREVENTION:
6797                                 /* no dissector necessary since no mandatory parameters included */
6798                                 opt_part_possible = TRUE;
6799                                 break;
6800                         case MESSAGE_TYPE_APPLICATION_TRANS:
6801                                 /* no dissector necessary since no mandatory parameters included */
6802                                 opt_part_possible = TRUE;
6803                                 break;
6804                         case MESSAGE_TYPE_PRE_RELEASE_INFO:
6805                                 /* no dissector necessary since no mandatory parameters included */
6806                                 opt_part_possible = TRUE;
6807                                 break;
6808                         case MESSAGE_TYPE_SUBSEQUENT_DIR_NUM:
6809                                 /* do nothing since format is a national matter */
6810                                 bufferlength = tvb_length_remaining(message_tvb, offset);
6811                                 if (bufferlength != 0)
6812                                         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
6813                                 break;
6814                         default:
6815                                 bufferlength = tvb_length_remaining(message_tvb, offset);
6816                                 if (bufferlength != 0)
6817                                         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Unknown Message type (possibly reserved/used in former ISUP version)");
6818                                 break;
6819                         }
6820                         break;
6821                 case ANSI_STANDARD:
6822                         /* TODO if neccessary make new "dissect_ansi_isup_xxx() routines or add branches in the current ones.
6823                          */
6824                         switch (message_type) {
6825                         case MESSAGE_TYPE_INITIAL_ADDR:
6826                                 offset += dissect_isup_initial_address_message(parameter_tvb, isup_tree);
6827                                 opt_part_possible = TRUE;
6828                                 break;
6829                         case MESSAGE_TYPE_SUBSEQ_ADDR:
6830                                 offset += dissect_isup_subsequent_address_message(parameter_tvb, isup_tree);
6831                                 opt_part_possible = TRUE;
6832                                 break;
6833                         case MESSAGE_TYPE_INFO_REQ:
6834                                 offset += dissect_isup_information_request_message(parameter_tvb, isup_tree);
6835                                 opt_part_possible = TRUE;
6836                                 break;
6837                         case MESSAGE_TYPE_INFO:
6838                                 offset += dissect_isup_information_message(parameter_tvb, isup_tree);
6839                                 opt_part_possible = TRUE;
6840                                 break;
6841                         case MESSAGE_TYPE_CONTINUITY:
6842                                 offset += dissect_isup_continuity_message(parameter_tvb, isup_tree);
6843                                 break;
6844                         case MESSAGE_TYPE_ADDR_CMPL:
6845                                 offset += dissect_isup_address_complete_message(parameter_tvb, isup_tree);
6846                                 opt_part_possible = TRUE;
6847                                 break;
6848                         case MESSAGE_TYPE_CONNECT:
6849                                 offset += dissect_isup_connect_message(parameter_tvb, isup_tree);
6850                                 opt_part_possible = TRUE;
6851                                 break;
6852                         case MESSAGE_TYPE_FORW_TRANS:
6853                                 /* no dissector necessary since no mandatory parameters included */
6854                                 opt_part_possible = TRUE;
6855                                 break;
6856                         case MESSAGE_TYPE_ANSWER:
6857                                 /* no dissector necessary since no mandatory parameters included */
6858                                 opt_part_possible = TRUE;
6859                                 break;
6860                         case MESSAGE_TYPE_RELEASE:
6861                                 offset += dissect_isup_release_message(parameter_tvb, isup_tree);
6862                                 opt_part_possible = TRUE;
6863                                 break;
6864                         case MESSAGE_TYPE_SUSPEND:
6865                                 offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
6866                                 opt_part_possible = TRUE;
6867                                 break;
6868                         case MESSAGE_TYPE_RESUME:
6869                                 offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
6870                                 opt_part_possible = TRUE;
6871                                 break;
6872                         case MESSAGE_TYPE_REL_CMPL:
6873                                 /* no dissector necessary since no mandatory parameters included */
6874                                 break;
6875                         case MESSAGE_TYPE_CONT_CHECK_REQ:
6876                                 /* no dissector necessary since no mandatory parameters included */
6877                                 break;
6878                         case MESSAGE_TYPE_RESET_CIRCUIT:
6879                                 /* no dissector necessary since no mandatory parameters included */
6880                                 break;
6881                         case MESSAGE_TYPE_BLOCKING:
6882                                 /* no dissector necessary since no mandatory parameters included */
6883                                 break;
6884                         case MESSAGE_TYPE_UNBLOCKING:
6885                                 /* no dissector necessary since no mandatory parameters included */
6886                                 break;
6887                         case MESSAGE_TYPE_BLOCK_ACK:
6888                                 /* no dissector necessary since no mandatory parameters included */
6889                                 break;
6890                         case MESSAGE_TYPE_UNBLOCK_ACK:
6891                                 /* no dissector necessary since no mandatory parameters included */
6892                                 break;
6893                         case MESSAGE_TYPE_CIRC_GRP_RST:
6894                                 offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
6895                                 break;
6896                         case MESSAGE_TYPE_CIRC_GRP_BLCK:
6897                                 offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
6898                                 break;
6899                         case MESSAGE_TYPE_CIRC_GRP_UNBL:
6900                                 offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
6901                                 break;
6902                         case MESSAGE_TYPE_CIRC_GRP_BL_ACK:
6903                                 offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
6904                                 break;
6905                         case MESSAGE_TYPE_CIRC_GRP_UNBL_ACK:
6906                                 offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
6907                                 break;
6908                         case MESSAGE_TYPE_FACILITY_REQ:
6909                                 offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
6910                                 opt_part_possible = TRUE;
6911                                 break;
6912                         case MESSAGE_TYPE_FACILITY_ACC:
6913                                 offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
6914                                 opt_part_possible = TRUE;
6915                                 break;
6916                         case MESSAGE_TYPE_FACILITY_REJ:
6917                                 offset += dissect_isup_facility_reject_message(parameter_tvb, isup_tree);
6918                                 opt_part_possible = TRUE;
6919                                 break;
6920                         case MESSAGE_TYPE_LOOP_BACK_ACK:
6921                                 /* no dissector necessary since no mandatory parameters included */
6922                                 break;
6923                         case MESSAGE_TYPE_PASS_ALONG:
6924                                 /* call dissect_isup_message recursively */
6925                                 {       guint8 pa_message_type;
6926                                         pa_message_type = tvb_get_guint8(parameter_tvb, 0);
6927                                         pass_along_item = proto_tree_add_text(isup_tree, parameter_tvb, offset, -1, "Pass-along: %s Message (%u)", val_to_str(pa_message_type, isup_message_type_value_acro, "reserved"), pa_message_type);
6928                                         pass_along_tree = proto_item_add_subtree(pass_along_item, ett_isup_pass_along_message);
6929                                         dissect_isup_message(parameter_tvb, pinfo, pass_along_tree);
6930                                         break;
6931                                 }
6932                         case MESSAGE_TYPE_CIRC_GRP_RST_ACK:
6933                                 offset += dissect_isup_circuit_group_reset_acknowledgement_message(parameter_tvb, isup_tree);
6934                                 break;
6935                         case MESSAGE_TYPE_CIRC_GRP_QRY:
6936                                 offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
6937                                 break;
6938                         case MESSAGE_TYPE_CIRC_GRP_QRY_RSP:
6939                                 offset += dissect_isup_circuit_group_query_response_message(parameter_tvb, isup_tree);
6940                                 break;
6941                         case MESSAGE_TYPE_CALL_PROGRSS:
6942                                 offset += dissect_isup_call_progress_message(parameter_tvb, isup_tree);
6943                                 opt_part_possible = TRUE;
6944                                 break;
6945                         case MESSAGE_TYPE_USER2USER_INFO:
6946                                 offset += dissect_isup_user_to_user_information_message(parameter_tvb, isup_tree);
6947                                 opt_part_possible = TRUE;
6948                                 break;
6949                         case MESSAGE_TYPE_UNEQUIPPED_CIC:
6950                                 /* no dissector necessary since no mandatory parameters included */
6951                                 break;
6952                         case MESSAGE_TYPE_CONFUSION:
6953                                 offset += dissect_isup_confusion_message(parameter_tvb, isup_tree);
6954                                 opt_part_possible = TRUE;
6955                                 break;
6956                         case MESSAGE_TYPE_OVERLOAD:
6957                                 /* no dissector necessary since no mandatory parameters included */
6958                                 break;
6959                         case MESSAGE_TYPE_CHARGE_INFO:
6960                                 /* do nothing since format is a national matter */
6961                                 bufferlength = tvb_length_remaining(message_tvb, offset);
6962                                 if (bufferlength != 0)
6963                                         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
6964                                 break;
6965                         case MESSAGE_TYPE_NETW_RESRC_MGMT:
6966                                 /* no dissector necessary since no mandatory parameters included */
6967                                 opt_part_possible = TRUE;
6968                                 break;
6969                         case MESSAGE_TYPE_FACILITY:
6970                                 /* no dissector necessary since no mandatory parameters included */
6971                                 opt_part_possible = TRUE;
6972                                 break;
6973                         case MESSAGE_TYPE_USER_PART_TEST:
6974                                 /* no dissector necessary since no mandatory parameters included */
6975                                 opt_part_possible = TRUE;
6976                                 break;
6977                         case MESSAGE_TYPE_USER_PART_AVAIL:
6978                                 /* no dissector necessary since no mandatory parameters included */
6979                                 opt_part_possible = TRUE;
6980                                 break;
6981                         case MESSAGE_TYPE_IDENT_REQ:
6982                                 /* no dissector necessary since no mandatory parameters included */
6983                                 opt_part_possible = TRUE;
6984                                 break;
6985                         case MESSAGE_TYPE_IDENT_RSP:
6986                                 /* no dissector necessary since no mandatory parameters included */
6987                                 opt_part_possible = TRUE;
6988                                 break;
6989                         case MESSAGE_TYPE_SEGMENTATION:
6990                                 /* no dissector necessary since no mandatory parameters included */
6991                                 opt_part_possible = TRUE;
6992                                 break;
6993                         case MESSAGE_TYPE_LOOP_PREVENTION:
6994                                 /* no dissector necessary since no mandatory parameters included */
6995                                 opt_part_possible = TRUE;
6996                                 break;
6997                         case MESSAGE_TYPE_APPLICATION_TRANS:
6998                                 /* no dissector necessary since no mandatory parameters included */
6999                                 opt_part_possible = TRUE;
7000                                 break;
7001                         case MESSAGE_TYPE_PRE_RELEASE_INFO:
7002                                 /* no dissector necessary since no mandatory parameters included */
7003                                 opt_part_possible = TRUE;
7004                                 break;
7005                         case MESSAGE_TYPE_SUBSEQUENT_DIR_NUM:
7006                                 /* do nothing since format is a national matter */
7007                                 bufferlength = tvb_length_remaining(message_tvb, offset);
7008                                 if (bufferlength != 0)
7009                                         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
7010                                 break;
7011                         case ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES_ACK:
7012                                 /* no dissector necessary since no mandatory parameters included */
7013                                 break;
7014                         case ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES:
7015                                 offset += dissect_ansi_isup_circuit_reservation_message( parameter_tvb, isup_tree );
7016                                 break;
7017                         case ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST_RSP:
7018                                 opt_part_possible = TRUE;
7019                                 offset += dissect_ansi_isup_circuit_validation_test_resp_message( parameter_tvb, isup_tree );
7020                                 break;
7021                         case ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST:
7022                                 /* no dissector necessary since no mandatory parameters included */
7023                                 break;
7024                         default:
7025                                 bufferlength = tvb_length_remaining(message_tvb, offset);
7026                                 if (bufferlength != 0)
7027                                         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Unknown Message type (possibly reserved/used in former ISUP version)");
7028                                 break;
7029                         }
7030                         break;
7031   }
7032
7033    /* extract pointer to start of optional part (if any) */
7034    if (opt_part_possible == TRUE){
7035      opt_parameter_pointer = tvb_get_guint8(message_tvb, offset);
7036      if (opt_parameter_pointer > 0){
7037        proto_tree_add_uint_format(isup_tree, hf_isup_pointer_to_start_of_optional_part, message_tvb, offset, PARAMETER_POINTER_LENGTH, opt_parameter_pointer, "Pointer to start of optional part: %u", opt_parameter_pointer);
7038        offset += opt_parameter_pointer;
7039        optional_parameter_tvb = tvb_new_subset(message_tvb, offset, -1, -1 );
7040            switch(isup_standard){
7041            case ITU_STANDARD:
7042                    dissect_isup_optional_parameter(optional_parameter_tvb, pinfo, isup_tree);
7043                    break;
7044            case ANSI_STANDARD:
7045                    dissect_ansi_isup_optional_parameter(optional_parameter_tvb, pinfo, isup_tree);
7046                    break;
7047            }
7048      }
7049      else
7050        proto_tree_add_uint_format(isup_tree, hf_isup_pointer_to_start_of_optional_part, message_tvb, offset, PARAMETER_POINTER_LENGTH, opt_parameter_pointer, "No optional parameter present (Pointer: %u)", opt_parameter_pointer);
7051    }
7052    else if (message_type !=MESSAGE_TYPE_CHARGE_INFO)
7053      proto_tree_add_text(isup_tree, message_tvb, 0, 0, "No optional parameters are possible with this message type");
7054    /* if there are calling/called number, we'll get them for the tap */
7055
7056    tap_rec.calling_number=tap_calling_number?tap_calling_number:ep_strdup("");
7057    tap_rec.called_number=tap_called_number;
7058    tap_rec.cause_value=tap_cause_value;
7059    tap_queue_packet(isup_tap, pinfo, &tap_rec);
7060 }
7061
7062 /* ------------------------------------------------------------------ */
7063 static void
7064 dissect_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
7065 {
7066
7067 /* Set up structures needed to add the protocol subtree and manage it */
7068         proto_item *ti;
7069         proto_tree *isup_tree = NULL;
7070         tvbuff_t *message_tvb;
7071         guint16 cic;
7072         guint8 message_type;
7073
7074         switch(mtp3_standard){
7075         case ANSI_STANDARD:
7076                 isup_standard = ANSI_STANDARD;
7077                 break;
7078         default:
7079                 isup_standard = ITU_STANDARD;
7080         }
7081
7082 /* Make entries in Protocol column and Info column on summary display */
7083         switch (isup_standard){
7084         case ITU_STANDARD:
7085                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISUP(ITU)");
7086                 break;
7087         case ANSI_STANDARD:
7088                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISUP(ANSI)");
7089                 break;
7090         }
7091
7092 /* Extract message type field */
7093         message_type = tvb_get_guint8(tvb, CIC_OFFSET + CIC_LENGTH);
7094         /* dissect CIC in main dissector since pass-along message type carrying complete IUSP message w/o CIC needs
7095            recursive message dissector call */
7096         if (mtp3_standard == ANSI_STANDARD)
7097                 cic = tvb_get_letohs(tvb, CIC_OFFSET) & 0x3FFF; /*since upper 2 bits spare */
7098         else /* ITU, China, and Japan; yes, J7's CICs are a different size */
7099                 cic = tvb_get_letohs(tvb, CIC_OFFSET) & 0x0FFF; /*since upper 4 bits spare */
7100
7101         pinfo->ctype = CT_ISUP;
7102         pinfo->circuit_id = cic;
7103
7104         if (check_col(pinfo->cinfo, COL_INFO))
7105         {
7106                 if (isup_show_cic_in_info){
7107                         switch (isup_standard){
7108                         case ITU_STANDARD:
7109                                 col_add_fstr(pinfo->cinfo, COL_INFO, "%s (CIC %u) ", val_to_str(message_type, isup_message_type_value_acro, "reserved"), cic);
7110                                 break;
7111                         case ANSI_STANDARD:
7112                                 col_add_fstr(pinfo->cinfo, COL_INFO, "%s (CIC %u) ", val_to_str(message_type, ansi_isup_message_type_value_acro, "reserved"), cic);
7113                                 break;
7114                         }
7115                 }else{
7116                         switch (isup_standard){
7117                         case ITU_STANDARD:
7118                                 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(message_type, isup_message_type_value_acro, "reserved"));
7119                                 break;
7120                         case ANSI_STANDARD:
7121                                 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(message_type, ansi_isup_message_type_value_acro, "reserved"));
7122                                 break;
7123                         }
7124                 }
7125         }
7126
7127         /* In the interest of speed, if "tree" is NULL, don't do any work not
7128      * necessary to generate protocol tree items.
7129          */
7130         if (tree) {
7131                 ti = proto_tree_add_item(tree, proto_isup, tvb, 0, -1, FALSE);
7132                 isup_tree = proto_item_add_subtree(ti, ett_isup);
7133
7134
7135                 proto_tree_add_uint_format(isup_tree, hf_isup_cic, tvb, CIC_OFFSET, CIC_LENGTH, cic, "CIC: %u", cic);
7136         }
7137
7138         message_tvb = tvb_new_subset(tvb, CIC_LENGTH, -1, -1);
7139         dissect_isup_message(message_tvb, pinfo, isup_tree);
7140 }
7141
7142 /* ------------------------------------------------------------------ */
7143 static void
7144 dissect_bicc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
7145 {
7146
7147 /* Set up structures needed to add the protocol subtree and manage it */
7148         proto_item *ti;
7149         proto_tree *bicc_tree = NULL;
7150         tvbuff_t *message_tvb;
7151         guint32 bicc_cic;
7152         guint8 message_type;
7153
7154         /*circuit_t *circuit;*/
7155
7156 /* Make entries in Protocol column and Info column on summary display */
7157         col_set_str(pinfo->cinfo, COL_PROTOCOL, "BICC");
7158
7159 /* Extract message type field */
7160         message_type = tvb_get_guint8(tvb, BICC_CIC_OFFSET + BICC_CIC_LENGTH);
7161
7162         if (check_col(pinfo->cinfo, COL_INFO))
7163                 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(message_type, isup_message_type_value_acro, "reserved"));
7164
7165         /* dissect CIC in main dissector since pass-along message type carrying complete BICC/ISUP message w/o CIC needs
7166          * recursive message dissector call
7167          */
7168         bicc_cic = tvb_get_letohl(tvb, BICC_CIC_OFFSET);
7169
7170         pinfo->ctype = CT_BICC;
7171         pinfo->circuit_id = bicc_cic;
7172
7173         /* In the interest of speed, if "tree" is NULL, don't do any work not
7174          * necessary to generate protocol tree items.
7175          */
7176         if (tree) {
7177                 ti = proto_tree_add_item(tree, proto_bicc, tvb, 0, -1, FALSE);
7178                 bicc_tree = proto_item_add_subtree(ti, ett_bicc);
7179
7180
7181                 proto_tree_add_uint_format(bicc_tree, hf_bicc_cic, tvb, BICC_CIC_OFFSET, BICC_CIC_LENGTH, bicc_cic, "CIC: %u", bicc_cic);
7182         }
7183
7184         message_tvb = tvb_new_subset(tvb, BICC_CIC_LENGTH, -1, -1);
7185         dissect_isup_message(message_tvb, pinfo, bicc_tree);
7186 }
7187
7188 static void
7189 dissect_application_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
7190 {
7191 /* Set up structures needed to add the protocol subtree and manage it */
7192         proto_item *ti;
7193         proto_tree *isup_tree = NULL;
7194         tvbuff_t *message_tvb;
7195         guint8 message_type;
7196
7197 /* Make entries in Protocol column and Info column on summary display */
7198         if (check_col(pinfo->cinfo, COL_PROTOCOL))
7199                 col_append_str(pinfo->cinfo, COL_PROTOCOL, "/ISUP(ITU)");
7200
7201 /* Extract message type field */
7202         message_type = tvb_get_guint8(tvb, 0);
7203         /* application/ISUP has no  CIC  */
7204         if (check_col(pinfo->cinfo, COL_INFO))
7205                 col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ", "ISUP:%s", val_to_str(message_type, isup_message_type_value_acro, "reserved"));
7206
7207 /* In the interest of speed, if "tree" is NULL, don't do any work not
7208    necessary to generate protocol tree items. */
7209         if (tree) {
7210                 ti = proto_tree_add_item(tree, proto_isup, tvb, 0, -1, FALSE);
7211                 isup_tree = proto_item_add_subtree(ti, ett_isup);
7212         }
7213
7214         message_tvb = tvb_new_subset(tvb, 0, -1, -1);
7215         dissect_isup_message(message_tvb, pinfo, isup_tree);
7216 }
7217 /* ---------------------------------------------------- stats tree
7218 */
7219 static int st_node_msg = -1;
7220 static int st_node_dir = -1;
7221
7222 static void
7223 msg_stats_tree_init(stats_tree* st)
7224 {
7225         st_node_msg = stats_tree_create_node(st, "Messages by Type", 0, TRUE);
7226         st_node_dir = stats_tree_create_node(st, "Messages by Direction", 0, TRUE);
7227 }
7228
7229 static int
7230 msg_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p )
7231 {
7232         const gchar* msg = match_strval(((const isup_tap_rec_t*)p)->message_type, isup_message_type_value_acro);
7233         gchar src[MAX_ADDR_STR_LEN];
7234         gchar dst[MAX_ADDR_STR_LEN];
7235         gchar dir[MAX_ADDR_STR_LEN];
7236         int msg_node;
7237         int dir_node;
7238
7239         address_to_str_buf(&(pinfo->src), src, sizeof src);
7240         address_to_str_buf(&(pinfo->dst), dst, sizeof dst);
7241         g_snprintf(dir,sizeof(dir),"%s->%s",src,dst);
7242
7243         msg_node = tick_stat_node(st, msg, st_node_msg, TRUE);
7244         tick_stat_node(st, dir, msg_node, FALSE);
7245
7246         dir_node = tick_stat_node(st, dir, st_node_dir, TRUE);
7247         tick_stat_node(st, msg, dir_node, FALSE);
7248
7249         return 1;
7250 }
7251
7252 /*---------------------------------------------------------------------*/
7253 /* Register the protocol with Wireshark */
7254 void
7255 proto_register_isup(void)
7256 {
7257 /* Setup list of header fields  See Section 1.6.1 for details*/
7258         static hf_register_info hf[] = {
7259                 { &hf_isup_cic,
7260                         { "CIC",           "isup.cic",
7261                         FT_UINT16, BASE_HEX, NULL, 0x0,
7262                           NULL, HFILL }},
7263
7264                 { &hf_isup_message_type,
7265                         { "Message Type",  "isup.message_type",
7266                         FT_UINT8, BASE_DEC, NULL, 0x0,
7267                         NULL, HFILL }},
7268
7269                 { &hf_isup_parameter_type,
7270                         { "Parameter Type",  "isup.parameter_type",
7271                         FT_UINT8, BASE_DEC, NULL, 0x0,
7272                         NULL, HFILL }},
7273
7274                 { &hf_isup_parameter_length,
7275                         { "Parameter Length",  "isup.parameter_length",
7276                         FT_UINT8, BASE_DEC, NULL, 0x0,
7277                         NULL, HFILL }},
7278
7279                 { &hf_isup_mandatory_variable_parameter_pointer,
7280                         { "Pointer to Parameter",  "isup.mandatory_variable_parameter_pointer",
7281                         FT_UINT8, BASE_DEC, NULL, 0x0,
7282                         NULL, HFILL }},
7283
7284                 { &hf_isup_pointer_to_start_of_optional_part,
7285                         { "Pointer to optional parameter part",  "isup.optional_parameter_part_pointer",
7286                         FT_UINT8, BASE_DEC, NULL, 0x0,
7287                         NULL, HFILL }},
7288
7289                 { &hf_isup_satellite_indicator,
7290                         { "Satellite Indicator",  "isup.satellite_indicator",
7291                         FT_UINT8, BASE_HEX, VALS(isup_satellite_ind_value), BA_8BIT_MASK,
7292                         NULL, HFILL }},
7293
7294                 { &hf_isup_continuity_check_indicator,
7295                         { "Continuity Check Indicator",  "isup.continuity_check_indicator",
7296                         FT_UINT8, BASE_HEX, VALS(isup_continuity_check_ind_value), DC_8BIT_MASK,
7297                         NULL, HFILL }},
7298
7299                 { &hf_isup_echo_control_device_indicator,
7300                         { "Echo Control Device Indicator",  "isup.echo_control_device_indicator",
7301                         FT_BOOLEAN, 8, TFS(&isup_echo_control_device_ind_value),E_8BIT_MASK,
7302                         NULL, HFILL }},
7303
7304                 { &hf_isup_forw_call_natnl_inatnl_call_indicator,
7305                         { "National/international call indicator",  "isup.forw_call_natnl_inatnl_call_indicator",
7306                         FT_BOOLEAN, 16, TFS(&isup_natnl_inatnl_call_ind_value),A_16BIT_MASK,
7307                         NULL, HFILL }},
7308
7309                 { &hf_isup_forw_call_end_to_end_method_indicator,
7310                         { "End-to-end method indicator",  "isup.forw_call_end_to_end_method_indicator",
7311                         FT_UINT16, BASE_HEX, VALS(isup_end_to_end_method_ind_value), CB_16BIT_MASK,
7312                         NULL, HFILL }},
7313
7314                 { &hf_isup_forw_call_interworking_indicator,
7315                         { "Interworking indicator",  "isup.forw_call_interworking_indicator",
7316                         FT_BOOLEAN, 16, TFS(&isup_interworking_ind_value), D_16BIT_MASK,
7317                         NULL, HFILL }},
7318
7319                 { &hf_isup_forw_call_end_to_end_info_indicator,
7320                         { "End-to-end information indicator",  "isup.forw_call_end_to_end_information_indicator",
7321                         FT_BOOLEAN, 16, TFS(&isup_end_to_end_info_ind_value), E_16BIT_MASK,
7322                         NULL, HFILL }},
7323
7324                 { &hf_isup_forw_call_isdn_user_part_indicator,
7325                         { "ISDN user part indicator",  "isup.forw_call_isdn_user_part_indicator",
7326                         FT_BOOLEAN, 16, TFS(&isup_ISDN_user_part_ind_value), F_16BIT_MASK,
7327                         NULL, HFILL }},
7328
7329                 { &hf_isup_forw_call_preferences_indicator,
7330                         { "ISDN user part preference indicator",  "isup.forw_call_preferences_indicator",
7331                         FT_UINT16, BASE_HEX, VALS(isup_preferences_ind_value), HG_16BIT_MASK,
7332                         NULL, HFILL }},
7333
7334                 { &hf_isup_forw_call_isdn_access_indicator,
7335                         { "ISDN access indicator",  "isup.forw_call_isdn_access_indicator",
7336                         FT_BOOLEAN, 16, TFS(&isup_ISDN_originating_access_ind_value), I_16BIT_MASK,
7337                         NULL, HFILL }},
7338
7339                 { &hf_isup_forw_call_sccp_method_indicator,
7340                         { "SCCP method indicator",  "isup.forw_call_sccp_method_indicator",
7341                         FT_UINT16, BASE_HEX, VALS(isup_SCCP_method_ind_value), KJ_16BIT_MASK,
7342                         NULL, HFILL }},
7343
7344                 { &hf_isup_forw_call_ported_num_trans_indicator,
7345                         { "Ported number translation indicator",  "isup.forw_call_ported_num_trans_indicator",
7346                         FT_BOOLEAN, 16, TFS(&isup_ISDN_ported_num_trans_ind_value), M_16BIT_MASK,
7347                         NULL, HFILL }},
7348
7349                 { &hf_isup_forw_call_qor_attempt_indicator,
7350                         { "Query on Release attempt indicator",  "isup.forw_call_isdn_access_indicator",
7351                         FT_BOOLEAN, 16, TFS(&isup_ISDN_qor_attempt_ind_value), N_16BIT_MASK,
7352                         NULL, HFILL }},
7353
7354                 { &hf_isup_calling_partys_category,
7355                         { "Calling Party's category",  "isup.calling_partys_category",
7356                         FT_UINT8, BASE_HEX, VALS(isup_calling_partys_category_value), 0x0,
7357                         NULL, HFILL }},
7358
7359                 { &hf_isup_transmission_medium_requirement,
7360                         { "Transmission medium requirement",  "isup.transmission_medium_requirement",
7361                         FT_UINT8, BASE_DEC, VALS(isup_transmission_medium_requirement_value), 0x0,
7362                         NULL, HFILL }},
7363
7364                 { &hf_isup_odd_even_indicator,
7365                         { "Odd/even indicator",  "isup.isdn_odd_even_indicator",
7366                         FT_BOOLEAN, 8, TFS(&isup_odd_even_ind_value), ISUP_ODD_EVEN_MASK,
7367                         NULL, HFILL }},
7368
7369                 { &hf_isup_generic_name_presentation,
7370                         { "Presentation indicator",  "isup.isdn_generic_name_presentation",
7371                         FT_UINT8, BASE_DEC, VALS(isup_generic_name_presentation_value), BA_8BIT_MASK,
7372                         NULL, HFILL }},
7373
7374                 { &hf_isup_generic_name_availability,
7375                         { "Availability indicator",  "isup.isdn_generic_name_availability",
7376                         FT_BOOLEAN, 8, TFS(&isup_generic_name_availability_value), E_8BIT_MASK,
7377                         NULL, HFILL }},
7378
7379                 { &hf_isup_generic_name_type,
7380                         { "Type indicator",  "isup.isdn_generic_name_type",
7381                         FT_UINT8, BASE_DEC, VALS(isup_generic_name_type_value), HGF_8BIT_MASK,
7382                         NULL, HFILL }},
7383
7384                 { &hf_isup_generic_name_ia5,
7385                         { "Generic Name",  "isup.isdn_generic_name_ia5",
7386                         FT_STRING, BASE_NONE, NULL, 0x0,
7387                         NULL, HFILL }},
7388
7389                 { &hf_isup_called_party_nature_of_address_indicator,
7390                         { "Nature of address indicator",  "isup.called_party_nature_of_address_indicator",
7391                         FT_UINT8, BASE_DEC, VALS(isup_called_party_nature_of_address_ind_value), ISUP_NATURE_OF_ADDRESS_IND_MASK,
7392                         NULL, HFILL }},
7393
7394                 { &hf_isup_calling_party_nature_of_address_indicator,
7395                         { "Nature of address indicator",  "isup.calling_party_nature_of_address_indicator",
7396                         FT_UINT8, BASE_DEC, VALS(isup_calling_party_nature_of_address_ind_value), ISUP_NATURE_OF_ADDRESS_IND_MASK,
7397                         NULL, HFILL }},
7398
7399                 { &hf_isup_charge_number_nature_of_address_indicator,
7400                         { "Nature of address indicator",  "isup.charge_number_nature_of_address_indicator",
7401                         FT_UINT8, BASE_DEC, VALS(isup_charge_number_nature_of_address_ind_value), ISUP_NATURE_OF_ADDRESS_IND_MASK,
7402                         NULL, HFILL }},
7403
7404                 { &hf_isup_inn_indicator,
7405                         { "INN indicator",  "isup.inn_indicator",
7406                         FT_BOOLEAN, 8, TFS(&isup_INN_ind_value), ISUP_INN_MASK,
7407                         NULL, HFILL }},
7408
7409                 { &hf_isup_ni_indicator,
7410                         { "NI indicator",  "isup.ni_indicator",
7411                         FT_BOOLEAN, 8, TFS(&isup_NI_ind_value), ISUP_NI_MASK,
7412                         NULL, HFILL }},
7413
7414                 { &hf_isup_numbering_plan_indicator,
7415                         { "Numbering plan indicator",  "isup.numbering_plan_indicator",
7416                         FT_UINT8, BASE_DEC, VALS(isup_numbering_plan_ind_value), ISUP_NUMBERING_PLAN_IND_MASK,
7417                         NULL, HFILL }},
7418
7419                 { &hf_isup_address_presentation_restricted_indicator,
7420                         { "Address presentation restricted indicator",  "isup.address_presentation_restricted_indicator",
7421                         FT_UINT8, BASE_DEC, VALS(isup_address_presentation_restricted_ind_value), ISUP_ADDRESS_PRESENTATION_RESTR_IND_MASK,
7422                         NULL, HFILL }},
7423
7424                 { &hf_isup_screening_indicator,
7425                         { "Screening indicator",  "isup.screening_indicator",
7426                         FT_UINT8, BASE_DEC, VALS(isup_screening_ind_value), ISUP_SCREENING_IND_MASK,
7427                         NULL, HFILL }},
7428
7429                 { &hf_isup_screening_indicator_enhanced,
7430                         { "Screening indicator",  "isup.screening_indicator_enhanced",
7431                         FT_UINT8, BASE_DEC, VALS(isup_screening_ind_enhanced_value), ISUP_SCREENING_IND_MASK,
7432                         NULL, HFILL }},
7433
7434                 { &hf_isup_called_party_odd_address_signal_digit,
7435                         { "Address signal digit",  "isup.called_party_odd_address_signal_digit",
7436                         FT_UINT8, BASE_DEC, VALS(isup_called_party_address_digit_value), ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK,
7437                         NULL, HFILL }},
7438
7439                 { &hf_isup_calling_party_odd_address_signal_digit,
7440                         { "Address signal digit",  "isup.calling_party_odd_address_signal_digit",
7441                         FT_UINT8, BASE_DEC, VALS(isup_calling_party_address_digit_value), ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK,
7442                         NULL, HFILL }},
7443
7444                 { &hf_isup_called_party_even_address_signal_digit,
7445                         { "Address signal digit",  "isup.called_party_even_address_signal_digit",
7446                         FT_UINT8, BASE_DEC, VALS(isup_called_party_address_digit_value), ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK,
7447                         NULL, HFILL }},
7448
7449                 { &hf_isup_calling_party_even_address_signal_digit,
7450                         { "Address signal digit",  "isup.calling_party_even_address_signal_digit",
7451                         FT_UINT8, BASE_DEC, VALS(isup_calling_party_address_digit_value), ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK,
7452                         NULL, HFILL }},
7453
7454                 { &hf_isup_calling_party_address_request_indicator,
7455                         { "Calling party address request indicator",  "isup.calling_party_address_request_indicator",
7456                         FT_BOOLEAN, 16, TFS(&isup_calling_party_address_request_ind_value), A_16BIT_MASK,
7457                         NULL, HFILL }},
7458
7459                 { &hf_isup_info_req_holding_indicator,
7460                         { "Holding indicator",  "isup.info_req_holding_indicator",
7461                         FT_BOOLEAN, 16, TFS(&isup_holding_ind_value), B_16BIT_MASK,
7462                         NULL, HFILL }},
7463
7464                 { &hf_isup_calling_partys_category_request_indicator,
7465                         { "Calling party's category request indicator",  "isup.calling_partys_category_request_indicator",
7466                         FT_BOOLEAN, 16, TFS(&isup_calling_partys_category_request_ind_value), D_16BIT_MASK,
7467                         NULL, HFILL }},
7468
7469                 { &hf_isup_charge_information_request_indicator,
7470                         { "Charge information request indicator",  "isup.charge_information_request_indicator",
7471                         FT_BOOLEAN, 16, TFS(&isup_charge_information_request_ind_value), E_16BIT_MASK,
7472                         NULL, HFILL }},
7473
7474                 { &hf_isup_malicious_call_identification_request_indicator,
7475                         { "Malicious call identification request indicator (ISUP'88)",  "isup.malicious_call_ident_request_indicator",
7476                         FT_BOOLEAN, 16, TFS(&isup_malicious_call_identification_request_ind_value), H_16BIT_MASK,
7477                         NULL, HFILL }},
7478
7479                 { &hf_isup_calling_party_address_response_indicator,
7480                         { "Calling party address response indicator",  "isup.calling_party_address_response_indicator",
7481                         FT_UINT16, BASE_HEX, VALS(isup_calling_party_address_response_ind_value), BA_16BIT_MASK,
7482                         NULL, HFILL }},
7483
7484                 { &hf_isup_OECD_inf_ind,
7485                         { "OECD information indicator",  "isup.OECD_inf_ind_vals",
7486                         FT_UINT8, BASE_HEX, VALS(OECD_inf_ind_vals), BA_8BIT_MASK,
7487                         NULL, HFILL }},
7488
7489                 { &hf_isup_IECD_inf_ind,
7490                         { "IECD information indicator",  "isup.IECD_inf_ind_vals",
7491                         FT_UINT8, BASE_HEX, VALS(IECD_inf_ind_vals), DC_8BIT_MASK,
7492                         NULL, HFILL }},
7493
7494                 { &hf_isup_OECD_req_ind,
7495                         { "OECD request indicator",  "isup.OECD_req_ind_vals",
7496                         FT_UINT8, BASE_HEX, VALS(OECD_req_ind_vals), FE_8BIT_MASK,
7497                         NULL, HFILL }},
7498
7499                 { &hf_isup_IECD_req_ind,
7500                         { "IECD request indicator",  "isup.IECD_req_ind_vals",
7501                         FT_UINT8, BASE_HEX, VALS(IECD_req_ind_vals), HG_8BIT_MASK,
7502                         NULL, HFILL }},
7503
7504                 { &hf_isup_hold_provided_indicator,
7505                         { "Hold provided indicator",  "isup.hold_provided_indicator",
7506                         FT_BOOLEAN, 16, TFS(&isup_hold_provided_ind_value), C_16BIT_MASK,
7507                         NULL, HFILL }},
7508
7509                 { &hf_isup_calling_partys_category_response_indicator,
7510                         { "Calling party's category response indicator",  "isup.calling_partys_category_response_indicator",
7511                         FT_BOOLEAN, 16, TFS(&isup_calling_partys_category_response_ind_value), F_16BIT_MASK,
7512                         NULL, HFILL }},
7513
7514                 { &hf_isup_charge_information_response_indicator,
7515                         { "Charge information response indicator",  "isup.charge_information_response_indicator",
7516                         FT_BOOLEAN, 16, TFS(&isup_charge_information_response_ind_value), G_16BIT_MASK,
7517                         NULL, HFILL }},
7518
7519                 { &hf_isup_solicited_indicator,
7520                         { "Solicited indicator",  "isup.solicided_indicator",
7521                         FT_BOOLEAN, 16, TFS(&isup_solicited_information_ind_value), H_16BIT_MASK,
7522                         NULL, HFILL }},
7523
7524                 { &hf_isup_continuity_indicator,
7525                         { "Continuity indicator",  "isup.continuity_indicator",
7526                         FT_BOOLEAN, 8, TFS(&isup_continuity_ind_value), A_8BIT_MASK,
7527                         NULL, HFILL }},
7528
7529                 { &hf_isup_backw_call_charge_ind,
7530                         { "Charge indicator",  "isup.charge_indicator",
7531                         FT_UINT16, BASE_HEX, VALS(isup_charge_ind_value), BA_16BIT_MASK,
7532                         NULL, HFILL }},
7533
7534                 { &hf_isup_backw_call_called_partys_status_ind,
7535                         { "Called party's status indicator",  "isup.called_partys_status_indicator",
7536                         FT_UINT16, BASE_HEX, VALS(isup_called_partys_status_ind_value), DC_16BIT_MASK,
7537                         NULL, HFILL }},
7538
7539                 { &hf_isup_backw_call_called_partys_category_ind,
7540                         { "Called party's category indicator",  "isup.called_partys_category_indicator",
7541                         FT_UINT16, BASE_HEX, VALS(isup_called_partys_category_ind_value), FE_16BIT_MASK,
7542                         NULL, HFILL }},
7543
7544                 { &hf_isup_backw_call_end_to_end_method_ind,
7545                         { "End-to-end method indicator",  "isup.backw_call_end_to_end_method_indicator",
7546                         FT_UINT16, BASE_HEX, VALS(isup_end_to_end_method_ind_value), HG_16BIT_MASK,
7547                         NULL, HFILL }},
7548
7549                 { &hf_isup_backw_call_interworking_ind,
7550                         { "Interworking indicator",  "isup.backw_call_interworking_indicator",
7551                         FT_BOOLEAN, 16, TFS(&isup_interworking_ind_value), I_16BIT_MASK,
7552                         NULL, HFILL }},
7553
7554                 { &hf_isup_backw_call_end_to_end_info_ind,
7555                         { "End-to-end information indicator",  "isup.backw_call_end_to_end_information_indicator",
7556                         FT_BOOLEAN, 16, TFS(&isup_end_to_end_info_ind_value), J_16BIT_MASK,
7557                         NULL, HFILL }},
7558
7559                 { &hf_isup_backw_call_isdn_user_part_ind,
7560                         { "ISDN user part indicator",  "isup.backw_call_isdn_user_part_indicator",
7561                         FT_BOOLEAN, 16, TFS(&isup_ISDN_user_part_ind_value), K_16BIT_MASK,
7562                         NULL, HFILL }},
7563
7564                 { &hf_isup_backw_call_holding_ind,
7565                         { "Holding indicator",  "isup.backw_call_holding_indicator",
7566                         FT_BOOLEAN, 16, TFS(&isup_holding_ind_value), L_16BIT_MASK,
7567                         NULL, HFILL }},
7568
7569                 { &hf_isup_backw_call_isdn_access_ind,
7570                         { "ISDN access indicator",  "isup.backw_call_isdn_access_indicator",
7571                         FT_BOOLEAN, 16, TFS(&isup_ISDN_terminating_access_ind_value), M_16BIT_MASK,
7572                         NULL, HFILL }},
7573
7574                 { &hf_isup_backw_call_echo_control_device_ind,
7575                         { "Echo Control Device Indicator",  "isup.backw_call_echo_control_device_indicator",
7576                         FT_BOOLEAN, 16, TFS(&isup_echo_control_device_ind_value), N_16BIT_MASK,
7577                         NULL, HFILL }},
7578
7579                 { &hf_isup_backw_call_sccp_method_ind,
7580                         { "SCCP method indicator",  "isup.backw_call_sccp_method_indicator",
7581                         FT_UINT16, BASE_HEX, VALS(isup_SCCP_method_ind_value), PO_16BIT_MASK,
7582                         NULL, HFILL }},
7583
7584                 { &hf_isup_cause_indicator,
7585                         { "Cause indicator",  "isup.cause_indicator",
7586                         FT_UINT8, BASE_DEC, VALS(q850_cause_code_vals), 0x7f,
7587                         NULL, HFILL }},
7588
7589                 { &hf_ansi_isup_cause_indicator,
7590                         { "Cause indicator",  "ansi_isup.cause_indicator",
7591                         FT_UINT8, BASE_DEC, VALS(ansi_isup_cause_code_vals), 0x7f,
7592                         NULL, HFILL }},
7593
7594                 { &hf_isup_suspend_resume_indicator,
7595                         { "Suspend/Resume indicator",  "isup.suspend_resume_indicator",
7596                         FT_BOOLEAN, 8, TFS(&isup_suspend_resume_ind_value), A_8BIT_MASK,
7597                         NULL, HFILL }},
7598
7599                 { &hf_isup_range_indicator,
7600                         { "Range indicator",  "isup.range_indicator",
7601                           FT_UINT8, BASE_DEC, NULL , 0x0,
7602                           NULL, HFILL }},
7603
7604                 { &hf_isup_cgs_message_type,
7605                         { "Circuit group supervision message type",  "isup.cgs_message_type",
7606                         FT_UINT8, BASE_DEC, VALS(isup_cgs_message_type_value), BA_8BIT_MASK,
7607                         NULL, HFILL }},
7608
7609                 { &hf_isup_mtc_blocking_state1,
7610                         { "Maintenance blocking state",  "isup.mtc_blocking_state",
7611                         FT_UINT8, BASE_DEC, VALS(isup_mtc_blocking_state_DC00_value), BA_8BIT_MASK,
7612                         NULL, HFILL }},
7613
7614                 { &hf_isup_mtc_blocking_state2,
7615                         { "Maintenance blocking state",  "isup.mtc_blocking_state",
7616                         FT_UINT8, BASE_DEC, VALS(isup_mtc_blocking_state_DCnot00_value), BA_8BIT_MASK,
7617                         NULL, HFILL }},
7618
7619                 { &hf_isup_call_proc_state,
7620                         { "Call processing state",  "isup.call_processing_state",
7621                         FT_UINT8, BASE_DEC, VALS(isup_call_processing_state_value), DC_8BIT_MASK,
7622                         NULL, HFILL }},
7623
7624                 { &hf_isup_hw_blocking_state,
7625                         { "HW blocking state",  "isup.hw_blocking_state",
7626                         FT_UINT8, BASE_DEC, VALS(isup_HW_blocking_state_value), FE_8BIT_MASK,
7627                         NULL, HFILL }},
7628
7629                 { &hf_isup_event_ind,
7630                         { "Event indicator",  "isup.event_ind",
7631                           FT_UINT8, BASE_DEC, VALS(isup_event_ind_value), GFEDCBA_8BIT_MASK,
7632                         NULL, HFILL }},
7633
7634                 { &hf_isup_event_presentation_restricted_ind,
7635                         { "Event presentation restricted indicator",  "isup.event_presentatiation_restr_ind",
7636                         FT_BOOLEAN, 8, TFS(&isup_event_presentation_restricted_ind_value), H_8BIT_MASK,
7637                         NULL, HFILL }},
7638
7639                 { &hf_isup_cug_call_ind,
7640                         { "Closed user group call indicator",  "isup.clg_call_ind",
7641                         FT_UINT8, BASE_DEC, VALS(isup_CUG_call_ind_value), BA_8BIT_MASK,
7642                         NULL, HFILL }},
7643
7644                 { &hf_isup_simple_segmentation_ind,
7645                         { "Simple segmentation indicator",  "isup.simple_segmentation_ind",
7646                         FT_BOOLEAN, 8, TFS(&isup_simple_segmentation_ind_value), C_8BIT_MASK,
7647                         NULL, HFILL }},
7648
7649                 { &hf_isup_connected_line_identity_request_ind,
7650                         { "Connected line identity request indicator",  "isup.connected_line_identity_request_ind",
7651                         FT_BOOLEAN, 8, TFS(&isup_connected_line_identity_request_ind_value), H_8BIT_MASK,
7652                         NULL, HFILL }},
7653
7654                 { &hf_isup_redirecting_ind,
7655                         { "Redirection indicator",  "isup.redirecting_ind",
7656                         FT_UINT16, BASE_DEC, VALS(isup_redirecting_ind_value), CBA_16BIT_MASK,
7657                         NULL, HFILL }},
7658
7659                 { &hf_isup_original_redirection_reason,
7660                         { "Original redirection reason",  "isup.original_redirection_reason",
7661                         FT_UINT16, BASE_DEC, VALS(isup_original_redirection_reason_value), HGFE_16BIT_MASK,
7662                         NULL, HFILL }},
7663
7664                 { &hf_isup_redirection_counter,
7665                         { "Redirection counter",  "isup.redirection_counter",
7666                         FT_UINT16, BASE_DEC, NULL, KJI_16BIT_MASK,
7667                         NULL, HFILL }},
7668
7669                 { &hf_isup_redirection_reason,
7670                         { "Redirection reason",  "isup.redirection_reason",
7671                         FT_UINT16, BASE_DEC, VALS(isup_redirection_reason_value), PONM_16BIT_MASK,
7672                         NULL, HFILL }},
7673
7674                 { &hf_isup_type_of_network_identification,
7675                         { "Type of network identification",  "isup.type_of_network_identification",
7676                         FT_UINT8, BASE_DEC, VALS(isup_type_of_network_identification_value), GFE_8BIT_MASK,
7677                         NULL, HFILL }},
7678
7679                 { &hf_isup_network_identification_plan,
7680                         { "Network identification plan",  "isup.network_identification_plan",
7681                         FT_UINT8, BASE_DEC, VALS(isup_network_identification_plan_value), DCBA_8BIT_MASK,
7682                         NULL, HFILL }},
7683
7684                 { &hf_isup_map_type,
7685                         { "Map Type",  "isup.map_type",
7686                         FT_UINT8, BASE_DEC, VALS(isup_map_type_value), FEDCBA_8BIT_MASK,
7687                         NULL, HFILL }},
7688
7689                 { &hf_isup_automatic_congestion_level,
7690                         { "Automatic congestion level",  "isup.automatic_congestion_level",
7691                         FT_UINT8, BASE_DEC, VALS(isup_auto_congestion_level_value), 0x0,
7692                         NULL, HFILL }},
7693
7694                 { &hf_isup_inband_information_ind,
7695                         { "In-band information indicator",  "isup.inband_information_ind",
7696                         FT_BOOLEAN, 8, TFS(&isup_inband_information_ind_value), A_8BIT_MASK,
7697                         NULL, HFILL }},
7698
7699                 { &hf_isup_call_diversion_may_occur_ind,
7700                         { "Call diversion may occur indicator",  "isup.call_diversion_may_occur_ind",
7701                         FT_BOOLEAN, 8, TFS(&isup_call_diversion_may_occur_ind_value), B_8BIT_MASK,
7702                         NULL, HFILL }},
7703
7704                 { &hf_isup_mlpp_user_ind,
7705                         { "MLPP user indicator",  "isup.mlpp_user",
7706                         FT_BOOLEAN, 8, TFS(&isup_MLPP_user_ind_value), D_8BIT_MASK,
7707                         NULL, HFILL }},
7708
7709                 { &hf_isup_UUI_type,
7710                         { "User-to-User indicator type",  "isup.UUI_type",
7711                         FT_BOOLEAN, 8, TFS(&isup_UUI_type_value), A_8BIT_MASK,
7712                         NULL, HFILL }},
7713
7714                 { &hf_isup_UUI_req_service1,
7715                         { "User-to-User indicator request service 1",  "isup.UUI_req_service1",
7716                         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), CB_8BIT_MASK,
7717                         NULL, HFILL }},
7718
7719                 { &hf_isup_UUI_req_service2,
7720                         { "User-to-User indicator request service 2",  "isup.UUI_req_service2",
7721                         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), ED_8BIT_MASK,
7722                         NULL, HFILL }},
7723
7724                 { &hf_isup_UUI_req_service3,
7725                         { "User-to-User indicator request service 3",  "isup.UUI_req_service3",
7726                         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), GF_8BIT_MASK,
7727                         NULL, HFILL }},
7728
7729                 { &hf_isup_UUI_res_service1,
7730                         { "User-to-User indicator response service 1",  "isup.UUI_res_service1",
7731                         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), CB_8BIT_MASK,
7732                         NULL, HFILL }},
7733
7734                 { &hf_isup_UUI_res_service2,
7735                         { "User-to-User indicator response service 2",  "isup.UUI_res_service2",
7736                         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), ED_8BIT_MASK,
7737                         NULL, HFILL }},
7738
7739                 { &hf_isup_UUI_res_service3,
7740                         { "User-to-User response service 3",  "isup.UUI_res_service3",
7741                         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), GF_8BIT_MASK,
7742                         NULL, HFILL }},
7743
7744                 { &hf_isup_UUI_network_discard_ind,
7745                         { "User-to-User indicator network discard indicator",  "isup.UUI_network_discard_ind",
7746                         FT_BOOLEAN, 8, TFS(&isup_UUI_network_discard_ind_value), H_8BIT_MASK,
7747                         NULL, HFILL }},
7748
7749                 { &hf_isup_access_delivery_ind,
7750                         { "Access delivery indicator",  "isup.access_delivery_ind",
7751                         FT_BOOLEAN, 8, TFS(&isup_access_delivery_ind_value), A_8BIT_MASK,
7752                         NULL, HFILL }},
7753
7754                 { &hf_isup_transmission_medium_requirement_prime,
7755                         { "Transmission medium requirement prime",  "isup.transmission_medium_requirement_prime",
7756                         FT_UINT8, BASE_DEC, VALS(isup_transmission_medium_requirement_prime_value), 0x0,
7757                         NULL, HFILL }},
7758
7759                 { &hf_isup_loop_prevention_response_ind,
7760                         { "Response indicator",  "isup.loop_prevention_response_ind",
7761                         FT_UINT8, BASE_DEC, VALS(isup_loop_prevention_response_ind_value), CB_8BIT_MASK,
7762                         NULL, HFILL }},
7763
7764                 { &hf_isup_temporary_alternative_routing_ind,
7765                         { "Temporary alternative routing indicator",  "isup.temporary_alternative_routing_ind",
7766                         FT_BOOLEAN, 8, TFS(&isup_temporary_alternative_routing_ind_value), A_8BIT_MASK,
7767                         NULL, HFILL }},
7768
7769                 { &hf_isup_extension_ind,
7770                         { "Extension indicator",  "isup.extension_ind",
7771                         FT_BOOLEAN, 8, TFS(&isup_extension_ind_value), H_8BIT_MASK,
7772                         NULL, HFILL }},
7773
7774                 { &hf_isup_call_to_be_diverted_ind,
7775                         { "Call to be diverted indicator",  "isup.call_to_be_diverted_ind",
7776                         FT_UINT8, BASE_DEC, VALS(isup_call_to_be_diverted_ind_value), BA_8BIT_MASK,
7777                         NULL, HFILL }},
7778
7779                 { &hf_isup_call_to_be_offered_ind,
7780                         { "Call to be offered indicator",  "isup.call_to_be_offered_ind",
7781                         FT_UINT8, BASE_DEC, VALS(isup_call_to_be_offered_ind_value), BA_8BIT_MASK,
7782                         NULL, HFILL }},
7783
7784                 { &hf_isup_conference_acceptance_ind,
7785                         { "Conference acceptance indicator",  "isup.conference_acceptance_ind",
7786                         FT_UINT8, BASE_DEC, VALS(isup_conference_acceptance_ind_value), BA_8BIT_MASK,
7787                         NULL, HFILL }},
7788
7789                 { &hf_isup_transit_at_intermediate_exchange_ind,
7790                         { "Transit at intermediate exchange indicator", "isup.transit_at_intermediate_exchange_ind",
7791                         FT_BOOLEAN, 8, TFS(&isup_transit_at_intermediate_exchange_ind_value), A_8BIT_MASK,
7792                         NULL, HFILL }},
7793
7794                 { &hf_isup_Release_call_ind,
7795                         { "Release call indicator", "isup.Release_call_ind",
7796                         FT_BOOLEAN, 8, TFS(&isup_Release_call_indicator_value), B_8BIT_MASK,
7797                         NULL, HFILL }},
7798
7799                 { &hf_isup_Send_notification_ind,
7800                         { "Send notification indicator", "isup.Send_notification_ind",
7801                         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value),C_8BIT_MASK,
7802                         NULL, HFILL }},
7803
7804                 { &hf_isup_Discard_message_ind_value,
7805                         { "Discard message indicator","isup.Discard_message_ind_value",
7806                         FT_BOOLEAN, 8, TFS(&isup_Discard_message_ind_value), D_8BIT_MASK,
7807                         NULL, HFILL }},
7808
7809                 { &hf_isup_Discard_parameter_ind,
7810                         { "Discard parameter indicator","isup.Discard_parameter_ind",
7811                         FT_BOOLEAN, 8, TFS(&isup_Discard_parameter_ind_value), E_8BIT_MASK,
7812                         NULL, HFILL }},
7813
7814                 { &hf_isup_Pass_on_not_possible_indicator,
7815                         { "Pass on not possible indicator",  "isup_Pass_on_not_possible_ind",
7816                         FT_UINT8, BASE_HEX, VALS(isup_Pass_on_not_possible_indicator_vals),GF_8BIT_MASK,
7817                         NULL, HFILL }},
7818
7819                 { &hf_isup_pass_on_not_possible_indicator2,
7820                         { "Pass on not possible indicator",  "isup_Pass_on_not_possible_val",
7821                         FT_BOOLEAN, 8, TFS(&isup_pass_on_not_possible_indicator_value),E_8BIT_MASK,
7822                         NULL, HFILL }},
7823
7824                 { &hf_isup_Broadband_narrowband_interworking_ind,
7825                         { "Broadband narrowband interworking indicator Bits JF",  "isup_broadband-narrowband_interworking_ind",
7826                         FT_UINT8, BASE_HEX, VALS(ISUP_Broadband_narrowband_interworking_indicator_vals),BA_8BIT_MASK,
7827                         NULL, HFILL }},
7828
7829                 { &hf_isup_Broadband_narrowband_interworking_ind2,
7830                         { "Broadband narrowband interworking indicator Bits GF",  "isup_broadband-narrowband_interworking_ind2",
7831                         FT_UINT8, BASE_HEX, VALS(ISUP_Broadband_narrowband_interworking_indicator_vals),GF_8BIT_MASK,
7832                         NULL, HFILL }},
7833
7834                 { &hf_isup_app_cont_ident,
7835                         { "Application context identifier",  "isup.app_context_identifier",
7836                         FT_UINT16, BASE_DEC, VALS(isup_application_transport_parameter_value),GFEDCBA_8BIT_MASK,
7837                         NULL, HFILL }},
7838
7839                 { &hf_isup_app_Release_call_ind,
7840                         { "Release call indicator (RCI)",  "isup.app_Release_call_indicator",
7841                         FT_BOOLEAN, 8, TFS(&isup_Release_call_indicator_value), A_8BIT_MASK,
7842                         NULL, HFILL }},
7843
7844                 { &hf_isup_app_Send_notification_ind,
7845                         { "Send notification indicator (SNI)",  "isup.app_Send_notification_ind",
7846                         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), B_8BIT_MASK,
7847                         NULL, HFILL }},
7848
7849                 { &hf_isup_apm_segmentation_ind,
7850                         { "APM segmentation indicator",  "isup.apm_segmentation_ind",
7851                         FT_UINT8, BASE_DEC, VALS(isup_APM_segmentation_ind_value), FEDCBA_8BIT_MASK,
7852                         NULL, HFILL }},
7853
7854                 { &hf_isup_apm_si_ind,
7855                         { "Sequence indicator (SI)",  "isup.APM_Sequence_ind",
7856                         FT_BOOLEAN, 8, TFS(&isup_Sequence_ind_value), G_8BIT_MASK,
7857                         NULL, HFILL }},
7858
7859                 { &hf_isup_orig_addr_len,
7860                         { "Originating Address length",  "isup.orig_addr_len",
7861                         FT_UINT8, BASE_DEC, NULL, 0x0,
7862                         NULL, HFILL }},
7863
7864                 { &hf_isup_dest_addr_len,
7865                         { "Destination Address length",  "isup.orig_addr_len",
7866                         FT_UINT8, BASE_DEC, NULL, 0x0,
7867                         NULL, HFILL }},
7868
7869                 { &hf_isup_apm_slr,
7870                         { "Segmentation local reference (SLR)",  "isup.APM_slr",
7871                         FT_UINT8, BASE_DEC, NULL,GFEDCBA_8BIT_MASK,
7872                         NULL, HFILL }},
7873                 { &hf_isup_cause_location,
7874                         { "Cause location", "isup.cause_location",
7875                         FT_UINT8, BASE_DEC, VALS(q931_cause_location_vals), 0x0f,
7876                         NULL, HFILL }},
7877
7878                 { &hf_ansi_isup_coding_standard,
7879                   { "Coding standard", "ansi_isup.coding_standard", FT_UINT8, BASE_HEX,
7880                          VALS(ansi_isup_coding_standard_vals), 0x60,NULL, HFILL }},
7881
7882                 { &hf_bat_ase_identifier,
7883                         { "BAT ASE Identifiers",  "bicc.bat_ase_identifier",
7884                         FT_UINT8, BASE_HEX, VALS(bat_ase_list_of_Identifiers_vals),0x0,
7885                         NULL, HFILL }},
7886
7887                 { &hf_length_indicator,
7888                         { "BAT ASE Element length indicator",  "bicc.bat_ase_length_indicator",
7889                         FT_UINT16, BASE_DEC, NULL,0x0,
7890                         NULL, HFILL }},
7891
7892                 { &hf_Action_Indicator,
7893                         { "BAT ASE action indicator field",  "bicc.bat_ase_bat_ase_action_indicator_field",
7894                         FT_UINT8, BASE_HEX, VALS(bat_ase_action_indicator_field_vals),0x00,
7895                         NULL, HFILL }},
7896
7897                 { &hf_Instruction_ind_for_general_action,
7898                         { "BAT ASE Instruction indicator for general action",  "bicc.bat_ase_Instruction_ind_for_general_action",
7899                         FT_UINT8, BASE_HEX, VALS(Instruction_indicator_for_general_action_vals),0x03,
7900                         NULL, HFILL }},
7901
7902                 { &hf_Send_notification_ind_for_general_action,
7903                         { "Send notification indicator for general action",  "bicc.bat_ase_Send_notification_ind_for_general_action",
7904                         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), 0x04,
7905                         NULL, HFILL }},
7906
7907                 { &hf_Instruction_ind_for_pass_on_not_possible,
7908                         { "Instruction ind for pass-on not possible",  "bicc.bat_ase_Instruction_ind_for_pass_on_not_possible",
7909                         FT_UINT8, BASE_HEX, VALS(Instruction_indicator_for_pass_on_not_possible_vals),0x30,
7910                         NULL, HFILL }},
7911
7912                 { &hf_Send_notification_ind_for_pass_on_not_possible,
7913                         { "Send notification indication for pass-on not possible",  "bicc.bat_ase_Send_notification_ind_for_pass_on_not_possible",
7914                         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), 0x40,
7915                         NULL, HFILL }},
7916
7917                 { &hf_BCTP_Version_Indicator,
7918                         { "BCTP Version Indicator",  "bicc.bat_ase_BCTP_Version_Indicator",
7919                         FT_UINT8, BASE_DEC, NULL,0x1f,
7920                         NULL, HFILL }},
7921
7922                 { &hf_BVEI,
7923                         { "BVEI",  "bicc.bat_ase_BCTP_BVEI",
7924                         FT_BOOLEAN, 8, TFS(&BCTP_BVEI_value), 0x40,
7925                         NULL, HFILL }},
7926
7927                 { &hf_Tunnelled_Protocol_Indicator,
7928                         { "Tunnelled Protocol Indicator",  "bicc.bat_ase_BCTP_Tunnelled_Protocol_Indicator",
7929                         FT_UINT8, BASE_DEC, VALS(BCTP_Tunnelled_Protocol_Indicator_vals),0x3f,
7930                         NULL, HFILL }},
7931
7932                 { &hf_TPEI,
7933                         { "TPEI",  "bicc.bat_ase_BCTP_tpei",
7934                         FT_BOOLEAN, 8, TFS(&BCTP_TPEI_value), 0x40,
7935                         NULL, HFILL }},
7936
7937                 { &hf_bncid,
7938                         { "Backbone Network Connection Identifier (BNCId)", "bat_ase.bncid",
7939                         FT_UINT32, BASE_HEX, NULL, 0x0,
7940                           NULL, HFILL }},
7941
7942                 { &hf_bat_ase_biwfa,
7943                         { "Interworking Function Address( X.213 NSAP encoded)", "bat_ase_biwfa",
7944                         FT_BYTES, BASE_NONE, NULL, 0x0,
7945                           NULL, HFILL }},
7946
7947                 { &hf_afi,
7948                         { "X.213 Address Format Information ( AFI )",  "x213.afi",
7949                         FT_UINT8, BASE_HEX, VALS(x213_afi_value),0x0,
7950                         NULL, HFILL }},
7951
7952                 { &hf_bicc_nsap_dsp,
7953                         { "X.213 Address Format Information ( DSP )",  "x213.dsp",
7954                         FT_BYTES, BASE_NONE, NULL,0x0,
7955                         NULL, HFILL }},
7956                 { &hf_characteristics,
7957                         { "Backbone network connection characteristics", "bat_ase.char",
7958                         FT_UINT8, BASE_HEX, VALS(bearer_network_connection_characteristics_vals),0x0,
7959                           NULL, HFILL }},
7960
7961                 { &hf_Organization_Identifier,
7962                         { "Organization identifier subfield",  "bat_ase.organization_identifier_subfield",
7963                         FT_UINT8, BASE_DEC, VALS(bat_ase_organization_identifier_subfield_vals),0x0,
7964                         NULL, HFILL }},
7965
7966                 { &hf_codec_type,
7967                         { "ITU-T codec type subfield",  "bat_ase.ITU_T_codec_type_subfield",
7968                         FT_UINT8, BASE_HEX, VALS(ITU_T_codec_type_subfield_vals),0x0,
7969                         NULL, HFILL }},
7970
7971                 { &hf_etsi_codec_type,
7972                         { "ETSI codec type subfield",  "bat_ase.ETSI_codec_type_subfield",
7973                         FT_UINT8, BASE_HEX, VALS(ETSI_codec_type_subfield_vals),0x0,
7974                         NULL, HFILL }},
7975
7976                 { &hf_active_code_set,
7977                         { "Active Code Set",  "bat_ase.acs",
7978                         FT_UINT8, BASE_HEX, NULL,0x0,
7979                         NULL, HFILL }},
7980
7981                 { &hf_active_code_set_12_2,
7982                         { "12.2 kbps rate",  "bat_ase.acs.12_2",
7983                         FT_UINT8, BASE_HEX, NULL,0x80,
7984                         NULL, HFILL }},
7985
7986                 { &hf_active_code_set_10_2,
7987                         { "10.2 kbps rate",  "bat_ase.acs.10_2",
7988                         FT_UINT8, BASE_HEX, NULL,0x40,
7989                         NULL, HFILL }},
7990
7991                 { &hf_active_code_set_7_95,
7992                         { "7.95 kbps rate",  "bat_ase.acs.7_95",
7993                         FT_UINT8, BASE_HEX, NULL,0x20,
7994                         NULL, HFILL }},
7995
7996                 { &hf_active_code_set_7_40,
7997                         { "7.40 kbps rate",  "bat_ase.acs.7_40",
7998                         FT_UINT8, BASE_HEX, NULL,0x10,
7999                         NULL, HFILL }},
8000
8001                 { &hf_active_code_set_6_70,
8002                         { "6.70 kbps rate",  "bat_ase.acs.6_70",
8003                         FT_UINT8, BASE_HEX, NULL,0x08,
8004                         NULL, HFILL }},
8005
8006                 { &hf_active_code_set_5_90,
8007                         { "5.90 kbps rate",  "bat_ase.acs.5_90",
8008                         FT_UINT8, BASE_HEX, NULL,0x04,
8009                         NULL, HFILL }},
8010
8011                 { &hf_active_code_set_5_15,
8012                         { "5.15 kbps rate",  "bat_ase.acs.5_15",
8013                         FT_UINT8, BASE_HEX, NULL,0x02,
8014                         NULL, HFILL }},
8015
8016                 { &hf_active_code_set_4_75,
8017                         { "4.75 kbps rate",  "bat_ase.acs.4_75",
8018                         FT_UINT8, BASE_HEX, NULL,0x01,
8019                         NULL, HFILL }},
8020
8021                 { &hf_supported_code_set,
8022                         { "Supported Code Set",  "bat_ase.scs",
8023                         FT_UINT8, BASE_HEX, NULL,0x0,
8024                         NULL, HFILL }},
8025
8026                 { &hf_supported_code_set_12_2,
8027                         { "12.2 kbps rate",  "bat_ase.scs.12_2",
8028                         FT_UINT8, BASE_HEX, NULL,0x80,
8029                         NULL, HFILL }},
8030
8031                 { &hf_supported_code_set_10_2,
8032                         { "10.2 kbps rate",  "bat_ase.scs.10_2",
8033                         FT_UINT8, BASE_HEX, NULL,0x40,
8034                         NULL, HFILL }},
8035
8036                 { &hf_supported_code_set_7_95,
8037                         { "7.95 kbps rate",  "bat_ase.scs.7_95",
8038                         FT_UINT8, BASE_HEX, NULL,0x20,
8039                         NULL, HFILL }},
8040
8041                 { &hf_supported_code_set_7_40,
8042                         { "7.40 kbps rate",  "bat_ase.scs.7_40",
8043                         FT_UINT8, BASE_HEX, NULL,0x10,
8044                         NULL, HFILL }},
8045
8046                 { &hf_supported_code_set_6_70,
8047                         { "6.70 kbps rate",  "bat_ase.scs.6_70",
8048                         FT_UINT8, BASE_HEX, NULL,0x08,
8049                         NULL, HFILL }},
8050
8051                 { &hf_supported_code_set_5_90,
8052                         { "5.90 kbps rate",  "bat_ase.scs.5_90",
8053                         FT_UINT8, BASE_HEX, NULL,0x04,
8054                         NULL, HFILL }},
8055
8056                 { &hf_supported_code_set_5_15,
8057                         { "5.15 kbps rate",  "bat_ase.scs.5_15",
8058                         FT_UINT8, BASE_HEX, NULL,0x02,
8059                         NULL, HFILL }},
8060
8061                 { &hf_supported_code_set_4_75,
8062                         { "4.75 kbps rate",  "bat_ase.scs.4_75",
8063                         FT_UINT8, BASE_HEX, NULL,0x01,
8064                         NULL, HFILL }},
8065
8066                 { &hf_optimisation_mode,
8067                         { "Optimisation Mode for ACS , OM",  "bat_ase.optimisation_mode",
8068                         FT_UINT8, BASE_HEX, VALS(optimisation_mode_vals),0x8,
8069                         NULL, HFILL }},
8070
8071                 { &hf_max_codec_modes,
8072                         { "Maximal number of Codec Modes, MACS",  "bat_ase.macs",
8073                         FT_UINT8, BASE_DEC, NULL,0x07,
8074                         NULL, HFILL }},
8075
8076
8077                 { &hf_bearer_control_tunneling,
8078                         { "Bearer control tunneling",  "bat_ase.bearer_control_tunneling",
8079                         FT_BOOLEAN, 8, TFS(&Bearer_Control_Tunnelling_ind_value),0x01,
8080                         NULL, HFILL }},
8081
8082                 { &hf_BAT_ASE_Comp_Report_Reason,
8083                         { "Compatibility report reason",  "bat_ase.Comp_Report_Reason",
8084                         FT_UINT8, BASE_HEX, VALS(BAT_ASE_Report_Reason_vals),0x0,
8085                         NULL, HFILL }},
8086
8087
8088                 { &hf_BAT_ASE_Comp_Report_ident,
8089                         { "Bearer control tunneling",  "bat_ase.bearer_control_tunneling",
8090                         FT_UINT8, BASE_HEX, VALS(bat_ase_list_of_Identifiers_vals),0x0,
8091                         NULL, HFILL }},
8092
8093                 { &hf_BAT_ASE_Comp_Report_diagnostic,
8094                         { "Diagnostics",  "bat_ase.Comp_Report_diagnostic",
8095                         FT_UINT16, BASE_HEX, NULL,0x0,
8096                         NULL, HFILL }},
8097
8098                 { &hf_Local_BCU_ID,
8099                         { "Local BCU ID",  "bat_ase.Local_BCU_ID",
8100                         FT_UINT32, BASE_HEX, NULL, 0x0,
8101                           NULL, HFILL }},
8102
8103                 { &hf_late_cut_trough_cap_ind,
8104                         { "Late Cut-through capability indicator",  "bat_ase.late_cut_trough_cap_ind",
8105                         FT_BOOLEAN, 8, TFS(&late_cut_trough_cap_ind_value),0x01,
8106                         NULL, HFILL }},
8107
8108                 { &hf_bat_ase_signal,
8109                         { "Q.765.5 - Signal Type",  "bat_ase.signal_type",
8110                         FT_UINT8, BASE_HEX, VALS(BAt_ASE_Signal_Type_vals),0x0,
8111                         NULL, HFILL }},
8112
8113                 { &hf_bat_ase_duration,
8114                         { "Duration in ms",  "bat_ase.signal_type",
8115                         FT_UINT16, BASE_DEC, NULL,0x0,
8116                         NULL, HFILL }},
8117
8118                 { &hf_bat_ase_bearer_redir_ind,
8119                         { "Redirection Indicator",  "bat_ase.bearer_redir_ind",
8120                         FT_UINT8, BASE_HEX, VALS(Bearer_Redirection_Indicator_vals),0x0,
8121                         NULL, HFILL }},
8122
8123                 { &hf_nsap_ipv4_addr,
8124                         { "IWFA IPv4 Address", "nsap.ipv4_addr",
8125                         FT_IPv4, BASE_NONE, NULL, 0x0,
8126                         "IPv4 address", HFILL }},
8127
8128                 { &hf_nsap_ipv6_addr,
8129                         { "IWFA IPv6 Address", "nsap.ipv6_addr",
8130                         FT_IPv6, BASE_NONE, NULL, 0x0,
8131                         "IPv6 address", HFILL}},
8132
8133                 { &hf_iana_icp,
8134                         { "IANA ICP",  "nsap.iana_icp",
8135                         FT_UINT16, BASE_HEX, VALS(iana_icp_values),0x0,
8136                       NULL, HFILL }},
8137
8138               { &hf_isup_called,
8139                       { "ISUP Called Number",  "isup.called",
8140                       FT_STRING, BASE_NONE, NULL,0x0,
8141                       NULL, HFILL }},
8142
8143               { &hf_isup_calling,
8144                       { "ISUP Calling Number",  "isup.calling",
8145                       FT_STRING, BASE_NONE, NULL,0x0,
8146                       NULL, HFILL }},
8147
8148               { &hf_isup_redirecting,
8149                       { "ISUP Redirecting Number",  "isup.redirecting",
8150                       FT_STRING, BASE_NONE, NULL,0x0,
8151                         NULL, HFILL }},
8152                 {&hf_isup_apm_msg_fragments,
8153                         {"Message fragments", "isup_apm.msg.fragments",
8154                         FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }
8155                 },
8156                 {&hf_isup_apm_msg_fragment,
8157                         {"Message fragment", "isup_apm.msg.fragment",
8158                         FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
8159                 },
8160                 {&hf_isup_apm_msg_fragment_overlap,
8161                         {"Message fragment overlap", "isup_apm.msg.fragment.overlap",
8162                         FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
8163                 },
8164                 {&hf_isup_apm_msg_fragment_overlap_conflicts,
8165                         {"Message fragment overlapping with conflicting data","isup_apm.msg.fragment.overlap.conflicts",
8166                         FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
8167                 },
8168                 {&hf_isup_apm_msg_fragment_multiple_tails,
8169                         {"Message has multiple tail fragments", "isup_apm.msg.fragment.multiple_tails",
8170                         FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
8171                 },
8172                 {&hf_isup_apm_msg_fragment_too_long_fragment,
8173                         {"Message fragment too long", "isup_apm.msg.fragment.too_long_fragment",
8174                         FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
8175                 },
8176                 {&hf_isup_apm_msg_fragment_error,
8177                         {"Message defragmentation error", "isup_apm.msg.fragment.error",
8178                         FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
8179                 },
8180                 {&hf_isup_apm_msg_reassembled_in,
8181                         {"Reassembled in", "isup_apm.msg.reassembled.in",
8182                         FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
8183                 },
8184                 {&hf_isup_cvr_rsp_ind,
8185                  {"CVR Response Ind", "conn_rsp_ind",
8186                   FT_UINT8, BASE_DEC, VALS(isup_cvr_rsp_ind_value), BA_8BIT_MASK,
8187                   NULL, HFILL }},
8188                 {&hf_isup_cvr_cg_car_ind,
8189                  {"CVR Circuit Group Carrier","cg_carrier_ind",
8190                  FT_UINT8, BASE_HEX, VALS(isup_cvr_cg_car_ind_value), BA_8BIT_MASK,
8191                   NULL, HFILL }},
8192                 {&hf_isup_cvr_cg_double_seize,
8193                  {"Double Seize Control", "cg_char_ind.doubleSeize",
8194                   FT_UINT8, BASE_HEX, VALS(isup_cvr_cg_double_seize_value), DC_8BIT_MASK,
8195                   NULL, HFILL }},
8196                 {&hf_isup_cvr_cg_alarm_car_ind,
8197                  {"Alarm Carrier Indicator", "cg_alarm_car_ind",
8198                   FT_UINT8, BASE_HEX, VALS(isup_cvr_alarm_car_ind_value), FE_8BIT_MASK,
8199                   NULL, HFILL }},
8200                 {&hf_isup_cvr_cont_chk_ind,
8201                  {"Continuity Check Indicator","cg_alarm_cnt_chk",
8202                   FT_UINT8, BASE_HEX, VALS(isup_cvr_cont_chk_ind_value), HG_8BIT_MASK,
8203                   NULL,HFILL }},
8204
8205                 { &hf_isup_geo_loc_presentation_restricted_ind,
8206                         { "Calling Geodetic Location presentation restricted indicator",  "isup.location_presentation_restr_ind",
8207                         FT_UINT8, BASE_DEC, VALS(isup_location_presentation_restricted_ind_value), DC_8BIT_MASK,
8208                         NULL, HFILL }},
8209                 { &hf_isup_geo_loc_screening_ind,
8210                         { "Calling Geodetic Location screening indicator",  "isup.location_screening_ind",
8211                         FT_UINT8, BASE_DEC, VALS(isup_screening_ind_enhanced_value), BA_8BIT_MASK,              /* using previously defined screening values */
8212                         NULL, HFILL }}
8213         };
8214
8215 /* Setup protocol subtree array */
8216         static gint *ett[] = {
8217                 &ett_isup,
8218                 &ett_isup_parameter,
8219                 &ett_isup_address_digits,
8220                 &ett_isup_pass_along_message,
8221                 &ett_isup_circuit_state_ind,
8222                 &ett_bat_ase,
8223                 &ett_bat_ase_element,
8224                 &ett_bat_ase_iwfa,
8225                 &ett_scs,
8226                 &ett_acs,
8227                 &ett_isup_apm_msg_fragment,
8228                 &ett_isup_apm_msg_fragments,
8229         };
8230
8231 /* Register the protocol name and description */
8232         proto_isup = proto_register_protocol("ISDN User Part",
8233             "ISUP", "isup");
8234
8235         register_dissector("isup", dissect_isup, proto_isup);
8236
8237 /* Required function calls to register the header fields and subtrees used */
8238         proto_register_field_array(proto_isup, hf, array_length(hf));
8239         proto_register_subtree_array(ett, array_length(ett));
8240
8241         isup_tap = register_tap("isup");
8242
8243         isup_module = prefs_register_protocol(proto_isup, NULL);
8244
8245
8246         prefs_register_bool_preference(isup_module, "show_cic_in_info", "Show CIC in Info column",
8247                                  "Show the CIC value (in addition to the message type) in the Info column",
8248                                  (gint *)&isup_show_cic_in_info);
8249
8250         prefs_register_bool_preference(isup_module, "defragment_apm",
8251                 "Reassemble APM messages",
8252                 "Whether APM messages datagrams should be reassembled",
8253                 &isup_apm_desegment);
8254
8255         /* Register the stats_tree */
8256         stats_tree_register_with_group("isup", "isup_msg", "_ISUP Messages",
8257                 0, msg_stats_tree_packet, msg_stats_tree_init,
8258                 NULL, REGISTER_STAT_GROUP_TELEPHONY);
8259 }
8260
8261
8262 /* ------------------------------------------------------------------ */
8263 /* Register isup with the sub-laying MTP L3 dissector */
8264 void
8265 proto_reg_handoff_isup(void)
8266 {
8267   dissector_handle_t isup_handle;
8268   dissector_handle_t application_isup_handle;
8269
8270   isup_handle = create_dissector_handle(dissect_isup, proto_isup);
8271   application_isup_handle = create_dissector_handle(dissect_application_isup, proto_isup);
8272   dissector_add("mtp3.service_indicator", MTP3_ISUP_SERVICE_INDICATOR, isup_handle);
8273   dissector_add_string("media_type","application/isup", application_isup_handle);
8274   dissector_add_string("tali.opcode", "isot", isup_handle);
8275
8276 }
8277
8278 void
8279 proto_register_bicc(void)
8280 {
8281 /* Setup list of header fields  See Section 1.6.1 for details*/
8282         static hf_register_info hf[] = {
8283                 { &hf_bicc_cic,
8284                         { "Call identification Code (CIC)",           "bicc.cic",
8285                         FT_UINT32, BASE_HEX, NULL, 0x0,
8286                           NULL, HFILL }},
8287         };
8288
8289 /* Setup protocol subtree array */
8290         static gint *ett[] = {
8291                 &ett_bicc
8292         };
8293         proto_bicc = proto_register_protocol("Bearer Independent Call Control",
8294             "BICC", "bicc");
8295 /* Required function calls to register the header fields and subtrees used */
8296         proto_register_field_array(proto_bicc, hf, array_length(hf));
8297         proto_register_subtree_array(ett, array_length(ett));
8298
8299         register_init_routine(isup_apm_defragment_init);
8300 }
8301
8302 /* Register isup with the sub-laying MTP L3 dissector */
8303 void
8304 proto_reg_handoff_bicc(void)
8305 {
8306   dissector_handle_t bicc_handle;
8307   sdp_handle = find_dissector("sdp");
8308   q931_ie_handle = find_dissector("q931.ie");
8309
8310   bicc_handle = create_dissector_handle(dissect_bicc, proto_bicc);
8311   dissector_add("mtp3.service_indicator", MTP3_BICC_SERVICE_INDICATOR, bicc_handle);
8312   dissector_add("sctp.ppi", BICC_PAYLOAD_PROTOCOL_ID, bicc_handle);
8313 }