summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-06-13 22:22:54 +0000
committerBenny Prijono <bennylp@teluu.com>2006-06-13 22:22:54 +0000
commit3ce16e8a22d2e8e11a749902c621673f87f187be (patch)
tree26ffecf0b7f8a9b67900630dfd592697cc547f7b /pjmedia
parent26af83c5f17911357c683761253a7b25993f321f (diff)
Added pjmedia_sdp_neg_was_aswer_remote()
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@501 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/include/pjmedia/sdp_neg.h16
-rw-r--r--pjmedia/src/pjmedia/sdp_neg.c18
2 files changed, 32 insertions, 2 deletions
diff --git a/pjmedia/include/pjmedia/sdp_neg.h b/pjmedia/include/pjmedia/sdp_neg.h
index 55c74401..d2d977e0 100644
--- a/pjmedia/include/pjmedia/sdp_neg.h
+++ b/pjmedia/include/pjmedia/sdp_neg.h
@@ -392,6 +392,22 @@ PJ_DECL(pj_status_t)
pjmedia_sdp_neg_get_active_remote( pjmedia_sdp_neg *neg,
const pjmedia_sdp_session **remote);
+
+/**
+ * Determine whether remote sent answer (as opposed to offer) on the
+ * last negotiation. This function can only be called in state
+ * PJMEDIA_SDP_NEG_STATE_DONE.
+ *
+ * @param neg The SDP negotiator instance.
+ *
+ * @return Non-zero if it was remote who sent answer,
+ * otherwise zero if it was local who supplied
+ * answer.
+ */
+PJ_DECL(pj_bool_t)
+pjmedia_sdp_neg_was_answer_remote(pjmedia_sdp_neg *neg);
+
+
/**
* Get the current remote SDP offer or answer. Application can only
* call this function in state PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER or
diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c
index dd954305..41383d6d 100644
--- a/pjmedia/src/pjmedia/sdp_neg.c
+++ b/pjmedia/src/pjmedia/sdp_neg.c
@@ -32,6 +32,7 @@ struct pjmedia_sdp_neg
{
pjmedia_sdp_neg_state state; /**< Negotiator state. */
pj_bool_t has_remote_answer;
+ pj_bool_t answer_was_remote;
pjmedia_sdp_session *initial_sdp, /**< Initial local SDP */
*active_local_sdp, /**< Currently active local SDP. */
@@ -174,6 +175,16 @@ pjmedia_sdp_neg_get_active_remote( pjmedia_sdp_neg *neg,
return PJ_SUCCESS;
}
+
+PJ_DEF(pj_bool_t)
+pjmedia_sdp_neg_was_answer_remote(pjmedia_sdp_neg *neg)
+{
+ PJ_ASSERT_RETURN(neg, PJ_FALSE);
+
+ return neg->answer_was_remote;
+}
+
+
PJ_DEF(pj_status_t)
pjmedia_sdp_neg_get_neg_remote( pjmedia_sdp_neg *neg,
const pjmedia_sdp_session **remote)
@@ -274,7 +285,7 @@ pjmedia_sdp_neg_set_remote_answer( pj_pool_t *pool,
/* We're ready to negotiate. */
neg->state = PJMEDIA_SDP_NEG_STATE_WAIT_NEGO;
- neg->has_remote_answer = 1;
+ neg->has_remote_answer = PJ_TRUE;
neg->neg_remote_sdp = pjmedia_sdp_session_clone(pool, remote);
return PJ_SUCCESS;
@@ -917,9 +928,12 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_negotiate( pj_pool_t *pool,
/* State is DONE regardless */
neg->state = PJMEDIA_SDP_NEG_STATE_DONE;
+ /* Save state */
+ neg->answer_was_remote = neg->has_remote_answer;
+
/* Clear temporary SDP */
neg->neg_local_sdp = neg->neg_remote_sdp = NULL;
- neg->has_remote_answer = 0;
+ neg->has_remote_answer = PJ_FALSE;
return status;
}