Difference between revisions of "M4 Source Transformation"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Source Transformation rules=
=Source Transformation rules=


Source Transformation rules are used to manipulate Source (CallerID) number (cut prefix, add prefix). Only number part of CallerID will be changed. Rules can be set in [[M2 Termination Points | Termination Points]] or [[M2 Origination Points | Origination Points]] Source Transformation input field. There are 3 different Source Transformation rules:
Source Transformation rules are used to manipulate the Source (CallerID) number (cut prefix, add prefix). The only number part of CallerID will be changed. Rules can be set in [[M4 Termination Points | Termination Points]] or [[M4 Origination Points | Origination Points]] Source Transformation input field. There are 3 different Source Transformation rules:


'''1. Add prefix'''
'''1. Add prefix'''
Line 9: Line 9:
'''2. Cut prefix'''
'''2. Cut prefix'''


To cut something from number, write - (minus) character and then what to cut. For example -00 will cut 00 from the beginning of number (only if number starts with 00).
To cut something from a number, write - (minus) character and then what to cut. For example, -00 will cut 00 from the beginning of the number (only if the number starts with 00).


'''3. Replace prefix'''
'''3. Replace prefix'''


To cut something from number and add something else (replace), write - (minus) character followed by what to cut, then + (plus) character and what to add. For example -00+8 will cut 00 from beginning of number and add digit 8 in front (00 will be replaced by 8).
To cut something from the number and add something else (replace), write - (minus) character followed by what to cut, then + (plus) character and what to add. For example, -00+8 will cut 00 from the beginning of the number and add the digit 8 in front (00 will be replaced by 8).


<br><br>
<br><br>
Line 23: Line 23:
-A+B|-C+D|-X|Z
-A+B|-C+D|-X|Z


Rules are checked in the order they are written and first matching rule will be applied. If one rule is applied, then other rules will be skipped. This means that some rules do no make sense, for example 00|-6+370 rule will always add 00 in front of number and second rule will be skipped.<br>
Rules are checked in the order they are written and the first matching rule will be applied. If one rule is applied, then other rules will be skipped. This means that some rules do not make sense, for example, 00|-6+370 rule will always add 00 in front of the number and the second rule will be skipped.<br>


The number of rules is limited only by the length of input field (255 characters).
The number of rules is limited only by the length of the input field (255 characters).


<br><br>
<br><br>
Line 34: Line 34:
| '''Incoming Source Number''' || '''Source Transformation''' || '''Outgoing Source number''' || '''Comment'''
| '''Incoming Source Number''' || '''Source Transformation''' || '''Outgoing Source number''' || '''Comment'''


|-
| +86123456789 || -\+ || 86123456789 || cut + in front of number
|-
|-
| 86123456789 || 00 || 0086123456789 || simple rule just adds 00 in front of number
| 86123456789 || 00 || 0086123456789 || simple rule just adds 00 in front of number
|-
|-
| 003706123456789 || -00 || 3706123456789 || if number starts with digits 00, then cut them
| 003706123456789 || -00 || 3706123456789 || if the number starts with digits 00, then cut them
|-
|-
| 86123456789 || -8+370 || 3706123456789 || cut number 8 and add 370. If number does not start with 8, then nothing will be added
| 003706123456789 or +3706123456789 || <nowiki>-\+|-00</nowiki> || 3706123456789 || cut + or 00 in front of number
|-
|-
| 03706123456789 || <nowiki>-00+370|-0</nowiki> || 3706123456789 || Source Transformation contains multiple rules but first rule is skipped, because number starts with 0 and not 00. Second rule is applied and 0 is cut from number  
| 86123456789 || -8+370 || 3706123456789 || cut number 8 and add 370. If the number does not start with 8, then nothing will be added
|-
|-
| 3706123456789 || <nowiki>-00+370|-0|+</nowiki> || +3706123456789 || Source Transformation contains multiple rules but first and second rules are skipped. Last rule simply adds + to the number
| 03706123456789 || <nowiki>-00+370|-0</nowiki> || 3706123456789 || Source Transformation contains multiple rules but the first rule is skipped because the number starts with 0 and not 00. The second rule is applied and 0 is cut from the number  
|-
|-
| 86123456789 || <nowiki>-8+370|00</nowiki> || 3706123456789 || Source Transformation contains multiple rules but first rule is applied and other rules are skipped
| 3706123456789 || <nowiki>-00+370|-0|+</nowiki> || +3706123456789 || Source Transformation contains multiple rules but the first and second rules are skipped. The last rule simply adds + to the number
|-
|-
| 86123456789 || <nowiki>-8+\+370</nowiki> || +3706123456789 || if number start with digit 8, then cut it and add +370. Note that + is escaped by using \ character
| 86123456789 || <nowiki>-8+370|00</nowiki> || 3706123456789 || Source Transformation contains multiple rules but the first rule is applied and other rules are skipped
|-
| 86123456789 || <nowiki>-8+\+370</nowiki> || +3706123456789 || if the number starts with the digit 8, then cut it and add +370. Note that + is escaped by using \ character
|}
|}
<br><br>
= Regexp Rules =
Number transformation can also be done using Regexp. More information: [[M4 Regexp Examples]]


