It’s pretty simple to achieve what you want to do (I’m even handling four All-IP numbers like this).
User 520 should use line 035xxxx520
User 202 should use line 035xxxxxx202
User 244 should use line 035xxxxxx244
How to do it? Example User 520:
User 520 places an outbound call and uses CID 520. On base of this CID, you can add an outbound route, which matches to the CID 250 (it’s the fourth column of the Dial patterns tab). You have to take care, that a match of the route is possible by defining a reasonable entry in the third column - something like 0XXXXXX. e.g. (this expects you to dial always the numbers with prefix, like 0891234567).
On the tab “Routen Einstellungen”, you define trunks (Hauptleitungen) to be used for this route (here: 035xxxx520).
It is very important, that you create a correct destination number, which is given to the trunk and lastly to Telekom. If it’s wrong, Telekom won’t handle it. Telekom expects E.164 format, e.g. +49891234567. Therefore you have to take care, that you always create correct E.164 numbers. This means, you have to handle dialed numbers like 089… (for Munich e.g.) and rewrite it to +4989… or 4989… to +4989 or 0089… to +4989… or dialed numbers without any prefix: you have to add your local prefix 89 e.g. (those could be detected by the length of the dialed number).
Doing these number manipulations is possible in the outbound route and in the trunk. I’m configuring the trunks exactly the same way regarding number manipulation - they expect always the same format to be presented as input.
The trunk itself is the instance which creates the connect to the provider.
To check what is sent to the provider, you can enable SIP trace in asterisk:
asterisk -x “pjsip set logger on”
asterisk -x “pjsip set logger verbose off”
asterisk -x “pjsip set logger pcap trace.pcap”
Probably in /var/lib/asterisk/ you’re finding a trace.pcap file, which can be evaluated with wireshark. Be careful: you have to repeat the trace.pcap activation each time you reload asterisk - means each time, you activate changes in FreePBX.