Wed Jan 23 10:07:30 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com>
* soa_static.c: fixed signedness error Shall I unpull this patch? (8/128) [ynWvpxqadjk], or ? for help: y Tue Jan 22 11:35:44 EST 2008 Pekka.Pessi@nokia.com * test_soa.c: testing hold with inactive, offered mode and setting remote activity flags while in hold Shall I unpull this patch? (15/128) [ynWvpxqadjk], or ? for help: y Mon Jan 21 14:08:08 EST 2008 Pekka.Pessi@nokia.com * soa_static.c: soa_sdp_mode_set() now includes wanted media state in offer The wanted media state is based on original user SDP and SOATAG_HOLD() content. Removed soa_sdp_mode_set_is_needed(), using dry-run parameter instead. Shall I unpull this patch? (20/128) [ynWvpxqadjk], or ? for help: y Thu Jan 17 11:40:46 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * soa_static.c: cleaned inactive hold, added tests Shall I unpull this patch? (31/128) [ynWvpxqadjk], or ? for help: y Fri Jan 11 09:15:18 EST 2008 Pekka.Pessi@nokia.com * soa_tag.c: documented SOATAG_HOLD() inactive mode Shall I unpull this patch? (46/128) [ynWvpxqadjk], or ? for help: y Fri Jan 11 09:12:01 EST 2008 Bernhard Suttner <suttner at comdasys.com> * Using # in SOATAG_HOLD to set media as inactive instead of sendonly Shall I unpull this patch? (47/128) [ynWvpxqadjk], or ? for help: y revert a few more patches from sofia-sip darcs git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7361 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
dd3fb97612
commit
d3e6109b34
|
@ -1 +1 @@
|
|||
Fri Jan 25 12:44:19 EST 2008
|
||||
Fri Jan 25 14:56:46 EST 2008
|
||||
|
|
|
@ -974,28 +974,58 @@ int soa_sdp_reject(su_home_t *home,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/** Update mode within session.
|
||||
*
|
||||
* @sa soatag_hold
|
||||
*
|
||||
* @retval 1 if session was changed (or to be changed, if @a dryrun is nonzero)
|
||||
*/
|
||||
/** Check if @a session mode should be changed. */
|
||||
static
|
||||
int soa_sdp_mode_set(sdp_session_t const *user,
|
||||
int const *s2u,
|
||||
sdp_session_t *session,
|
||||
int soa_sdp_mode_set_is_needed(sdp_session_t const *session,
|
||||
sdp_session_t const *remote,
|
||||
char const *hold,
|
||||
int dryrun)
|
||||
char const *hold)
|
||||
{
|
||||
sdp_media_t const *sm, *rm, *rm_next;
|
||||
int hold_all;
|
||||
sdp_mode_t recv_mode;
|
||||
|
||||
SU_DEBUG_7(("soa_sdp_mode_set_is_needed(%p, %p, \"%s\"): called\n",
|
||||
(void *)session, (void *)remote, hold ? hold : ""));
|
||||
|
||||
if (!session )
|
||||
return 0;
|
||||
|
||||
hold_all = str0cmp(hold, "*") == 0;
|
||||
|
||||
rm = remote ? remote->sdp_media : NULL, rm_next = NULL;
|
||||
|
||||
for (sm = session->sdp_media; sm; sm = sm->m_next, rm = rm_next) {
|
||||
rm_next = rm ? rm->m_next : NULL;
|
||||
|
||||
if (sm->m_rejected)
|
||||
continue;
|
||||
|
||||
if (rm) {
|
||||
/* Mode bits do not match */
|
||||
if (((rm->m_mode & sdp_recvonly) == sdp_recvonly)
|
||||
!= ((sm->m_mode & sdp_sendonly) == sdp_sendonly))
|
||||
return 1;
|
||||
}
|
||||
|
||||
recv_mode = sm->m_mode & sdp_recvonly;
|
||||
if (recv_mode && hold &&
|
||||
(hold_all || strcasestr(hold, sm->m_type_name)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/** Update mode within session */
|
||||
static
|
||||
int soa_sdp_mode_set(sdp_session_t *session,
|
||||
sdp_session_t const *remote,
|
||||
char const *hold)
|
||||
{
|
||||
sdp_media_t *sm;
|
||||
sdp_media_t const *rm, *rm_next, *um;
|
||||
int retval = 0, i, j;
|
||||
sdp_media_t const *rm, *rm_next;
|
||||
int hold_all;
|
||||
int inactive_all;
|
||||
int inactive = 0;
|
||||
char const *hold_media = NULL;
|
||||
sdp_mode_t send_mode, recv_mode;
|
||||
|
||||
SU_DEBUG_7(("soa_sdp_mode_set(%p, %p, \"%s\"): called\n",
|
||||
|
@ -1007,58 +1037,25 @@ int soa_sdp_mode_set(sdp_session_t const *user,
|
|||
rm = remote ? remote->sdp_media : NULL, rm_next = NULL;
|
||||
|
||||
hold_all = str0cmp(hold, "*") == 0;
|
||||
inactive_all = str0cmp(hold, "#") == 0;
|
||||
|
||||
i = 0;
|
||||
|
||||
for (sm = session->sdp_media; sm; sm = sm->m_next, rm = rm_next, i++) {
|
||||
for (sm = session->sdp_media; sm; sm = sm->m_next, rm = rm_next) {
|
||||
rm_next = rm ? rm->m_next : NULL;
|
||||
inactive = 0;
|
||||
|
||||
if (sm->m_rejected)
|
||||
continue;
|
||||
|
||||
assert(s2u);
|
||||
|
||||
for (j = 0, um = user->sdp_media; j != s2u[i]; um = um->m_next, j++)
|
||||
assert(um);
|
||||
assert(um);
|
||||
|
||||
send_mode = um->m_mode & sdp_sendonly;
|
||||
send_mode = sdp_sendonly;
|
||||
if (rm)
|
||||
send_mode = (rm->m_mode & sdp_recvonly) ? sdp_sendonly : 0;
|
||||
|
||||
recv_mode = um->m_mode & sdp_recvonly;
|
||||
|
||||
if (rm && rm->m_mode == sdp_inactive) {
|
||||
send_mode = recv_mode = 0;
|
||||
}
|
||||
else if (inactive_all) {
|
||||
send_mode = recv_mode = 0;
|
||||
}
|
||||
else if (hold_all) {
|
||||
recv_mode = sm->m_mode & sdp_recvonly;
|
||||
if (recv_mode && hold && (hold_all || strcasestr(hold, sm->m_type_name)))
|
||||
recv_mode = 0;
|
||||
}
|
||||
else if (hold && (hold_media = strcasestr(hold, sm->m_type_name))) {
|
||||
recv_mode = 0;
|
||||
hold_media += strlen(sm->m_type_name);
|
||||
hold_media += strspn(hold_media, " \t");
|
||||
if (hold_media[0] == '=') {
|
||||
hold_media += strspn(hold, " \t");
|
||||
if (strncasecmp(hold_media, "inactive", strlen("inactive")) == 0)
|
||||
recv_mode = send_mode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (sm->m_mode != (unsigned)(recv_mode | send_mode))
|
||||
retval = 1;
|
||||
|
||||
if (!dryrun) {
|
||||
sm->m_mode = recv_mode | send_mode;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum offer_answer_action {
|
||||
|
@ -1216,22 +1213,16 @@ static int offer_answer_step(soa_session_t *ss,
|
|||
|
||||
/* Step D: Set media mode bits */
|
||||
switch (action) {
|
||||
int const *s2u_;
|
||||
|
||||
case generate_offer:
|
||||
case generate_answer:
|
||||
case process_answer:
|
||||
s2u_ = s2u;
|
||||
|
||||
if (!s2u_) s2u_ = sss->sss_s2u;
|
||||
|
||||
if (soa_sdp_mode_set(user, s2u_, local, remote, ss->ss_hold, 1)) {
|
||||
if (soa_sdp_mode_set_is_needed(local, remote, ss->ss_hold)) {
|
||||
if (local != local0) {
|
||||
*local0 = *local, local = local0;
|
||||
DUP_LOCAL(local);
|
||||
}
|
||||
|
||||
soa_sdp_mode_set(user, s2u_, local, remote, ss->ss_hold, 0);
|
||||
soa_sdp_mode_set(local, remote, ss->ss_hold);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -585,22 +585,12 @@ tag_typedef_t soatag_srtp_integrity = BOOLTAG_TYPEDEF(srtp_integrity);
|
|||
|
||||
/**@def SOATAG_HOLD(x)
|
||||
*
|
||||
* Hold media stream or streams.
|
||||
*
|
||||
* The hold media stream will have the attribute a=sendonly (meaning that
|
||||
* some hold announcements or pause music is sent to the held party but that
|
||||
* the held party should not generate any media) or a=inactive (meaning that
|
||||
* no media is sent).
|
||||
*
|
||||
* When putting a SIP session on hold with sendonly, the application can
|
||||
* include, e.g., SOATAG_HOLD("audio") or SOATAG_HOLD("video") or
|
||||
* SOATAG_HOLD("audio, video") or SOATAG_HOLD("*") as @soa parameters. When
|
||||
* using inactive instead, the application should use "#" or
|
||||
* "audio=inactive" instead. When resuming the session, application should
|
||||
* include the tag SOATAG_HOLD(NULL).
|
||||
*
|
||||
* Note that last SOATAG_HOLD() in the tag list will override the
|
||||
* SOATAG_HOLD() tags before it.
|
||||
* Hold media stream or streams. When putting a SIP session on hold, the
|
||||
* application can include, e.g., SOATAG_HOLD("audio") or
|
||||
* SOATAG_HOLD("video") or SOATAG_HOLD("audio, video") or SOATAG_HOLD("*")
|
||||
* as @soa parameters. When resuming the session, it can include
|
||||
* SOATAG_HOLD(NULL). Note that last SOATAG_HOLD() in the tag list will
|
||||
* override the SOATAG_HOLD() tags before it.
|
||||
*
|
||||
* @par Used with
|
||||
* soa_set_params(), soa_get_params(), soa_get_paramlist() \n
|
||||
|
|
|
@ -451,67 +451,20 @@ int test_static_offer_answer(struct context *ctx)
|
|||
TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDONLY);
|
||||
TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDONLY);
|
||||
|
||||
/* 'A' will put call inactive */
|
||||
offer = NONE;
|
||||
TEST(soa_set_params(a, SOATAG_HOLD("#"), TAG_END()), 1);
|
||||
|
||||
TEST(soa_generate_offer(a, 1, test_completed), 0);
|
||||
TEST(soa_get_local_sdp(a, NULL, &offer, &offerlen), 1);
|
||||
TEST_1(offer != NULL && offer != NONE);
|
||||
TEST_1(strstr(offer, "a=inactive"));
|
||||
TEST(soa_set_remote_sdp(b, 0, offer, offerlen), 1);
|
||||
TEST(soa_generate_answer(b, test_completed), 0);
|
||||
TEST_1(soa_is_complete(b));
|
||||
TEST(soa_activate(b, NULL), 0);
|
||||
TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
|
||||
TEST_1(answer != NULL && answer != NONE);
|
||||
TEST_1(strstr(answer, "a=inactive"));
|
||||
TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
|
||||
TEST(soa_process_answer(a, test_completed), 0);
|
||||
TEST(soa_activate(a, NULL), 0);
|
||||
|
||||
TEST(soa_is_audio_active(a), SOA_ACTIVE_INACTIVE);
|
||||
TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_INACTIVE);
|
||||
|
||||
/* B will send an offer to A, but there is no change in O/A status */
|
||||
TEST(soa_generate_offer(b, 1, test_completed), 0);
|
||||
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);
|
||||
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);
|
||||
TEST(soa_is_audio_active(a), SOA_ACTIVE_INACTIVE);
|
||||
TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_INACTIVE);
|
||||
TEST_1(soa_is_complete(a));
|
||||
TEST(soa_activate(a, NULL), 0);
|
||||
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);
|
||||
TEST(soa_set_remote_sdp(b, 0, answer, -1), 1);
|
||||
TEST(soa_process_answer(b, test_completed), 0);
|
||||
TEST(soa_activate(b, NULL), 0);
|
||||
|
||||
|
||||
TEST(soa_is_audio_active(b), SOA_ACTIVE_INACTIVE);
|
||||
TEST(soa_is_remote_audio_active(b), SOA_ACTIVE_INACTIVE);
|
||||
|
||||
/* 'A' will release hold. */
|
||||
TEST(soa_set_params(a, SOATAG_HOLD(NULL), TAG_END()), 1);
|
||||
|
||||
TEST(soa_generate_offer(a, 1, test_completed), 0);
|
||||
TEST(soa_get_local_sdp(a, NULL, &offer, &offerlen), 1);
|
||||
TEST_1(offer != NULL && offer != NONE);
|
||||
TEST_1(!strstr(offer, "a=sendonly") && !strstr(offer, "a=inactive"));
|
||||
TEST_1(!strstr(offer, "a=sendonly"));
|
||||
TEST(soa_set_remote_sdp(b, 0, offer, offerlen), 1);
|
||||
TEST(soa_generate_answer(b, test_completed), 0);
|
||||
TEST_1(soa_is_complete(b));
|
||||
TEST(soa_activate(b, NULL), 0);
|
||||
TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
|
||||
TEST_1(answer != NULL && answer != NONE);
|
||||
TEST_1(!strstr(answer, "a=recvonly") && !strstr(answer, "a=inactive"));
|
||||
TEST_1(!strstr(answer, "a=recvonly"));
|
||||
TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
|
||||
TEST(soa_process_answer(a, test_completed), 0);
|
||||
TEST(soa_activate(a, NULL), 0);
|
||||
|
|
Loading…
Reference in New Issue