Commit 3cde2dfb authored by Pekka Pessi's avatar Pekka Pessi
Browse files

soa_static.c: updating c

darcs-hash:20061031203614-65a35-bc2b9bdf677958c3bf4c745aa6c3b9805bbbda58.gz
parent 50a08095
......@@ -773,7 +773,7 @@ int soa_sdp_reject_is_needed(sdp_session_t const *session,
return 0;
}
/** If m= line is rejected by, remote mark m= line rejected within session */
/** If m= line is rejected by remote mark m= line rejected within session */
int soa_sdp_reject(su_home_t *home,
sdp_session_t *session,
sdp_session_t const *remote)
......@@ -1080,6 +1080,46 @@ static int offer_answer_step(soa_session_t *ss,
break;
}
/* Step F: Update c= line */
switch (action) {
case generate_offer:
case generate_answer:
/* Upgrade local SDP based of user SDP */
if (ss->ss_local_user_version == user_version &&
local->sdp_connection)
break;
if (local->sdp_connection == NULL ||
(user->sdp_connection != NULL &&
sdp_connection_cmp(local->sdp_connection, user->sdp_connection))) {
sdp_media_t *m;
/* Every m= line (even rejected one) must have a c= line
* or there must be a c= line at session level
*/
if (user->sdp_connection)
c = user->sdp_connection;
else
c = local->sdp_origin->o_address;
for (m = local->sdp_media; m; m = m->m_next)
if (m->m_connections == NULL)
break;
if (m) {
if (local != local0) {
*local0 = *local, local = local0;
DUP_LOCAL(local);
}
local->sdp_connection = c;
}
}
break;
default:
break;
}
soa_description_free(ss, ss->ss_previous);
if (ss->ss_local->ssd_sdp != local &&
......@@ -1095,21 +1135,6 @@ static int offer_answer_step(soa_session_t *ss,
if (!local->sdp_time) /* t= is mandatory */
local->sdp_time = t;
/* Every m= line (even rejected one) must have a c= line
* or there must be a c= line at session level
*/
c = local->sdp_origin->o_address;
if (local->sdp_connection == NULL) {
sdp_media_t *m;
for (m = local->sdp_media; m; m = m->m_next)
if (m->m_connections == NULL)
break;
if (m)
local->sdp_connection = c;
}
if (action == generate_offer) {
/* Keep a copy of previous session state */
*ss->ss_previous = *ss->ss_local;
......
......@@ -1059,12 +1059,12 @@ int test_codec_selection(struct context *ctx)
),
TAG_END()));
/* B adds GSM to SRTP */
/* B adds GSM to SRTP, changes IP address */
TEST_1(soa_set_params(b,
SOATAG_USER_SDP_STR(
"v=0\r\n"
"o=left 219498671 2 IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.3\r\n"
"m=audio 5004 RTP/AVP 96 3 97 111\r\n"
"a=rtpmap:96 G7231/8000\n"
"a=rtpmap:97 G729/8000\n"
......@@ -1088,6 +1088,9 @@ int test_codec_selection(struct context *ctx)
/* Answer from B now accepts video */
n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
TEST_1(answer != NULL && answer != NONE);
/* Check that updated c= line is propagated */
TEST_1(b_sdp->sdp_connection);
TEST_S(b_sdp->sdp_connection->c_address, "127.0.0.3");
n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
n = soa_process_answer(a, test_completed); TEST(n, 0);
n = soa_get_local_sdp(a, &a_sdp, &offer, &offerlen); TEST(n, 1);
......
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