mirror of
https://github.com/RangeNetworks/openbts.git
synced 2025-11-01 20:33:33 +00:00
merge 5.0 preview from commercial
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
* Copyright 2011 Range Networks, Inc.
|
||||
* Copyright 2011, 2014 Range Networks, Inc.
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribuion.
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribution.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
@@ -20,9 +20,7 @@
|
||||
#define _SIP2MESSAGE_H_
|
||||
#include <string>
|
||||
#include "SIPParse.h"
|
||||
#include "config.h" // For VERSION
|
||||
|
||||
#include <ControlTransfer.h> // For CodecSet
|
||||
#include <MemoryLeak.h>
|
||||
|
||||
namespace SIP {
|
||||
using namespace std;
|
||||
@@ -53,52 +51,62 @@ class SipMessage : public MemCheckSipMessage {
|
||||
SipPreposition msmFrom;
|
||||
string msmReqMethod;
|
||||
string msmVias; // Via lines, including the first one with mViaBranch and mViaSentBy broken out.
|
||||
string msmRoutes; // Via lines, including the first one with mViaBranch and mViaSentBy broken out.
|
||||
string msmRecordRoutes; // Via lines, including the first one with mViaBranch and mViaSentBy broken out.
|
||||
string msmRoutes; // Route headers.
|
||||
string msmRecordRoutes; // Record-route headers.
|
||||
string msmContactValue;
|
||||
//list<SipBody> msmBodies;
|
||||
string msmContentType;
|
||||
string msmBody;
|
||||
int msmCode;
|
||||
string msmReason;
|
||||
string msmReason; // This is the reason phrase from the first line, not the "Reason: Header".
|
||||
string msmReasonHeader; // This is the "Reason:" header.
|
||||
int msmCSeqNum;
|
||||
string msmCSeqMethod;
|
||||
SipParamList msmHeaders; // Other unrecognized headers. We use SipParamList because its the same.
|
||||
string msmAuthenticateValue; // The www-authenticate value as a string.
|
||||
string msmAuthorizationValue; // The Authorization value as a string.
|
||||
string msmMaxForwards; // Must be a string so we can detect unset as a special case.
|
||||
SipTermList SIPMsgCallTerminationList; // List of SIP termination reasons
|
||||
|
||||
// Modifiers:
|
||||
void smInit() { msmMaxForwards = string("70"); }
|
||||
void smAddViaBranch(string transport, string branch);
|
||||
void smAddViaBranch(SipBase *dialog,string branch);
|
||||
string smGetBranch();
|
||||
string smGetReturnIPAndPort();
|
||||
void smAddViaBranch3(string transport, string proxy, string branch);
|
||||
string smPopVia(); // Pop and return the top via; modifies msmVias.
|
||||
void smCopyTopVia(SipMessage *other);
|
||||
void smAddBody(string contentType, string body);
|
||||
string smGenerate();
|
||||
SipMessage() : msmCode(0), msmCSeqNum(0) {} // mCSeq will be filled in later.
|
||||
int smCSeqNum() const { return msmCSeqNum; }
|
||||
|
||||
SipMessage() : msmCode(0), msmCSeqNum(0), SIPMsgCallTerminationList() {} // mCSeq will be filled in later.
|
||||
|
||||
void smAddHeader(string name, string value) {
|
||||
SipParam param(name,value);
|
||||
msmHeaders.push_back(param);
|
||||
}
|
||||
bool smDecrementMaxFowards();
|
||||
|
||||
string smGenerate(string userAgent); // Recreate the message from fields; return result and also leave it in msmContent.
|
||||
|
||||
SipTermList& getTermList() { return SIPMsgCallTerminationList; }
|
||||
void addCallTerminationReasonSM(CallTerminationCause::termGroup group, int cause, string desc);
|
||||
|
||||
// Accessors:
|
||||
bool isRequest() { return msmCode == 0; }
|
||||
bool isRequestNotAck() { return msmCode == 0 && strcasecmp(msmReqMethod.c_str(),"ACK"); }
|
||||
int smCSeqNum() const { return msmCSeqNum; }
|
||||
string smGetReturnIPAndPort();
|
||||
string smGetRemoteTag() { return isRequest() ? msmFrom.mTag : msmTo.mTag; }
|
||||
string smGetLocalTag() { return isRequest() ? msmTo.mTag : msmFrom.mTag; }
|
||||
string smCSeqMethod() const { return msmCSeqMethod; }
|
||||
string smGetToHeader() const { return msmTo.value(); }
|
||||
string smUriUsername();
|
||||
string smUriUsername(); // The username in an originating request.
|
||||
string smGetInviteImsi();
|
||||
string smGetMessageBody() const;
|
||||
string smGetMessageContentType() const;
|
||||
string smGetProxy() const {
|
||||
string topvia = commaListFront(msmVias);
|
||||
if (topvia.empty()) { return string(""); } // oops
|
||||
SipVia via(topvia);
|
||||
return via.mSentBy;
|
||||
}
|
||||
string smGetBranch(); // The branch from the top via.
|
||||
string smGetProxy() const; // The proxy from the top via.
|
||||
const char *smGetMethodName() const { return msmReqMethod.c_str(); }
|
||||
const char *smGetReason() const { return msmReason.c_str(); }
|
||||
const string smGetReason() const { return msmReason; }
|
||||
string smGetRand401();
|
||||
int smGetCode() const { return msmCode; }
|
||||
int smGetCodeClass() const { return (msmCode / 100) * 100; }
|
||||
|
||||
Reference in New Issue
Block a user