OPAL  Version 3.14.3
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: 32179 $
27  * $Author: rjongbloed $
28  * $Date: 2014-06-19 13:56:10 +1000 (Thu, 19 Jun 2014) $
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_config.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  ) const;
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  PString GetCallingPartyNumber() const;
337 
339  const PString & number,
340  unsigned plan = 1,
341  unsigned type = 0
342  );
343  PBoolean GetCalledPartyNumber(
344  PString & number,
345  unsigned * plan = NULL,
346  unsigned * type = NULL
347  ) const;
348  PString GetCalledPartyNumber() const;
349 
351  const PString & number,
352  unsigned plan = 1,
353  unsigned type = 0,
354  int presentation = -1,
355  int screening = -1,
356  int reason = -1
357  );
358  PBoolean GetRedirectingNumber(
359  PString & number,
360  unsigned * plan = NULL,
361  unsigned * type = NULL,
362  unsigned * presentation = NULL,
363  unsigned * screening = NULL,
364  unsigned * reason = NULL,
365  unsigned defPresentation = 0,
366  unsigned defScreening = 0,
367  unsigned defReason =0
368  ) const;
369 
370  void SetConnectedNumber(
371  const PString & number,
372  unsigned plan = 1,
373  unsigned type = 0,
374  int presentation = -1,
375  int screening = -1,
376  int reason = -1
377  );
378  PBoolean GetConnectedNumber(
379  PString & number,
380  unsigned * plan = NULL,
381  unsigned * type = NULL,
382  unsigned * presentation = NULL,
383  unsigned * screening = NULL,
384  unsigned * reason = NULL,
385  unsigned defPresentation = 0,
386  unsigned defScreening = 0,
387  unsigned defReason =0
388  ) const;
389 
397  unsigned interfaceType = 0,
398  unsigned preferredOrExclusive = 0,
399  int channelNumber = 1
400  );
401 
404  PBoolean GetChannelIdentification(
405  unsigned * interfaceType = NULL,
406  unsigned * preferredOrExclusive = NULL,
407  int * channelNumber = NULL
408  ) const;
409 
410  protected:
411  unsigned callReference;
412  PBoolean fromDestination;
415 
416  PARRAY(InternalInformationElement, PBYTEArray);
417  PDICTIONARY(InternalInformationElements, POrdinalKey, InternalInformationElement);
418  InternalInformationElements informationElements;
419 };
420 
421 
422 #endif // OPAL_H323_Q931_H
423 
424