To the original question posted here about the reply retransmission - is your testing client SIPp?  SIPp seems to have an odd behavior where the branch value in it's via increases with each request.  There is the ability to set [branch-N], where N is the value to decrement this.  Since every message (both request and replies) increments this, if your pattern is INVITE, 100, 302, ACK, the ACK's branch value would need to be decremented by 3.

https://sipp.readthedocs.io/en/latest/scenarios/keywords.html?highlight=%5Bbranch%5D#branch

Kaufman
Senior Voice Engineer



E: bkaufman@bcmone.com


 

SIP.US Client Support: 800.566.9810  |  SIPTRUNK Client Support: 800.250.6510  |  Flowroute Client Support: 855.356.9768

img
img
img
 


From: alexis via sr-users <sr-users@lists.kamailio.org>
Sent: Saturday, August 24, 2024 5:48 PM
To: sr-users@lists.kamailio.org <sr-users@lists.kamailio.org>
Cc: alexis <alzrck@gmail.com>
Subject: [SR-Users] http_async and tm
 

CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


Hello all, context first, we have an REST API that performs queries to external devices in the network (diameter to DRA's, REST to different servers) and based on n conditions returns the content for a Contact header to be used in a SIP 302.

Now we're consuming this API with http_client (synchronously) and as there's no way to speed up the API (pipeline executions, delays on external api's etc etc) we're hitting a limit where all children become busy waiting for the API to answer.

So i decided to move to http_async_client and started working on it on the lab with this first and base concept to test.

request_route {


#for testing purposes only
if(is_method("ACK")){
exit;
}
    $http_req(all) = $null;
    $http_req(suspend) = 1;
    $http_req(timeout) = 500;
    $http_req(method) = "POST";
    $http_req(hdr) = "Content-Type: application/json";
    jansson_set("string", "event", "sip-routing", "$var(cre_query)");
    xlog("L_INFO","API ASYNC ROUTING REQUEST: $var(cre_query)\n");
    $http_req(body) = $var(cre_query);
    t_newtran();
    http_async_query("http://192.168.86.128:8000/", "CRE_RESPONSE");
}

http://192.168.86.128:8000/ receives the POST, randomly creates a delay between 0.5 and 1 second and responds (simulating the real api with an excess delay to probe the concept)

Then

route[CRE_RESPONSE] {
    if ($http_ok && $http_rs == 200) {
        xlog("L_INFO","CRE RESPONSE: $http_rb\n");
# for testing purpose, Contact content will be replaced from the received api response
append_to_reply("Contact: <sip:1234@google.com>\r\n");
    send_reply(302,"Moved Temporarily");
exit;
    }
    send_reply(500, "Internal error");
    exit;
}

INVITE is received and processed, API is called, after API response, 302 is replied and then an ACK (ignored by now).

Situation is that the 302 retransmitted

   37 1519.846253067 192.168.86.34 → 192.168.86.128 SIP/SDP 585 Request: INVITE sip:service@192.168.86.128:5060 |
   38 1519.848100380 192.168.86.128 → 192.168.86.34 SIP 318 Status: 100 Trying |
   39 1520.094997642 192.168.86.128 → 192.168.86.34 SIP 407 Status: 302 Moved Temporarily |
   40 1520.102323728 192.168.86.34 → 192.168.86.128 SIP 453 Request: ACK sip:service@192.168.86.128:5060 |
   41 1520.591300933 192.168.86.128 → 192.168.86.34 SIP 407 Status: 302 Moved Temporarily |
   42 1521.591061065 192.168.86.128 → 192.168.86.34 SIP 407 Status: 302 Moved Temporarily |
   43 1523.591227956 192.168.86.128 → 192.168.86.34 SIP 407 Status: 302 Moved Temporarily |


18(24) DEBUG: tm [t_reply.c:1703]: t_retransmit_reply(): reply retransmitted. buf=0x7f6d79745dc0: SIP/2.0 3..., shmem=0x7f6d75187fd8: SIP/2.0 3
18(24) DEBUG: tm [t_reply.c:1703]: t_retransmit_reply(): reply retransmitted. buf=0x7f6d79745dc0: SIP/2.0 3..., shmem=0x7f6d75187fd8: SIP/2.0 3
18(24) DEBUG: tm [t_reply.c:1703]: t_retransmit_reply(): reply retransmitted. buf=0x7f6d79745dc0: SIP/2.0 3..., shmem=0x7f6d75187fd8: SIP/2.0 3
18(24) DEBUG: tm [timer.c:634]: wait_handler(): finished transaction: 0x7f6d75184cc8 (p:0x7f6d74f600c8/n:0x7f6d74f600c8)
18(24) DEBUG: tm [h_table.c:132]: free_cell_helper(): freeing transaction 0x7f6d75184cc8 from timer.c:643

Any help to avoid the retransmission and make the transaction just finish right after the 302 will be appreciated.

regards