Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

q931.h

Go to the documentation of this file.
00001 /* 00002 * q931.h 00003 * 00004 * Q.931 protocol handler 00005 * 00006 * Open H323 Library 00007 * 00008 * Copyright (c) 1998-2000 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Open H323 Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Contributor(s): ______________________________________. 00025 * 00026 * $Log: q931.h,v $ 00027 * Revision 1.53 2004/07/11 11:37:28 rjongbloed 00028 * Added ConnectAck support and fixed bugs in ChannelIdentificationIE, thanks Eize Slange 00029 * 00030 * Revision 1.52 2003/03/18 05:54:14 robertj 00031 * Added ChannelIdentifier IE support, thanks Eize Slange 00032 * 00033 * Revision 1.51 2003/02/12 00:02:06 robertj 00034 * Added more Q.931 cause codes. 00035 * Added ability to trace text version of cause codes and IE codes. 00036 * 00037 * Revision 1.50 2002/11/25 22:40:00 robertj 00038 * Added another Q.850 code 00039 * 00040 * Revision 1.49 2002/11/07 03:49:49 robertj 00041 * Added extra "congested" Q.931 codes. 00042 * 00043 * Revision 1.48 2002/09/16 01:14:15 robertj 00044 * Added #define so can select if #pragma interface/implementation is used on 00045 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00046 * 00047 * Revision 1.47 2002/09/03 05:42:27 robertj 00048 * Normalised the multi-include header prevention ifdef/define symbol. 00049 * Removed redundent includes. 00050 * 00051 * Revision 1.46 2002/08/05 10:03:47 robertj 00052 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00053 * 00054 * Revision 1.45 2002/07/05 03:13:35 robertj 00055 * Added copy constructor for Q.931 so makes duplicate instead of reference to IE's. 00056 * 00057 * Revision 1.44 2002/05/22 23:12:01 robertj 00058 * Enhanced the display of Release-Complete cause codes. 00059 * 00060 * Revision 1.43 2002/05/03 05:38:16 robertj 00061 * Added Q.931 Keypad IE mechanism for user indications (DTMF). 00062 * 00063 * Revision 1.42 2002/04/22 08:03:41 craigs 00064 * Added Q931 progress codes 00065 * 00066 * Revision 1.41 2002/04/22 07:33:02 craigs 00067 * Changed GetProgressIndicator to be const 00068 * Fixed spelling mistake in SignalType enums list 00069 * 00070 * Revision 1.40 2002/04/18 09:35:00 robertj 00071 * Added CallState IE processing. 00072 * 00073 * Revision 1.39 2002/03/27 06:04:42 robertj 00074 * Added Temporary Failure end code for connection, an application may 00075 * immediately retry the call if this occurs. 00076 * 00077 * Revision 1.38 2002/02/08 00:05:14 robertj 00078 * Changed release complete causes so can dsitinguish between unknown 00079 * cause and no cause at all. 00080 * 00081 * Revision 1.37 2002/01/07 04:25:41 robertj 00082 * Added support for Connected-Number Information Element, thanks Hans Verbeek 00083 * 00084 * Revision 1.36 2001/09/17 02:06:38 robertj 00085 * Added Redirecting Number IE to Q.931, thanks Frank Derks 00086 * 00087 * Revision 1.35 2001/09/13 02:41:32 robertj 00088 * Fixed call reference generation to use full range and common code, thanks Carlo Kielstra 00089 * 00090 * Revision 1.34 2001/09/12 02:01:33 robertj 00091 * Added "No Circuit" release complete code. 00092 * 00093 * Revision 1.33 2001/08/20 06:48:26 robertj 00094 * Added Q.931 function for setting bearer capabilities, allowing 00095 * applications to set the data rate as they require. 00096 * 00097 * Revision 1.32 2001/08/03 14:12:07 robertj 00098 * Fixed value for Call State Information Element 00099 * 00100 * Revision 1.31 2001/07/24 23:40:15 craigs 00101 * Added ability to remove Q931 IE 00102 * 00103 * Revision 1.30 2001/06/14 06:25:13 robertj 00104 * Added further H.225 PDU build functions. 00105 * Moved some functionality from connection to PDU class. 00106 * 00107 * Revision 1.29 2001/05/30 04:38:38 robertj 00108 * Added BuildStatusEnquiry() Q.931 function, thanks Markus Storm 00109 * 00110 * Revision 1.28 2001/04/11 00:12:38 robertj 00111 * Added some enums for numbering plans and call types, thanks Markus Storm. 00112 * 00113 * Revision 1.27 2001/02/09 05:16:24 robertj 00114 * Added #pragma interface for GNU C++. 00115 * 00116 * Revision 1.26 2001/01/19 07:01:42 robertj 00117 * Added all of the Q.931 message type codes. 00118 * 00119 * Revision 1.25 2000/10/13 02:15:23 robertj 00120 * Added support for Progress Indicator Q.931/H.225 message. 00121 * 00122 * Revision 1.24 2000/07/09 14:53:17 robertj 00123 * Added facility IE to facility message. 00124 * Changed reference to the word "field" to be more correct IE or "Information Element" 00125 * 00126 * Revision 1.23 2000/06/21 08:07:39 robertj 00127 * Added cause/reason to release complete PDU, where relevent. 00128 * 00129 * Revision 1.22 2000/05/18 11:53:34 robertj 00130 * Changes to support doc++ documentation generation. 00131 * 00132 * Revision 1.21 2000/05/09 12:19:23 robertj 00133 * Added ability to get and set "distinctive ring" Q.931 functionality. 00134 * 00135 * Revision 1.20 2000/05/08 14:07:26 robertj 00136 * Improved the provision and detection of calling and caller numbers, aliases and hostnames. 00137 * 00138 * Revision 1.19 2000/05/06 02:17:49 robertj 00139 * Changed the new CallingPartyNumber code so defaults for octet3a are application dependent. 00140 * 00141 * Revision 1.18 2000/05/05 00:44:05 robertj 00142 * Added presentation and screening fields to Calling Party Number field, thanks Dean Anderson. 00143 * 00144 * Revision 1.17 2000/05/02 04:32:25 robertj 00145 * Fixed copyright notice comment. 00146 * 00147 * Revision 1.16 2000/03/21 01:07:21 robertj 00148 * Fixed incorrect call reference code being used in originated call. 00149 * 00150 * Revision 1.15 1999/12/23 22:43:36 robertj 00151 * Added calling party number field. 00152 * 00153 * Revision 1.14 1999/09/10 03:36:48 robertj 00154 * Added simple Q.931 Status response to Q.931 Status Enquiry 00155 * 00156 * Revision 1.13 1999/08/31 12:34:18 robertj 00157 * Added gatekeeper support. 00158 * 00159 * Revision 1.12 1999/08/13 06:34:38 robertj 00160 * Fixed problem in CallPartyNumber Q.931 encoding. 00161 * Added field name display to Q.931 protocol. 00162 * 00163 * Revision 1.11 1999/08/10 13:14:15 robertj 00164 * Added Q.931 Called Number field if have "phone number" style destination addres. 00165 * 00166 * Revision 1.10 1999/07/23 02:36:56 robertj 00167 * Finally found correct value for FACILITY message. 00168 * 00169 * Revision 1.9 1999/07/16 02:15:30 robertj 00170 * Fixed more tunneling problems. 00171 * 00172 * Revision 1.8 1999/07/09 06:09:49 robertj 00173 * Major implementation. An ENORMOUS amount of stuff added everywhere. 00174 * 00175 * Revision 1.7 1999/06/13 12:41:14 robertj 00176 * Implement logical channel transmitter. 00177 * Fixed H245 connect on receiving call. 00178 * 00179 * Revision 1.6 1999/06/09 05:26:20 robertj 00180 * Major restructuring of classes. 00181 * 00182 * Revision 1.5 1999/02/23 11:04:29 robertj 00183 * Added capability to make outgoing call. 00184 * 00185 * Revision 1.4 1999/01/16 11:31:46 robertj 00186 * Fixed name in header comment. 00187 * 00188 * Revision 1.3 1999/01/16 01:31:39 robertj 00189 * Major implementation. 00190 * 00191 * Revision 1.2 1999/01/02 04:00:55 robertj 00192 * Added higher level protocol negotiations. 00193 * 00194 * Revision 1.1 1998/12/14 09:13:41 robertj 00195 * Initial revision 00196 * 00197 */ 00198 00199 #ifndef __OPAL_Q931_H 00200 #define __OPAL_Q931_H 00201 00202 #ifdef P_USE_PRAGMA 00203 #pragma interface 00204 #endif 00205 00206 00208 00211 class Q931 : public PObject 00212 { 00213 PCLASSINFO(Q931, PObject) 00214 public: 00215 enum MsgTypes { 00216 NationalEscapeMsg = 0x00, 00217 AlertingMsg = 0x01, 00218 CallProceedingMsg = 0x02, 00219 ConnectMsg = 0x07, 00220 ConnectAckMsg = 0x0f, 00221 ProgressMsg = 0x03, 00222 SetupMsg = 0x05, 00223 SetupAckMsg = 0x0d, 00224 ResumeMsg = 0x26, 00225 ResumeAckMsg = 0x2e, 00226 ResumeRejectMsg = 0x22, 00227 SuspendMsg = 0x25, 00228 SuspendAckMsg = 0x2d, 00229 SuspendRejectMsg = 0x21, 00230 UserInformationMsg = 0x20, 00231 DisconnectMsg = 0x45, 00232 ReleaseMsg = 0x4d, 00233 ReleaseCompleteMsg = 0x5a, 00234 RestartMsg = 0x46, 00235 RestartAckMsg = 0x4e, 00236 SegmentMsg = 0x60, 00237 CongestionCtrlMsg = 0x79, 00238 InformationMsg = 0x7b, 00239 NotifyMsg = 0x6e, 00240 StatusMsg = 0x7d, 00241 StatusEnquiryMsg = 0x75, 00242 FacilityMsg = 0x62 00243 }; 00244 00245 Q931(); 00246 Q931(const Q931 & other); 00247 Q931 & operator=(const Q931 & other); 00248 00249 void BuildFacility(int callRef, BOOL fromDest); 00250 void BuildInformation(int callRef, BOOL fromDest); 00251 void BuildProgress( 00252 int callRef, 00253 BOOL fromDest, 00254 unsigned description, 00255 unsigned codingStandard = 0, 00256 unsigned location = 0 00257 ); 00258 void BuildNotify(int callRef, BOOL fromDest); 00259 void BuildCallProceeding(int callRef); 00260 void BuildSetupAcknowledge(int callRef); 00261 void BuildAlerting(int callRef); 00262 void BuildSetup(int callRef = -1); 00263 void BuildConnect(int callRef); 00264 void BuildConnectAck(int callRef, BOOL fromDest); 00265 void BuildStatus(int callRef, BOOL fromDest); 00266 void BuildStatusEnquiry(int callRef, BOOL fromDest); 00267 void BuildReleaseComplete(int callRef, BOOL fromDest); 00268 00269 BOOL Decode(const PBYTEArray & data); 00270 BOOL Encode(PBYTEArray & data) const; 00271 00272 void PrintOn(ostream & strm) const; 00273 PString GetMessageTypeName() const; 00274 00275 static unsigned GenerateCallReference(); 00276 unsigned GetCallReference() const { return callReference; } 00277 BOOL IsFromDestination() const { return fromDestination; } 00278 MsgTypes GetMessageType() const { return messageType; } 00279 00280 enum InformationElementCodes { 00281 BearerCapabilityIE = 0x04, 00282 CauseIE = 0x08, 00283 ChannelIdentificationIE = 0x18, 00284 FacilityIE = 0x1c, 00285 ProgressIndicatorIE = 0x1e, 00286 CallStateIE = 0x14, 00287 DisplayIE = 0x28, 00288 KeypadIE = 0x2c, 00289 SignalIE = 0x34, 00290 ConnectedNumberIE = 0x4c, 00291 CallingPartyNumberIE = 0x6c, 00292 CalledPartyNumberIE = 0x70, 00293 RedirectingNumberIE = 0x74, 00294 UserUserIE = 0x7e 00295 }; 00296 friend ostream & operator<<(ostream & strm, InformationElementCodes ie); 00297 00298 BOOL HasIE(InformationElementCodes ie) const; 00299 PBYTEArray GetIE(InformationElementCodes ie) const; 00300 void SetIE(InformationElementCodes ie, const PBYTEArray & userData); 00301 void RemoveIE(InformationElementCodes ie); 00302 00303 enum InformationTransferCapability { 00304 TransferSpeech, 00305 TransferUnrestrictedDigital = 8, 00306 TransferRestrictedDigital = 9, 00307 Transfer3_1kHzAudio = 16, 00308 TrasnferUnrestrictedDigitalWithTones = 17, 00309 TransferVideo = 24 00310 }; 00311 00312 void SetBearerCapabilities( 00313 InformationTransferCapability capability, 00314 unsigned transferRate, // Number of 64k B channels 00315 unsigned codingStandard = 0, // 0 = ITU-T standardized coding 00316 unsigned userInfoLayer1 = 5 // 5 = Recommendations H.221 and H.242 00317 ); 00318 00319 BOOL GetBearerCapabilities( 00320 InformationTransferCapability & capability, 00321 unsigned & transferRate, // Number of 64k B channels 00322 unsigned * codingStandard = NULL, 00323 unsigned * userInfoLayer1 = NULL 00324 ); 00325 00326 enum CauseValues { 00327 UnknownCauseIE = 0, 00328 UnallocatedNumber = 1, 00329 NoRouteToNetwork = 2, 00330 NoRouteToDestination = 3, 00331 SendSpecialTone = 4, 00332 MisdialledTrunkPrefix = 5, 00333 ChannelUnacceptable = 6, 00334 NormalCallClearing = 16, 00335 UserBusy = 17, 00336 NoResponse = 18, 00337 NoAnswer = 19, 00338 SubscriberAbsent = 20, 00339 CallRejected = 21, 00340 NumberChanged = 22, 00341 Redirection = 23, 00342 ExchangeRoutingError = 25, 00343 NonSelectedUserClearing = 26, 00344 DestinationOutOfOrder = 27, 00345 InvalidNumberFormat = 28, 00346 FacilityRejected = 29, 00347 StatusEnquiryResponse = 30, 00348 NormalUnspecified = 31, 00349 NoCircuitChannelAvailable = 34, 00350 NetworkOutOfOrder = 38, 00351 TemporaryFailure = 41, 00352 Congestion = 42, 00353 RequestedCircuitNotAvailable = 44, 00354 ResourceUnavailable = 47, 00355 ServiceOptionNotAvailable = 63, 00356 InvalidCallReference = 81, 00357 ClearedRequestedCallIdentity = 86, 00358 IncompatibleDestination = 88, 00359 IENonExistantOrNotImplemented= 99, 00360 TimerExpiry = 102, 00361 ProtocolErrorUnspecified = 111, 00362 InterworkingUnspecified = 127, 00363 ErrorInCauseIE = 0x100 00364 }; 00365 friend ostream & operator<<(ostream & strm, CauseValues cause); 00366 00367 void SetCause( 00368 CauseValues value, 00369 unsigned standard = 0, // 0 = ITU-T standardized coding 00370 unsigned location = 0 // 0 = User 00371 ); 00372 CauseValues GetCause( 00373 unsigned * standard = NULL, // 0 = ITU-T standardized coding 00374 unsigned * location = NULL // 0 = User 00375 ) const; 00376 00377 enum CallStates { 00378 CallState_Null = 0, 00379 CallState_CallInitiated = 1, 00380 CallState_OverlapSending = 2, 00381 CallState_OutgoingCallProceeding= 3, 00382 CallState_CallDelivered = 4, 00383 CallState_CallPresent = 6, 00384 CallState_CallReceived = 7, 00385 CallState_ConnectRequest = 8, 00386 CallState_IncomingCallProceeding= 9, 00387 CallState_Active = 10, 00388 CallState_DisconnectRequest = 11, 00389 CallState_DisconnectIndication = 12, 00390 CallState_SuspendRequest = 15, 00391 CallState_ResumeRequest = 17, 00392 CallState_ReleaseRequest = 19, 00393 CallState_OverlapReceiving = 25, 00394 CallState_ErrorInIE = 0x100 00395 }; 00396 void SetCallState( 00397 CallStates value, 00398 unsigned standard = 0 // 0 = ITU-T standardized coding 00399 ); 00400 CallStates GetCallState( 00401 unsigned * standard = NULL // 0 = ITU-T standardized coding 00402 ) const; 00403 00404 enum SignalInfo { 00405 SignalDialToneOn, 00406 SignalRingBackToneOn, 00407 SignalInterceptToneOn, 00408 SignalNetworkCongestionToneOn, 00409 SignalBusyToneOn, 00410 SignalConfirmToneOn, 00411 SignalAnswerToneOn, 00412 SignalCallWaitingTone, 00413 SignalOffhookWarningTone, 00414 SignalPreemptionToneOn, 00415 SignalTonesOff = 0x3f, 00416 SignalAlertingPattern0 = 0x40, 00417 SignalAlertingPattern1, 00418 SignalAlertingPattern2, 00419 SignalAlertingPattern3, 00420 SignalAlertingPattern4, 00421 SignalAlertingPattern5, 00422 SignalAlertingPattern6, 00423 SignalAlertingPattern7, 00424 SignalAlertingOff = 0x4f, 00425 SignalErrorInIE = 0x100 00426 }; 00427 void SetSignalInfo(SignalInfo value); 00428 SignalInfo GetSignalInfo() const; 00429 00430 void SetKeypad(const PString & digits); 00431 PString GetKeypad() const; 00432 00433 enum ProgressIndication { 00434 ProgressNotEndToEndISDN = 1, // Call is not end-to-end ISDN; 00435 // further call progress information may be available in-band 00436 ProgressDestinationNonISDN = 2, // Destination address is non ISDN 00437 ProgressOriginNotISDN = 3, // Origination address is non ISDN 00438 ProgressReturnedToISDN = 4, // Call has returned to the ISDN 00439 ProgressServiceChange = 5, // Interworking has occurred and has 00440 // resulted in a telecommunication service change 00441 ProgressInbandInformationAvailable = 8 // In-band information or an appropriate pattern is now available. 00442 }; 00443 00444 void SetProgressIndicator( 00445 unsigned description, 00446 unsigned codingStandard = 0, 00447 unsigned location = 0 00448 ); 00449 BOOL GetProgressIndicator( 00450 unsigned & description, 00451 unsigned * codingStandard = NULL, 00452 unsigned * location = NULL 00453 ) const; 00454 00455 void SetDisplayName(const PString & name); 00456 PString GetDisplayName() const; 00457 00458 enum NumberingPlanCodes { 00459 UnknownPlan = 0x00, 00460 ISDNPlan = 0x01, 00461 DataPlan = 0x03, 00462 TelexPlan = 0x04, 00463 NationalStandardPlan = 0x08, 00464 PrivatePlan = 0x09, 00465 ReservedPlan = 0x0f 00466 }; 00467 00468 enum TypeOfNumberCodes { 00469 UnknownType = 0x00, 00470 InternationalType = 0x01, 00471 NationalType = 0x02, 00472 NetworkSpecificType = 0x03, 00473 SubscriberType = 0x04, 00474 AbbreviatedType = 0x06, 00475 ReservedType = 0x07 00476 }; 00477 00478 void SetCallingPartyNumber( 00479 const PString & number, // Number string 00480 unsigned plan = 1, // 1 = ISDN/Telephony numbering system 00481 unsigned type = 0, // 0 = Unknown number type 00482 int presentation = -1, // 0 = presentation allowed, -1 = no octet3a 00483 int screening = -1 // 0 = user provided, not screened 00484 ); 00485 BOOL GetCallingPartyNumber( 00486 PString & number, // Number string 00487 unsigned * plan = NULL, // ISDN/Telephony numbering system 00488 unsigned * type = NULL, // Number type 00489 unsigned * presentation = NULL, // Presentation indicator 00490 unsigned * screening = NULL, // Screening indicator 00491 unsigned defPresentation = 0, // Default value if octet3a not present 00492 unsigned defScreening = 0 // Default value if octet3a not present 00493 ) const; 00494 00495 void SetCalledPartyNumber( 00496 const PString & number, // Number string 00497 unsigned plan = 1, // 1 = ISDN/Telephony numbering system 00498 unsigned type = 0 // 0 = Unknown number type 00499 ); 00500 BOOL GetCalledPartyNumber( 00501 PString & number, // Number string 00502 unsigned * plan = NULL, // ISDN/Telephony numbering system 00503 unsigned * type = NULL // Number type 00504 ) const; 00505 00506 void SetRedirectingNumber( 00507 const PString & number, // Number string 00508 unsigned plan = 1, // 1 = ISDN/Telephony numbering system 00509 unsigned type = 0, // 0 = Unknown number type 00510 int presentation = -1, // 0 = presentation allowed, -1 = no octet3a 00511 int screening = -1, // 0 = user provided, not screened 00512 int reason = -1 // 0 = Unknown reason , -1 = no octet 3b 00513 ); 00514 BOOL GetRedirectingNumber( 00515 PString & number, // Number string 00516 unsigned * plan = NULL, // ISDN/Telephony numbering system 00517 unsigned * type = NULL, // Number type 00518 unsigned * presentation = NULL, // Presentation indicator 00519 unsigned * screening = NULL, // Screening indicator 00520 unsigned * reason = NULL, // Reason for redirection 00521 unsigned defPresentation = 0, // Default value if octet3a not present 00522 unsigned defScreening = 0, // Default value if octet3a not present 00523 unsigned defReason =0 // Default value if octet 3b not present 00524 ) const; 00525 00526 void SetConnectedNumber( 00527 const PString & number, // Number string 00528 unsigned plan = 1, // 1 = ISDN/Telephony numbering system 00529 unsigned type = 0, // 0 = Unknown number type 00530 int presentation = -1, // 0 = presentation allowed, -1 = no octet3a 00531 int screening = -1, // 0 = user provided, not screened 00532 int reason = -1 // 0 = Unknown reason , -1 = no octet 3b 00533 ); 00534 BOOL GetConnectedNumber( 00535 PString & number, // Number string 00536 unsigned * plan = NULL, // ISDN/Telephony numbering system 00537 unsigned * type = NULL, // Number type 00538 unsigned * presentation = NULL, // Presentation indicator 00539 unsigned * screening = NULL, // Screening indicator 00540 unsigned * reason = NULL, // Reason for redirection 00541 unsigned defPresentation = 0, // Default value if octet3a not present 00542 unsigned defScreening = 0, // Default value if octet3a not present 00543 unsigned defReason =0 // Default value if octet 3b not present 00544 ) const; 00545 00552 void SetChannelIdentification( 00553 unsigned interfaceType = 0, // 0 = basic, 1 = other (e.g. primary) 00554 unsigned preferredOrExclusive = 0, // 0 = preferred, 1 = exclusive 00555 int channelNumber = 1 // -1 = any, 0 = none/D, 1 = channel 1/B1, etc. 1-15,17-31 00556 ); 00557 00560 BOOL GetChannelIdentification( 00561 unsigned * interfaceType = NULL, // Interface type 00562 unsigned * preferredOrExclusive = NULL, // Channel negotiation preference 00563 int * channelNumber = NULL // Channel number 00564 ) const; 00565 00566 protected: 00567 unsigned callReference; 00568 BOOL fromDestination; 00569 unsigned protocolDiscriminator; 00570 MsgTypes messageType; 00571 00572 PDICTIONARY(InternalInformationElements, POrdinalKey, PBYTEArray); 00573 InternalInformationElements informationElements; 00574 }; 00575 00576 00577 #endif // __OPAL_Q931_H 00578 00579

Generated on Sat Jul 24 17:03:36 2004 for OpenH323 by doxygen 1.3.7