[OpenSIPS-Users] Cluster (anycast) adds extra hex 00 in the tail to replicated responses.

Denys Pozniak denys.pozniak at gmail.com
Tue Jan 3 11:58:47 UTC 2023


Hello!

I'm trying to build a classic anycast cluster topology with two OpenSIPS
nodes, in which requests are processed by one proxy and responses by
another.
The client and server are emulated via baresip.
But I ran into a problem in that the replicated responses have an extra 00
in the tail of the reply (the original reply from baresip UAS does not have
it).

ngrep -x:
#
U 192.168.100.100:5060 -> 192.168.56.103:37279 #5
  53 49 50 2f 32 2e 30 20    31 38 30 20 52 69 6e 67    SIP/2.0 180 Ring
  69 6e 67 0d 0a 52 65 63    6f 72 64 2d 52 6f 75 74    ing..Record-Rout
  65 3a 20 3c 73 69 70 3a    31 39 32 2e 31 36 38 2e    e: <sip:192.168.
  31 30 30 2e 31 30 30 3b    6c 72 3e 0d 0a 56 69 61    100.100;lr>..Via
  3a 20 53 49 50 2f 32 2e    30 2f 55 44 50 20 31 39    : SIP/2.0/UDP 19
  32 2e 31 36 38 2e 35 36    2e 31 30 33 3a 33 37 32    2.168.56.103:372
  37 39 3b 72 65 63 65 69    76 65 64 3d 31 39 32 2e    79;received=192.
  31 36 38 2e 35 36 2e 31    30 33 3b 62 72 61 6e 63    168.56.103;branc
  68 3d 7a 39 68 47 34 62    4b 62 65 63 38 65 38 66    h=z9hG4bKbec8e8f
  30 32 36 62 65 39 31 34    61 3b 72 70 6f 72 74 3d    026be914a;rport=
  33 37 32 37 39 0d 0a 54    6f 3a 20 3c 73 69 70 3a    37279..To: <sip:
  31 30 30 40 31 39 32 2e    31 36 38 2e 31 30 30 2e    100 at 192.168.100.
  31 30 30 3b 74 72 61 6e    73 70 6f 72 74 3d 75 64    100;transport=ud
  70 3e 3b 74 61 67 3d 32    37 65 33 63 32 31 38 65    p>;tag=27e3c218e
  30 65 61 31 32 30 64 0d    0a 46 72 6f 6d 3a 20 3c    0ea120d..From: <
  73 69 70 3a 32 30 30 40    31 39 32 2e 31 36 38 2e    sip:200 at 192.168.
  31 30 30 2e 31 30 30 3a    35 30 36 30 3e 3b 74 61    100.100:5060>;ta
  67 3d 35 36 38 35 66 33    38 39 61 39 37 66 65 31    g=5685f389a97fe1
  30 32 0d 0a 43 61 6c 6c    2d 49 44 3a 20 31 32 34    02..Call-ID: 124
  39 37 61 63 37 36 65 38    30 34 66 35 36 0d 0a 43    97ac76e804f56..C
  53 65 71 3a 20 36 33 37    30 37 20 49 4e 56 49 54    Seq: 63707 INVIT
  45 0d 0a 53 65 72 76 65    72 3a 20 62 61 72 65 73    E..Server: bares
  69 70 20 76 32 2e 31 30    2e 30 20 28 78 38 36 5f    ip v2.10.0 (x86_
  36 34 2f 4c 69 6e 75 78    29 0d 0a 43 6f 6e 74 61    64/Linux)..Conta
  63 74 3a 20 3c 73 69 70    3a 31 30 30 2d 30 78 63    ct: <sip:100-0xc
  62 63 31 39 30 40 31 39    32 2e 31 36 38 2e 35 36    bc190 at 192.168.56
  2e 31 30 36 3a 35 30 38    30 3e 0d 0a 41 6c 6c 6f    .106:5080>..Allo
  77 3a 20 49 4e 56 49 54    45 2c 41 43 4b 2c 42 59    w: INVITE,ACK,BY
  45 2c 43 41 4e 43 45 4c    2c 4f 50 54 49 4f 4e 53    E,CANCEL,OPTIONS
  2c 4e 4f 54 49 46 59 2c    53 55 42 53 43 52 49 42    ,NOTIFY,SUBSCRIB
  45 2c 49 4e 46 4f 2c 4d    45 53 53 41 47 45 2c 55    E,INFO,MESSAGE,U
  50 44 41 54 45 2c 52 45    46 45 52 0d 0a 43 6f 6e    PDATE,REFER..Con
  74 65 6e 74 2d 4c 65 6e    67 74 68 3a 20 30 0d 0a    tent-Length: 0..
  0d 0a 00                                              ...
#

So it throws a Baresip error:
call: SIP Progress: 100 Trying-2 (/)
call: SIP Progress: 100 Giving it a try (/)
call: SIP Progress: 180 Ringing (/)
call: could not decode SDP answer: Bad message [74]

192.168.56.103 - baresip UAC
192.168.56.106 - baresip UAS
192.168.100.100 - anycast OpenSIPS

opensips.cfg (node2):
...
socket = udp:192.168.100.100 anycast
socket= bin:192.168.56.105:5566
...
modparam ("tm", "tm_replication_cluster", 1)
modparam("clusterer", "db_mode", 0)
modparam("clusterer", "my_node_id", 2)
modparam("clusterer", "my_node_info", "cluster_id=1, url=bin:
192.168.56.105:5566")
modparam("clusterer", "neighbor_node_info", "cluster_id=1,node_id=1,url=bin:
192.168.56.104:5566")
modparam("clusterer", "sharing_tag", "vip1/2=active")
...
####### Routing Logic ########

route{

        if ( !mf_process_maxfwd_header(10) ) {
                send_reply(483,"Too Many Hops");
                exit;
        }

        sl_send_reply(100, "Trying-2");

        if (has_totag()) {

                if ( !loose_route() && !t_check_trans() ) {
                        if ( is_method("ACK") ) {
                                t_anycast_replicate();
                                exit;
                        }
                }

                t_relay();
                exit;
        }

        if (is_method("CANCEL")) {
                if (t_check_trans()) {
                        t_relay();

                } else {
                        t_anycast_replicate();
                }

                exit;
        }

        t_check_trans();

        if (!is_method("REGISTER|MESSAGE")) {
                record_route();
        }

        if ( is_method("INVITE") && $si!="5080" ) {
                $du = "sip:192.168.56.106:5080";
        }

        t_relay();
        exit;

}

[root at localhost opensips]# opensips -V
version: opensips 3.3.2 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC,
F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
main.c compiled on 16:12:02 Oct 19 2022 with gcc 4.8.5


-- 

BR,
Denys Pozniak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20230103/773ac584/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extra_00.pcap
Type: application/octet-stream
Size: 6476 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/users/attachments/20230103/773ac584/attachment.obj>


More information about the Users mailing list