Hi all,

I'm sending a patch implementing the tag SOATAG_DELAYED_OFFER_ENABLE
to enable delayed offer (without using the payload kludge).

Hope this helps!

Best regards,

Paulo Pizarro

2010/8/3 Pekka Pessi <ppe...@gmail.com>:
> 2010/7/21 edson.gomes.leme <edson.gomes.l...@uol.com.br>:
>> Hi Pekka Pessi;
>>
>> a) Does the Sofia-SIP soa module support “Delayed Offer” ?
>
> Yes..
>
>> b) How can this call scenario be implemented with the soa module?
>>
>>         SOFIA-SIP (soa)
>>              A (UAC)                         B (UAS)
>>                 |                               |
>>                 |<----------  INVITE  ----------|
>>                 |                               |
>>                 |-------  100 Trying  --------->|
>>                 |-------  180 Ringing  -------->|
>>                 |                               |
>>                 |-------  200 (offer)  -------->|
>>                 |<------  ACK (answer)  --------|
>>                 |                               |
>
> You need nothing special (but the usual remote sdp tags in
> nua_i_invite are missing).
>
>> c) How can this call scenario be implemented with the soa module?
>>
>>        SOFIA-SIP (soa)
>>             A (UAC)                         B (UAS)
>>                |                               |
>>                |----------  INVITE  ---------->|
>>                |                               |
>>                |<-------  100 Trying  ---------|
>>                |<-------  180 Ringing  --------|
>>                |                               |
>>                |<-------  200 (offer)  --------|
>>                |------  ACK (answer)  -------->|
>>                |                               |
>
> Currently, this requires a kludge, you have to include an empty
> payload (I think SIPTAG_PAYLOAD_STR("") is ok) in nua_invite().
>
> --Pekka
>
> --
> Pekka.Pessi mail at nokia.com
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> Sofia-sip-devel mailing list
> Sofia-sip-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel
>
From b6bee18e2b1610f8333495131ea3656a1115168e Mon Sep 17 00:00:00 2001
From: Paulo Pizarro <paulo.piza...@gmail.com>
Date: Wed, 4 Aug 2010 16:46:38 -0300
Subject: [PATCH] Created the tag SOATAG_DELAYED_OFFER_ENABLE to enable delayed offer (without using the payload kludge)


Signed-off-by: Paulo Pizarro <paulo.piza...@gmail.com>
---
 libsofia-sip-ua/nua/nua_session.c           |    4 +-
 libsofia-sip-ua/soa/soa.c                   |   33 ++++++++++++++++++++++-----
 libsofia-sip-ua/soa/soa_tag.c               |   21 +++++++++++++++++
 libsofia-sip-ua/soa/sofia-sip/soa.h         |    2 +
 libsofia-sip-ua/soa/sofia-sip/soa_session.h |    2 +
 libsofia-sip-ua/soa/sofia-sip/soa_tag.h     |    6 +++++
 libsofia-sip-ua/soa/test_soa.c              |   15 ++++++++++++
 7 files changed, 75 insertions(+), 8 deletions(-)

