How to remove digits


I have 30 digits in my sip number, last 9 of them are phone number.
Can anyone give me the info, in the easiest way how to remove first 21 digits before sending number to the trunk ? Its posible to do it in the trunk setings but i cant deal with it … or maybe there is another option to cut it ?

Im beging for help…

Outbound Routes dial patterns

In dial Outbound Routes, dial patterns i have “XXXXXXXXXXXXXXXXXXXX1.”

If 1 go to trunk 1 if 2 go to trunk 2, etc

I have to add something to this to remove 21 digits ? becuse now all 30 digits are going to the trunk…

XXXXXXXXXXXXXXXXXXXX3. this is in match pattern (21 digits)

Put everything you want to drop in the prefix box and what you want to keep in match pattern box.

Ok this in all my sip number XXXXXXXXXXXXXXXXXXXX5XXXXXXXXX 30 digits or more depense where im calling. Evrything after 5 is a phone number

So in the prefix im puting XXXXXXXXXXXXXXXXXXXX5 because its not necessary for my trunk

But what in match patter ? I need to chceck by 21st digit where to send the number, with-one trunk PBX have to use.

How to do it ? can you make a example for me ?

I will be gratefull