OPAL  Version 3.18.8
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 
27 #ifndef OPAL_H323_Q931_H
28 #define OPAL_H323_Q931_H
29 
30 #ifdef P_USE_PRAGMA
31 #pragma interface
32 #endif
33 
34 #include <opal_config.h>
35 
37 
40 class Q931 : public PObject
41 {
42  PCLASSINFO(Q931, PObject)
43  public:
44  enum MsgTypes {
46  AlertingMsg = 0x01,
48  ConnectMsg = 0x07,
49  ConnectAckMsg = 0x0f,
50  ProgressMsg = 0x03,
51  SetupMsg = 0x05,
52  SetupAckMsg = 0x0d,
53  ResumeMsg = 0x26,
54  ResumeAckMsg = 0x2e,
56  SuspendMsg = 0x25,
57  SuspendAckMsg = 0x2d,
60  DisconnectMsg = 0x45,
61  ReleaseMsg = 0x4d,
63  RestartMsg = 0x46,
64  RestartAckMsg = 0x4e,
65  SegmentMsg = 0x60,
68  NotifyMsg = 0x6e,
69  StatusMsg = 0x7d,
71  FacilityMsg = 0x62
72  };
73 
74  Q931();
75  Q931(const Q931 & other);
76  Q931 & operator=(const Q931 & other);
77 
78  void BuildFacility(int callRef, PBoolean fromDest);
79  void BuildInformation(int callRef, PBoolean fromDest);
80  void BuildProgress(
81  int callRef,
82  PBoolean fromDest,
83  unsigned description,
84  unsigned codingStandard = 0,
85  unsigned location = 0
86  );
87  void BuildNotify(int callRef, PBoolean fromDest);
88  void BuildCallProceeding(int callRef);
89  void BuildSetupAcknowledge(int callRef);
90  void BuildAlerting(int callRef);
91  void BuildSetup(int callRef = -1);
92  void BuildConnect(int callRef);
93  void BuildStatus(int callRef, PBoolean fromDest);
94  void BuildStatusEnquiry(int callRef, PBoolean fromDest);
95  void BuildReleaseComplete(int callRef, PBoolean fromDest);
96 
97  PBoolean Decode(const PBYTEArray & data);
98  PBoolean Encode(PBYTEArray & data) const;
99 
100  void PrintOn(ostream & strm) const;
101  PString GetMessageTypeName() const;
102 
103  static unsigned GenerateCallReference();
104  unsigned GetCallReference() const { return callReference; }
105  PBoolean IsFromDestination() const { return fromDestination; }
106  MsgTypes GetMessageType() const { return messageType; }
107 
110  CauseIE = 0x08,
112  FacilityIE = 0x1c,
114  CallStateIE = 0x14,
115  DisplayIE = 0x28,
116  KeypadIE = 0x2c,
117  SignalIE = 0x34,
122  UserUserIE = 0x7e
123  };
124  friend ostream & operator<<(ostream & strm, InformationElementCodes ie);
125 
126  PBoolean HasIE(InformationElementCodes ie) const;
127  PBYTEArray GetIE(
129  PINDEX idx = 0 // Index of duplicate IE entry
130  ) const;
131  void SetIE(
133  const PBYTEArray & userData,
134  bool append = FALSE
135  );
137 
145  };
146 
148  InformationTransferCapability capability,
149  unsigned transferRate,
150  unsigned codingStandard = 0,
151  unsigned userInfoLayer1 = 5
152  );
154  const PString & caps
155  );
156 
157  PBoolean GetBearerCapabilities(
158  InformationTransferCapability & capability,
159  unsigned & transferRate,
160  unsigned * codingStandard = NULL,
161  unsigned * userInfoLayer1 = NULL
162  ) const;
163 
164  enum CauseValues {
173  UserBusy = 17,
175  NoAnswer = 19,
198  TimerExpiry = 102,
202  };
203  friend ostream & operator<<(ostream & strm, CauseValues cause);
204 
205  void SetCause(
206  CauseValues value,
207  unsigned standard = 0,
208  unsigned location = 0
209  );
211  unsigned * standard = NULL,
212  unsigned * location = NULL
213  ) const;
214 
215  enum CallStates {
233  };
234  void SetCallState(
235  CallStates value,
236  unsigned standard = 0
237  );
239  unsigned * standard = NULL
240  ) const;
241 
242  enum SignalInfo {
264  };
265  void SetSignalInfo(SignalInfo value);
266  SignalInfo GetSignalInfo() const;
267 
268  void SetKeypad(const PString & digits);
269  PString GetKeypad() const;
270 
272  ProgressNotEndToEndISDN = 1, // Call is not end-to-end ISDN;
273  // further call progress information may be available in-band
274  ProgressDestinationNonISDN = 2, // Destination address is non ISDN
275  ProgressOriginNotISDN = 3, // Origination address is non ISDN
276  ProgressReturnedToISDN = 4, // Call has returned to the ISDN
277  ProgressServiceChange = 5, // Interworking has occurred and has
278  // resulted in a telecommunication service change
279  ProgressInbandInformationAvailable = 8 // In-band information or an appropriate pattern is now available.
280  };
281 
283  unsigned description,
284  unsigned codingStandard = 0,
285  unsigned location = 0
286  );
287  PBoolean GetProgressIndicator(
288  unsigned & description,
289  unsigned * codingStandard = NULL,
290  unsigned * location = NULL
291  ) const;
292 
293  void SetDisplayName(const PString & name);
294  PString GetDisplayName() const;
295 
297  UnknownPlan = 0x00,
298  ISDNPlan = 0x01,
299  DataPlan = 0x03,
300  TelexPlan = 0x04,
302  PrivatePlan = 0x09,
304  };
305 
307  UnknownType = 0x00,
309  NationalType = 0x02,
314  };
315 
317  const PString & number,
318  unsigned plan = 1,
319  unsigned type = 0,
320  int presentation = -1,
321  int screening = -1
322  );
323  PBoolean GetCallingPartyNumber(
324  PString & number,
325  unsigned * plan = NULL,
326  unsigned * type = NULL,
327  unsigned * presentation = NULL,
328  unsigned * screening = NULL,
329  unsigned defPresentation = 0,
330  unsigned defScreening = 0
331  ) const;
332  PString GetCallingPartyNumber() const;
333 
335  const PString & number,
336  unsigned plan = 1,
337  unsigned type = 0
338  );
339  PBoolean GetCalledPartyNumber(
340  PString & number,
341  unsigned * plan = NULL,
342  unsigned * type = NULL
343  ) const;
344  PString GetCalledPartyNumber() const;
345 
347  const PString & number,
348  unsigned plan = 1,
349  unsigned type = 0,
350  int presentation = -1,
351  int screening = -1,
352  int reason = -1
353  );
354  PBoolean GetRedirectingNumber(
355  PString & number,
356  unsigned * plan = NULL,
357  unsigned * type = NULL,
358  unsigned * presentation = NULL,
359  unsigned * screening = NULL,
360  unsigned * reason = NULL,
361  unsigned defPresentation = 0,
362  unsigned defScreening = 0,
363  unsigned defReason =0
364  ) const;
365 
366  void SetConnectedNumber(
367  const PString & number,
368  unsigned plan = 1,
369  unsigned type = 0,
370  int presentation = -1,
371  int screening = -1,
372  int reason = -1
373  );
374  PBoolean GetConnectedNumber(
375  PString & number,
376  unsigned * plan = NULL,
377  unsigned * type = NULL,
378  unsigned * presentation = NULL,
379  unsigned * screening = NULL,
380  unsigned * reason = NULL,
381  unsigned defPresentation = 0,
382  unsigned defScreening = 0,
383  unsigned defReason =0
384  ) const;
385 
393  unsigned interfaceType = 0,
394  unsigned preferredOrExclusive = 0,
395  int channelNumber = 1
396  );
397 
400  PBoolean GetChannelIdentification(
401  unsigned * interfaceType = NULL,
402  unsigned * preferredOrExclusive = NULL,
403  int * channelNumber = NULL
404  ) const;
405 
406  protected:
407  unsigned callReference;
408  PBoolean fromDestination;
411 
412  PARRAY(InternalInformationElement, PBYTEArray);
413  PDICTIONARY(InternalInformationElements, POrdinalKey, InternalInformationElement);
414  InternalInformationElements informationElements;
415 };
416 
417 
418 #endif // OPAL_H323_Q931_H
419 
420 
CauseValues
Definition: q931.h:164
Definition: q931.h:179
Definition: q931.h:46
void BuildSetup(int callRef=-1)
Definition: q931.h:66
Definition: q931.h:55
Definition: q931.h:225
Definition: q931.h:114
Definition: q931.h:169
void RemoveIE(InformationElementCodes ie)
Definition: q931.h:112
Definition: q931.h:200
PDICTIONARY(InternalInformationElements, POrdinalKey, InternalInformationElement)
Definition: q931.h:166
void BuildNotify(int callRef, PBoolean fromDest)
Definition: q931.h:48
InformationTransferCapability
Definition: q931.h:138
Definition: q931.h:248
Definition: q931.h:222
Definition: q931.h:276
Definition: q931.h:255
Definition: q931.h:63
Definition: q931.h:188
Definition: q931.h:216
void BuildStatusEnquiry(int callRef, PBoolean fromDest)
Definition: q931.h:182
PBoolean Encode(PBYTEArray &data) const
Definition: q931.h:121
PBoolean GetRedirectingNumber(PString &number, unsigned *plan=NULL, unsigned *type=NULL, unsigned *presentation=NULL, unsigned *screening=NULL, unsigned *reason=NULL, unsigned defPresentation=0, unsigned defScreening=0, unsigned defReason=0) const
Definition: q931.h:243
Definition: q931.h:115
Definition: q931.h:168
Definition: q931.h:217
Definition: q931.h:228
Definition: q931.h:142
Definition: q931.h:181
Definition: q931.h:60
Definition: q931.h:64
void BuildProgress(int callRef, PBoolean fromDest, unsigned description, unsigned codingStandard=0, unsigned location=0)
Definition: q931.h:226
SignalInfo GetSignalInfo() const
Definition: q931.h:229
Definition: q931.h:187
Definition: q931.h:180
void SetCause(CauseValues value, unsigned standard=0, unsigned location=0)
Definition: q931.h:311
Definition: q931.h:301
Definition: q931.h:165
Definition: q931.h:298
Definition: q931.h:171
Definition: q931.h:56
PString GetCalledPartyNumber() const
Definition: q931.h:312
Definition: q931.h:47
Definition: q931.h:170
Definition: q931.h:40
NumberingPlanCodes
Definition: q931.h:296
Definition: q931.h:193
Definition: q931.h:272
Definition: q931.h:69
Definition: q931.h:45
PBoolean GetConnectedNumber(PString &number, unsigned *plan=NULL, unsigned *type=NULL, unsigned *presentation=NULL, unsigned *screening=NULL, unsigned *reason=NULL, unsigned defPresentation=0, unsigned defScreening=0, unsigned defReason=0) const
unsigned protocolDiscriminator
Definition: q931.h:409
void SetRedirectingNumber(const PString &number, unsigned plan=1, unsigned type=0, int presentation=-1, int screening=-1, int reason=-1)
Definition: q931.h:54
Q931 & operator=(const Q931 &other)
PARRAY(InternalInformationElement, PBYTEArray)
friend ostream & operator<<(ostream &strm, InformationElementCodes ie)
Definition: q931.h:61
Definition: q931.h:174
Definition: q931.h:247
Definition: q931.h:251
Definition: q931.h:274
Definition: q931.h:172
void BuildSetupAcknowledge(int callRef)
Definition: q931.h:198
Definition: q931.h:119
Definition: q931.h:117
Definition: q931.h:259
Definition: q931.h:275
CallStates
Definition: q931.h:215
Definition: q931.h:253
Definition: q931.h:261
void SetBearerCapabilities(InformationTransferCapability capability, unsigned transferRate, unsigned codingStandard=0, unsigned userInfoLayer1=5)
Definition: q931.h:111
PBoolean GetChannelIdentification(unsigned *interfaceType=NULL, unsigned *preferredOrExclusive=NULL, int *channelNumber=NULL) const
PString GetKeypad() const
Definition: q931.h:189
Definition: q931.h:65
Definition: q931.h:167
Definition: q931.h:59
void SetCallingPartyNumber(const PString &number, unsigned plan=1, unsigned type=0, int presentation=-1, int screening=-1)
InternalInformationElements informationElements
Definition: q931.h:414
Definition: q931.h:183
Definition: q931.h:185
Definition: q931.h:67
void BuildReleaseComplete(int callRef, PBoolean fromDest)
Definition: q931.h:297
void SetSignalInfo(SignalInfo value)
Definition: q931.h:122
Definition: q931.h:110
Definition: q931.h:62
Definition: q931.h:303
unsigned callReference
Definition: q931.h:407
Definition: q931.h:177
Definition: q931.h:221
Definition: q931.h:173
Definition: q931.h:52
CauseValues GetCause(unsigned *standard=NULL, unsigned *location=NULL) const
InformationElementCodes
Definition: q931.h:108
Definition: q931.h:220
void BuildConnect(int callRef)
Definition: q931.h:307
Definition: q931.h:190
void BuildInformation(int callRef, PBoolean fromDest)
PBoolean GetProgressIndicator(unsigned &description, unsigned *codingStandard=NULL, unsigned *location=NULL) const
PBoolean GetBearerCapabilities(InformationTransferCapability &capability, unsigned &transferRate, unsigned *codingStandard=NULL, unsigned *userInfoLayer1=NULL) const
Definition: q931.h:116
Definition: q931.h:258
Definition: q931.h:118
Definition: q931.h:257
Definition: q931.h:184
SignalInfo
Definition: q931.h:242
Definition: q931.h:192
Definition: q931.h:300
Definition: q931.h:199
Definition: q931.h:260
Definition: q931.h:109
PBoolean Decode(const PBYTEArray &data)
MsgTypes messageType
Definition: q931.h:410
PBoolean fromDestination
Definition: q931.h:408
CallStates GetCallState(unsigned *standard=NULL) const
Definition: q931.h:140
Definition: q931.h:49
void SetDisplayName(const PString &name)
void SetConnectedNumber(const PString &number, unsigned plan=1, unsigned type=0, int presentation=-1, int screening=-1, int reason=-1)
PBoolean HasIE(InformationElementCodes ie) const
PBoolean IsFromDestination() const
Definition: q931.h:105
PString GetDisplayName() const
Definition: q931.h:230
unsigned GetCallReference() const
Definition: q931.h:104
static unsigned GenerateCallReference()
Definition: q931.h:196
Definition: q931.h:71
Definition: q931.h:254
void SetKeypad(const PString &digits)
#define FALSE
Definition: lidplugin.h:64
PString GetCallingPartyNumber() const
Definition: q931.h:302
Definition: q931.h:252
TypeOfNumberCodes
Definition: q931.h:306
Definition: q931.h:201
Definition: q931.h:186
Definition: q931.h:70
void SetCalledPartyNumber(const PString &number, unsigned plan=1, unsigned type=0)
Definition: q931.h:232
void BuildCallProceeding(int callRef)
Definition: q931.h:53
Definition: q931.h:262
void SetCallState(CallStates value, unsigned standard=0)
void BuildAlerting(int callRef)
Definition: q931.h:223
void PrintOn(ostream &strm) const
void SetIE(InformationElementCodes ie, const PBYTEArray &userData, bool append=FALSE)
Definition: q931.h:308
Definition: q931.h:178
void BuildFacility(int callRef, PBoolean fromDest)
ProgressIndication
Definition: q931.h:271
Definition: q931.h:144
Definition: q931.h:175
Definition: q931.h:310
Definition: q931.h:113
Definition: q931.h:68
Definition: q931.h:249
void SetChannelIdentification(unsigned interfaceType=0, unsigned preferredOrExclusive=0, int channelNumber=1)
Definition: q931.h:50
Definition: q931.h:176
MsgTypes GetMessageType() const
Definition: q931.h:106
Definition: q931.h:231
Definition: q931.h:139
Definition: q931.h:58
Definition: q931.h:309
Definition: q931.h:313
Definition: q931.h:51
Definition: q931.h:194
Definition: q931.h:256
Definition: q931.h:218
PString GetMessageTypeName() const
Definition: q931.h:57
MsgTypes
Definition: q931.h:44
Definition: q931.h:245
Definition: q931.h:120
Definition: q931.h:299
void BuildStatus(int callRef, PBoolean fromDest)
Definition: q931.h:263
PBYTEArray GetIE(InformationElementCodes ie, PINDEX idx=0) const
Definition: q931.h:277
Definition: q931.h:141
Definition: q931.h:250
void SetProgressIndicator(unsigned description, unsigned codingStandard=0, unsigned location=0)
Definition: q931.h:244