Commit ca159350 authored by Ghislain MARY's avatar Ghislain MARY

Some more fixes for call handling.

parent 6a1debb7
......@@ -3143,19 +3143,17 @@ void MediaSessionPrivate::updateStreams (SalMediaDescription *newMd, LinphoneCal
ms_message("Playing ringback tone, will restart the streams.");
#endif
else {
#if 0
if (call->all_muted && (targetState == LinphoneCallStreamsRunning)) {
if (allMuted && (targetState == LinphoneCallStreamsRunning)) {
lInfo() << "Early media finished, unmuting inputs...";
/* We were in early media, now we want to enable real media */
call->all_muted = FALSE;
allMuted = false;
if (audioStream)
linphone_core_enable_mic(core, linphone_core_mic_enabled(core));
#ifdef VIDEO_ENABLED
if (videoStream && cameraEnabled)
linphone_call_enable_camera(call, linphone_call_camera_enabled(call));
q->enableCamera(q->cameraEnabled());
#endif
}
#endif
if (mdChanged == SAL_MEDIA_DESCRIPTION_UNCHANGED) {
/* FIXME ZRTP, might be restarted in any cases? */
lInfo() << "No need to restart streams, SDP is unchanged";
......@@ -4201,11 +4199,11 @@ LinphoneStatus MediaSession::resume () {
if (d->audioStream)
audio_stream_play(d->audioStream, nullptr);
d->makeLocalMediaDescription();
sal_media_description_set_dir(d->localDesc, SalStreamSendRecv);
if (!d->core->sip_conf.sdp_200_ack)
d->op->set_local_media_description(d->localDesc);
else
d->op->set_local_media_description(nullptr);
sal_media_description_set_dir(d->localDesc, SalStreamSendRecv);
string subject = "Call resuming";
if (d->params->getPrivate()->getInConference() && !getCurrentParams()->getPrivate()->getInConference())
subject = "Conference";
......
......@@ -151,6 +151,11 @@ void ContentType::setParameter (const string &parameter) {
d->parameter = parameter;
}
bool ContentType::isEmpty () const {
L_D();
return d->type.empty() && d->subType.empty();
}
bool ContentType::isValid () const {
L_D();
return !d->type.empty() && !d->subType.empty();
......
......@@ -45,6 +45,7 @@ public:
bool operator== (const std::string &contentType) const = delete;
bool operator!= (const std::string &contentType) const = delete;
bool isEmpty () const;
bool isValid () const;
bool isFile () const;
......
......@@ -153,7 +153,7 @@ bool Content::isEmpty () const {
bool Content::isValid () const {
L_D();
return d->contentType.isValid() || d->body.empty();
return d->contentType.isValid() || (d->contentType.isEmpty() && d->body.empty());
}
LinphoneContent *Content::toLinphoneContent () const {
......
......@@ -255,7 +255,10 @@ int SalCallOp::parse_sdp_body(const Content &body,belle_sdp_session_description_
return 0;
}
*session_desc = belle_sdp_session_description_parse(body.getBodyAsString().c_str());
string strBody = body.getBodyAsString();
if (strBody.empty())
return 0;
*session_desc = belle_sdp_session_description_parse(strBody.c_str());
if (*session_desc == NULL) {
ms_error("Failed to parse SDP message.");
*error = SalReasonNotAcceptable;
......@@ -330,7 +333,7 @@ void SalCallOp::sdp_process(){
void SalCallOp::handle_body_from_response(belle_sip_response_t* response) {
SalReason reason;
belle_sdp_session_description_t* sdp;
belle_sdp_session_description_t* sdp = nullptr;
Content body = extract_body(BELLE_SIP_MESSAGE(response));
if (this->remote_media){
sal_media_description_unref(this->remote_media);
......@@ -568,7 +571,7 @@ SalReason SalCallOp::process_body_for_invite(belle_sip_request_t* invite) {
Content body = extract_body(BELLE_SIP_MESSAGE(invite));
if (!body.isValid()) return SalReasonUnsupportedContent;
if (body.getContentType() == ContentType::Sdp) {
if ((body.getContentType() == ContentType::Sdp) || (body.getContentType().isEmpty() && body.isEmpty())) {
belle_sdp_session_description_t* sdp;
if (parse_sdp_body(body, &sdp, &reason) == 0) {
if (sdp) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment