00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef OPAL_H323_Q931_H
00032 #define OPAL_H323_Q931_H
00033
00034 #ifdef P_USE_PRAGMA
00035 #pragma interface
00036 #endif
00037
00038 #include <opal/buildopts.h>
00039
00041
00044 class Q931 : public PObject
00045 {
00046 PCLASSINFO(Q931, PObject)
00047 public:
00048 enum MsgTypes {
00049 NationalEscapeMsg = 0x00,
00050 AlertingMsg = 0x01,
00051 CallProceedingMsg = 0x02,
00052 ConnectMsg = 0x07,
00053 ConnectAckMsg = 0x0f,
00054 ProgressMsg = 0x03,
00055 SetupMsg = 0x05,
00056 SetupAckMsg = 0x0d,
00057 ResumeMsg = 0x26,
00058 ResumeAckMsg = 0x2e,
00059 ResumeRejectMsg = 0x22,
00060 SuspendMsg = 0x25,
00061 SuspendAckMsg = 0x2d,
00062 SuspendRejectMsg = 0x21,
00063 UserInformationMsg = 0x20,
00064 DisconnectMsg = 0x45,
00065 ReleaseMsg = 0x4d,
00066 ReleaseCompleteMsg = 0x5a,
00067 RestartMsg = 0x46,
00068 RestartAckMsg = 0x4e,
00069 SegmentMsg = 0x60,
00070 CongestionCtrlMsg = 0x79,
00071 InformationMsg = 0x7b,
00072 NotifyMsg = 0x6e,
00073 StatusMsg = 0x7d,
00074 StatusEnquiryMsg = 0x75,
00075 FacilityMsg = 0x62
00076 };
00077
00078 Q931();
00079 Q931(const Q931 & other);
00080 Q931 & operator=(const Q931 & other);
00081
00082 void BuildFacility(int callRef, PBoolean fromDest);
00083 void BuildInformation(int callRef, PBoolean fromDest);
00084 void BuildProgress(
00085 int callRef,
00086 PBoolean fromDest,
00087 unsigned description,
00088 unsigned codingStandard = 0,
00089 unsigned location = 0
00090 );
00091 void BuildNotify(int callRef, PBoolean fromDest);
00092 void BuildCallProceeding(int callRef);
00093 void BuildSetupAcknowledge(int callRef);
00094 void BuildAlerting(int callRef);
00095 void BuildSetup(int callRef = -1);
00096 void BuildConnect(int callRef);
00097 void BuildStatus(int callRef, PBoolean fromDest);
00098 void BuildStatusEnquiry(int callRef, PBoolean fromDest);
00099 void BuildReleaseComplete(int callRef, PBoolean fromDest);
00100
00101 PBoolean Decode(const PBYTEArray & data);
00102 PBoolean Encode(PBYTEArray & data) const;
00103
00104 void PrintOn(ostream & strm) const;
00105 PString GetMessageTypeName() const;
00106
00107 static unsigned GenerateCallReference();
00108 unsigned GetCallReference() const { return callReference; }
00109 PBoolean IsFromDestination() const { return fromDestination; }
00110 MsgTypes GetMessageType() const { return messageType; }
00111
00112 enum InformationElementCodes {
00113 BearerCapabilityIE = 0x04,
00114 CauseIE = 0x08,
00115 ChannelIdentificationIE = 0x18,
00116 FacilityIE = 0x1c,
00117 ProgressIndicatorIE = 0x1e,
00118 CallStateIE = 0x14,
00119 DisplayIE = 0x28,
00120 KeypadIE = 0x2c,
00121 SignalIE = 0x34,
00122 ConnectedNumberIE = 0x4c,
00123 CallingPartyNumberIE = 0x6c,
00124 CalledPartyNumberIE = 0x70,
00125 RedirectingNumberIE = 0x74,
00126 UserUserIE = 0x7e
00127 };
00128 friend ostream & operator<<(ostream & strm, InformationElementCodes ie);
00129
00130 PBoolean HasIE(InformationElementCodes ie) const;
00131 PBYTEArray GetIE(
00132 InformationElementCodes ie,
00133 PINDEX idx = 0
00134 ) const;
00135 void SetIE(
00136 InformationElementCodes ie,
00137 const PBYTEArray & userData,
00138 bool append = FALSE
00139 );
00140 void RemoveIE(InformationElementCodes ie);
00141
00142 enum InformationTransferCapability {
00143 TransferSpeech,
00144 TransferUnrestrictedDigital = 8,
00145 TransferRestrictedDigital = 9,
00146 Transfer3_1kHzAudio = 16,
00147 TrasnferUnrestrictedDigitalWithTones = 17,
00148 TransferVideo = 24
00149 };
00150
00151 void SetBearerCapabilities(
00152 InformationTransferCapability capability,
00153 unsigned transferRate,
00154 unsigned codingStandard = 0,
00155 unsigned userInfoLayer1 = 5
00156 );
00157 void SetBearerCapabilities(
00158 const PString & caps
00159 );
00160
00161 PBoolean GetBearerCapabilities(
00162 InformationTransferCapability & capability,
00163 unsigned & transferRate,
00164 unsigned * codingStandard = NULL,
00165 unsigned * userInfoLayer1 = NULL
00166 );
00167
00168 enum CauseValues {
00169 UnknownCauseIE = 0,
00170 UnallocatedNumber = 1,
00171 NoRouteToNetwork = 2,
00172 NoRouteToDestination = 3,
00173 SendSpecialTone = 4,
00174 MisdialledTrunkPrefix = 5,
00175 ChannelUnacceptable = 6,
00176 NormalCallClearing = 16,
00177 UserBusy = 17,
00178 NoResponse = 18,
00179 NoAnswer = 19,
00180 SubscriberAbsent = 20,
00181 CallRejected = 21,
00182 NumberChanged = 22,
00183 Redirection = 23,
00184 ExchangeRoutingError = 25,
00185 NonSelectedUserClearing = 26,
00186 DestinationOutOfOrder = 27,
00187 InvalidNumberFormat = 28,
00188 FacilityRejected = 29,
00189 StatusEnquiryResponse = 30,
00190 NormalUnspecified = 31,
00191 NoCircuitChannelAvailable = 34,
00192 NetworkOutOfOrder = 38,
00193 TemporaryFailure = 41,
00194 Congestion = 42,
00195 RequestedCircuitNotAvailable = 44,
00196 ResourceUnavailable = 47,
00197 ServiceOptionNotAvailable = 63,
00198 InvalidCallReference = 81,
00199 ClearedRequestedCallIdentity = 86,
00200 IncompatibleDestination = 88,
00201 IENonExistantOrNotImplemented= 99,
00202 TimerExpiry = 102,
00203 ProtocolErrorUnspecified = 111,
00204 InterworkingUnspecified = 127,
00205 ErrorInCauseIE = 0x100
00206 };
00207 friend ostream & operator<<(ostream & strm, CauseValues cause);
00208
00209 void SetCause(
00210 CauseValues value,
00211 unsigned standard = 0,
00212 unsigned location = 0
00213 );
00214 CauseValues GetCause(
00215 unsigned * standard = NULL,
00216 unsigned * location = NULL
00217 ) const;
00218
00219 enum CallStates {
00220 CallState_Null = 0,
00221 CallState_CallInitiated = 1,
00222 CallState_OverlapSending = 2,
00223 CallState_OutgoingCallProceeding= 3,
00224 CallState_CallDelivered = 4,
00225 CallState_CallPresent = 6,
00226 CallState_CallReceived = 7,
00227 CallState_ConnectRequest = 8,
00228 CallState_IncomingCallProceeding= 9,
00229 CallState_Active = 10,
00230 CallState_DisconnectRequest = 11,
00231 CallState_DisconnectIndication = 12,
00232 CallState_SuspendRequest = 15,
00233 CallState_ResumeRequest = 17,
00234 CallState_ReleaseRequest = 19,
00235 CallState_OverlapReceiving = 25,
00236 CallState_ErrorInIE = 0x100
00237 };
00238 void SetCallState(
00239 CallStates value,
00240 unsigned standard = 0
00241 );
00242 CallStates GetCallState(
00243 unsigned * standard = NULL
00244 ) const;
00245
00246 enum SignalInfo {
00247 SignalDialToneOn,
00248 SignalRingBackToneOn,
00249 SignalInterceptToneOn,
00250 SignalNetworkCongestionToneOn,
00251 SignalBusyToneOn,
00252 SignalConfirmToneOn,
00253 SignalAnswerToneOn,
00254 SignalCallWaitingTone,
00255 SignalOffhookWarningTone,
00256 SignalPreemptionToneOn,
00257 SignalTonesOff = 0x3f,
00258 SignalAlertingPattern0 = 0x40,
00259 SignalAlertingPattern1,
00260 SignalAlertingPattern2,
00261 SignalAlertingPattern3,
00262 SignalAlertingPattern4,
00263 SignalAlertingPattern5,
00264 SignalAlertingPattern6,
00265 SignalAlertingPattern7,
00266 SignalAlertingOff = 0x4f,
00267 SignalErrorInIE = 0x100
00268 };
00269 void SetSignalInfo(SignalInfo value);
00270 SignalInfo GetSignalInfo() const;
00271
00272 void SetKeypad(const PString & digits);
00273 PString GetKeypad() const;
00274
00275 enum ProgressIndication {
00276 ProgressNotEndToEndISDN = 1,
00277
00278 ProgressDestinationNonISDN = 2,
00279 ProgressOriginNotISDN = 3,
00280 ProgressReturnedToISDN = 4,
00281 ProgressServiceChange = 5,
00282
00283 ProgressInbandInformationAvailable = 8
00284 };
00285
00286 void SetProgressIndicator(
00287 unsigned description,
00288 unsigned codingStandard = 0,
00289 unsigned location = 0
00290 );
00291 PBoolean GetProgressIndicator(
00292 unsigned & description,
00293 unsigned * codingStandard = NULL,
00294 unsigned * location = NULL
00295 ) const;
00296
00297 void SetDisplayName(const PString & name);
00298 PString GetDisplayName() const;
00299
00300 enum NumberingPlanCodes {
00301 UnknownPlan = 0x00,
00302 ISDNPlan = 0x01,
00303 DataPlan = 0x03,
00304 TelexPlan = 0x04,
00305 NationalStandardPlan = 0x08,
00306 PrivatePlan = 0x09,
00307 ReservedPlan = 0x0f
00308 };
00309
00310 enum TypeOfNumberCodes {
00311 UnknownType = 0x00,
00312 InternationalType = 0x01,
00313 NationalType = 0x02,
00314 NetworkSpecificType = 0x03,
00315 SubscriberType = 0x04,
00316 AbbreviatedType = 0x06,
00317 ReservedType = 0x07
00318 };
00319
00320 void SetCallingPartyNumber(
00321 const PString & number,
00322 unsigned plan = 1,
00323 unsigned type = 0,
00324 int presentation = -1,
00325 int screening = -1
00326 );
00327 PBoolean GetCallingPartyNumber(
00328 PString & number,
00329 unsigned * plan = NULL,
00330 unsigned * type = NULL,
00331 unsigned * presentation = NULL,
00332 unsigned * screening = NULL,
00333 unsigned defPresentation = 0,
00334 unsigned defScreening = 0
00335 ) const;
00336
00337 void SetCalledPartyNumber(
00338 const PString & number,
00339 unsigned plan = 1,
00340 unsigned type = 0
00341 );
00342 PBoolean GetCalledPartyNumber(
00343 PString & number,
00344 unsigned * plan = NULL,
00345 unsigned * type = NULL
00346 ) const;
00347
00348 void SetRedirectingNumber(
00349 const PString & number,
00350 unsigned plan = 1,
00351 unsigned type = 0,
00352 int presentation = -1,
00353 int screening = -1,
00354 int reason = -1
00355 );
00356 PBoolean GetRedirectingNumber(
00357 PString & number,
00358 unsigned * plan = NULL,
00359 unsigned * type = NULL,
00360 unsigned * presentation = NULL,
00361 unsigned * screening = NULL,
00362 unsigned * reason = NULL,
00363 unsigned defPresentation = 0,
00364 unsigned defScreening = 0,
00365 unsigned defReason =0
00366 ) const;
00367
00368 void SetConnectedNumber(
00369 const PString & number,
00370 unsigned plan = 1,
00371 unsigned type = 0,
00372 int presentation = -1,
00373 int screening = -1,
00374 int reason = -1
00375 );
00376 PBoolean GetConnectedNumber(
00377 PString & number,
00378 unsigned * plan = NULL,
00379 unsigned * type = NULL,
00380 unsigned * presentation = NULL,
00381 unsigned * screening = NULL,
00382 unsigned * reason = NULL,
00383 unsigned defPresentation = 0,
00384 unsigned defScreening = 0,
00385 unsigned defReason =0
00386 ) const;
00387
00394 void SetChannelIdentification(
00395 unsigned interfaceType = 0,
00396 unsigned preferredOrExclusive = 0,
00397 int channelNumber = 1
00398 );
00399
00402 PBoolean GetChannelIdentification(
00403 unsigned * interfaceType = NULL,
00404 unsigned * preferredOrExclusive = NULL,
00405 int * channelNumber = NULL
00406 ) const;
00407
00408 protected:
00409 unsigned callReference;
00410 PBoolean fromDestination;
00411 unsigned protocolDiscriminator;
00412 MsgTypes messageType;
00413
00414 PARRAY(InternalInformationElement, PBYTEArray);
00415 PDICTIONARY(InternalInformationElements, POrdinalKey, InternalInformationElement);
00416 InternalInformationElements informationElements;
00417 };
00418
00419
00420 #endif // OPAL_H323_Q931_H
00421
00422