summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-02-21 23:41:33 +0000
committerBenny Prijono <bennylp@teluu.com>2006-02-21 23:41:33 +0000
commite77ee9b77d5813b3ebbf2f29ac5a005de23c6fa0 (patch)
tree31e8a720c1c7c6cc2bd9abc96e71c751072c7c24
parent8f621792f7e321df325377487ea8193844044d07 (diff)
Added has_local_answer(), and more relaxed negotiation
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@207 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/include/pjmedia/sdp_neg.h13
-rw-r--r--pjmedia/src/pjmedia/sdp_neg.c19
2 files changed, 32 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia/sdp_neg.h b/pjmedia/include/pjmedia/sdp_neg.h
index 5c2e564f..c3cb14e7 100644
--- a/pjmedia/include/pjmedia/sdp_neg.h
+++ b/pjmedia/include/pjmedia/sdp_neg.h
@@ -532,6 +532,19 @@ pjmedia_sdp_neg_set_local_answer( pj_pool_t *pool,
/**
+ * Call this function when the negotiator is in PJMEDIA_SDP_NEG_STATE_WAIT_NEGO
+ * state to see if it was local who is answering the offer (instead of
+ * remote).
+ *
+ * @param neg The negotiator.
+ *
+ * @return PJ_TRUE if it is local is answering an offer, PJ_FALSE
+ * if remote has answered local offer.
+ */
+PJ_DECL(pj_bool_t) pjmedia_sdp_neg_has_local_answer(pjmedia_sdp_neg *neg);
+
+
+/**
* Negotiate local and remote answer. Before calling this function, the
* SDP negotiator must be in PJMEDIA_SDP_NEG_STATE_WAIT_NEGO state.
* After calling this function, the negotiator state will move to
diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c
index 59d0f15e..91eeec10 100644
--- a/pjmedia/src/pjmedia/sdp_neg.c
+++ b/pjmedia/src/pjmedia/sdp_neg.c
@@ -329,6 +329,13 @@ pjmedia_sdp_neg_set_local_answer( pj_pool_t *pool,
return PJ_SUCCESS;
}
+PJ_DEF(pj_bool_t) pjmedia_sdp_neg_has_local_answer(pjmedia_sdp_neg *neg)
+{
+ pj_assert(neg && neg->state==PJMEDIA_SDP_NEG_STATE_WAIT_NEGO);
+ return !neg->has_remote_answer;
+}
+
+
/* Swap string. */
static void str_swap(pj_str_t *str1, pj_str_t *str2)
{
@@ -693,6 +700,7 @@ static pj_bool_t match_offer(pj_pool_t *pool,
}
/* See if all types of offer can be matched. */
+#if 0
if ((offer_has_codec && !found_matching_codec) ||
(offer_has_telephone_event && !found_matching_telephone_event) ||
(offer_has_other && !found_matching_other))
@@ -700,6 +708,16 @@ static pj_bool_t match_offer(pj_pool_t *pool,
/* Some of the payload in the offer has no matching local sdp */
return PJ_FALSE;
}
+#else
+ PJ_TODO(FULL_MATCHING_WITH_TELEPHONE_EVENTS);
+ if (!found_matching_codec &&
+ !found_matching_telephone_event &&
+ !found_matching_other)
+ {
+ /* Some of the payload in the offer has no matching local sdp */
+ return PJ_FALSE;
+ }
+#endif
/* Seems like everything is in order.
* Build the answer by cloning from local media, but rearrange the payload
@@ -838,6 +856,7 @@ static pj_status_t create_answer( pj_pool_t *pool,
*p_answer = answer;
return has_active ? PJ_SUCCESS : PJMEDIA_SDPNEG_ENOMEDIA;
+ //return PJ_SUCCESS;
}
/* The best bit: SDP negotiation function! */