[Serusers] save_memory behavior for NATed clients

George Perantinos gper at forthnet.gr
Thu Oct 6 18:01:55 CEST 2005


Dear list,
I'm trying to implement registration replication between 2 SERs (ver. 0.9.4, 
they are AA behind an F5 BigIP). Both SERs are using the same mysql database 
and mediaproxy is used for RTP relaying (whenever needed). The basis for my 
configuration is the mediaproxy config from onsip.org (excellent work, many 
thanx guys).

My servers are 10.21.128.232 and 10.21.128.233. I'm using forward_tcp and 
save_memory for replication purposes, as can be seen in the following 
registration route block:

route[2] {

    # -----------------------------------------------------------------
    # REGISTER Message Handler
    # ----------------------------------------------------------------

    sl_send_reply("100", "Trying");

    if(src_ip==10.21.128.233) {
# If it is a forward from our brother then...
    if (client_nat_test("3")) {
# check if the user is NATed
        setflag(6);
        fix_nated_register();
        force_rport();
    };
     save_memory("location");
     break;

    } else {
    if (!search("^Contact:[ ]*\*") && client_nat_test("7")) {
        setflag(6);
        fix_nated_register();
        force_rport();
    };

    if (!radius_www_authorize("domain.com")) {
        www_challenge("domain.com","0");
        xlog("L_NOTICE","Could not authorize user %fu, IP %is \n");
        break;
    };

    if (!check_to()) {
        sl_send_reply("401", "Unauthorized");
        xlog("L_NOTICE","From: does not match URI:, user %fu, IP %is \n");
        break;
    };

    consume_credentials();

    if (!save("location")) {
        xlog("L_WARN","MYSQL down? Could not save location\n");
        sl_reply_error();
    };
    xlog("L_INFO","Updating registration for user %fu, IP %is \n");
    add_rcv_param();
    if (!forward_tcp("10.21.128.233", 5060)) {
        xlog("L_WARN","Cannot replicate user %fu at server 10.21.128.233\n");
    };
    };
}



When performing a "serctl ul show" on the servers, the results are as follows:

1) For UAs coming from real IPs, serctl shows identical results on both 
servers.
2) For NATed UAs there is difference in the "Flags:" field.
On the server that initialy proccessed the request, the value of the "Flags" 
is 1 (OK!),  while on the server that the registration was forwarded, the 
value of the "Flags" field is 257(??).

My impression is that the Flags field should be 1 if a UA is NATed and 0 if 
not. Am I wrong? 

If I'm right on the above, then shouldn't both servers show the same result in 
Flags (i.e. 1) for NATed clients? 

On the other hand, if I restart SER (and the contacts are read from the 
database), then every "weird" 257 Flag is reset to 1, until the next UA 
re-registration (where it returns again to 257).

Thanx for any help,
George.




More information about the sr-users mailing list