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
00158 PBoolean GetBearerCapabilities(
00159 InformationTransferCapability & capability,
00160 unsigned & transferRate,
00161 unsigned * codingStandard = NULL,
00162 unsigned * userInfoLayer1 = NULL
00163 );
00164
00165 enum CauseValues {
00166 UnknownCauseIE = 0,
00167 UnallocatedNumber = 1,
00168 NoRouteToNetwork = 2,
00169 NoRouteToDestination = 3,
00170 SendSpecialTone = 4,
00171 MisdialledTrunkPrefix = 5,
00172 ChannelUnacceptable = 6,
00173 NormalCallClearing = 16,
00174 UserBusy = 17,
00175 NoResponse = 18,
00176 NoAnswer = 19,
00177 SubscriberAbsent = 20,
00178 CallRejected = 21,
00179 NumberChanged = 22,
00180 Redirection = 23,
00181 ExchangeRoutingError = 25,
00182 NonSelectedUserClearing = 26,
00183 DestinationOutOfOrder = 27,
00184 InvalidNumberFormat = 28,
00185 FacilityRejected = 29,
00186 StatusEnquiryResponse = 30,
00187 NormalUnspecified = 31,
00188 NoCircuitChannelAvailable = 34,
00189 NetworkOutOfOrder = 38,
00190 TemporaryFailure = 41,
00191 Congestion = 42,
00192 RequestedCircuitNotAvailable = 44,
00193 ResourceUnavailable = 47,
00194 ServiceOptionNotAvailable = 63,
00195 InvalidCallReference = 81,
00196 ClearedRequestedCallIdentity = 86,
00197 IncompatibleDestination = 88,
00198 IENonExistantOrNotImplemented= 99,
00199 TimerExpiry = 102,
00200 ProtocolErrorUnspecified = 111,
00201 InterworkingUnspecified = 127,
00202 ErrorInCauseIE = 0x100
00203 };
00204 friend ostream & operator<<(ostream & strm, CauseValues cause);
00205
00206 void SetCause(
00207 CauseValues value,
00208 unsigned standard = 0,
00209 unsigned location = 0
00210 );
00211 CauseValues GetCause(
00212 unsigned * standard = NULL,
00213 unsigned * location = NULL
00214 ) const;
00215
00216 enum CallStates {
00217 CallState_Null = 0,
00218 CallState_CallInitiated = 1,
00219 CallState_OverlapSending = 2,
00220 CallState_OutgoingCallProceeding= 3,
00221 CallState_CallDelivered = 4,
00222 CallState_CallPresent = 6,
00223 CallState_CallReceived = 7,
00224 CallState_ConnectRequest = 8,
00225 CallState_IncomingCallProceeding= 9,
00226 CallState_Active = 10,
00227 CallState_DisconnectRequest = 11,
00228 CallState_DisconnectIndication = 12,
00229 CallState_SuspendRequest = 15,
00230 CallState_ResumeRequest = 17,
00231 CallState_ReleaseRequest = 19,
00232 CallState_OverlapReceiving = 25,
00233 CallState_ErrorInIE = 0x100
00234 };
00235 void SetCallState(
00236 CallStates value,
00237 unsigned standard = 0
00238 );
00239 CallStates GetCallState(
00240 unsigned * standard = NULL
00241 ) const;
00242
00243 enum SignalInfo {
00244 SignalDialToneOn,
00245 SignalRingBackToneOn,
00246 SignalInterceptToneOn,
00247 SignalNetworkCongestionToneOn,
00248 SignalBusyToneOn,
00249 SignalConfirmToneOn,
00250 SignalAnswerToneOn,
00251 SignalCallWaitingTone,
00252 SignalOffhookWarningTone,
00253 SignalPreemptionToneOn,
00254 SignalTonesOff = 0x3f,
00255 SignalAlertingPattern0 = 0x40,
00256 SignalAlertingPattern1,
00257 SignalAlertingPattern2,
00258 SignalAlertingPattern3,
00259 SignalAlertingPattern4,
00260 SignalAlertingPattern5,
00261 SignalAlertingPattern6,
00262 SignalAlertingPattern7,
00263 SignalAlertingOff = 0x4f,
00264 SignalErrorInIE = 0x100
00265 };
00266 void SetSignalInfo(SignalInfo value);
00267 SignalInfo GetSignalInfo() const;
00268
00269 void SetKeypad(const PString & digits);
00270 PString GetKeypad() const;
00271
00272 enum ProgressIndication {
00273 ProgressNotEndToEndISDN = 1,
00274
00275 ProgressDestinationNonISDN = 2,
00276 ProgressOriginNotISDN = 3,
00277 ProgressReturnedToISDN = 4,
00278 ProgressServiceChange = 5,
00279
00280 ProgressInbandInformationAvailable = 8
00281 };
00282
00283 void SetProgressIndicator(
00284 unsigned description,
00285 unsigned codingStandard = 0,
00286 unsigned location = 0
00287 );
00288 PBoolean GetProgressIndicator(
00289 unsigned & description,
00290 unsigned * codingStandard = NULL,
00291 unsigned * location = NULL
00292 ) const;
00293
00294 void SetDisplayName(const PString & name);
00295 PString GetDisplayName() const;
00296
00297 enum NumberingPlanCodes {
00298 UnknownPlan = 0x00,
00299 ISDNPlan = 0x01,
00300 DataPlan = 0x03,
00301 TelexPlan = 0x04,
00302 NationalStandardPlan = 0x08,
00303 PrivatePlan = 0x09,
00304 ReservedPlan = 0x0f
00305 };
00306
00307 enum TypeOfNumberCodes {
00308 UnknownType = 0x00,
00309 InternationalType = 0x01,
00310 NationalType = 0x02,
00311 NetworkSpecificType = 0x03,
00312 SubscriberType = 0x04,
00313 AbbreviatedType = 0x06,
00314 ReservedType = 0x07
00315 };
00316
00317 void SetCallingPartyNumber(
00318 const PString & number,
00319 unsigned plan = 1,
00320 unsigned type = 0,
00321 int presentation = -1,
00322 int screening = -1
00323 );
00324 PBoolean GetCallingPartyNumber(
00325 PString & number,
00326 unsigned * plan = NULL,
00327 unsigned * type = NULL,
00328 unsigned * presentation = NULL,
00329 unsigned * screening = NULL,
00330 unsigned defPresentation = 0,
00331 unsigned defScreening = 0
00332 ) const;
00333
00334 void SetCalledPartyNumber(
00335 const PString & number,
00336 unsigned plan = 1,
00337 unsigned type = 0
00338 );
00339 PBoolean GetCalledPartyNumber(
00340 PString & number,
00341 unsigned * plan = NULL,
00342 unsigned * type = NULL
00343 ) const;
00344
00345 void SetRedirectingNumber(
00346 const PString & number,
00347 unsigned plan = 1,
00348 unsigned type = 0,
00349 int presentation = -1,
00350 int screening = -1,
00351 int reason = -1
00352 );
00353 PBoolean GetRedirectingNumber(
00354 PString & number,
00355 unsigned * plan = NULL,
00356 unsigned * type = NULL,
00357 unsigned * presentation = NULL,
00358 unsigned * screening = NULL,
00359 unsigned * reason = NULL,
00360 unsigned defPresentation = 0,
00361 unsigned defScreening = 0,
00362 unsigned defReason =0
00363 ) const;
00364
00365 void SetConnectedNumber(
00366 const PString & number,
00367 unsigned plan = 1,
00368 unsigned type = 0,
00369 int presentation = -1,
00370 int screening = -1,
00371 int reason = -1
00372 );
00373 PBoolean GetConnectedNumber(
00374 PString & number,
00375 unsigned * plan = NULL,
00376 unsigned * type = NULL,
00377 unsigned * presentation = NULL,
00378 unsigned * screening = NULL,
00379 unsigned * reason = NULL,
00380 unsigned defPresentation = 0,
00381 unsigned defScreening = 0,
00382 unsigned defReason =0
00383 ) const;
00384
00391 void SetChannelIdentification(
00392 unsigned interfaceType = 0,
00393 unsigned preferredOrExclusive = 0,
00394 int channelNumber = 1
00395 );
00396
00399 PBoolean GetChannelIdentification(
00400 unsigned * interfaceType = NULL,
00401 unsigned * preferredOrExclusive = NULL,
00402 int * channelNumber = NULL
00403 ) const;
00404
00405 protected:
00406 unsigned callReference;
00407 PBoolean fromDestination;
00408 unsigned protocolDiscriminator;
00409 MsgTypes messageType;
00410
00411 PARRAY(InternalInformationElement, PBYTEArray);
00412 PDICTIONARY(InternalInformationElements, POrdinalKey, InternalInformationElement);
00413 InternalInformationElements informationElements;
00414 };
00415
00416
00417 #endif // OPAL_H323_Q931_H
00418
00419