Hi,

Can you send the output of "kamcmd dmq.list_nodes" (mask IP addresses if needed)?

I will try to replicate your scenario and come back with a solution shortly.

By the way, your dmq "notification_address" parameter looks slightly odd (although I don't know what you're doing with DNS) - it should simply point to one other node in the cluster, so that on startup it can request information about any other nodes from this one. Also, in the block which calls dmq_handle_message(), you should exit straight away after.

One final note, you should really listen on a separate port for dmq purposes (e.g. 5080) and restrict access to it at firewall level. You can then check in config that the message was received on this port, like:

        if (method == "KDMQ" && $Rp == 5080) {
               dmq_handle_message();
               exit;
        }


Regards,

Charles


On 2 February 2015 at 10:52, Leonardo Arena <rnalrd@gmail.com> wrote:
Hi all,
I have three Registrar-only proxies DMQ interconnected [1]. I'm
attempting to use a client to register to one of them and replicate
REGISTRAR message to the other two.

* What it works:
- Clients registration to proxy1
- Proxy1 replication of REGISTRAR message to proxy2

* What does not work:
- Proxy replication of REGISTRAR message to proxy3

* Error message of proxy1:
ERROR: tm [t_fwd.c:1770]: t_forward_nonack(): ERROR: t_forward_nonack:
no branches for forwarding
ERROR: dmq [dmq_funcs.c:410]: cfg_dmq_t_replicate(): error calling
t_replicate

append_branch() did't help me and a search on the ML either.

What am I doing wrong?

Thanks!

- leonardo


[1]

#--------------------------------------------------------
# Global Definitions
#--------------------------------------------------------
debug      =   2
fork      =   yes
log_stderror   =   no
# listen      =   0.0.0.0
port      =   5060
children   =   4

dns      =   no
rev_dns      =   no
use_dns_failover =    on
dns_srv_lb   =   yes
#dns_try_naptr    =    no


mpath      =   "/usr/lib/kamailio/modules_k/:/usr/lib/kamailio/modules/"

#--------------------------------------------------------
# Modules
#--------------------------------------------------------

loadmodule   "tm.so"
loadmodule   "sl.so"
loadmodule   "tmx.so"
loadmodule   "maxfwd.so"
loadmodule   "usrloc.so"
loadmodule   "registrar.so"
loadmodule   "pv.so"
loadmodule   "xlog.so"
loadmodule   "ctl.so"
#loadmodule   "db_text.so"
loadmodule   "db_sqlite.so"
loadmodule   "auth.so"
loadmodule   "auth_db.so"
loadmodule   "memcached.so"
loadmodule   "dmq.so"
loadmodule   "corex.so"

#--------------------------------------------------------
# Module Configuration
#--------------------------------------------------------

modparam ( "usrloc", "db_mode", 0 )
modparam ( "usrloc", "use_domain", 1 )
modparam ( "usrloc", "hash_size", 20 )
#modparam ( "ctl", "binrpc_max_body_size", 10000 )
#modparam ( "ctl", "binrpc_struct_max_body_size", 200 )
#default
#modparam ( "db_text", "db_mode", 0 )
modparam ( "auth", "use_domain", 1 )
#modparam ( "auth_db", "db_url", "text:///etc/kamailio/dbtext/" )
modparam ( "auth_db", "db_url", "sqlite:///etc/kamailio/kamailiodb" )
modparam ( "auth_db", "use_domain", 1 )
#use plaintext passwords for testing
modparam ( "auth_db", "calculate_ha1", 1 )
modparam ( "auth_db", "version_table", 0 )
modparam ( "auth_db", "password_column", "password" )
modparam ( "auth_db", "load_credentials", "$avp(s:username)=username;
$avp(s:domain)=domain;$avp(s:password)=password" )

modparam( "memcached", "servers", "localhost:11211" )

modparam( "dmq", "server_address", "sip:10.0.0.1:5060" )
modparam( "dmq", "notification_address", "sip:dmq.my.domain.net" )
#modparam( "dmq", "num_threads", 4 )
# modparam( "dmq", "ping_interval", 60 )

#--------------------------------------------------------
# Main Route Block
#--------------------------------------------------------

include_file "kamailio-errors.cfg"

route
  {
   # Uncomment next line if you  want to see
   # each incoming message
   xlog( "L_INFO", "$rm: $fu -> $ru" );

   if (!mf_process_maxfwd_header("20")) {
      route(ERROR_TOO_MANY_HOPS);
   }

   if (msg:len > 4096) {
      route(ERROR_MESSAGE_OVERFLOW);
   }

   if ($rm == "REGISTER" ) {
      if ( dmq_is_from_node() ) {
         xlog( "L_INFO", "REGISTER from node" );
         route(REGISTER);
         exit;
      }
      else {
         # if we don't have credentials in cache authenticate against DB
         if ( $mct($tU@$td) == $null ) {
            if (!www_authenticate("$td", "subscriber")) {
               www_challenge("$td", "1");
               exit;
            }
            else {
               route(REGISTER);
               xlog( "L_INFO", "Authenticated user $tU for domain $td
against DB" );
               # store credentials into cache
               $mct($avp(s:username)@$avp(s:domain)) = $avp(s:password);
               exit;
            }

         }
         # credentials are in cache, authenticate against it
         else {
            if (!pv_www_authenticate("$td", "$mct($tU@$td)", "0")) { #
turn last param to "1" if using ha1 passwords
               # keep a counter of authentication attempts
               # if above 1 user is denied auth from cache so we discard
the cache and force auth from DB at next attempt
               if ( $mct(count_$tU@$td) ) == $null {
                  $mct(count_$tU@$td) = 1;
               }
               else {
                  $mct(count_$tU@$td) = $null;
                  $mct($tU@$td) = $null;
                  xlog( "L_INFO", "Authentication count limit for user
$tU for domain $td against cache reached. Cache discarded" );
               }
               www_challenge("$td", "1");
               exit;
            }
            else {
               route(REGISTER);
               $mct( count_$tU@$td ) = $null;
               xlog( "L_INFO", "Authenticated user $tU for domain $td
against cache" );
               exit;
            }
         }
      }
   }

        if ( $rm == "KDMQ" ) {
                dmq_handle_message();
        }

        route(ERROR_INVALID_METHOD);

}

route[REGISTER] {
   if (!save("location")) {
      sl_reply_error();
   }
   else {
      append_branch();
      dmq_t_replicate();
   }
}


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




www.sipcentric.com

Follow us on twitter @sipcentric

Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB.