Kamailio 3.1.2
Here is my setup:
Phone1  (10.10.1.114)
                 |
  Kamailio (10.10.1.230)
                  /           \
                 /             \
   Freeswitch1        Freeswitch2              ---------------------->  Other phones
(10.10.1.222)        (10.10.1.223)

Both Freeswitch's share the same REGISTRATION information. Phone1 is already registered with Freeswitch. When I try to dial 'Other phones' using phone1,  the dispatcher always get into FAILURE route although the log shows that kamailio did send INVITE to 10.10.1.222 and  received '407 - Proxy Authentication Required' from Freexwitch1 and then dispatcher send INVITE to 10.10.1.223 and also received '407 - Proxy Authentication Required' from Freexwitch2 and eventually failed.

Any idea?

Here is my configuration:
modparam("dispatcher", "db_url", DBURL)
modparam("dispatcher", "table_name", "dispatcher")
modparam("dispatcher", "ds_ping_interval", 10000)
modparam("dispatcher", "ds_probing_threshhold", 3)
#modparam("dispatcher", "ds_ping_reply_codes", "class=2;class=4")
modparam("dispatcher", "ds_ping_method", "OPTIONS")
modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "ds_ping_from", "sip:proxy@SIP-router1.testnet.net")
modparam("dispatcher", "dst_avp", "$avp(dsdst)")
modparam("dispatcher", "grp_avp", "$avp(dsgrp)")
modparam("dispatcher", "cnt_avp", "$avp(dscnt)")
modparam("dispatcher", "attrs_avp", "$avp(dsattrs)")
modparam("dispatcher", "flags", 3)
modparam("dispatcher", "force_dst", 1)