diff --git a/libsofia-sip-ua/nua/nua_session.c b/libsofia-sip-ua/nua/nua_session.c
index ad3f97c..7b52aac 100644
--- a/libsofia-sip-ua/nua/nua_session.c
+++ b/libsofia-sip-ua/nua/nua_session.c
@@ -800,8 +800,8 @@ static int nua_invite_client_request(nua_client_request_t *cr,
   if (nh->nh_soa) {
     soa_init_offer_answer(nh->nh_soa);
 
-    if (sip->sip_payload)
-      offer_sent = 0;		/* XXX - kludge */
+    if (soa_is_delayed_offer(nh->nh_soa))
+      offer_sent = 0;
     else if (soa_generate_offer(nh->nh_soa, 0, NULL) < 0)
       return -1;
     else
diff --git a/libsofia-sip-ua/soa/soa.c b/libsofia-sip-ua/soa/soa.c
index de79e0f..2c501fd 100644
--- a/libsofia-sip-ua/soa/soa.c
+++ b/libsofia-sip-ua/soa/soa.c
@@ -389,8 +389,9 @@ void soa_base_deinit(soa_session_t *ss)
  * SOATAG_RTP_SORT(),
  * SOATAG_RTP_MISMATCH(),
  * SOATAG_SRTP_ENABLE(),
- * SOATAG_SRTP_CONFIDENTIALITY(), and
- * SOATAG_SRTP_INTEGRITY().
+ * SOATAG_SRTP_CONFIDENTIALITY(),
+ * SOATAG_SRTP_INTEGRITY(), and
+ * SOATAG_DELAYED_OFFER_ENABLE().
  */
 int soa_set_params(soa_session_t *ss, tag_type_t tag, tag_value_t value, ...)
 {
@@ -434,8 +435,9 @@ int soa_set_params(soa_session_t *ss, tag_type_t tag, tag_value_t value, ...)
  * SOATAG_RTP_SORT(),
  * SOATAG_RTP_MISMATCH(),
  * SOATAG_SRTP_ENABLE(),
- * SOATAG_SRTP_CONFIDENTIALITY(), and
- * SOATAG_SRTP_INTEGRITY().
+ * SOATAG_SRTP_CONFIDENTIALITY(),
+ * SOATAG_SRTP_INTEGRITY(), and
+ * SOATAG_DELAYED_OFFER_ENABLE().
  */
 int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
 {
@@ -449,6 +451,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
   int rtp_select, rtp_sort;
   int rtp_mismatch;
   int srtp_enable, srtp_confidentiality, srtp_integrity;
+  int delayed_offer_enable;
 
   af = ss->ss_af;
 
@@ -463,6 +466,8 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
   srtp_confidentiality = ss->ss_srtp_confidentiality;
   srtp_integrity = ss->ss_srtp_integrity;
 
+  delayed_offer_enable = ss->ss_delayed_offer_enable;
+
   caps_sdp = user_sdp = NONE;
   caps_sdp_str = user_sdp_str = NONE;
 
@@ -486,6 +491,8 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
 	      SOATAG_SRTP_CONFIDENTIALITY_REF(srtp_confidentiality),
 	      SOATAG_SRTP_INTEGRITY_REF(srtp_integrity),
 
+	      SOATAG_DELAYED_OFFER_ENABLE_REF(delayed_offer_enable),
+
 	      TAG_END());
 
   if (n <= 0)
@@ -534,6 +541,8 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
   srtp_confidentiality = srtp_confidentiality != 0;
   srtp_integrity = srtp_integrity != 0;
 
+  delayed_offer_enable = delayed_offer_enable != 0;
+
   change_session
     =  af != (int)ss->ss_af
     || rtp_select != (int)ss->ss_rtp_select
@@ -542,6 +551,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
     || srtp_enable != (int)ss->ss_srtp_enable
     || srtp_confidentiality != (int)ss->ss_srtp_confidentiality
     || srtp_integrity != (int)ss->ss_srtp_integrity
+    || delayed_offer_enable != (int)ss->ss_delayed_offer_enable
     ;
 
   ss->ss_af = (enum soa_af)af;
@@ -554,6 +564,8 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
   ss->ss_srtp_confidentiality = srtp_confidentiality;
   ss->ss_srtp_integrity = srtp_integrity;
 
+  ss->ss_delayed_offer_enable = delayed_offer_enable;
+
   if (!su_casematch(media_address, ss->ss_address)) {
     su_free(ss->ss_home, (void *)ss->ss_address);
     ss->ss_address = su_strdup(ss->ss_home, media_address);
@@ -647,8 +659,9 @@ int soa_get_params(soa_session_t const *ss,
  * SOATAG_RTP_SORT(),
  * SOATAG_RTP_MISMATCH(),
  * SOATAG_SRTP_ENABLE(),
- * SOATAG_SRTP_CONFIDENTIALITY(), and
- * SOATAG_SRTP_INTEGRITY().
+ * SOATAG_SRTP_CONFIDENTIALITY(),
+ * SOATAG_SRTP_INTEGRITY(), and
+ * SOATAG_DELAYED_OFFER_ENABLE().
  */
 int soa_base_get_params(soa_session_t const *ss, tagi_t *tags)
 {
@@ -679,6 +692,8 @@ int soa_base_get_params(soa_session_t const *ss, tagi_t *tags)
 	       SOATAG_SRTP_CONFIDENTIALITY(ss->ss_srtp_confidentiality),
 	       SOATAG_SRTP_INTEGRITY(ss->ss_srtp_integrity),
 
+	       SOATAG_DELAYED_OFFER_ENABLE(ss->ss_delayed_offer_enable),
+
 	       TAG_END());
 
   return n;
@@ -1874,6 +1889,12 @@ int soa_is_remote_chat_active(soa_session_t const *ss)
   return ma;
 }
 
+/** Return true if delayed offer has been activated. */
+int soa_is_delayed_offer(soa_session_t const *ss)
+{
+  return ss ? ss->ss_delayed_offer_enable : 0;
+}
+
 /* ======================================================================== */
 /* Methods used by soa instances */
 
diff --git a/libsofia-sip-ua/soa/soa_tag.c b/libsofia-sip-ua/soa/soa_tag.c
index b251035..d0b654e 100644
--- a/libsofia-sip-ua/soa/soa_tag.c
+++ b/libsofia-sip-ua/soa/soa_tag.c
@@ -647,3 +647,24 @@ tag_typedef_t soatag_hold = STRTAG_TYPEDEF(hold);
 tag_typedef_t soatag_ordered_user = BOOLTAG_TYPEDEF(ordered_user);
 
 tag_typedef_t soatag_reuse_rejected = BOOLTAG_TYPEDEF(reuse_rejected);
+
+/*...@def SOATAG_DELAYED_OFFER_ENABLE(x)
+ *
+ * Enable delayed offer
+ *
+ * @par Used with
+ *    soa_set_params(), soa_get_params(), soa_get_paramlist() \n
+ *
+ * @par Parameter type
+ *    boolean (int)
+ *
+ * @par Values
+ *    @c !=0 enable \n
+ *    @c 0 disable
+ *
+ * Corresponding tag taking reference parameter is
+ * SOATAG_DELAYED_OFFER_ENABLE_REF()
+ *
+ */
+tag_typedef_t soatag_delayed_offer_enable = BOOLTAG_TYPEDEF(delayed_offer_enable);
+
diff --git a/libsofia-sip-ua/soa/sofia-sip/soa.h b/libsofia-sip-ua/soa/sofia-sip/soa.h
index 9330005..de4c4db 100644
--- a/libsofia-sip-ua/soa/sofia-sip/soa.h
+++ b/libsofia-sip-ua/soa/sofia-sip/soa.h
@@ -146,6 +146,8 @@ SOFIAPUBFUN int soa_is_remote_video_active(soa_session_t const *ss);
 SOFIAPUBFUN int soa_is_remote_image_active(soa_session_t const *ss);
 SOFIAPUBFUN int soa_is_remote_chat_active(soa_session_t const *ss);
 
+SOFIAPUBFUN int soa_is_delayed_offer(soa_session_t const *ss);
+
 SOFIAPUBFUN int soa_tag_filter(tagi_t const *f, tagi_t const *t);
 
 SOFIA_END_DECLS
diff --git a/libsofia-sip-ua/soa/sofia-sip/soa_session.h b/libsofia-sip-ua/soa/sofia-sip/soa_session.h
index 8691156..099414d 100644
--- a/libsofia-sip-ua/soa/sofia-sip/soa_session.h
+++ b/libsofia-sip-ua/soa/sofia-sip/soa_session.h
@@ -225,6 +225,8 @@ struct soa_session
     ss_srtp_confidentiality:1,
     ss_srtp_integrity:1;
 
+  unsigned  ss_delayed_offer_enable:1;
+
   unsigned :0;			/* Pad */
 
   int             ss_wcode;	/**< Warning code from last media operation */
diff --git a/libsofia-sip-ua/soa/sofia-sip/soa_tag.h b/libsofia-sip-ua/soa/sofia-sip/soa_tag.h
index 7c31ac0..677917f 100644
--- a/libsofia-sip-ua/soa/sofia-sip/soa_tag.h
+++ b/libsofia-sip-ua/soa/sofia-sip/soa_tag.h
@@ -258,6 +258,12 @@ SOFIAPUBVAR tag_typedef_t soatag_reuse_rejected;
   soatag_reuse_rejected_ref, tag_bool_vr(&(x))
 SOFIAPUBVAR tag_typedef_t soatag_reuse_rejected_ref;
 
+#define SOATAG_DELAYED_OFFER_ENABLE(x)  soatag_delayed_offer_enable, tag_bool_v(x)
+SOFIAPUBVAR tag_typedef_t soatag_delayed_offer_enable;
+
+#define SOATAG_DELAYED_OFFER_ENABLE_REF(x) soatag_delayed_offer_enable_ref, tag_bool_vr(&(x))
+SOFIAPUBVAR tag_typedef_t soatag_delayed_offer_enable_ref;
+
 SOFIA_END_DECLS
 
 #endif /* SOA_TAG_H */
diff --git a/libsofia-sip-ua/soa/test_soa.c b/libsofia-sip-ua/soa/test_soa.c
index ff43caa..0406a1a 100644
--- a/libsofia-sip-ua/soa/test_soa.c
+++ b/libsofia-sip-ua/soa/test_soa.c
@@ -339,6 +339,7 @@ int test_params(struct context *ctx)
   int rtp_select, rtp_sort;
   int rtp_mismatch;
   int srtp_enable, srtp_confidentiality, srtp_integrity;
+  int delayed_offer_enable;
   soa_session_t *a = ctx->a, *b = ctx->b;
 
   n = soa_set_params(a, TAG_END()); TEST(n, 0);
@@ -350,6 +351,7 @@ int test_params(struct context *ctx)
 
   rtp_select = -1, rtp_sort = -1, rtp_mismatch = -1;
   srtp_enable = -1, srtp_confidentiality = -1, srtp_integrity = -1;
+  delayed_offer_enable = -1;
 
   TEST(soa_get_params(a,
 		      SOATAG_AF_REF(af),
@@ -363,6 +365,9 @@ int test_params(struct context *ctx)
 		      SOATAG_SRTP_ENABLE_REF(srtp_enable),
 		      SOATAG_SRTP_CONFIDENTIALITY_REF(srtp_confidentiality),
 		      SOATAG_SRTP_INTEGRITY_REF(srtp_integrity),
+
+		      SOATAG_DELAYED_OFFER_ENABLE_REF(delayed_offer_enable),
+
 		      TAG_END()),
        9);
   TEST(af, SOA_AF_ANY);
@@ -373,7 +378,9 @@ int test_params(struct context *ctx)
   TEST(rtp_mismatch, 0);
   TEST(srtp_enable, 0);
   TEST(srtp_confidentiality, 0);
+  TEST(rtp_mismatch, 0);
   TEST(srtp_integrity, 0);
+  TEST(delayed_offer_enable, 0);
 
   TEST(soa_set_params(a,
 		      SOATAG_AF(SOA_AF_IP4_IP6),
@@ -388,6 +395,8 @@ int test_params(struct context *ctx)
 		      SOATAG_SRTP_CONFIDENTIALITY(1),
 		      SOATAG_SRTP_INTEGRITY(1),
 
+		      SOATAG_DELAYED_OFFER_ENABLE(1),
+
 		      TAG_END()),
        9);
   TEST(soa_get_params(a,
@@ -402,6 +411,9 @@ int test_params(struct context *ctx)
 		      SOATAG_SRTP_ENABLE_REF(srtp_enable),
 		      SOATAG_SRTP_CONFIDENTIALITY_REF(srtp_confidentiality),
 		      SOATAG_SRTP_INTEGRITY_REF(srtp_integrity),
+
+		      SOATAG_DELAYED_OFFER_ENABLE_REF(delayed_offer_enable),
+
 		      TAG_END()),
        9);
   TEST(af, SOA_AF_IP4_IP6);
@@ -413,6 +425,7 @@ int test_params(struct context *ctx)
   TEST(srtp_enable, 1);
   TEST(srtp_confidentiality, 1);
   TEST(srtp_integrity, 1);
+  TEST(delayed_offer_enable, 1);
 
   /* Restore defaults */
   TEST(soa_set_params(a,
@@ -428,6 +441,8 @@ int test_params(struct context *ctx)
 		      SOATAG_SRTP_CONFIDENTIALITY(0),
 		      SOATAG_SRTP_INTEGRITY(0),
 
+		      SOATAG_DELAYED_OFFER_ENABLE(0),
+
 		      TAG_END()),
        9);
 
-- 
1.7.0.4

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to