OPAL  Version 3.12.9
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-17 14:56:23 +1100 (Wed, 17 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 {
50  AlertingMsg = 0x01,
52  ConnectMsg = 0x07,
53  ConnectAckMsg = 0x0f,
54  ProgressMsg = 0x03,
55  SetupMsg = 0x05,
56  SetupAckMsg = 0x0d,
57  ResumeMsg = 0x26,
58  ResumeAckMsg = 0x2e,
60  SuspendMsg = 0x25,
61  SuspendAckMsg = 0x2d,
64  DisconnectMsg = 0x45,
65  ReleaseMsg = 0x4d,
67  RestartMsg = 0x46,
68  RestartAckMsg = 0x4e,
69  SegmentMsg = 0x60,
72  NotifyMsg = 0x6e,
73  StatusMsg = 0x7d,
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 
114  CauseIE = 0x08,
116  FacilityIE = 0x1c,
118  CallStateIE = 0x14,
119  DisplayIE = 0x28,
120  KeypadIE = 0x2c,
121  SignalIE = 0x34,
126  UserUserIE = 0x7e
127  };
128  friend ostream & operator<<(ostream & strm, InformationElementCodes ie);
129 
130  PBoolean HasIE(InformationElementCodes ie) const;
131  PBYTEArray GetIE(
133  PINDEX idx = 0 // Index of duplicate IE entry
134  ) const;
135  void SetIE(
137  const PBYTEArray & userData,
138  bool append = FALSE
139  );
141 
149  };
150 
152  InformationTransferCapability capability,
153  unsigned transferRate,
154  unsigned codingStandard = 0,
155  unsigned userInfoLayer1 = 5
156  );
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 {
177  UserBusy = 17,
179  NoAnswer = 19,
202  TimerExpiry = 102,
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  );
215  unsigned * standard = NULL,
216  unsigned * location = NULL
217  ) const;
218 
219  enum CallStates {
237  };
238  void SetCallState(
239  CallStates value,
240  unsigned standard = 0
241  );
243  unsigned * standard = NULL
244  ) const;
245 
246  enum SignalInfo {
268  };
269  void SetSignalInfo(SignalInfo value);
270  SignalInfo GetSignalInfo() const;
271 
272  void SetKeypad(const PString & digits);
273  PString GetKeypad() const;
274 
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 
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 
301  UnknownPlan = 0x00,
302  ISDNPlan = 0x01,
303  DataPlan = 0x03,
304  TelexPlan = 0x04,
306  PrivatePlan = 0x09,
308  };
309 
311  UnknownType = 0x00,
313  NationalType = 0x02,
318  };
319 
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 
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 
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 
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;
413 
414  PARRAY(InternalInformationElement, PBYTEArray);
415  PDICTIONARY(InternalInformationElements, POrdinalKey, InternalInformationElement);
416  InternalInformationElements informationElements;
417 };
418 
419 
420 #endif // OPAL_H323_Q931_H
421 
422