Skip to content

Commit aca9a9a

Browse files
committed
rtp_relay: use the opposite tag when creating the peer leg in request
When request_route lazily creates the peer leg for an unestablished RTP relay session, the local leg is already matched by the From tag. The peer leg therefore needs the opposite tag (To tag) so the internal leg map stays consistent. Thanks to @sindy39 on GitHub for reporting it in #3884.
1 parent 96a8ffa commit aca9a9a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

modules/rtp_relay/rtp_relay.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,11 @@ static struct rtp_relay_leg *pv_get_rtp_relay_leg(struct sip_msg *msg,
465465
if (!peer) {
466466
if (!set)
467467
return NULL;
468-
peer = rtp_relay_new_leg(ctx, &get_from(msg)->tag_value, RTP_RELAY_ALL_BRANCHES);
468+
if (route_type == BRANCH_ROUTE)
469+
tag = get_from(msg)->tag_value;
470+
else
471+
tag = get_to(msg)->tag_value;
472+
peer = rtp_relay_new_leg(ctx, &tag, RTP_RELAY_ALL_BRANCHES);
469473
if (!peer) {
470474
LM_ERR("cannot create a new leg\n");
471475
return NULL;

0 commit comments

Comments
 (0)