<br><br>
<br><br>
Line 54: Line 64:
=See also=
=See also=


* [[M2 Termination Points]]
* [[M4 Termination Points]]
* [[M2 Origination Points]]
* [[M4 Origination Points]]
* [[M4 Destination Transformation | Destination Transformation]]

Latest revision as of 07:06, 19 January 2023

Source Transformation rules

Source Transformation rules are used to manipulate the Source (CallerID) number (cut prefix, add prefix). The only number part of CallerID will be changed. Rules can be set in Termination Points or Origination Points Source Transformation input field. There are 3 different Source Transformation rules:

1. Add prefix

To add something to every number, just enter what to add.

2. Cut prefix

To cut something from a number, write - (minus) character and then what to cut. For example, -00 will cut 00 from the beginning of the number (only if the number starts with 00).

3. Replace prefix

To cut something from the number and add something else (replace), write - (minus) character followed by what to cut, then + (plus) character and what to add. For example, -00+8 will cut 00 from the beginning of the number and add the digit 8 in front (00 will be replaced by 8).



Multiple rules

It is possible to define multiple Source Transformation rules in one single line. It is done by separating rules with | character:

-A+B|-C+D|-X|Z

Rules are checked in the order they are written and the first matching rule will be applied. If one rule is applied, then other rules will be skipped. This means that some rules do not make sense, for example, 00|-6+370 rule will always add 00 in front of the number and the second rule will be skipped.

The number of rules is limited only by the length of the input field (255 characters).



Examples

Incoming Source Number Source Transformation Outgoing Source number Comment
+86123456789 -\+ 86123456789 cut + in front of number
86123456789 00 0086123456789 simple rule just adds 00 in front of number
003706123456789 -00 3706123456789 if the number starts with digits 00, then cut them
003706123456789 or +3706123456789 -\+|-00 3706123456789 cut + or 00 in front of number
86123456789 -8+370 3706123456789 cut number 8 and add 370. If the number does not start with 8, then nothing will be added
03706123456789 -00+370|-0 3706123456789 Source Transformation contains multiple rules but the first rule is skipped because the number starts with 0 and not 00. The second rule is applied and 0 is cut from the number
3706123456789 -00+370|-0|+ +3706123456789 Source Transformation contains multiple rules but the first and second rules are skipped. The last rule simply adds + to the number
86123456789 -8+370|00 3706123456789 Source Transformation contains multiple rules but the first rule is applied and other rules are skipped
86123456789 -8+\+370 +3706123456789 if the number starts with the digit 8, then cut it and add +370. Note that + is escaped by using \ character



Regexp Rules

Number transformation can also be done using Regexp. More information: M4 Regexp Examples




See also