Then I restart Asterisk
Now if you call me at 2020 the calls will be placed in context from-2020
but if you call me at 2021, the call will be placed in context from-2020 too.
Why go to the same context if they are really different in the config?
What I’m doing wrong?
Because they come from the same IP address, and, in spite of your use of friend, they are not passing the extension number in the From header (not that you would expect a PABX to do that).
Note that most SIP PABXes support SIP tie “trunks”, so you shouldn’t need to do this hack with extensions.
You continue to use the wrong forum for your support questions.
PBX A has it’s own set of extensions.
PBX B has it’s own set of extensions.
Set up a telephone connection between PBX A and PBX B (i.e. SIP Trunk). If you are using SIP, I recommend not using any authentication or registration.
Use the PBX A - PBX B telephone connection in your call routing scenarios. PBX A should route calls to PBX B extension numbers via the telephone connection between PBX A and PBX B. The same goes for PBX B and calls to extension numbers that are on PBX A.