Commit 1771b790 authored by François Grisez's avatar François Grisez

Fix carsh when receiving out-of-dialog provisional responses

parent 363b884f
...@@ -405,19 +405,21 @@ void SalCallOp::processResponseCb (void *userCtx, const belle_sip_response_event ...@@ -405,19 +405,21 @@ void SalCallOp::processResponseCb (void *userCtx, const belle_sip_response_event
} }
} }
} else if ((code >= 180) && (code < 200)) { } else if ((code >= 180) && (code < 200)) {
auto previousResponse = reinterpret_cast<belle_sip_response_t *>( auto *previousResponse = dialog ? static_cast<belle_sip_response_t *>(
belle_sip_object_data_get(BELLE_SIP_OBJECT(dialog), "early_response") belle_sip_object_data_get(BELLE_SIP_OBJECT(dialog), "early_response")
); ) : nullptr;
if (!previousResponse || (code > belle_sip_response_get_status_code(previousResponse))) { if (previousResponse == nullptr || (code > belle_sip_response_get_status_code(previousResponse))) {
op->handleBodyFromResponse(response); op->handleBodyFromResponse(response);
op->mRoot->mCallbacks.call_ringing(op); op->mRoot->mCallbacks.call_ringing(op);
} }
if (dialog) {
belle_sip_object_data_set( belle_sip_object_data_set(
BELLE_SIP_OBJECT(dialog), BELLE_SIP_OBJECT(dialog),
"early_response", "early_response",
belle_sip_object_ref(response), belle_sip_object_ref(response),
belle_sip_object_unref belle_sip_object_unref
); );
}
} else if (code >= 300) { } else if (code >= 300) {
op->setError(response, true); op->setError(response, true);
if (!op->mDialog) if (!op->mDialog)
......
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