They really shouldn't be challenging the bye like that because not every device can answer the challenge properly.  Either case it doesn't matter if you have a proper domain 206.57.23.143 in your user directory with the proper user and realm set to meet this challenge.   We have a setting in FreeSWITCH to auth all packets and when we did that we found out that some devices just do not work properly when doing that.  I need to see your original gateway XML.  You can email it off list if you like and let me try to solve this.

/b

On Oct 30, 2008, at 7:52 PM, Wellie Chao wrote:

Here is the BYE from Freeswitch to Metaswitch:

send 683 bytes to udp/[64.115.128.6]:5060 at 00:44:46.607025:

------------------------------------------------------------------------
   BYE sip:9172388084@64.115.128.6:5060;transport=udp SIP/2.0
   Via: SIP/2.0/UDP 216.57.23.143;rport;branch=z9hG4bKNa693jZ8SD54D
   Max-Forwards: 70
   From: <sip:2675379325@216.57.23.143>;tag=r4yBmtX3U0Hrr
   To: 
<sip:9172388084@64.115.128.6:5060;transport=udp>;tag=Broadview1+1+25f76f+cc3ba534
   Call-ID: CEB9027F@Broadview1
   CSeq: 106588607 BYE
   Contact: <sip:mod_sofia@216.57.23.143:5060;transport=udp>
   User-Agent: FreeSWITCH-mod_sofia/1.0.1-9171
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, 
NOTIFY, REFER, UPDATE, REGISTER, INFO, PUBLISH
   Supported: 100rel, timer, precondition, path, replaces
   Reason: Q.850;cause=16;text="NORMAL_CLEARING"
   Content-Length: 0


------------------------------------------------------------------------

Metaswitch is not so happy with the BYE message:

recv 491 bytes from udp/[64.115.128.6]:5060 at 00:44:46.630445:

------------------------------------------------------------------------
   SIP/2.0 401 Unauthorized
   Via: SIP/2.0/UDP 
216.57.23.143;received=216.57.23.143;branch=z9hG4bKNa693jZ8SD54D;rport=5060
   From: <sip:2675379325@216.57.23.143>;tag=r4yBmtX3U0Hrr
   To: 
<sip:9172388084@64.115.128.6:5060;transport=udp>;tag=Broadview1+1+25f76f+cc3ba534
   Call-ID: CEB9027F@Broadview1
   CSeq: 106588607 BYE
   WWW-Authenticate: Digest 
realm="SipLocal",nonce="3e952db60fb8",stale=false,algorithm=MD5,qop="auth"
   Server: DC-SIP/2.0
   Organization:
   Supported: 100rel
   Content-Length: 0


------------------------------------------------------------------------

Right after receiving the 401 Unauthorized message from Metaswitch, 
Freeswitch emits the following error on the console:

2008-10-30 20:44:46 [ERR] sofia_reg.c:1089 
sofia_reg_handle_sip_r_challenge() No Matching gateway found

At this point, the caller (the endpoint connected to Metaswitch) just 
remains on the line, never having received the BYE.

Did you take a look at the packet traces I captured? The carrier 
gave me a packet trace for an Aastra PBX/softswitch, and it had the same 
interaction, but immediately upon receiving the 401 Unauthorized from 
Metaswitch, the Aastra machine then sent a second BYE, this time with 
authentication. Is there some way I can tell Freeswitch to do the same?

Regards,
Wellie