Skip to content

Commit

Permalink
rtpengine: fix offer vs answer detection for replies
Browse files Browse the repository at this point in the history
When late negociation is not used, rtpengine_manage() should send an
answer command, not an offer one.

(cherry picked from commit d064131)
  • Loading branch information
razvancrainea committed Jul 21, 2020
1 parent 377e526 commit d3445e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
7 changes: 0 additions & 7 deletions modules/rtpengine/doc/rtpengine_admin.xml
Expand Up @@ -738,13 +738,6 @@ rtpengine_delete();
If INVITE with SDP, then do <function>rtpengine_offer()</function>
</para>
</listitem>
<listitem>
<para>
If INVITE with SDP, when the tm module is loaded, mark transaction with
internal flag FL_SDP_BODY to know that the 1xx and 2xx are for
<function>rtpengine_answer()</function>
</para>
</listitem>
<listitem>
<para>
If ACK with SDP, then do <function>rtpengine_answer()</function>
Expand Down
20 changes: 16 additions & 4 deletions modules/rtpengine/rtpengine.c
Expand Up @@ -2393,6 +2393,9 @@ rtpengine_manage(struct sip_msg *msg, const char *flags, pv_spec_t *spvar, pv_sp
{
int method;
int nosdp;
int op = OP_ANSWER;
struct cell *t;
struct sip_msg req;

if(msg->cseq==NULL && ((parse_headers(msg, HDR_CSEQ_F, 0)==-1)
|| (msg->cseq==NULL)))
Expand Down Expand Up @@ -2431,10 +2434,19 @@ rtpengine_manage(struct sip_msg *msg, const char *flags, pv_spec_t *spvar, pv_sp
if(nosdp==0) {
if(method==METHOD_UPDATE)
return rtpengine_offer_answer(msg, flags, spvar, bpvar, OP_ANSWER);
if(tmb.t_gett==NULL || tmb.t_gett()==NULL
|| tmb.t_gett()==T_UNDEFINED)
return rtpengine_offer_answer(msg, flags, spvar, bpvar, OP_ANSWER);
return rtpengine_offer_answer(msg, flags, spvar, bpvar, OP_OFFER);
if (tmb.t_gett != NULL) {
t = tmb.t_gett();
if(t && t != T_UNDEFINED) {
/* dup the request so that we don't overlap with other
* replies that might parse the request in the same time */
req = *t->uas.request;
if (!msg_has_sdp(&req))
op = OP_OFFER;
free_sip_body(req.body);
}
}
/* op defaults to OP_ANSWER */
return rtpengine_offer_answer(msg, flags, spvar, bpvar, op);
}
}
return -1;
Expand Down

0 comments on commit d3445e1

Please sign in to comment.