Hi Mr.Bogdan,
 
Yes, the REGISTERs are replicated between the 02 SIP servers cos I can see them on 'location' tables on both servers.
 
I found out what is problem:
When UA1 register with SIP1, it opens the port on NAT with the public IP is of SIP1
When UA2, which is registered with SIP2, call UA1 (registered with SIP1), the SIP2 send INVITE to UA1 using correct port on location table, but the problem is here: the NAT router does not has the any information about SIP2 IP on it NATed table, so the INVITE message cannot come in to UA1.
 
I think this t_replicate() function does not work with my case. Should you please suggest me another solution to make a failover system (one SIP server got failure, other one can handle).
 
Thanks in advanced

Tung

 
 
> Hi Tung,
>
> first check using ngrep if the REGISTERs are replicated between the
> two servers.
>
> regards,
> bogdan
>
> Tung Tran wrote:
>
>> Hi all,
>>
>> Please help me on this:
>>
>> I want to deploy failover scenario using t_replicate function,
>> here is apart of configuration SIP1:
>>
>> ######################################################################
>> ## # Request route 'REGISTER'
>> ######################################################################
>> ## route[2] {
>> xlog("L_INFO", "*-*- Jump to Route[2]: REGISTER procedure *-*-*
>> \n"); sl_send_reply("100", "Trying"); if(src_ip=="SIP2 IP") {
>>
>> xlog("L_INFO", "*-*-* Got REGISTER replication from peering, Save
>> location! \n"); save("location"); exit; }
>>
>> if(nat_uac_test("19"))
>> {
>>
>> fix_nated_register();
>> setbflag(6);
>> xlog("L_INFO", "*-*-* Discovering UAC is behind NAT,
>> fix_nated_register - M=$rm RURI=$ru Contact=$ct bflag=$bF \n"); }
>>
>> #if(!www_authorize("", "subscriber"))
>> #{
>> #
>> #    www_challenge("", "0");
>> #    exit;
>> #}
>>
>> #consume_credentials();
>>
>>
>> if(!save("location"))
>> {
>>
>> xlog("L_ERR", "*-*-* Saving contact failed - M=$rm RURI=$ru F=$fu
>> T=$tu IP=$si ID=$ci\n"); sl_reply_error(); exit; }
>> add_rcv_param();
>> xlog("L_INFO", "*-*-* REPLICATE register to peering \n");
>>
>> if(!t_replicate("sip:SIP2-IP:5060"))
>> {
>> xlog("L_ERR", "*-*-* Cannot contact to the peer, REPLICATION
>> failed\n"); };
>>
>> xlog("L_INFO", "*-*-* Registration successful - M=$rm RURI=$ru
>> F=$fu T=$tu IP=$si ID=$ci\n");
>> xlog("L_INFO", "*-*-* End of Route[2]: REGISTER procedure *-*-*
>> \n"); exit;
>>
>> }
>> -------
>>
>> SIP2 config:
>>
>>
>> ######################################################################
>> ## # Request route 'REGISTER'
>> ######################################################################
>> ## route[2] {
>> xlog("L_INFO", "*-*- Jump to Route[2]: REGISTER procedure *-*-*
>> \n"); sl_send_reply("100", "Trying"); if(src_ip=="SIP1-IP") {
>>
>> xlog("L_INFO", "*-*-* Got REGISTER replication from peering, Save
>> location! \n"); save("location"); exit; } if(nat_uac_test("19")) {
>>
>> fix_nated_register();
>> setbflag(6);
>> xlog("L_INFO", "*-*-* Discovering UAC is behind NAT,
>> fix_nated_register - M=$rm RURI=$ru Contact=$ct bflag=$bF \n"); }
>>
>>
>> #if(!www_authorize("", "subscriber"))
>> #{
>> #
>> #    www_challenge("", "0");
>> #    exit;
>> #}
>>
>> #consume_credentials();
>>
>>
>> if(!save("location"))
>> {
>>
>> xlog("L_ERR", "*-*-* Saving contact failed - M=$rm RURI=$ru F=$fu
>> T=$tu IP=$si ID=$ci\n"); sl_reply_error(); exit; }
>>
>> add_rcv_param();
>> xlog("L_INFO", "*-*-* REPLICATE register to peering \n"); if (!
>> t_replicate("sip:SIP1-IP:5060")) {
>> xlog("L_ERR", "*-*-* Cannot contact to the peer, REPLICATION
>> failed\n"); };
>>
>> xlog("L_INFO", "*-*-* Registration successful - M=$rm RURI=$ru
>> F=$fu T=$tu IP=$si ID=$ci\n");
>> xlog("L_INFO", "*-*-* End of Route[2]: REGISTER procedure *-*-*
>> \n"); exit;
>>
>> }
>>
>> And here is the location table of both server:
>>
>> SIP1;
>>
>> mysql> select * from location;
>> +----+-----------+--------+---------------------------------------
>> --------+--------------------------+------+---------------------+-
>> ------+---------------------------------------------------+-------
>> +---------------------+-------+--------+--------------------------
>> ---------+-----------------------+---------+
>> | id | username  | domain | contact | received                 |
>> path | expires             | q     | callid
>>                      | cseq  | last_modified       | flags |
>> cflags | user_agent | socket                | methods | +----+----
>> -------+--------+-----------------------------------------------+-
>> -------------------------+------+---------------------+-------+---
>> ------------------------------------------------+-------+---------
>> ------------+-------+--------+-----------------------------------
>> +-----------------------+---------+
>> | 95 | 1016      |        |
>> sip:1016@192.168.1.202:5061;transport=udp |
>> sip:203.190.172.49:44293 | NULL | 2007-08-28 11:28:31 | -1.00 |
>> 0006d752-a91d0005-647e0f99-44142f0e@192.168.1.202 |   238 | 2007-
>> 08-28 11:27:31 |     0 |     64 | Cisco-CP7960G/8.0
>>   | udp:116.193.69.3:5060 |    NULL |
>> | 98 | 1005      |        | sip:1005@192.168.1.103:5060 |
>> sip:203.190.172.49:41124 | NULL | 2007-08-28 11:28:41 | -1.00 |
>> zxjvYGlwjx2VbuGu@192.168.1.103                    | 22171 | 2007-
>> 08-28 11:27:41 |     0 |     64 | PA168S
>>   | udp:116.193.69.3:5060 |    NULL |
>> | 97 | 1001      |        | sip:1001@192.168.1.66:8887 |
>> sip:203.190.172.49:43767 | NULL | 2007-08-28 11:28:50 | -1.00 |
>> a20a87250b56ff1b                                  |   104 | 2007-
>> 08-28 11:27:50 |     0 |     64 | eyeBeam release 3004t stamp
>> 16741 | udp:116.193.69.3:5060 |    5951 | | 99 | 841170047 |
>>   |
>> sip:841170047@192.168.1.66:5080;transport=UDP |
>> sip:203.190.172.49:39960 | NULL | 2007-08-28 11:28:47 | -1.00 |
>> f6b2e2ce36244ddd9f967b5efbc39b16                  | 47970 | 2007-
>> 08-28 11:27:47 |     0 |     64 | RTC/1.0.2299
>>   | udp:116.193.69.3:5060 |    5423 | +----+-----------+--------+-
>> ----------------------------------------------+-------------------
>> -------+------+---------------------+-------+---------------------
>> ------------------------------+-------+---------------------+-----
>> --+--------+-----------------------------------+------------------
>> -----+---------+ 4 rows in set (0.00 sec)
>>
>> SIP2:
>>
>> mysql> select * from location;
>> +----+-----------+--------+---------------------------------------
>> --------+--------------------------+------+---------------------+-
>> ------+---------------------------------------------------+-------
>> +---------------------+-------+--------+--------------------------
>> ---------+-----------------------+---------+
>> | id | username  | domain | contact | received                 |
>> path | expires             | q     | callid
>>                      | cseq  | last_modified       | flags |
>> cflags | user_agent | socket                | methods | +----+----
>> -------+--------+-----------------------------------------------+-
>> -------------------------+------+---------------------+-------+---
>> ------------------------------------------------+-------+---------
>> ------------+-------+--------+-----------------------------------
>> +-----------------------+---------+
>> | 46 | 1001      |        | sip:1001@192.168.1.66:8887 |
>> sip:203.190.172.49:43767 | NULL | 2007-08-28 11:28:53 | -1.00 |
>> 8b3cbf617b787578                                  |   105 | 2007-
>> 08-28 11:27:53 |     0 |     64 | eyeBeam release 3004t stamp
>> 16741 | udp:116.193.69.4:5060 |    5951 |
>> | 47 | 1016      |        |
>> sip:1016@192.168.1.202:5061;transport=udp |
>> sip:203.190.172.49:44293 | NULL | 2007-08-28 11:28:41 | -1.00 |
>> 0006d752-a91d0005-647e0f99-44142f0e@192.168.1.202 |   239 | 2007-
>> 08-28 11:27:41 |     0 |     64 | Cisco-CP7960G/8.0
>>   | udp:116.193.69.4:5060 |    NULL | | 48 | 841170047 |        |
>> sip:841170047@192.168.1.66:5080;transport=UDP |
>> sip:203.190.172.49:39960 | NULL | 2007-08-28 11:28:57 | -1.00 |
>> f6b2e2ce36244ddd9f967b5efbc39b16                  | 47971 | 2007-
>> 08-28 11:27:57 |     0 |     64 | RTC/1.0.2299
>>   | udp:116.193.69.4:5060 |    5423 |
>> | 44 | 1005      |        | sip:1005@192.168.1.103:5060 |
>> sip:203.190.172.49:41124 | NULL | 2007-08-28 11:28:56 | -1.00 |
>> zxjvYGlwjx2VbuGu@192.168.1.103                    | 22172 | 2007-
>> 08-28 11:27:56 |     0 |     64 | PA168S
>>   | udp:116.193.69.4:5060 |    NULL | +----+-----------+--------+-
>> ----------------------------------------------+-------------------
>> -------+------+---------------------+-------+---------------------
>> ------------------------------+-------+---------------------+-----
>> --+--------+-----------------------------------+------------------
>> -----+---------+ 4 rows in set (0.00 sec)
>>
>> mysql>
>>
>> Both tables have the information almost the same and snync BUT
>>
>> When I use an UA1 registered to SIP1, calling UA2 register to
>> SIP2, it does not work. Nothing happens on UA2.
>>
>> Please help me how to fix them
>>
>> Thanks in advanced
>>
>> Regards
>> TUng
>> ------------------------------------------------------------------
>> ------
>>
>> _______________________________________________
>> Users mailing list
>> Users@openser.org
>> http://openser.org/cgi-bin/mailman/listinfo/users