Asterisk 18.0.1: wrong SIP Gateway displayed on incoming calls

Hi all,
I have an Asterisk Server behind a Fritz!Box.
All incoming lines from my provider are configured on the Fritzbox and set as SIP clients on the Asterisk like so:

sip.conf

[general]
port = 5060
bindaddr = 0.0.0.0
language = de
disallow = all
allow = alaw
allow = ulaw
allow = gsm
allow = g729
dtmfmode=auto
fromdomain=10.10.10.254

register => 626Cisco:[SECRET]@10.10.10.254/626

[626]
type = peer
username = 626Cisco
secret = [SECRET]
host = 10.10.10.254
fromdomain = fritz.box
fromuser = 626Cisco
nat = no
canreinvite = yes
insecure = port,invite

[10]
context = 10_SIP
type = friend
secret = [SECRET]
host = dynamic
nat = force_rport,comedia

On the Fritz!Box the MSN1 is bound to the extension “626”.
I spare out the rest, because the issue can be replicated by a single line object.
If I call from outside to the number of my MSN1 the call is routed to Asterisk and forwarded according to the dialplan:

extensions.conf

[FritzBoxIncomingMSN01]
;Incoming Call on MSN1 (xxxxx) 60 sec ring, than voicebox
exten => 626,n,dial(sip/10,60);
exten => 626,n,VoiceMail(9);
exten => 626,n,hangup();

The Fritz!Box has IP 10.10.10.254 and the Asterisk 10.10.10.242.
on the SIP Device registered with “10” this is displayed:
sip:[callerid]@10.10.10.254

I can pickup the call, but I cannot call back if I miss, because the SIP Gateway is displayed from the Fritz!Box.
What do I need to change, that the caller is changed to
sip:[callerid]@10.10.10.242
??

10 is broken if it is using the From address to determine the request URI to be used for transfers; it should be using the Contact address, which should always be the either the true address, or the externhost address.

Your From domain is being set by fromdomain, in the general section.

(Also, nat=no is almost certainly unnecessary, and inseure=port is probably unnecessary. canreinvite is now called directmedia.)

Ah, ok.
I missunderstood the “fromdomain” completely, as it somewhen back in my first steps was set this way, while troubleshooting the Fritz!Box connection.
I never changed it, and it never turned to be an issue as I am using SCCP devices mostly.
Now starting with some SIP devices it came up on a call back attempt.

So thanks for that!
After changing it to the correct ip (or better FQDN) of my asterisk, it works as expected.

For the other values I have to check later on.
It is a small home environment and used very rarly.