route {
....
                if ( ds_select_dst("$var(group)", "9") ){
                      route(RELAY_DS);
                      return;
...
}
route[[RELAY_DS]
        if (is_method("INVITE")) {
                t_on_branch("BRANCH_ONE");
                t_on_reply("NAT_REPLY");
                t_on_failure("FAIL_DS");
        }
        if (!t_relay()) {
                sl_reply_error();
        }
}
failure_route[FAIL_DS] {
  if (t_check_status("408")) {
        ds_mark_dst("i");
  }
  if (!ds_next_dst()) {
    t_reply("503", "Service unavailable: no more dst");
    exit;
  }
    t_on_failure("FAIL_DS");
    route(RELAY_DS);
}
onreply_route[NAT_REPLY]
{
        xlog("L_INFO", "REPLY_ROUTE: S=$rs - $rr F=$fu T=$tu IP=$avp(s:ip):$avp(s:port) ($si:$sp) ID=$ci\n");
       
}

And here is the SIP messages from ngrep:
U 10.10.1.144:51029 -> 10.10.1.230:5060
  INVITE sip:1001@fs2000.testnet.net;user=phone SIP/2.0..Via: SIP/2.0/UDP 10.10.1.144:5060;branch=z9hG4bK116d554d..F
  rom: "Line1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet
  .net;user=phone>..Call-ID: 00082166-efcb0013-692f44d9-6760a891@10.10.1.144..Max-Forwards: 70..Date: Thu, 02 Jun 2011
   19:14:14 GMT..CSeq: 101 INVITE..User-Agent: Cisco-CP7960G/7.5..Contact: <sip:5022441011@10.10.1.144:5060>..Expires:
   180..Accept: application/sdp..Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE..Supported: replaces..C
  ontent-Length: 261..Content-Type: application/sdp..Content-Disposition: session;handling=optional....v=0..o=Cisco-SIPUA
  10962 0 IN IP4 10.10.1.144..s=SIP Call..t=0 0..m=audio 20372 RTP/AVP 0 8 18 101..c=IN IP4 10.10.1.144..a=rtpmap:
  0 PCMU/8000..a=rtpmap:8 PCMA/8000..a=rtpmap:18 G729/8000..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-15..a=sendrecv
  ..
#
U 10.10.1.230:5060 -> 10.10.1.144:5060
  SIP/2.0 100 trying -- your call is important to us..Via: SIP/2.0/UDP 10.10.1.144:5060;branch=z9hG4bK116d554d..From:
  "Line1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.net;
  user=phone>..Call-ID: 00082166-efcb0013-692f44d9-6760a891@10.10.1.144..CSeq: 101 INVITE..Server: kamailio (3.1.2 (x8
  6_64/linux))..Content-Length: 0....
#
U 10.10.1.230:5060 -> 10.10.1.222:5060
  INVITE sip:1001@fs2000.testnet.net;user=phone SIP/2.0..Record-Route: <sip:10.10.1.230;lr=on;nat=yes>..Via: SIP/2.0/
  UDP 10.10.1.230;branch=z9hG4bK1ef6.c9d52d72.0..Via: SIP/2.0/UDP 10.10.1.144:5060;branch=z9hG4bK116d554d..From: "L
  ine1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.net;us
  er=phone>..Call-ID: 00082166-efcb0013-692f44d9-6760a891@10.10.1.144..Max-Forwards: 69..Date: Thu, 02 Jun 2011 19:14:
  14 GMT..CSeq: 101 INVITE..User-Agent: Cisco-CP7960G/7.5..Contact: <sip:5022441011@10.10.1.144:5060>..Expires: 180..A
  ccept: application/sdp..Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE..Supported: replaces..Content-
  Length: 277..Content-Type: application/sdp..Content-Disposition: session;handling=optional....v=0..o=Cisco-SIPUA 10962 0
   IN IP4 10.10.1.231..s=SIP Call..t=0 0..m=audio 38426 RTP/AVP 0 8 18 101..c=IN IP4 10.10.1.231..a=rtpmap:0 PCMU/80
  00..a=rtpmap:8 PCMA/8000..a=rtpmap:18 G729/8000..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-15..a=sendrecv..a=nortp
  proxy:yes..
#
U 10.10.1.222:5060 -> 10.10.1.230:5060
  SIP/2.0 100 Trying..Via: SIP/2.0/UDP 10.10.1.230;branch=z9hG4bK1ef6.c9d52d72.0..Via: SIP/2.0/UDP 10.10.1.144:5060
  ;branch=z9hG4bK116d554d..Record-Route: <sip:10.10.1.230;lr=on;nat=yes>..From: "Line1" <sip:5022441011@fs2000.lightyea
  r.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.net;user=phone>..Call-ID: 00082166-efcb0013
  -692f44d9-6760a891@10.10.1.144..CSeq: 101 INVITE..User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-f17e962 2011-04-19 0
  3-05-32 -0400..Content-Length: 0....
#
U 10.10.1.222:5060 -> 10.10.1.230:5060
  SIP/2.0 407 Proxy Authentication Required..Via: SIP/2.0/UDP 10.10.1.230;branch=z9hG4bK1ef6.c9d52d72.0..Via: SIP/2.0/U
  DP 10.10.1.144:5060;branch=z9hG4bK116d554d..From: "Line1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb0021
  53bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.net;user=phone>;tag=6mjQm2eayZ49j..Call-ID: 00082166-efcb0013-692f44d9
  -6760a891@10.10.1.144..CSeq: 101 INVITE..User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-f17e962 2011-04-19 03-05-32 -
  0400..Accept: application/sdp..Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY,
   PUBLISH, SUBSCRIBE..Supported: timer, precondition, path, replaces..Allow-Events: talk, hold, presence, dialog, line-se
  ize, call-info, sla, include-session-description, presence.winfo, message-summary, refer..Proxy-Authenticate: Digest rea
  lm="fs2000.testnet.net", nonce="8da1ddb1-e393-442c-8be0-17e439457363", algorithm=MD5, qop="auth"..Content-Length: 0...
  .
#
U 10.10.1.230:5060 -> 10.10.1.222:5060
  ACK sip:1001@fs2000.testnet.net;user=phone SIP/2.0..Via: SIP/2.0/UDP 10.10.1.230;branch=z9hG4bK1ef6.c9d52d72.0..Fro
  m: "Line1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.n
  et;user=phone>;tag=6mjQm2eayZ49j..Call-ID: 00082166-efcb0013-692f44d9-6760a891@10.10.1.144..Max-Forwards: 69..CSeq:
  101 ACK..Content-Length: 0....
#
U 10.10.1.230:5060 -> 10.10.1.223:5060
  INVITE sip:1001@fs2000.testnet.net;user=phone SIP/2.0..Record-Route: <sip:10.10.1.230;lr=on;nat=yes;nat=yes>..Via:
  SIP/2.0/UDP 10.10.1.230;branch=z9hG4bK1ef6.c9d52d72.1..Via: SIP/2.0/UDP 10.10.1.144:5060;branch=z9hG4bK116d554d..
  From: "Line1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.lightyea
  r.net;user=phone>..Call-ID: 00082166-efcb0013-692f44d9-6760a891@10.10.1.144..Max-Forwards: 69..Date: Thu, 02 Jun 201
  1 19:14:14 GMT..CSeq: 101 INVITE..User-Agent: Cisco-CP7960G/7.5..Contact: <sip:5022441011@10.10.1.144:5060>..Expires
  : 180..Accept: application/sdp..Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE..Supported: replaces..
  Content-Length: 328..Content-Type: application/sdp..Content-Disposition: session;handling=optional....v=0..o=Cisco-SIPUA
   10962 0 IN IP4 10.10.1.23110.10.1.231..s=SIP Call..t=0 0..m=audio 3842638426 RTP/AVP 0 8 18 101..c=IN IP4 216.49.
  129.23110.10.1.231..a=rtpmap:0 PCMU/8000..a=rtpmap:8 PCMA/8000..a=rtpmap:18 G729/8000..a=rtpmap:101 telephone-event/8
  000..a=fmtp:101 0-15..a=sendrecv..a=nortpproxy:yes..a=nortpproxy:yes..
#
U 10.10.1.223:5060 -> 10.10.1.230:5060
  SIP/2.0 100 Trying..Via: SIP/2.0/UDP 10.10.1.230;branch=z9hG4bK1ef6.c9d52d72.1..Via: SIP/2.0/UDP 10.10.1.144:5060
  ;branch=z9hG4bK116d554d..Record-Route: <sip:10.10.1.230;lr=on;nat=yes;nat=yes>..From: "Line1" <sip:5022441011@fs2000.
  testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.net;user=phone>..Call-ID: 00082166-
  efcb0013-692f44d9-6760a891@10.10.1.144..CSeq: 101 INVITE..User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-f17e962 2011
  -04-19 03-05-32 -0400..Content-Length: 0....
#
U 10.10.1.223:5060 -> 10.10.1.230:5060
  SIP/2.0 407 Proxy Authentication Required..Via: SIP/2.0/UDP 10.10.1.230;branch=z9hG4bK1ef6.c9d52d72.1..Via: SIP/2.0/U
  DP 10.10.1.144:5060;branch=z9hG4bK116d554d..From: "Line1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb0021
  53bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.net;user=phone>;tag=Ky0XB4gDeDy6F..Call-ID: 00082166-efcb0013-692f44d9
  -6760a891@10.10.1.144..CSeq: 101 INVITE..User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-f17e962 2011-04-19 03-05-32 -
  0400..Accept: application/sdp..Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY,
   PUBLISH, SUBSCRIBE..Supported: timer, precondition, path, replaces..Allow-Events: talk, hold, presence, dialog, line-se
  ize, call-info, sla, include-session-description, presence.winfo, message-summary, refer..Proxy-Authenticate: Digest rea
  lm="fs2000.testnet.net", nonce="8769298b-c52d-43b8-b69c-6ebf26f3184d", algorithm=MD5, qop="auth"..Content-Length: 0...
  .
#
U 10.10.1.230:5060 -> 10.10.1.223:5060
  ACK sip:1001@fs2000.testnet.net;user=phone SIP/2.0..Via: SIP/2.0/UDP 10.10.1.230;branch=z9hG4bK1ef6.c9d52d72.1..From: "Line1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.n
  et;user=phone>;tag=Ky0XB4gDeDy6F..Call-ID: 00082166-efcb0013-692f44d9-6760a891@10.10.1.144..Max-Forwards: 69..CSeq:
  101 ACK..Content-Length: 0....
#
U 10.10.1.230:5060 -> 10.10.1.144:5060
  SIP/2.0 503 Service unavailable: no more dst..Via: SIP/2.0/UDP 10.10.1.144:5060;branch=z9hG4bK116d554d..From: "Line1
  " <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.net;user=p
  hone>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-2c94..Call-ID: 00082166-efcb0013-692f44d9-6760a891@10.10.1.144..CSeq: 101
   INVITE..Server: kamailio (3.1.2 (x86_64/linux))..Content-Length: 0....
#
U 10.10.1.144:51030 -> 10.10.1.230:5060
  ACK sip:1001@fs2000.testnet.net;user=phone SIP/2.0..Via: SIP/2.0/UDP 10.10.1.144:5060;branch=z9hG4bK116d554d..From
  : "Line1" <sip:5022441011@fs2000.testnet.net>;tag=00082166efcb002153bc0a31-20004ffd..To: <sip:1001@fs2000.testnet.ne
  t;user=phone>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-2c94..Call-ID: 00082166-efcb0013-692f44d9-6760a891@10.10.1.144..D
  ate: Thu, 02 Jun 2011 19:14:14 GMT..CSeq: 101 ACK..Content-Length: 0....


Gary Chen