MT#61574 AmOfferAnswer: don't generate SDP answer if offer empty

When replying with 200OK generated by SEMS to INVITE requests,
which have no SDP body included, just answer with empty 200OK.

This sets the `OAState` of the call leg to `OA_None`.

Change-Id: Ic28e80d670ba4ce98be6abac9d17689688f99f71
mr13.1
Donat Zenichev 2 years ago
parent f97ff25ae5
commit 129b407bfb

@ -361,7 +361,7 @@ int AmOfferAnswer::onRequestOut(AmSipRequest& req)
return 0;
}
int AmOfferAnswer::onReplyOut(AmSipReply& reply)
int AmOfferAnswer::onReplyOut(AmSipReply& reply, bool no_sdp_generation)
{
AmMimeBody* sdp_body = reply.body.hasContentType(SIP_APPLICATION_SDP);
AmMimeBody* csta_body = reply.body.hasContentType(SIP_APPLICATION_CSTA_XML);
@ -418,9 +418,10 @@ int AmOfferAnswer::onReplyOut(AmSipReply& reply)
} else if ((reply.code == 183) || ((reply.code >= 200) && (reply.code < 300))) {
/* either offer received or no offer at all: -> force SDP */
generate_sdp = (state == OA_OfferRecved)
generate_sdp = !no_sdp_generation &&
((state == OA_OfferRecved)
|| (state == OA_None)
|| (state == OA_Completed);
|| (state == OA_Completed));
}
} else if (reply.cseq_method == SIP_METH_UPDATE) {
@ -473,7 +474,7 @@ int AmOfferAnswer::onReplyOut(AmSipReply& reply)
} else if (sdp_body && has_sdp) {
/* update local SDP copy */
if (sdp_local.parse((const char*)sdp_body->getPayload())) {
ERROR("parser failed on Tx SDP: '%s'\n", (const char*)sdp_body->getPayload());
WARN("parser failed on Tx SDP: '%s'\n", (const char*)sdp_body->getPayload());
}
}

@ -85,7 +85,8 @@ public:
int onRequestIn(const AmSipRequest& req);
int onReplyIn(const AmSipReply& reply);
int onRequestOut(AmSipRequest& req);
int onReplyOut(AmSipReply& reply);
/* `no_sdp_generation` - can be used for cases like absent SDP in coming INVITE */
int onReplyOut(AmSipReply& reply, bool no_sdp_generation = false);
int onRequestSent(const AmSipRequest& req);
int onReplySent(const AmSipReply& reply);
void onNoAck(unsigned int ack_cseq);

@ -271,7 +271,7 @@ int AmSipDialog::onTxRequest(AmSipRequest& req, int& flags)
int AmSipDialog::onTxReply(const AmSipRequest& req, AmSipReply& reply, int& flags)
{
if (offeranswer_enabled) {
if(oa.onReplyOut(reply) < 0)
if(oa.onReplyOut(reply, req.body.empty()) < 0)
return -1;
}

Loading…
Cancel
Save