Add prefix to caller id in Outging calls

Good day, sorry if the same topic exist, but i cant find them.

I have three trunks in asterisk:

  1. Genersl city outgoing sip trunk
  2. Trunk to our company depaatrment 1
  3. Trunk to our company department 2

Department 1 have shared numbers with us ex. we have 2xx and 3xx, they have 4xx and 5xx, but our departent two have phone numbers mask XXXXX and call to us with 51+2xx,51+3xx.

When department 2 call to us, phones show numbers in 517xx and 518xx etc, but when we call them his phones show only 2xx and 3xx without 51, how i can add prefix 51 to all outgoing calls to this trunk?

See the CALLERID function and the Set application (core show function and core show application).