From d3af77f81fad492a6bc74b48a3b8ebc751a8feb6 Mon Sep 17 00:00:00 2001 From: Kurtis Heimerl Date: Mon, 24 Sep 2012 20:02:32 +0000 Subject: [PATCH] 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 --- SIP/SIPEngine.cpp | 7 ++++++- SIP/SIPEngine.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SIP/SIPEngine.cpp b/SIP/SIPEngine.cpp index 727a875..b0dff3c 100644 --- a/SIP/SIPEngine.cpp +++ b/SIP/SIPEngine.cpp @@ -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]; diff --git a/SIP/SIPEngine.h b/SIP/SIPEngine.h index 71c03ca..72e8640 100644 --- a/SIP/SIPEngine.h +++ b/SIP/SIPEngine.h @@ -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 and generate a call ID; for mobile-originated transactions. */ void user( const char * IMSI );