Cesmm / doubango

Automatically exported from code.google.com/p/doubango
0 stars 0 forks source link

When 100rel is disabled, don't advertise PRACK as an allowed method #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. If 100rel support is disabled (PRACK)
2.
3.

What is the expected output? What do you see instead?

Currently even if 100rel support is not enabled, PRACK is advertised as being 
supported. Here is a proposed patch

Index: include/tinysip/headers/tsip_header_Allow.h
===================================================================
--- include/tinysip/headers/tsip_header_Allow.h (revision previous)
+++ include/tinysip/headers/tsip_header_Allow.h (revision new)
@@ -36,6 +36,7 @@
 TSIP_BEGIN_DECLS

 #define TSIP_HEADER_ALLOW_DEFAULT      "ACK, BYE, CANCEL, INVITE, MESSAGE, NOTIFY, OPTIONS, PRACK, REFER, UPDATE"
+#define TSIP_HEADER_ALLOW_NOPRACK      "ACK, BYE, CANCEL, INVITE, MESSAGE, 
NOTIFY, OPTIONS, REFER, UPDATE"
 #define TSIP_HEADER_STR                            "Allow:"TSIP_HEADER_ALLOW_DEFAULT"\r\n"

 ///////////////////////////////////////////////////////////////////////////////
/////////////////////
Index: src/dialogs/tsip_dialog_invite.c
===================================================================
--- src/dialogs/tsip_dialog_invite.c    (revision previous)
+++ src/dialogs/tsip_dialog_invite.c    (revision new)
@@ -1135,10 +1135,17 @@
                        }

                        /* Add Allow header */
-                       tsip_message_add_headers(response,
+                       if(self->supported._100rel){
+                               tsip_message_add_headers(response,
                                                TSIP_HEADER_DUMMY_VA_ARGS("Allow", TSIP_HEADER_ALLOW_DEFAULT),
                                                tsk_null
                                        );
+                       } else {
+                               tsip_message_add_headers(response,
+                                               
TSIP_HEADER_DUMMY_VA_ARGS("Allow", TSIP_HEADER_ALLOW_NOPRACK),
+                                               tsk_null
+                                       );
+                       }
                }

                ret = tsip_dialog_response_send(TSIP_DIALOG(self), response);
What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by saket...@gmail.com on 14 Oct 2010 at 12:55

GoogleCodeExporter commented 9 years ago

Original comment by boss...@yahoo.fr on 14 Oct 2010 at 2:27

GoogleCodeExporter commented 9 years ago
From section 11 of RFC 3312
  The mapping of offers and answers to SIP requests and responses is
   performed following the rules given in [5]. Therefore, a user agent
   including preconditions in the SDP MUST support the PRACK and UPDATE
   methods. Consequently, it MUST include the "100rel" [7] tag in the
   Supported header field and SHOULD include an Allow header field with
   the "UPDATE" tag [5].

I just noticed in tinySIP/src/dialogs/tsip_dialog_invite.client.c that 
preconditions and 100 rel are being handled independently even though support 
for preconditions
requires 100rel support. So here is another proposed patch

Index: src/dialogs/tsip_dialog_invite.client.c
===================================================================
--- src/dialogs/tsip_dialog_invite.client.c     (revision previous)
+++ src/dialogs/tsip_dialog_invite.client.c     (revision new)
@@ -157,20 +157,25 @@
                self->supported.timer = tsk_true;
        }

+       /* 100rel */
+       self->supported._100rel = TSIP_DIALOG_GET_SS(self)->media.enable_100rel;

+
        /* QoS
        * One Voice Profile - 5.4.1 SIP Precondition Considerations
        * The UE shall use the Supported header, and not the Require header, to
indicate the support of precondition in
        * accordance with Section 5.1.3.1 of 3GPP TS 24.229.
        */
+if (self->supported._100rel) {
        self->qos.type = TSIP_DIALOG_GET_SS(self)->media.qos.type;
        self->qos.strength = TSIP_DIALOG_GET_SS(self)->media.qos.strength;
        tmedia_session_mgr_set_qos(self->msession_mgr, self->qos.type, self->qos
.strength);
        self->supported.precondition = (self->qos.strength == tmedia_qos_strengt
h_optional);
        self->require.precondition = (self->qos.strength == tmedia_qos_strength_
mandatory);
+} else {
+       self->qos.type = tmedia_qos_stype_none;
+       self->qos.strength = tmedia_qos_strength_none;
+}

-       /* 100rel */
-       self->supported._100rel = TSIP_DIALOG_GET_SS(self)->media.enable_100rel;

-
        /* send the request */
        ret = send_INVITE(self, tsk_false);

Original comment by saket...@gmail.com on 14 Oct 2010 at 10:41