From a2fa8010627ea52387da71dc45ab470aa78920e2 Mon Sep 17 00:00:00 2001 From: Kurtis Heimerl Date: Sat, 7 Jan 2012 09:41:24 +0000 Subject: [PATCH] Bug #173-public. Now appropriately responds to a SIP CANCEL with a SIP OK. Still won't respond if that OK is dropped. git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2995 19bc5d8c-e614-43d4-8b26-e1612bc8e597 --- SIP/SIPEngine.cpp | 11 ++++++++--- SIP/SIPMessage.cpp | 6 +++--- SIP/SIPMessage.h | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/SIP/SIPEngine.cpp b/SIP/SIPEngine.cpp index 2b18f1a..d393285 100644 --- a/SIP/SIPEngine.cpp +++ b/SIP/SIPEngine.cpp @@ -679,7 +679,7 @@ SIPState SIPEngine::MTCSendOK( short wRTPPort, unsigned wCodec ) mCodec = wCodec; LOG(DEBUG) << "port=" << wRTPPort << " codec=" << mCodec; // Form ack from invite and new parameters. - osip_message_t * okay = sip_okay(mINVITE, mSIPUsername.c_str(), + osip_message_t * okay = sip_okay_sdp(mINVITE, mSIPUsername.c_str(), mSIPIP.c_str(), mSIPPort, mRTPPort, mCodec); gSIPInterface.write(&mProxyAddr,okay); osip_message_free(okay); @@ -732,8 +732,10 @@ SIPState SIPEngine::MTCWaitForACK() // check for the CANCEL else if( strcmp(ack->sip_method,"CANCEL") == 0){ LOG(INFO) << "received CANCEL"; + osip_message_t * okay = sip_okay(msg, mSIPUsername.c_str(),mSIPIP.c_str(), mSIPPort); + gSIPInterface.write(&mProxyAddr,okay); + osip_message_free(okay); mState=Fail; - // FIXME -- Send 200 OK, see ticket #173. } // check for strays else { @@ -784,6 +786,9 @@ SIPState SIPEngine::MTCCheckForCancel() // check for the CANCEL else if (strcmp(msg->sip_method,"CANCEL")==0) { LOG(INFO) << "received CANCEL"; + osip_message_t * okay = sip_okay(msg, mSIPUsername.c_str(),mSIPIP.c_str(), mSIPPort); + gSIPInterface.write(&mProxyAddr,okay); + osip_message_free(okay); mState=Fail; } // check for strays @@ -982,7 +987,7 @@ SIPState SIPEngine::MTSMSSendOK() return mState; } // Form ack from invite and new parameters. - osip_message_t * okay = sip_okay_SMS(mINVITE, mSIPUsername.c_str(), + osip_message_t * okay = sip_okay(mINVITE, mSIPUsername.c_str(), mSIPIP.c_str(), mSIPPort); gSIPInterface.write(&mProxyAddr,okay); osip_message_free(okay); diff --git a/SIP/SIPMessage.cpp b/SIP/SIPMessage.cpp index 445bf2a..1f74ce3 100644 --- a/SIP/SIPMessage.cpp +++ b/SIP/SIPMessage.cpp @@ -593,7 +593,7 @@ osip_message_t * SIP::sip_bye(const char * req_uri, const char * dialed_number, } -osip_message_t * SIP::sip_okay( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port, short rtp_port, unsigned audio_codec) +osip_message_t * SIP::sip_okay_sdp( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port, short rtp_port, unsigned audio_codec) { // Check for consistency. @@ -844,7 +844,7 @@ osip_message_t * SIP::sip_ringing( osip_message_t * invite, const char * sip_use } -osip_message_t * SIP::sip_okay_SMS( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port) +osip_message_t * SIP::sip_okay( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port) { // Check for consistency. @@ -878,7 +878,7 @@ osip_message_t * SIP::sip_okay_SMS( osip_message_t * inv, const char * sip_usern // osip_via_clone(inv->via, &okay->via); osip_via_t * via; char * via_str; - osip_message_get_via(inv, 1, &via); + osip_message_get_via(inv, 0, &via); osip_via_to_str(via, &via_str); osip_message_set_via(okay, via_str); osip_free(via_str); diff --git a/SIP/SIPMessage.h b/SIP/SIPMessage.h index cb0d611..a706ccd 100644 --- a/SIP/SIPMessage.h +++ b/SIP/SIPMessage.h @@ -50,9 +50,9 @@ osip_message_t * sip_ack( const char * req_uri, const char * dialed_number, cons osip_message_t * sip_bye( const char * req_uri, const char * dialed_number, const char * sip_username, short local_port, const char * local_ip, const char * proxy_ip, short proxy_port, const osip_from_t *from_header, const osip_to_t * to_header, const char * via_branch, const osip_call_id_t* call_id_header, int cseq); -osip_message_t * sip_okay( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port, short rtp_port, unsigned audio_codecs ); +osip_message_t * sip_okay_sdp( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port, short rtp_port, unsigned audio_codecs ); -osip_message_t * sip_okay_SMS( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port); +osip_message_t * sip_okay( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port); osip_message_t * sip_info(unsigned info, const char *dialed_number, short rtp_port,const char * sip_username, short local_port, const char * local_ip, const char * proxy_ip, const char * from_tag, const char * via_branch, const osip_call_id_t* call_id_header, int cseq);