OPAL  Version 3.10.10
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 {
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 
CauseValues
Definition: q931.h:168
Definition: q931.h:183
Definition: q931.h:50
void BuildSetup(int callRef=-1)
Definition: q931.h:70
Definition: q931.h:59
Definition: q931.h:229
Definition: q931.h:118
Definition: q931.h:173
void RemoveIE(InformationElementCodes ie)
Definition: q931.h:116
Definition: q931.h:204
PDICTIONARY(InternalInformationElements, POrdinalKey, InternalInformationElement)
Definition: q931.h:170
void BuildNotify(int callRef, PBoolean fromDest)
Definition: q931.h:52
InformationTransferCapability
Definition: q931.h:142
Definition: q931.h:252
Definition: q931.h:226
Definition: q931.h:280
Definition: q931.h:259
Definition: q931.h:67
Definition: q931.h:192
Definition: q931.h:220
void BuildStatusEnquiry(int callRef, PBoolean fromDest)
PBoolean GetBearerCapabilities(InformationTransferCapability &capability, unsigned &transferRate, unsigned *codingStandard=NULL, unsigned *userInfoLayer1=NULL)
Definition: q931.h:186
PBoolean Encode(PBYTEArray &data) const
Definition: q931.h:125
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:247
Definition: q931.h:119
Definition: q931.h:172
Definition: q931.h:221
Definition: q931.h:232
Definition: q931.h:146
Definition: q931.h:185
Definition: q931.h:64
Definition: q931.h:68
void BuildProgress(int callRef, PBoolean fromDest, unsigned description, unsigned codingStandard=0, unsigned location=0)
Definition: q931.h:230
SignalInfo GetSignalInfo() const
Definition: q931.h:233
Definition: q931.h:191
Definition: q931.h:184
void SetCause(CauseValues value, unsigned standard=0, unsigned location=0)
Definition: q931.h:315
Definition: q931.h:305
Definition: q931.h:169
Definition: q931.h:302
Definition: q931.h:175
Definition: q931.h:60
Definition: q931.h:316
Definition: q931.h:51
Definition: q931.h:174
Definition: q931.h:44
NumberingPlanCodes
Definition: q931.h:300
Definition: q931.h:197
Definition: q931.h:276
PBoolean GetCallingPartyNumber(PString &number, unsigned *plan=NULL, unsigned *type=NULL, unsigned *presentation=NULL, unsigned *screening=NULL, unsigned defPresentation=0, unsigned defScreening=0) const
Definition: q931.h:73
Definition: q931.h:49
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:411
void SetRedirectingNumber(const PString &number, unsigned plan=1, unsigned type=0, int presentation=-1, int screening=-1, int reason=-1)
Definition: q931.h:58
Q931 & operator=(const Q931 &other)
PBoolean GetCalledPartyNumber(PString &number, unsigned *plan=NULL, unsigned *type=NULL) const
PARRAY(InternalInformationElement, PBYTEArray)
friend ostream & operator<<(ostream &strm, InformationElementCodes ie)
Definition: q931.h:65
Definition: q931.h:178
Definition: q931.h:251
Definition: q931.h:255
Definition: q931.h:278
Definition: q931.h:176
void BuildSetupAcknowledge(int callRef)
Definition: q931.h:202
Definition: q931.h:123
Definition: q931.h:121
Definition: q931.h:263
Definition: q931.h:279
CallStates
Definition: q931.h:219
Definition: q931.h:257
Definition: q931.h:265
void SetBearerCapabilities(InformationTransferCapability capability, unsigned transferRate, unsigned codingStandard=0, unsigned userInfoLayer1=5)
Definition: q931.h:115
PBoolean GetChannelIdentification(unsigned *interfaceType=NULL, unsigned *preferredOrExclusive=NULL, int *channelNumber=NULL) const
PString GetKeypad() const
Definition: q931.h:193
Definition: q931.h:69
Definition: q931.h:171
Definition: q931.h:63
void SetCallingPartyNumber(const PString &number, unsigned plan=1, unsigned type=0, int presentation=-1, int screening=-1)
InternalInformationElements informationElements
Definition: q931.h:416
Definition: q931.h:187
Definition: q931.h:189
Definition: q931.h:71
void BuildReleaseComplete(int callRef, PBoolean fromDest)
Definition: q931.h:301
void SetSignalInfo(SignalInfo value)
Definition: q931.h:126
Definition: q931.h:114
Definition: q931.h:66
Definition: q931.h:307
unsigned callReference
Definition: q931.h:409
Definition: q931.h:181
Definition: q931.h:225
Definition: q931.h:177
Definition: q931.h:56
CauseValues GetCause(unsigned *standard=NULL, unsigned *location=NULL) const
InformationElementCodes
Definition: q931.h:112
Definition: q931.h:224
void BuildConnect(int callRef)
Definition: q931.h:311
Definition: q931.h:194
void BuildInformation(int callRef, PBoolean fromDest)
PBoolean GetProgressIndicator(unsigned &description, unsigned *codingStandard=NULL, unsigned *location=NULL) const
Definition: q931.h:120
Definition: q931.h:262
Definition: q931.h:122
Definition: q931.h:261
Definition: q931.h:188
SignalInfo
Definition: q931.h:246
Definition: q931.h:196
Definition: q931.h:304
Definition: q931.h:203
Definition: q931.h:264
Definition: q931.h:113
PBoolean Decode(const PBYTEArray &data)
MsgTypes messageType
Definition: q931.h:412
PBoolean fromDestination
Definition: q931.h:410
CallStates GetCallState(unsigned *standard=NULL) const
Definition: q931.h:144
Definition: q931.h:53
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:109
PString GetDisplayName() const
Definition: q931.h:234
unsigned GetCallReference() const
Definition: q931.h:108
static unsigned GenerateCallReference()
Definition: q931.h:200
Definition: q931.h:75
Definition: q931.h:258
void SetKeypad(const PString &digits)
#define FALSE
Definition: lidplugin.h:68
Definition: q931.h:306
Definition: q931.h:256
TypeOfNumberCodes
Definition: q931.h:310
Definition: q931.h:205
Definition: q931.h:190
Definition: q931.h:74
void SetCalledPartyNumber(const PString &number, unsigned plan=1, unsigned type=0)
Definition: q931.h:236
void BuildCallProceeding(int callRef)
Definition: q931.h:57
Definition: q931.h:266
void SetCallState(CallStates value, unsigned standard=0)
void BuildAlerting(int callRef)
Definition: q931.h:227
void PrintOn(ostream &strm) const
void SetIE(InformationElementCodes ie, const PBYTEArray &userData, bool append=FALSE)
Definition: q931.h:312
Definition: q931.h:182
void BuildFacility(int callRef, PBoolean fromDest)
ProgressIndication
Definition: q931.h:275
Definition: q931.h:148
Definition: q931.h:179
Definition: q931.h:314
Definition: q931.h:117
Definition: q931.h:72
Definition: q931.h:253
void SetChannelIdentification(unsigned interfaceType=0, unsigned preferredOrExclusive=0, int channelNumber=1)
Definition: q931.h:54
Definition: q931.h:180
MsgTypes GetMessageType() const
Definition: q931.h:110
Definition: q931.h:235
Definition: q931.h:143
Definition: q931.h:62
Definition: q931.h:313
Definition: q931.h:317
Definition: q931.h:55
Definition: q931.h:198
Definition: q931.h:260
Definition: q931.h:222
PString GetMessageTypeName() const
Definition: q931.h:61
MsgTypes
Definition: q931.h:48
Definition: q931.h:249
Definition: q931.h:124
Definition: q931.h:303
void BuildStatus(int callRef, PBoolean fromDest)
Definition: q931.h:267
PBYTEArray GetIE(InformationElementCodes ie, PINDEX idx=0) const
Definition: q931.h:281
Definition: q931.h:145
Definition: q931.h:254
void SetProgressIndicator(unsigned description, unsigned codingStandard=0, unsigned location=0)
Definition: q931.h:248