OPAL Version 3.10.4

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

q931.h
Go to the documentation of this file.
1 /*
2 * q931.h
3 *
4 * Q.931 protocol handler
5 *
6 * Open H323 Library
7 *
8 * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
9 *
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
14 *
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * The Original Code is Open H323 Library.
21 *
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23 *
24 * Contributor(s): ______________________________________.
25 *
26 * $Revision: 24879 $
27 * $Author: rjongbloed $
28 * $Date: 2010-11-16 21:56:23 -0600 (Tue, 16 Nov 2010) $
29 */
30
31 #ifndef OPAL_H323_Q931_H
32 #define OPAL_H323_Q931_H
33
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37
38 #include <opal/buildopts.h>
39
41
44 class Q931 : public PObject
45 {
46 PCLASSINFO(Q931, PObject)
47 public:
48 enum MsgTypes {
49 NationalEscapeMsg = 0x00,
50 AlertingMsg = 0x01,
51 CallProceedingMsg = 0x02,
52 ConnectMsg = 0x07,
53 ConnectAckMsg = 0x0f,
54 ProgressMsg = 0x03,
55 SetupMsg = 0x05,
56 SetupAckMsg = 0x0d,
57 ResumeMsg = 0x26,
58 ResumeAckMsg = 0x2e,
59 ResumeRejectMsg = 0x22,
60 SuspendMsg = 0x25,
61 SuspendAckMsg = 0x2d,
62 SuspendRejectMsg = 0x21,
63 UserInformationMsg = 0x20,
64 DisconnectMsg = 0x45,
65 ReleaseMsg = 0x4d,
66 ReleaseCompleteMsg = 0x5a,
67 RestartMsg = 0x46,
68 RestartAckMsg = 0x4e,
69 SegmentMsg = 0x60,
70 CongestionCtrlMsg = 0x79,
71 InformationMsg = 0x7b,
72 NotifyMsg = 0x6e,
73 StatusMsg = 0x7d,
74 StatusEnquiryMsg = 0x75,
75 FacilityMsg = 0x62
76 };
77
78 Q931();
79 Q931(const Q931 & other);
80 Q931 & operator=(const Q931 & other);
81
82 void BuildFacility(int callRef, PBoolean fromDest);
83 void BuildInformation(int callRef, PBoolean fromDest);
84 void BuildProgress(
85 int callRef,
86 PBoolean fromDest,
87 unsigned description,
88 unsigned codingStandard = 0,
89 unsigned location = 0
90 );
91 void BuildNotify(int callRef, PBoolean fromDest);
92 void BuildCallProceeding(int callRef);
93 void BuildSetupAcknowledge(int callRef);
94 void BuildAlerting(int callRef);
95 void BuildSetup(int callRef = -1);
96 void BuildConnect(int callRef);
97 void BuildStatus(int callRef, PBoolean fromDest);
98 void BuildStatusEnquiry(int callRef, PBoolean fromDest);
99 void BuildReleaseComplete(int callRef, PBoolean fromDest);
100
101 PBoolean Decode(const PBYTEArray & data);
102 PBoolean Encode(PBYTEArray & data) const;
103
104 void PrintOn(ostream & strm) const;
105 PString GetMessageTypeName() const;
106
107 static unsigned GenerateCallReference();
108 unsigned GetCallReference() const { return callReference; }
109 PBoolean IsFromDestination() const { return fromDestination; }
110 MsgTypes GetMessageType() const { return messageType; }
111
112 enum InformationElementCodes {
113 BearerCapabilityIE = 0x04,
114 CauseIE = 0x08,
115 ChannelIdentificationIE = 0x18,
116 FacilityIE = 0x1c,
117 ProgressIndicatorIE = 0x1e,
118 CallStateIE = 0x14,
119 DisplayIE = 0x28,
120 KeypadIE = 0x2c,
121 SignalIE = 0x34,
122 ConnectedNumberIE = 0x4c,
123 CallingPartyNumberIE = 0x6c,
124 CalledPartyNumberIE = 0x70,
125 RedirectingNumberIE = 0x74,
126 UserUserIE = 0x7e
127 };
128 friend ostream & operator<<(ostream & strm, InformationElementCodes ie);
129
130 PBoolean HasIE(InformationElementCodes ie) const;
131 PBYTEArray GetIE(
132 InformationElementCodes ie,
133 PINDEX idx = 0 // Index of duplicate IE entry
134 ) const;
135 void SetIE(
136 InformationElementCodes ie,
137 const PBYTEArray & userData,
138 bool append = FALSE
139 );
140 void RemoveIE(InformationElementCodes ie);
141
142 enum InformationTransferCapability {
143 TransferSpeech,
144 TransferUnrestrictedDigital = 8,
145 TransferRestrictedDigital = 9,
146 Transfer3_1kHzAudio = 16,
147 TrasnferUnrestrictedDigitalWithTones = 17,
148 TransferVideo = 24
149 };
150
151 void SetBearerCapabilities(
152 InformationTransferCapability capability,
153 unsigned transferRate,
154 unsigned codingStandard = 0,
155 unsigned userInfoLayer1 = 5
156 );
157 void SetBearerCapabilities(
158 const PString & caps
159 );
160
161 PBoolean GetBearerCapabilities(
162 InformationTransferCapability & capability,
163 unsigned & transferRate,
164 unsigned * codingStandard = NULL,
165 unsigned * userInfoLayer1 = NULL
166 );
167
168 enum CauseValues {
169 UnknownCauseIE = 0,
170 UnallocatedNumber = 1,
171 NoRouteToNetwork = 2,
172 NoRouteToDestination = 3,
173 SendSpecialTone = 4,
174 MisdialledTrunkPrefix = 5,
175 ChannelUnacceptable = 6,
176 NormalCallClearing = 16,
177 UserBusy = 17,
178 NoResponse = 18,
179 NoAnswer = 19,
180 SubscriberAbsent = 20,
181 CallRejected = 21,
182 NumberChanged = 22,
183 Redirection = 23,
184 ExchangeRoutingError = 25,
185 NonSelectedUserClearing = 26,
186 DestinationOutOfOrder = 27,
187 InvalidNumberFormat = 28,
188 FacilityRejected = 29,
189 StatusEnquiryResponse = 30,
190 NormalUnspecified = 31,
191 NoCircuitChannelAvailable = 34,
192 NetworkOutOfOrder = 38,
193 TemporaryFailure = 41,
194 Congestion = 42,
195 RequestedCircuitNotAvailable = 44,
196 ResourceUnavailable = 47,
197 ServiceOptionNotAvailable = 63,
198 InvalidCallReference = 81,
199 ClearedRequestedCallIdentity = 86,
200 IncompatibleDestination = 88,
201 IENonExistantOrNotImplemented= 99,
202 TimerExpiry = 102,
203 ProtocolErrorUnspecified = 111,
204 InterworkingUnspecified = 127,
205 ErrorInCauseIE = 0x100
206 };
207 friend ostream & operator<<(ostream & strm, CauseValues cause);
208
209 void SetCause(
210 CauseValues value,
211 unsigned standard = 0,
212 unsigned location = 0
213 );
214 CauseValues GetCause(
215 unsigned * standard = NULL,
216 unsigned * location = NULL
217 ) const;
218
219 enum CallStates {
220 CallState_Null = 0,
221 CallState_CallInitiated = 1,
222 CallState_OverlapSending = 2,
223 CallState_OutgoingCallProceeding= 3,
224 CallState_CallDelivered = 4,
225 CallState_CallPresent = 6,
226 CallState_CallReceived = 7,
227 CallState_ConnectRequest = 8,
228 CallState_IncomingCallProceeding= 9,
229 CallState_Active = 10,
230 CallState_DisconnectRequest = 11,
231 CallState_DisconnectIndication = 12,
232 CallState_SuspendRequest = 15,
233 CallState_ResumeRequest = 17,
234 CallState_ReleaseRequest = 19,
235 CallState_OverlapReceiving = 25,
236 CallState_ErrorInIE = 0x100
237 };
238 void SetCallState(
239 CallStates value,
240 unsigned standard = 0
241 );
242 CallStates GetCallState(
243 unsigned * standard = NULL
244 ) const;
245
246 enum SignalInfo {
247 SignalDialToneOn,
248 SignalRingBackToneOn,
249 SignalInterceptToneOn,
250 SignalNetworkCongestionToneOn,
251 SignalBusyToneOn,
252 SignalConfirmToneOn,
253 SignalAnswerToneOn,
254 SignalCallWaitingTone,
255 SignalOffhookWarningTone,
256 SignalPreemptionToneOn,
257 SignalTonesOff = 0x3f,
258 SignalAlertingPattern0 = 0x40,
259 SignalAlertingPattern1,
260 SignalAlertingPattern2,
261 SignalAlertingPattern3,
262 SignalAlertingPattern4,
263 SignalAlertingPattern5,
264 SignalAlertingPattern6,
265 SignalAlertingPattern7,
266 SignalAlertingOff = 0x4f,
267 SignalErrorInIE = 0x100
268 };
269 void SetSignalInfo(SignalInfo value);
270 SignalInfo GetSignalInfo() const;
271
272 void SetKeypad(const PString & digits);
273 PString GetKeypad() const;
274
275 enum ProgressIndication {
276 ProgressNotEndToEndISDN = 1, // Call is not end-to-end ISDN;
277 // further call progress information may be available in-band
278 ProgressDestinationNonISDN = 2, // Destination address is non ISDN
279 ProgressOriginNotISDN = 3, // Origination address is non ISDN
280 ProgressReturnedToISDN = 4, // Call has returned to the ISDN
281 ProgressServiceChange = 5, // Interworking has occurred and has
282 // resulted in a telecommunication service change
283 ProgressInbandInformationAvailable = 8 // In-band information or an appropriate pattern is now available.
284 };
285
286 void SetProgressIndicator(
287 unsigned description,
288 unsigned codingStandard = 0,
289 unsigned location = 0
290 );
291 PBoolean GetProgressIndicator(
292 unsigned & description,
293 unsigned * codingStandard = NULL,
294 unsigned * location = NULL
295 ) const;
296
297 void SetDisplayName(const PString & name);
298 PString GetDisplayName() const;
299
300 enum NumberingPlanCodes {
301 UnknownPlan = 0x00,
302 ISDNPlan = 0x01,
303 DataPlan = 0x03,
304 TelexPlan = 0x04,
305 NationalStandardPlan = 0x08,
306 PrivatePlan = 0x09,
307 ReservedPlan = 0x0f
308 };
309
310 enum TypeOfNumberCodes {
311 UnknownType = 0x00,
312 InternationalType = 0x01,
313 NationalType = 0x02,
314 NetworkSpecificType = 0x03,
315 SubscriberType = 0x04,
316 AbbreviatedType = 0x06,
317 ReservedType = 0x07
318 };
319
320 void SetCallingPartyNumber(
321 const PString & number,
322 unsigned plan = 1,
323 unsigned type = 0,
324 int presentation = -1,
325 int screening = -1
326 );
327 PBoolean GetCallingPartyNumber(
328 PString & number,
329 unsigned * plan = NULL,
330 unsigned * type = NULL,
331 unsigned * presentation = NULL,
332 unsigned * screening = NULL,
333 unsigned defPresentation = 0,
334 unsigned defScreening = 0
335 ) const;
336
337 void SetCalledPartyNumber(
338 const PString & number,
339 unsigned plan = 1,
340 unsigned type = 0
341 );
342 PBoolean GetCalledPartyNumber(
343 PString & number,
344 unsigned * plan = NULL,
345 unsigned * type = NULL
346 ) const;
347
348 void SetRedirectingNumber(
349 const PString & number,
350 unsigned plan = 1,
351 unsigned type = 0,
352 int presentation = -1,
353 int screening = -1,
354 int reason = -1
355 );
356 PBoolean GetRedirectingNumber(
357 PString & number,
358 unsigned * plan = NULL,
359 unsigned * type = NULL,
360 unsigned * presentation = NULL,
361 unsigned * screening = NULL,
362 unsigned * reason = NULL,
363 unsigned defPresentation = 0,
364 unsigned defScreening = 0,
365 unsigned defReason =0
366 ) const;
367
368 void SetConnectedNumber(
369 const PString & number,
370 unsigned plan = 1,
371 unsigned type = 0,
372 int presentation = -1,
373 int screening = -1,
374 int reason = -1
375 );
376 PBoolean GetConnectedNumber(
377 PString & number,
378 unsigned * plan = NULL,
379 unsigned * type = NULL,
380 unsigned * presentation = NULL,
381 unsigned * screening = NULL,
382 unsigned * reason = NULL,
383 unsigned defPresentation = 0,
384 unsigned defScreening = 0,
385 unsigned defReason =0
386 ) const;
387
394 void SetChannelIdentification(
395 unsigned interfaceType = 0,
396 unsigned preferredOrExclusive = 0,
397 int channelNumber = 1
398 );
399
402 PBoolean GetChannelIdentification(
403 unsigned * interfaceType = NULL,
404 unsigned * preferredOrExclusive = NULL,
405 int * channelNumber = NULL
406 ) const;
407
408 protected:
409 unsigned callReference;
410 PBoolean fromDestination;
411 unsigned protocolDiscriminator;
412 MsgTypes messageType;
413
414 PARRAY(InternalInformationElement, PBYTEArray);
415 PDICTIONARY(InternalInformationElements, POrdinalKey, InternalInformationElement);
416 InternalInformationElements informationElements;
417 };
418
419
420 #endif // OPAL_H323_Q931_H
421
422