bugThe eXtended osip library - Bugs: bug #54624, after called...

 
 

bug #54624: after called eXosip_call_build_prack, local_cseq not increased

Submitter:  tanhuacheng <tanhuacheng>
Submitted:  Thu 06 Sep 2018 07:12:42 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  aymeric
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 06 Sep 2018 02:18:38 PM UTC, comment #11: 

thanks, it seems great.
i would test it later, but i currently use the released version(5.0.0), i need checkout to master first.

tanhuacheng <tanhuacheng>
Thu 06 Sep 2018 01:46:12 PM UTC, comment #10: 

Hi,

Tks again...

I have improved again. Can you check the newer code?

http://git.savannah.nongnu.org/cgit/exosip.git/commit/?id=a4ac92d4a6f6ffe488ca3adcdfeb0a10468a8a86

I think the newer patch will support both:
1/ several PRACK being sent to same user.
2/ several PRACK being sent to different users.

Tks!
Aymeric

Aymeric MOIZARD <aymeric>
Group administrator
Thu 06 Sep 2018 01:45:43 PM UTC, comment #9: 

and if we received another 1xx respone with higher RSeq from the same UAS, we must send a new PRACK. then we call eXosip_call_build_prack, but the new generated PRACK always has cseq equal to the origin request(that is INVITE)'s cseq + 1, we expect the cseq is incremental.

by the way, about the previos comment use the word "UAC" is a fault, it should be "UAS"

tanhuacheng <tanhuacheng>
Thu 06 Sep 2018 12:19:26 PM UTC, comment #8: 

yes, i see it. but there is another issue here, with your patch we can only build the PRACK for the first received UAC's 1xx respone, if we received another UAC's 1xx respone, that is, with different "to tag", then this function return OSIP_WRONG_STATE on line 1069.

this could happen because of a server may fork our INVITE to many UAs

tanhuacheng <tanhuacheng>
Thu 06 Sep 2018 12:07:49 PM UTC, comment #7: 

Please take a look at the patch I have made and commited.

I think it's easier and complete.

http://git.savannah.nongnu.org/cgit/exosip.git/commit/?id=b7992f6e3aa000377f93fed8e296a628dd891d97

Let me know!

Aymeric MOIZARD <aymeric>
Group administrator
Thu 06 Sep 2018 11:49:47 AM UTC, comment #6: 

what! reverse again!

