Wed Mar 5 05:54:15 EST 2008 Pekka.Pessi@nokia.com
* soa_static.c: fixed initial SOATAG_ORDERED_USER(1) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7796 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
0db4364682
commit
dfb6ccc208
|
@ -822,13 +822,14 @@ int soa_sdp_upgrade(soa_session_t *ss,
|
|||
continue;
|
||||
|
||||
for (i = 0; i < size - 1; i++) {
|
||||
if (s_media[i] != NULL)
|
||||
continue;
|
||||
s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
|
||||
u2s[j] = i, s2u[i] = j;
|
||||
if (s_media[i] == NULL) {
|
||||
s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
|
||||
u2s[j] = i, s2u[i] = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert(i != size);
|
||||
assert(i != size - 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -478,7 +478,7 @@ int test_static_offer_answer(struct context *ctx)
|
|||
TEST(soa_get_local_sdp(b, NULL, &offer, &offerlen), 1);
|
||||
TEST_1(offer != NULL && offer != NONE);
|
||||
TEST_1(!strstr(offer, "a=inactive"));
|
||||
printf("offer:\n%s", offer);
|
||||
/* printf("offer:\n%s", offer); */
|
||||
TEST(soa_set_remote_sdp(a, 0, offer, offerlen), 1);
|
||||
TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
|
||||
TEST(soa_generate_answer(a, test_completed), 0);
|
||||
|
@ -489,7 +489,7 @@ int test_static_offer_answer(struct context *ctx)
|
|||
TEST(soa_get_local_sdp(a, NULL, &answer, &answerlen), 1);
|
||||
TEST_1(answer != NULL && answer != NONE);
|
||||
TEST_1(strstr(answer, "a=inactive"));
|
||||
printf("answer:\n%s", answer);
|
||||
/* printf("answer:\n%s", answer); */
|
||||
TEST(soa_set_remote_sdp(b, 0, answer, -1), 1);
|
||||
TEST(soa_process_answer(b, test_completed), 0);
|
||||
TEST(soa_activate(b, NULL), 0);
|
||||
|
@ -1372,6 +1372,159 @@ int test_media_reject(struct context *ctx)
|
|||
}
|
||||
|
||||
|
||||
int test_media_replace2(struct context *ctx)
|
||||
{
|
||||
BEGIN();
|
||||
int n;
|
||||
|
||||
soa_session_t *a, *b;
|
||||
|
||||
char const *offer = NONE, *answer = NONE;
|
||||
isize_t offerlen = (isize_t)-1, answerlen = (isize_t)-1;
|
||||
|
||||
sdp_session_t const *a_sdp, *b_sdp;
|
||||
sdp_media_t const *m;
|
||||
|
||||
char const a_caps[] =
|
||||
"v=0\r\n"
|
||||
"o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
|
||||
"c=IN IP4 127.0.0.2\r\n"
|
||||
"m=audio 5004 RTP/AVP 0 8\n"
|
||||
"a=rtpmap:96 G7231/8000\n"
|
||||
"a=rtpmap:97 G729/8000\n"
|
||||
"m=image 5556 UDPTL t38\r\n"
|
||||
"a=T38FaxVersion:0\r\n"
|
||||
"a=T38MaxBitRate:9600\r\n"
|
||||
"a=T38FaxFillBitRemoval:0\r\n"
|
||||
"a=T38FaxTranscodingMMR:0\r\n"
|
||||
"a=T38FaxTranscodingJBIG:0\r\n"
|
||||
"a=T38FaxRateManagement:transferredTCF\r\n"
|
||||
"a=T38FaxMaxDatagram:400\r\n";
|
||||
|
||||
char const a_caps2[] =
|
||||
"v=0\r\n"
|
||||
"o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
|
||||
"c=IN IP4 127.0.0.2\r\n"
|
||||
"m=image 5004 UDPTL t38\r\n"
|
||||
"a=T38FaxVersion:0\r\n"
|
||||
"a=T38MaxBitRate:9600\r\n"
|
||||
"a=T38FaxFillBitRemoval:0\r\n"
|
||||
"a=T38FaxTranscodingMMR:0\r\n"
|
||||
"a=T38FaxTranscodingJBIG:0\r\n"
|
||||
"a=T38FaxRateManagement:transferredTCF\r\n"
|
||||
"a=T38FaxMaxDatagram:400\r\n";
|
||||
|
||||
char const b_caps[] =
|
||||
"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"
|
||||
"m=audio 5008 RTP/AVP 0 8\r\n"
|
||||
;
|
||||
|
||||
char const b_caps2[] =
|
||||
"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"
|
||||
"m=image 5008 UDPTL t38\r\n"
|
||||
;
|
||||
|
||||
TEST_1(a = soa_create("static", ctx->root, ctx));
|
||||
TEST_1(b = soa_create("static", ctx->root, ctx));
|
||||
|
||||
TEST_1(soa_set_params(a, SOATAG_ORDERED_USER(1),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
TAG_END()) > 0);
|
||||
TEST_1(soa_set_params(b, SOATAG_ORDERED_USER(1),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
TAG_END()) > 0);
|
||||
|
||||
TEST(soa_set_user_sdp(a, 0, a_caps, strlen(a_caps)), 1);
|
||||
TEST(soa_set_user_sdp(b, 0, b_caps, strlen(b_caps)), 1);
|
||||
|
||||
n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
|
||||
n = soa_get_local_sdp(a, NULL, &offer, &offerlen); TEST(n, 1);
|
||||
TEST_1(offer != NULL && offer != NONE);
|
||||
n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
|
||||
n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 0);
|
||||
n = soa_generate_answer(b, test_completed); TEST(n, 0);
|
||||
n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
|
||||
TEST_1(answer != NULL && answer != NONE);
|
||||
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, NULL, NULL); TEST(n, 1);
|
||||
|
||||
TEST_1(soa_is_complete(b));
|
||||
TEST(soa_activate(b, NULL), 0);
|
||||
|
||||
TEST_1(soa_is_complete(a));
|
||||
TEST(soa_activate(a, NULL), 0);
|
||||
|
||||
TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
|
||||
TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
|
||||
|
||||
TEST_1(a_sdp->sdp_media);
|
||||
TEST_1(a_sdp->sdp_media->m_type == sdp_media_audio);
|
||||
TEST_1(a_sdp->sdp_media->m_next);
|
||||
TEST_1(a_sdp->sdp_media->m_next->m_type == sdp_media_image);
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Re-O/A: replace media stream */
|
||||
|
||||
/* Accept media without common codecs */
|
||||
TEST_1(soa_set_params(b, SOATAG_RTP_MISMATCH(0),
|
||||
SOATAG_USER_SDP_STR(b_caps2),
|
||||
TAG_END()) > 0);
|
||||
|
||||
n = soa_generate_offer(b, 1, test_completed); TEST(n, 0);
|
||||
n = soa_get_local_sdp(b, &b_sdp, &offer, &offerlen); TEST(n, 1);
|
||||
TEST_1(offer != NULL && offer != NONE);
|
||||
n = soa_set_remote_sdp(a, 0, offer, offerlen); TEST(n, 1);
|
||||
/*printf("offer 2:\n%s", offer);*/
|
||||
TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0),
|
||||
SOATAG_USER_SDP_STR(a_caps2),
|
||||
TAG_END()) > 0);
|
||||
|
||||
n = soa_generate_answer(a, test_completed); TEST(n, 0);
|
||||
n = soa_get_local_sdp(a, &a_sdp, &answer, &answerlen); TEST(n, 1);
|
||||
TEST_1(answer != NULL && answer != NONE);
|
||||
/*printf("answer 2:\n%s", answer);*/
|
||||
n = soa_set_remote_sdp(b, 0, answer, -1); TEST(n, 1);
|
||||
n = soa_process_answer(b, test_completed); TEST(n, 0);
|
||||
n = soa_get_local_sdp(b, &b_sdp, NULL, NULL); TEST(n, 1);
|
||||
|
||||
TEST_1(soa_is_complete(a));
|
||||
TEST(soa_activate(a, NULL), 0);
|
||||
|
||||
TEST_1(soa_is_complete(b));
|
||||
TEST(soa_activate(b, NULL), 0);
|
||||
|
||||
TEST_1(m = a_sdp->sdp_media); TEST_1(!m->m_rejected);
|
||||
TEST(m->m_type, sdp_media_image);
|
||||
TEST(m->m_proto, sdp_proto_udptl);
|
||||
TEST_1(m->m_format);
|
||||
TEST_S(m->m_format->l_text, "t38");
|
||||
|
||||
TEST_1(m = b_sdp->sdp_media); TEST_1(!m->m_rejected);
|
||||
TEST(m->m_type, sdp_media_image);
|
||||
TEST(m->m_proto, sdp_proto_udptl);
|
||||
TEST_1(m->m_format);
|
||||
TEST_S(m->m_format->l_text, "t38");
|
||||
|
||||
TEST(soa_is_audio_active(a), SOA_ACTIVE_DISABLED);
|
||||
TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_DISABLED);
|
||||
|
||||
TEST_VOID(soa_terminate(a, NULL));
|
||||
TEST_VOID(soa_terminate(b, NULL));
|
||||
|
||||
TEST_VOID(soa_destroy(a));
|
||||
TEST_VOID(soa_destroy(b));
|
||||
|
||||
END();
|
||||
}
|
||||
|
||||
|
||||
int test_asynch_offer_answer(struct context *ctx)
|
||||
{
|
||||
BEGIN();
|
||||
|
@ -1568,6 +1721,8 @@ int main(int argc, char *argv[])
|
|||
retval |= test_soa_tags(ctx); SINGLE_FAILURE_CHECK();
|
||||
retval |= test_init(ctx, argv + i); SINGLE_FAILURE_CHECK();
|
||||
if (retval == 0) {
|
||||
retval |= test_media_replace2(ctx); SINGLE_FAILURE_CHECK();
|
||||
|
||||
retval |= test_params(ctx); SINGLE_FAILURE_CHECK();
|
||||
retval |= test_static_offer_answer(ctx); SINGLE_FAILURE_CHECK();
|
||||
retval |= test_codec_selection(ctx); SINGLE_FAILURE_CHECK();
|
||||
|
|
Loading…
Reference in New Issue