Skip to content

Commit

Permalink
media_exchange: make utils work with media_session_leg instead of dlg
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Mar 6, 2020
1 parent eb451f0 commit 3e1a091
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions modules/media_exchange/media_exchange.c
Expand Up @@ -245,7 +245,7 @@ static int media_session_fetch_server_reply(struct sip_msg *msg, int status, voi
if (!pbody)
goto error;
/* XXX: should we care whether the other party is properly on hold? */
if (media_session_reinvite(msl->ms->dlg,
if (media_session_reinvite(msl,
MEDIA_SESSION_DLG_OTHER_LEG(msl), pbody) < 0)
LM_ERR("could not copy send indialog request for hold\n");
pkg_free(pbody->s);
Expand Down Expand Up @@ -384,7 +384,7 @@ static int b2b_media_server_notify(struct sip_msg *msg, str *key, int type, void
if (media_b2b.send_reply(&reply_data) < 0)
LM_ERR("could not confirm session ending!\n");

if (media_session_resume_dlg(msl->ms->dlg, MEDIA_SESSION_DLG_LEG(msl)) < 0)
if (media_session_resume_dlg(msl) < 0)
LM_ERR("could not resume media session!\n");

/* should be last unref */
Expand Down
18 changes: 11 additions & 7 deletions modules/media_exchange/media_utils.c
Expand Up @@ -78,23 +78,27 @@ str *media_session_get_hold_sdp(struct media_session_leg *msl)
return &new_body;
}

int media_session_resume_dlg(struct dlg_cell *dlg, int first_leg)
int media_session_resume_dlg(struct media_session_leg *msl)
{
if (media_session_reinvite(dlg, first_leg, NULL) < 0)
int first_leg = MEDIA_SESSION_DLG_LEG(msl);
if (media_session_reinvite(msl, first_leg, NULL) < 0)
LM_ERR("could not resume call for leg %d\n", first_leg);
if (media_session_reinvite(dlg, other_leg(dlg, first_leg), NULL) < 0)
LM_ERR("could not resume call for leg %d\n", other_leg(dlg, first_leg));
if (!msl->nohold && media_session_reinvite(msl,
other_leg(msl->ms->dlg, first_leg), NULL) < 0)
LM_ERR("could not resume call for leg %d\n",
other_leg(msl->ms->dlg, first_leg));
return 0;
}

int media_session_reinvite(struct dlg_cell *dlg, int leg, str *pbody)
int media_session_reinvite(struct media_session_leg *msl, int leg, str *pbody)
{
static str inv = str_init("INVITE");

str body;
if (pbody)
body = *pbody;
else
body = dlg_get_out_sdp(dlg, leg);
return media_dlg.send_indialog_request(dlg, &inv, leg, &body, &ct_sdp, NULL, NULL);
body = dlg_get_out_sdp(msl->ms->dlg, leg);
return media_dlg.send_indialog_request(msl->ms->dlg,
&inv, leg, &body, &ct_sdp, NULL, NULL);
}
5 changes: 3 additions & 2 deletions modules/media_exchange/media_utils.h
Expand Up @@ -23,7 +23,8 @@

str *media_session_get_hold_sdp(struct media_session_leg *msl);

int media_session_reinvite(struct dlg_cell *dlg, int leg, str *pbody);
int media_session_resume_dlg(struct media_session_leg *msl);

int media_session_reinvite(struct media_session_leg *msl, int leg, str *pbody);

int media_session_resume_dlg(struct dlg_cell *dlg, int first_leg);
#endif /* _MEDIA_UTILS_H_ */

0 comments on commit 3e1a091

Please sign in to comment.