--- ../../eXcall_api.c 2018-09-06 18:59:45.736442832 +0800
+++ libexosip2-5.0.0/src/eXcall_api.c 2018-09-06 18:59:49.612226998 +0800
@@ -1060,7 +1060,9 @@
 
   old_prack_tr = (osip_transaction_t*)osip_list_get_first(jd->d_out_trs, &it);
   while (old_prack_tr != NULL) {
-    if (old_prack_tr != NULL && old_prack_tr->orig_request != NULL && 0 == osip_strcasecmp (old_prack_tr->orig_request->sip_method, "PRACK")) {
+    if (old_prack_tr->orig_request != NULL && 0 == osip_strcasecmp (old_prack_tr->orig_request->sip_method, "PRACK") &&
+        OSIP_SUCCESS == osip_to_tag_match(old_prack_tr->orig_request->to, response1xx->to))
+    {
       osip_header_t *rack_header = NULL;
 
       osip_message_header_get_byname (old_prack_tr->orig_request, "RAck", 0, &rack_header);
@@ -1073,8 +1075,26 @@
   }
 
   {
+    osip_message_t *_response1xx = NULL;
+    char *_number = NULL;
     osip_dialog_t *_1xxok_dialog = NULL;
-    i = osip_dialog_init_as_uac (&_1xxok_dialog, response1xx);
+
+    if (OSIP_SUCCESS != osip_message_clone(response1xx, &_response1xx)) {
+      return OSIP_NOMEM;
+    }
+
+    _number = _eXosip_strdup_printf("%d", jd->d_dialog->local_cseq);
+    if (!_number) {
+      osip_message_free(_response1xx);
+      return OSIP_NOMEM;
+    }
+
+    osip_free(_response1xx->cseq->number);
+    _response1xx->cseq->number = _number;
+
+    i = osip_dialog_init_as_uac (&_1xxok_dialog, _response1xx);
+    osip_message_free(_response1xx);
+
     if (i != 0) {
       OSIP_TRACE (osip_trace (_FILE_, _LINE_, OSIP_ERROR, NULL, "eXosip: cannot build a dialog for this 1xx answer.\n"));
       return OSIP_WRONG_STATE;
@@ -1086,6 +1106,8 @@
 
     if (i != 0)
       return i;
+
+    jd->d_dialog->local_cseq++;
   }
 
   osip_message_set_header (*prack, "RAck", tmp);

tanhuacheng <tanhuacheng>
Thu 06 Sep 2018 11:44:54 AM UTC, comment #5: 

oh! the patch file is reverse!!

--- libexosip2-5.0.0/src/eXcall_api.c 2018-09-06 18:59:49.612226998 +0800
+++ ../../eXcall_api.c 2018-09-06 18:59:45.736442832 +0800
@@ -1060,9 +1060,7 @@
 
   old_prack_tr = (osip_transaction_t*)osip_list_get_first(jd->d_out_trs, &it);
   while (old_prack_tr != NULL) {
-    if (old_prack_tr->orig_request != NULL && 0 == osip_strcasecmp (old_prack_tr->orig_request->sip_method, "PRACK") &&
-        OSIP_SUCCESS == osip_to_tag_match(old_prack_tr->orig_request->to, response1xx->to))
-    {
+    if (old_prack_tr != NULL && old_prack_tr->orig_request != NULL && 0 == osip_strcasecmp (old_prack_tr->orig_request->sip_method, "PRACK")) {
       osip_header_t *rack_header = NULL;
 
       osip_message_header_get_byname (old_prack_tr->orig_request, "RAck", 0, &rack_header);
@@ -1075,26 +1073,8 @@
   }
 
   {
-    osip_message_t *_response1xx = NULL;
-    char *_number = NULL;
     osip_dialog_t *_1xxok_dialog = NULL;
-
-    if (OSIP_SUCCESS != osip_message_clone(response1xx, &_response1xx)) {
-      return OSIP_NOMEM;
-    }
-
-    _number = _eXosip_strdup_printf("%d", jd->d_dialog->local_cseq);
-    if (!_number) {
-      osip_message_free(_response1xx);
-      return OSIP_NOMEM;
-    }
-
-    osip_free(_response1xx->cseq->number);
-    _response1xx->cseq->number = _number;
-
-    i = osip_dialog_init_as_uac (&_1xxok_dialog, _response1xx);
-    osip_message_free(_response1xx);
-
+    i = osip_dialog_init_as_uac (&_1xxok_dialog, response1xx);
     if (i != 0) {
       OSIP_TRACE (osip_trace (_FILE_, _LINE_, OSIP_ERROR, NULL, "eXosip: cannot build a dialog for this 1xx answer.\n"));
       return OSIP_WRONG_STATE;
@@ -1106,8 +1086,6 @@
 
     if (i != 0)
       return i;
-
-    jd->d_dialog->local_cseq++;
   }
 
   osip_message_set_header (*prack, "RAck", tmp);

tanhuacheng <tanhuacheng>
Thu 06 Sep 2018 11:44:36 AM UTC, comment #4: 
Aymeric MOIZARD <aymeric>
Group administrator
Thu 06 Sep 2018 11:18:18 AM UTC, comment #3: 

sorry about this, i'm new for bug report on here, and my english is not that good.

osip version: osip2-5.0.0
exosip version: exosip2-5.0.0

i add two files in "Attached Files" field (log.txt, eXcall_api.patch):

log.txt - the log when i reproduce this problem

eXcall_api.patch - the patch that i think can resolve this problem

in the patch, i just add the dialog's "local_sec".

and there is another problem, a sip server may fork a call.
so when send an INVITE, i may receive more 1xx respones with header "Require: 100rel" from different UAs,
with this patch, it works for me.

(file #44941, file #44942)

tanhuacheng <tanhuacheng>
Thu 06 Sep 2018 10:49:34 AM UTC, comment #2: 

Hi!

I was able to test and found the issue. PRACK is sent using a "temporary dialog"
where the cseq is updated, but the cseq for the dialog in memory is not updated.

The code below should fix the issue:

diff --git a/src/eXcall_api.c b/src/eXcall_api.c
index a8f8828..7d7b1b5
--- a/src/eXcall_api.c
+++ b/src/eXcall_api.c
@@ -1172,6 +1172,9 @@ eXosip_call_build_prack (struct eXosip_t *excontext, int tid, osip_message_t *re

     i = _eXosip_build_request_within_dialog (excontext, prack, "PRACK", _1xxok_dialog);

+    /* the newer code above use a temporary dialog: thus, we need to maintain the local_cseq on the in-memory dialog*/
+    jd->d_dialog->local_cseq++;
+
     osip_dialog_free(_1xxok_dialog);

     if (i != 0)

Aymeric MOIZARD <aymeric>
Group administrator
Thu 06 Sep 2018 10:18:41 AM UTC, comment #1: 

Hi!

Could you provide more on your test?
The osip & exosip version you are using?
Can you provide a network capture?
Tks
Aymeric

Aymeric MOIZARD <aymeric>
Group administrator
Thu 06 Sep 2018 07:12:42 AM UTC, original submission:  

1. send an INVITE with supported 100rel, cseq = 21
2. recv 180 respone with require 100rel
3. send PRACK use eXosip_call_build_prack, cseq = 22
4. recv 200 respone
5. send re-INVITE, but the cseq is still 22

tanhuacheng <tanhuacheng>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44941:  log.txt added by tanhuacheng (13KiB - text/plain)
file #44942:  eXcall_api.patch added by tanhuacheng (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by aymeric (Posted a comment)
  • -email is unavailable- added by tanhuacheng (Submitted the item)
  • -email is unavailable- added by tanhuacheng
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-18 aymeric StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2018-09-06 aymeric StatusFixed Ready For Test
        Open/ClosedClosed Open
    2018-09-06 aymeric Open/ClosedOpen Closed
    2018-09-06 aymeric StatusReady For Test Fixed
    2018-09-06 tanhuacheng Attached File- Added log.txt, #44941
        Attached File- Added eXcall_api.patch, #44942
    2018-09-06 aymeric StatusNeed Info Ready For Test
    2018-09-06 aymeric StatusNone Need Info
        Assigned toNone aymeric
    2018-09-06 tanhuacheng Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code