[Freeswitch-users] Hangup problem/SIP BYE lacking authentication

Wellie Chao wchao at yahoo.com
Thu Oct 30 14:45:15 PDT 2008

Here is what I have:

   <gateway name="broadview">
     <param name="username" value="MY_USERNAME"/>
     <param name="password" value="MY_PASSWORD"/>
     <param name="realm" value=""/>
     <param name="proxy" value=""/>
     <param name="register" value="false"/>

Whether register is true or false doesn't seem to make a difference 
(except that Freeswitch then comes up with broadview in NOREG state). On 
calls from Metaswitch to Freeswitch, it's the same problem, and I get the 
same message in the Freeswitch logs:

2008-10-30 17:39:04 [ERR] sofia_reg.c:1089 
sofia_reg_handle_sip_r_challenge() No Matching gateway found

I presume this is the same thing with the 401 Unauthorized packet being 
sent by Metaswitch in response to Freeswitch's BYE message. Note that the 
call itself goes just fine. I pick up, both sides can hear each other. 
Just the hangup gets messed up and for some reason Metaswitch expects an 
authenticated BYE message even though the connection was not authenticated 
in the beginning when Metaswitch initiated it. The packet trace shows this 
and it's very odd.

Is that what you meant when you said set up a gateway in Freeswitch that 
has reg=false and the proper credentials?

On Thu, 30 Oct 2008, Anthony Minessale wrote:

> Date: Thu, 30 Oct 2008 16:10:58 -0500
> From: Anthony Minessale <anthony.minessale at gmail.com>
> Reply-To: freeswitch-users at lists.freeswitch.org
> To: freeswitch-users at lists.freeswitch.org
> Subject: Re: [Freeswitch-users] Hangup problem/SIP BYE lacking authentication
> just setup a gateway in fs that has reg=false and the proper credentials to pass the challenge.
> On Thu, Oct 30, 2008 at 2:49 PM, Wellie Chao <wchao at yahoo.com> wrote:
>       Hangups do not work for me under certain circumstances. Here is the
>       background information:
>       * Our carrier uses a Metaswitch server with Acme Packet in front as a
>         proxy/SBC. Only the Acme Packet machine is publicly visible
>         (
>       * Our Freeswitch server is at
>       * For calls originating from Freeswitch and terminating on Metaswitch
>         ( ->, Freeswitch authenticates with
>         Metaswitch and everything works hunky-dorey. Either side can hang up and
>         the other side will automatically hang up without requiring a manual
>         hang-up.
>       Now the problem:
>       For calls originating from Metaswitch to Freeswitch ( ->
>, Metaswitch does not authenticate with Freeswitch.
>       Metaswitch also does not use the existing authenticated registration that
>       our Freeswitch server initiates with Metaswitch upon startup of
>       Freeswitch. Metaswitch just begins a new (unauthenticated) session and we
>       have configured Freeswitch to allow any inbound calls from
>       without requiring authentication.
>       We receive inbound calls (Metaswitch to Freeswitch, ->
> just fine. The phone rings and we can have a normal
>       conversation. If the caller (the endpoint attached to Metaswitch) hangs
>       up, both sides hang up. If I hang up (remember, I'm at the endpoint
>       attached to Freeswitch), the caller's line remains attached forever.
>       I have recorded a packet trace. Look at freeswitch_2.cap in the ZIP file,
>       and you want to graph the first call starting at 21.202 and ending 53.798.
>       If you go to time 53.087, you can see that my Freeswitch server sends a
>       BYE to Metaswitch. This is a result of me hanging up my phone. At time
>       53.089, you see Metaswitch responding with 401 Unauthorized. Later at time
>       53.777, you see a BYE from Metaswitch to Freeswitch, but you should ignore
>       this because that was a result of the caller (the guy hooked up to
>       Metaswitch) manually hanging up. If he had not hung up his phone, the BYE
>       from Metaswitch to Freeswitch would not have been issued and his phone
>       would just stay on the line forever. Also, when I hang up my phone, I see
>       the following at the Freeswitch console:
>       2008-10-29 23:03:28 [ERR] sofia_reg.c:1089
>       sofia_reg_handle_sip_r_challenge() No Matching gateway found
>       I presume that Freeswitch emits this error because it got the 401
>       Unauthorized from Metaswitch.
>       I also asked our carrier for a packet trace of a successful hangup on the
>       Aastra platform (the engineer at the carrier says it is an Asterisk
>       derivative -- I'm not sure about that). Look at
>       Aastra_authentication_test.cap in the ZIP file. Graph the first call
>       starting at 43.633 and ending 93.156. If you go to 93.118, you'll see that
>       the Aastra server sends a BYE. Just like our Freeswitch scenario,
>       Metaswitch sends back a 401 Unauthorized, but in response to the 401
>       Unauthorized, Aastra then sends back another BYE with the difference that
>       the second BYE is authenticated. Metaswitch gets the second BYE and
>       responds with 200 OK.
>       I am pretty sure that if Freeswitch were to send back a second BYE (but
>       with authentication), it would work fine. Now my question is how can I do
>       this? I am not sure if this divergence of behavior is caused by: (a) my
>       own error in configuring Freeswitch, (b) Metaswitch lacking standard SIP
>       support (maybe it's not supposed to send the 401 Unauthorized), or (c)
>       Freeswitch lacking standard SIP support (maybe it's supposed to send back
>       a second BYE with authentication automatically). I don't know the SIP
>       standards (or Freeswitch) well enough to know whether this problem is
>       caused by me or by a deficiency in one of the two products (Metaswitch or
>       Freeswitch).
>       Can you provide some pointers?
>       The ZIP file with the packet traces can be downloaded here:
>       _______________________________________________
>       Freeswitch-users mailing list
>       Freeswitch-users at lists.freeswitch.org
>       http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>       UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>       http://www.freeswitch.org
> --
> Anthony Minessale II
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
> AIM: anthm
> MSN:anthony_minessale at hotmail.com
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 at conference.freeswitch.org
> pstn:213-799-1400

More information about the FreeSWITCH-users mailing list