Inbound route does not work: check_auth: username mismatch

I have a freepbx server behind my router. The calls should pass through the router to my freepbx server and then forwarded back to the router.
This works for outgoing calls. But every time an incoming call comes in the console shows an error and the server does not handle it.
WARNING[1993][C-00000029]: chan_sip.c:17207 check_auth: username mismatch, have <99>, digest has <server620>
Which is strange, because 99 is my extension back to the router (FritzBox) again.

This is my trunk configuration (I also tried type=peer):

OK - a “type=Friend” setting means “use the same settings for the inbound that you used for the outbound.” Friend is “PEER + USER”, so you don’t have to fill in the User section on a Friend type connection. You shouldn’t need a “user” section at all if all of the settings are the same AND you are using a “friend” type.

I’m not sure I understand how your PBX is set up if your using an extension to send calls back out into the Internet. The bidirectional trunk you set up for server620 should handle all of your traffic in and out.

All right then, I think I didn’t need an extension.

What I have configured on my router, is:

  1. a SIP server, which forwards the incoming calls (to PBX)
  2. a SIP client, which waits for calls (from PBX)

Now how I need to configure the incoming and outgoing trunk to match the settings on my router?

Put this in your sip global options (not at the sip trunk options)

match_auth_username=yes

Try again.