/usr/include/sipxtapi/cp/SipConnection.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | //
// Copyright (C) 2005-2011 SIPez LLC. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2004-2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
// Author: Daniel Petrie dpetrie AT SIPez DOT com
#ifndef _SipConnection_h_
#define _SipConnection_h_
// SYSTEM INCLUDES
//#include <...>
// APPLICATION INCLUDES
#include "cp/Connection.h"
#include "cp/CSeqManager.h"
#include "net/SipContactDb.h"
#include "utl/UtlObservable.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
class SipUserAgent;
class SipMessage;
class SdpCodec;
class SdpCodecList;
class MediaStreamPassThroughData;
//:Class short description which may consist of multiple lines (note the ':')
// Class detailed description which may extend to multiple lines
class SipConnection : public Connection, public UtlObservable
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
enum ReinviteStates
{
ACCEPT_INVITE = 0,
REINVITED,
REINVITING
};
static const UtlContainableType TYPE;
/* ============================ CREATORS ================================== */
SipConnection(const char* outboundLineAddress,
UtlBoolean isEarlyMediaFor180Enabled = TRUE,
CpCallManager* callMgr = NULL,
CpCall* call = NULL,
CpMediaInterface* mediaInterface = NULL,
SipUserAgent* sipUA = NULL,
int offeringDelayMilliSeconds = IMMEDIATE,
int sessionReinviteTimer = 0,
int availableBehavior = RING,
const char* forwardUnconditionalUrl = NULL,
int busyBehavior = BUSY,
const char* forwardOnBusy = NULL);
//:Default constructor
virtual
~SipConnection();
//:Destructor
/* ============================ MANIPULATORS ============================== */
virtual UtlBoolean dequeue();
virtual UtlBoolean send(SipMessage& message,
OsMsgQ* responseListener = NULL,
void* responseListenerData = NULL,
UtlBoolean bUseSendToTransportType = FALSE);
virtual UtlBoolean dial(const char* dialString,
const char* callerId,
const char* callId,
const char* callController = NULL,
const char* originalCallConnection = NULL,
UtlBoolean requestQueuedCall = FALSE,
const void* pDisplay = NULL,
const void* pSecurity = NULL,
const char* locationHeader = NULL,
const int bandWidth = AUDIO_MICODEC_BW_DEFAULT,
UtlBoolean bOnHold = FALSE,
const char* originalCallId = NULL,
const RTP_TRANSPORT rtpTransportOptions = RTP_TRANSPORT_UDP);
//! param: requestQueuedCall - indicates that the caller wishes to have the callee queue the call if busy
virtual UtlBoolean originalCallTransfer(UtlString& transferTargetAddress,
const char* transferControllerAddress,
const char* targetCallId);
// Initiate transfer on transfer controller connection in
// the original call.
// If fromAddress or toAddress are NULL it is assumed to
// be a blind transfer.
virtual UtlBoolean targetCallBlindTransfer(const char* transferTargetAddress,
const char* transferControllerAddress);
// Communicate blind transfer on transfer controller connection in
// the target call. This is signaled by the transfer controller in the
// original call.
virtual UtlBoolean transfereeStatus(int connectionState, int response);
// Method to communicate status to original call on transferee side
virtual UtlBoolean transferControllerStatus(int connectionState, int response);
// Method to communicate status to target call on transfer
// controller side
virtual void outOfFocus() ;
virtual UtlBoolean answer(const void* hWnd = NULL);
virtual UtlBoolean hangUp();
virtual UtlBoolean hold();
virtual UtlBoolean offHold();
virtual UtlBoolean renegotiateCodecs();
virtual UtlBoolean silentRemoteHold();
virtual UtlBoolean accept(int forwardOnNoAnswerTimeOut,
const void *pSecurity = NULL,
const char* locationHeader = NULL,
const int bandWidth = AUDIO_MICODEC_BW_DEFAULT,
UtlBoolean sendEarlyMedia = FALSE);
virtual UtlBoolean reject(int errorCode = 0, const char* errorText = "");
virtual UtlBoolean redirect(const char* forwardAddress);
virtual UtlBoolean canSendInfo() ;
virtual UtlBoolean sendInfo(UtlString contentType, UtlString sContent);
virtual UtlBoolean processMessage(OsMsg& eventMessage);
void setCallerId();
virtual UtlBoolean getRemoteAddress(UtlString* remoteAddress) const;
virtual UtlBoolean getRemoteAddress(UtlString* remoteAddress,
UtlBoolean leaveFieldParmetersIn) const;
static UtlBoolean processNewFinalMessage(SipUserAgent* sipUa,
OsMsg* eventMessage);
void setContactType(SIPX_CONTACT_TYPE eType, Url* pToUrl = NULL) ;
void setContactId(SIPX_CONTACT_ID contactId) { mContactId = contactId; }
void setExternalTransport(SIPX_TRANSPORT_DATA* pTransport) { if (pTransport) { mTransport = *pTransport; }}
void setVoiceQualityReportTarget(const char* szTargetSipUrl) ;
void sendVoiceQualityReport(const char* szTargetSipUrl) ;
void cacheMediaPassThroughData(CpMediaInterface::MEDIA_STREAM_TYPE mediaType,
int mediaTypeStreamIndex,
UtlString& receiveAddress,
int rtpPort,
int rtcpPort);
/* ============================ ACCESSORS ================================= */
virtual UtlContainableType getContainableType() const;
virtual UtlBoolean getSession(SipSession& session);
virtual OsStatus getFromField(UtlString* fromField);
virtual OsStatus getToField(UtlString* toField);
int getNextCseq();
/* ============================ INQUIRY =================================== */
virtual UtlBoolean isInstanceOf(const UtlContainableType type) const;
static UtlBoolean shouldCreateConnection(SipUserAgent& sipUa,
OsMsg& eventMessage,
SdpCodecList* codecFactory = NULL);
virtual UtlBoolean willHandleMessage(OsMsg& eventMessage) const;
virtual UtlBoolean isConnection(const char* callId,
const char* toTag,
const char* fromTag,
UtlBoolean strictCompare) const;
virtual UtlBoolean isSameRemoteAddress(Url& remoteAddress) const;
virtual UtlBoolean isSameRemoteAddress(Url& remoteAddress,
UtlBoolean tagsMustMatch) const;
void setSecurity(const SIPXTACK_SECURITY_ATTRIBUTES* const pSecurity);
void getRemoteUserAgent(UtlString* userAgent);
virtual UtlBoolean isLocallyInitiatedRemoteHold() const ;
virtual void registerObserver(UtlObserver* observer);
/**
* Removes a listener of this observable.
*/
virtual void removeObserver(UtlObserver* observer);
private:
UtlSList mObservers;
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/**
* The observable calls this to notify its
* observers of a change.
*/
virtual void notify(int code, void *pUserData);
UtlBoolean prepareInviteSdpForSend(SipMessage* pMsg, int connectionId, const void* pSecurityAttribute) ;
void setMediaDestination(const char* hostAddress,
int audioRtpPort,
int audioRtcpPort,
int videoRtpPort,
int videoRtcpPort,
const SdpBody* pRemoteBody) ;
SIPX_CONTACT_TYPE selectCompatibleContactType(const SipMessage& request) ;
//: Select a compatible contact given the URI
void updateContact(Url* pContactUrl,
SIPX_CONTACT_TYPE eType,
Url* pToUrl = NULL,
UtlString* pRemoteHostOrIp = NULL,
int* pRemotePort = NULL) ;
void updateContactFromResponse(const SipMessage* pResponse) ;
static UtlBoolean requestShouldCreateConnection(const SipMessage* sipMsg,
SipUserAgent& sipUa,
SdpCodecList* codecFactory);
UtlBoolean doOffHold(UtlBoolean forceReInvite);
UtlBoolean doHangUp(const char* dialString = NULL,
const char* callerId = NULL);
void buildFromToAddresses(const char* dialString,
const char* callerId,
const char* callerDisplayName,
UtlString& fromAddress,
UtlString& goodToAddress);
void buildLocalContact(Url fromAddress,
UtlString& localContact,
Url* pToUrl = NULL) ;//for outbound call
UtlBoolean extendSessionReinvite();
// SIP Request handlers
UtlBoolean processRequest(const SipMessage* request);
void processInviteRequest(const SipMessage* request);
void processReferRequest(const SipMessage* request);
void processAckRequest(const SipMessage* request);
void processByeRequest(const SipMessage* request);
void processCancelRequest(const SipMessage* request);
void processNotifyRequest(const SipMessage* request);
// SIP Response handlers
UtlBoolean processResponse(const SipMessage* response);
void processInviteResponse(const SipMessage* request);
void processReferResponse(const SipMessage* request);
void processOptionsResponse(const SipMessage* request);
void processByeResponse(const SipMessage* request);
void processCancelResponse(const SipMessage* request);
void processNotifyResponse(const SipMessage* request);
void processInviteResponseRinging(const SipMessage* response);
void processInviteResponseBusy(const SipMessage* response);
void processInviteResponseQueued(const SipMessage* response);
void processInviteResponseRequestPending(const SipMessage* response);
void processInviteResponseFailed(const SipMessage* response);
void processInviteResponseHangingUp(const SipMessage* response);
void processInviteResponseNormal(const SipMessage* response);
void processInviteResponseRedirect(const SipMessage* response);
void processInviteResponseUnknown(const SipMessage* response);
void processInviteRequestBadTransaction(const SipMessage* request, int tag) ;
void processInviteRequestLoop(const SipMessage* request, int tag) ;
void processInviteRequestBadRefer(const SipMessage* request, int tag) ;
void processInviteRequestOffering(const SipMessage* request,
int tag,
UtlBoolean doesReplaceCallLegExist,
int replaceCallLegState,
UtlString& replaceCallId,
UtlString& replaceToTag,
UtlString& replaceFromTag);
void processInviteRequestReinvite(const SipMessage* request, int tag) ;
void fireIncompatibleCodecsEvent(SdpCodecList* pSupportedCodecs,
SdpCodec** ppMatchedCodecs,
int nMatchedCodces) ;
void fireAudioStartEvents(SIPX_MEDIA_CAUSE cause = MEDIA_CAUSE_NORMAL) ;
void fireAudioStopEvents(SIPX_MEDIA_CAUSE cause = MEDIA_CAUSE_NORMAL) ;
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
CSeqManager mCSeqMgr ;
int mRtpTransport;
int mRtpTcpRole;
UtlBoolean mbByeAttempted;
SipUserAgent* sipUserAgent;
UtlString mFromTag;
UtlString mLocationHeader;
SipMessage* inviteMsg;
UtlBoolean mbCancelling;
UtlBoolean mbLocallyInitiatedRemoteHold ;
SIPXTACK_SECURITY_ATTRIBUTES* mpSecurity;
SipMessage* mReferMessage;
UtlBoolean inviteFromThisSide;
UtlString mLastRequestMethod;
UtlString mRemoteContact; //last contact frield from the other side
Url mFromUrl; // SIP address for the local side
Url mToUrl; // SIP address for the remote side
UtlString mRemoteUriStr; // SIP uri string for the remote side
UtlString mLocalUriStr; // SIP uri string for the local side
UtlString mContactUriStr; // SIP uri string for the contact
int lastLocalSequenceNumber;
int lastRemoteSequenceNumber;
int reinviteState;
UtlString mRouteField;
int mDefaultSessionReinviteTimer;
int mSessionReinviteTimer;
UtlString mAllowedRemote; // Methods supported by the otherside
UtlBoolean mIsReferSent; // used to determine whether to send ack when sequence number is smaller
UtlBoolean mIsAcceptSent; // used to determine whether to accept ack when sequence number is smaller
int mHoldCompleteAction;
int mBandwidthId;
UtlBoolean mIsEarlyMediaFor180;
UtlString mLineId; //line identifier for incoming calls.
UtlString mLocalContact; ///< The local Contact: field value - a URI in name-addr format.
SIPX_CONTACT_TYPE mContactType ;
SIPX_CONTACT_ID mContactId;
UtlBoolean mDropping ;
UtlString mRemoteUserAgent;
SIPX_TRANSPORT_DATA mTransport;
UtlString mVoiceQualityReportTarget;
MediaStreamPassThroughData* mpPassThroughData;
UtlBoolean getInitialSdpCodecs(const SipMessage* sdpMessage,
SdpCodecList& supportedCodecsArray,
int& numCodecsInCommon,
SdpCodec** &commonCodecsForEncoder,
UtlString& remoteAddress,
int& remotePort,
int& remoteRtcpPort,
int& remoteVideoRtpPort,
int& remoteVideoRtcpPort,
SdpSrtpParameters& localSrtpParams,
SdpSrtpParameters& matchingSrtpParams,
int localBandwidth,
int& matchingBandwidth,
int localVideoFramerate,
int& matchingVideoFramerate);
virtual void proceedToRinging(const SipMessage* inviteMessage,
SipUserAgent* sipUserAgent,
int tagNum,
int availableBehavior,
int numAddresses = 0,
UtlString hostAddresses[] = NULL,
int receiveRtpPorts[] = NULL,
int receiveRtcpPorts[] = NULL,
int receiveVideoRtpPorts[] = NULL,
int receiveVideoRtcpPorts[] = NULL,
RTP_TRANSPORT transportTypes[] = NULL,
int numMatchingCodecs = 0,
SdpCodec* matchingCodecs[] = NULL,
SdpSrtpParameters* matchingSrtpParams = NULL,
int totalBandwidth = 0,
int matchingVideoFramerate = 0);
UtlBoolean isMethodAllowed(const char* method);
void doBlindRefer();
SipConnection& operator=(const SipConnection& rhs);
//:Assignment operator (disabled)
SipConnection(const SipConnection& rSipConnection);
//:Copy constructor (disabled)
};
/* ============================ INLINE METHODS ============================ */
#endif // _SipConnection_h_
|