Commit f782483e authored by Michael Jerris's avatar Michael Jerris Committed by Pekka Pessi

soa: add SOATAG_USER_O_LINE()

With SOATAG_USER_O_LINE(1), use o= address, id, and version from user
sdp (if they exist).
parent f162a4b9
......@@ -453,6 +453,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
int rtp_mismatch;
int srtp_enable, srtp_confidentiality, srtp_integrity;
int delayed_offer_enable;
int user_o_line;
af = ss->ss_af;
......@@ -468,6 +469,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
srtp_integrity = ss->ss_srtp_integrity;
delayed_offer_enable = ss->ss_delayed_offer_enable;
user_o_line = ss->ss_user_o_line;
caps_sdp = user_sdp = NONE;
caps_sdp_str = user_sdp_str = NONE;
......@@ -493,6 +495,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
SOATAG_SRTP_INTEGRITY_REF(srtp_integrity),
SOATAG_DELAYED_OFFER_ENABLE_REF(delayed_offer_enable),
SOATAG_USER_O_LINE_REF(user_o_line),
TAG_END());
......@@ -529,6 +532,8 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
}
}
user_o_line = user_o_line != 0;
if (af < SOA_AF_ANY || af > SOA_AF_IP6_IP4)
af = ss->ss_af;
......@@ -546,6 +551,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
change_session
= af != (int)ss->ss_af
|| user_o_line != (int)ss->ss_user_o_line
|| rtp_select != (int)ss->ss_rtp_select
|| rtp_sort != (int)ss->ss_rtp_sort
|| rtp_mismatch != (int)ss->ss_rtp_mismatch
......@@ -566,6 +572,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
ss->ss_srtp_integrity = srtp_integrity;
ss->ss_delayed_offer_enable = delayed_offer_enable;
ss->ss_user_o_line = user_o_line;
if (!su_casematch(media_address, ss->ss_address)) {
su_free(ss->ss_home, (void *)ss->ss_address);
......@@ -661,8 +668,9 @@ int soa_get_params(soa_session_t const *ss,
* SOATAG_RTP_MISMATCH(),
* SOATAG_SRTP_ENABLE(),
* SOATAG_SRTP_CONFIDENTIALITY(),
* SOATAG_SRTP_INTEGRITY(), and
* SOATAG_DELAYED_OFFER_ENABLE().
* SOATAG_SRTP_INTEGRITY(),
* SOATAG_DELAYED_OFFER_ENABLE(), and
* SOATAG_USER_O_LINE().
*/
int soa_base_get_params(soa_session_t const *ss, tagi_t *tags)
{
......@@ -694,6 +702,7 @@ int soa_base_get_params(soa_session_t const *ss, tagi_t *tags)
SOATAG_SRTP_INTEGRITY(ss->ss_srtp_integrity),
SOATAG_DELAYED_OFFER_ENABLE(ss->ss_delayed_offer_enable),
SOATAG_USER_O_LINE(ss->ss_user_o_line),
TAG_END());
......@@ -763,6 +772,9 @@ tagi_t *soa_base_get_paramlist(soa_session_t const *ss,
SOATAG_SRTP_CONFIDENTIALITY(ss->ss_srtp_confidentiality),
SOATAG_SRTP_INTEGRITY(ss->ss_srtp_integrity),
SOATAG_DELAYED_OFFER_ENABLE(ss->ss_delayed_offer_enable),
SOATAG_USER_O_LINE(ss->ss_user_o_line),
ta_tags(ta));
ta_end(ta);
......
......@@ -1291,9 +1291,22 @@ static int offer_answer_step(soa_session_t *ss,
/* Step F0: Initialize o= line */
if (fresh) {
if (user->sdp_origin)
if (user->sdp_origin) {
o->o_username = user->sdp_origin->o_username;
if (ss->ss_user_o_line) {
if (user->sdp_origin->o_address)
o->o_address = user->sdp_origin->o_address;
if (user->sdp_origin->o_id)
o->o_id = user->sdp_origin->o_id;
if (user->sdp_origin->o_version &&
user->sdp_origin->o_version != o->o_version)
o->o_version = user->sdp_origin->o_version - 1;
}
}
if (soa_init_sdp_origin_with_session(ss, o, c0_buffer, local) < 0) {
phrase = "Cannot Get IP Address for Session Description";
goto internal_error;
......
......@@ -244,6 +244,31 @@ tag_typedef_t soatag_user_sdp = SDPTAG_TYPEDEF(user_sdp);
*/
tag_typedef_t soatag_user_sdp_str = STRTAG_TYPEDEF(user_sdp_str);
/**@def SOATAG_USER_O_LINE(x)
*
* Use address, id and version in the initial o= line from the user SDP
* o= line.
*
* @par Used with
* soa_set_params(), soa_get_params(), soa_get_paramlist() \n
*
* @par Parameter type
* Boolean (int)
*
* @par Values
* 0 - generate address, id and version \n
* 1 (!= 0) - use address, id and version from o= line
*
* Corresponding tag taking reference parameter is SOATAG_USER_O_LINE_REF()
*
* @sa SOATAG_USER_SDP()
*
* @NEW_UNRELEASED
*/
tag_typedef_t soatag_user_o_line = BOOLTAG_TYPEDEF(user_o_line);
/**@def SOATAG_AF(x)
*
* Preferred address family for media.
......
......@@ -225,7 +225,9 @@ struct soa_session
ss_srtp_confidentiality:1,
ss_srtp_integrity:1;
unsigned ss_delayed_offer_enable:1;
unsigned ss_delayed_offer_enable:1;
unsigned ss_user_o_line:1;
unsigned :0; /* Pad */
......
......@@ -252,6 +252,11 @@ SOFIAPUBVAR tag_typedef_t soatag_delayed_offer_enable;
#define SOATAG_DELAYED_OFFER_ENABLE_REF(x) soatag_delayed_offer_enable_ref, tag_bool_vr(&(x))
SOFIAPUBVAR tag_typedef_t soatag_delayed_offer_enable_ref;
#define SOATAG_USER_O_LINE(x) soatag_user_o_line, tag_bool_v(x)
SOFIAPUBVAR tag_typedef_t soatag_user_o_line;
#define SOATAG_USER_O_LINE_REF(x) soatag_user_o_line_ref, tag_bool_vr(&(x))
SOFIAPUBVAR tag_typedef_t soatag_user_o_line_ref;
SOFIA_END_DECLS
#endif /* SOA_TAG_H */
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