r4161 in private:

SIPEngine::instigator now based on a flag instead of a string comparison.

For some reason that we need to understand, string comparisons on oSIP messages are really not reliable.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4173 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
Kurtis Heimerl
2012-09-24 20:02:32 +00:00
parent 56d93e6c0a
commit d3af77f81f
2 changed files with 8 additions and 2 deletions

View File

@@ -97,7 +97,7 @@ SIPEngine::SIPEngine(const char* proxy, const char* IMSI)
mSIPIP(gConfig.getStr("SIP.Local.IP")),
mINVITE(NULL), mLastResponse(NULL), mBYE(NULL),
mCANCEL(NULL), mERROR(NULL), mSession(NULL),
mTxTime(0), mRxTime(0), mState(NullState),
mTxTime(0), mRxTime(0), mState(NullState), mInstigator(false),
mDTMF('\0'),mDTMFDuration(0)
{
assert(proxy);
@@ -210,6 +210,8 @@ void SIPEngine::saveERROR(const osip_message_t *ERROR, bool mine)
osip_message_clone(ERROR,&mERROR);
}
#if 0
This was replaced with a simple flag set during MO transactions.
/* we're going to figure if the from field is us or not */
bool SIPEngine::instigator()
{
@@ -218,6 +220,7 @@ bool SIPEngine::instigator()
return (!strncmp(from_uri->username,mSIPUsername.c_str(),15) &&
!strncmp(from_uri->host, mSIPIP.c_str(), 30));
}
#endif
void SIPEngine::user( const char * IMSI )
{
@@ -434,6 +437,7 @@ SIPState SIPEngine::MOCSendINVITE( const char * wCalledUsername,
LOG(INFO) << "user " << mSIPUsername << " state " << mState;
// Before start, need to add mCallID
gSIPInterface.addCall(mCallID);
mInstigator = true;
// Set Invite params.
// new CSEQ and codec
@@ -1123,6 +1127,7 @@ SIPState SIPEngine::MOSMSSendMESSAGE(const char * wCalledUsername,
LOG(INFO) << "SIP send to " << wCalledUsername << "@" << wCalledDomain << " MESSAGE " << messageText;
// Before start, need to add mCallID
gSIPInterface.addCall(mCallID);
mInstigator = true;
// Set MESSAGE params.
char tmp[50];

View File

@@ -126,6 +126,7 @@ private:
//@}
SIPState mState; ///< current SIP call state
bool mInstigator; ///< true if this side initiated the call
/**@name RFC-2833 DTMF state. */
//@{
@@ -161,7 +162,7 @@ public:
/** Return if the communication was started by us (true) or not (false) */
/* requires an mINVITE be established */
bool instigator();
bool instigator() const { return mInstigator; }
/** Set the user to IMSI<IMSI> and generate a call ID; for mobile-originated transactions. */
void user( const char * IMSI );