From 013963a5725b7a443eccff66d6cf6be23f9589ed Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Thu, 27 Sep 2012 15:19:02 -0400 Subject: [PATCH] * #15545: sip: restore old Call API but handle invite with no SDP correctly --- daemon/src/call.h | 2 ++ daemon/src/iax/iaxcall.h | 4 ++-- daemon/src/iax/iaxvoiplink.cpp | 2 +- daemon/src/sip/sipcall.cpp | 5 +++-- daemon/src/sip/sipcall.h | 4 +--- daemon/src/sip/sipvoiplink.cpp | 4 +--- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/daemon/src/call.h b/daemon/src/call.h index 2a4b8da43b..281f896724 100644 --- a/daemon/src/call.h +++ b/daemon/src/call.h @@ -173,6 +173,8 @@ class Call : public Recordable { isIPToIP_ = IPToIP; } + virtual void answer() = 0; + /** * Set my IP [not protected] * @param ip The local IP address diff --git a/daemon/src/iax/iaxcall.h b/daemon/src/iax/iaxcall.h index d9dfde7700..739f7b90a7 100644 --- a/daemon/src/iax/iaxcall.h +++ b/daemon/src/iax/iaxcall.h @@ -71,11 +71,11 @@ class IAXCall : public Call { int getAudioCodec() const; - void answer(); - int format; iax_session* session; private: + void answer(); + NON_COPYABLE(IAXCall); }; diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp index 0518937d6e..aaf1333cf2 100644 --- a/daemon/src/iax/iaxvoiplink.cpp +++ b/daemon/src/iax/iaxvoiplink.cpp @@ -278,7 +278,7 @@ IAXVoIPLink::answer(Call *call) Manager::instance().addStream(call->getCallId()); mutexIAX_.enter(); - static_cast<IAXCall*>(call)->answer(); + call->answer(); mutexIAX_.leave(); call->setState(Call::ACTIVE); diff --git a/daemon/src/sip/sipcall.cpp b/daemon/src/sip/sipcall.cpp index c324d92001..fe1d91ea0c 100644 --- a/daemon/src/sip/sipcall.cpp +++ b/daemon/src/sip/sipcall.cpp @@ -62,13 +62,14 @@ SIPCall::~SIPCall() pj_pool_release(pool_); } -void SIPCall::answer(bool needsSdp) +void SIPCall::answer() { pjsip_tx_data *tdata; if (!inv->last_answer) throw std::runtime_error("Should only be called for initial answer"); - if (pjsip_inv_answer(inv, PJSIP_SC_OK, NULL, needsSdp ? local_sdp_->getLocalSdpSession() : NULL, &tdata) != PJ_SUCCESS) + // answer with SDP if no SDP was given in initial invite (i.e. inv->neg is NULL) + if (pjsip_inv_answer(inv, PJSIP_SC_OK, NULL, !inv->neg ? local_sdp_->getLocalSdpSession() : NULL, &tdata) != PJ_SUCCESS) throw std::runtime_error("Could not init invite request answer (200 OK)"); if (pjsip_inv_send_msg(inv, tdata) != PJ_SUCCESS) diff --git a/daemon/src/sip/sipcall.h b/daemon/src/sip/sipcall.h index edd56b6afe..186abbf381 100644 --- a/daemon/src/sip/sipcall.h +++ b/daemon/src/sip/sipcall.h @@ -100,9 +100,7 @@ class SIPCall : public Call { return pool_; } - // @param needsSdp: true if the invite was received without an SDP - // and thus one must been added, false otherwise - void answer(bool needsSdp); + void answer(); /** * The invite session to be reused in case of transfer diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index e75e5d4ac4..b42be97263 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -913,15 +913,13 @@ SIPVoIPLink::answer(Call *call) return; SIPCall *sipCall = static_cast<SIPCall*>(call); - bool needsSdp = false; if (!sipCall->inv->neg) { WARN("Negotiator is NULL, we've received an INVITE without an SDP"); pjmedia_sdp_session *dummy; sdp_create_offer_cb(sipCall->inv, &dummy); - needsSdp = true; } - sipCall->answer(needsSdp); + call->answer(); } namespace { -- GitLab