Difference between revisions of "M4 Header Transformation Rules Groups"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(13 intermediate revisions by the same user not shown)
Line 27: Line 27:
Some headers will still be modified during call processing, for example Max-Forwards counter will be changed (decreased) even if it was set to forward without changes as this is required for SIP message processing.
Some headers will still be modified during call processing, for example Max-Forwards counter will be changed (decreased) even if it was set to forward without changes as this is required for SIP message processing.


Both '''EXISTING HEADER TRANSFORMATION''' and '''NEW HEADER CONSTRUCTION''' options are disabled in this action since no modification is required.
Both <code>EXISTING HEADER TRANSFORMATION</code> and <code>NEW HEADER CONSTRUCTION</code> options are disabled in this action since no modification is required.
<br>
<br>
<br>
<br>
Line 33: Line 33:
===Transform and forward===
===Transform and forward===


If the header exists, it will be modified by '''EXISTING HEADER TRANSFORMATION''' rule.
If the header exists, it will be modified by <code>EXISTING HEADER TRANSFORMATION</code> rule.


Option '''NEW HEADER CONSTRUCTION''' is disabled in this action since we only operate on an existing header.
Option <code>NEW HEADER CONSTRUCTION</code> is disabled in this action since we only operate on an existing header.
<br>
<br>
<br>
<br>
Line 41: Line 41:
===Transform existing, generate if missing===
===Transform existing, generate if missing===


If the header exists, it will be modified by '''EXISTING HEADER TRANSFORMATION''' rule.
If the header exists, it will be modified by <code>EXISTING HEADER TRANSFORMATION</code> rule.<br>
If the header does not exist, it will be generated by '''NEW HEADER CONSTRUCTION''' rule.
If the header does not exist, it will be generated by <code>NEW HEADER CONSTRUCTION</code> rule.
<br>
<br>
<br>
<br>
Line 48: Line 48:
===Overwrite===
===Overwrite===


A new header will be constructed by '''NEW HEADER CONSTRUCTION''' rule. If the header was already present, it will be overwritten by the new header.
A new header will be constructed by <code>NEW HEADER CONSTRUCTION</code> rule.<br>
If the header is already present, it will be overwritten by the new header.


Option '''EXISTING HEADER TRANSFORMATION''' is disabled in this action since we only overwrite the existing header (or if the header is missing, adding a new header).
Option <code>EXISTING HEADER TRANSFORMATION</code> is disabled in this action since we only overwrite the existing header (or if the header is missing, adding a new header).
<br>
<br>
<br>
<br>
Line 58: Line 59:
If the header exists, it will be dropped.
If the header exists, it will be dropped.


Both '''EXISTING HEADER TRANSFORMATION''' and '''NEW HEADER CONSTRUCTION''' options are disabled in this action since no modification is required, only drop.
Both <code>EXISTING HEADER TRANSFORMATION</code> and <code>NEW HEADER CONSTRUCTION</code> options are disabled in this action since no modification is required, only drop.
<br>
<br>
<br>
<br>
==Existing Header Transformation==
This option is only available in actions <code>Transform and forward</code> and <code>Transform existing, generate if missing</code>.
The format is:
'''/match_expression/replacement_expression/flags'''
* match_expression - POSIX regular expression
* replacement_expression - replacement expression with back references to matched tokes: \1, \2, …, \9
* flags (optional):
** i - match ignore case
** g - replace all matches
More information [[M4_Kamailio_Transformations | here]].
==New Header Construction==
This option is only available in actions <code>Transform existing, generate if missing</code> and <code>Overwrite</code>.
The format is a plain text value that will be added to a header.


==Custom headers==
==Custom headers==
Line 68: Line 91:
==Limitations==
==Limitations==


* Only the Invite request is available for modifications.
* Only the outgoing Invite request is available for modifications.
* Some actions cannot be applied to specific headers. For example you can't modify Call-ID, Via, Contact headers as these header are required for internal operations and should be left as is.
* Some actions cannot be applied to specific headers. For example, you can't modify Call-ID, Via, Contact headers as these headers are required for internal operations and should be left as is.


<br><br>
<br><br>
Line 78: Line 101:
<br>
<br>
[[File:Termination point rules settings.png]]
[[File:Termination point rules settings.png]]
<br><br>
=Format=
Kamailio Transformations are used to modify headers. More information [[M4_Kamailio_Transformations | here]]


<br><br>
<br><br>
= User-Agent header =
= User-Agent header =


[[M4_User-Agent|User-Agent]] header can be changed in the system configuration file. Please contact support to change this header.
Due to technical limitations, [[M4_User-Agent|User-Agent]] header cannot be changed using Header Transformation Rules. Please contact support to change this header for all calls.


<br><br>
<br><br>

Latest revision as of 08:34, 9 February 2024

About

Header Transformation Rules are used to modify or add headers.

Header Transformation Rules are available in the Routing section.

M4 routing header transformation rules.png



Create

Press ADD NEW to create Header Transformation Rules Group.

M4 header transformation rules add new.png

The image below shows which headers are possible to modify.
M4 header transformation rules.png

Actions

Depending on the header, it is possible to perform various actions on the header.

Forward without changes

If the header exists, it will be forwarded with no additional changes.

Some headers will still be modified during call processing, for example Max-Forwards counter will be changed (decreased) even if it was set to forward without changes as this is required for SIP message processing.

Both EXISTING HEADER TRANSFORMATION and NEW HEADER CONSTRUCTION options are disabled in this action since no modification is required.

Transform and forward

If the header exists, it will be modified by EXISTING HEADER TRANSFORMATION rule.

Option NEW HEADER CONSTRUCTION is disabled in this action since we only operate on an existing header.

Transform existing, generate if missing

If the header exists, it will be modified by EXISTING HEADER TRANSFORMATION rule.
If the header does not exist, it will be generated by NEW HEADER CONSTRUCTION rule.

Overwrite

A new header will be constructed by NEW HEADER CONSTRUCTION rule.
If the header is already present, it will be overwritten by the new header.

Option EXISTING HEADER TRANSFORMATION is disabled in this action since we only overwrite the existing header (or if the header is missing, adding a new header).

Drop

If the header exists, it will be dropped.

Both EXISTING HEADER TRANSFORMATION and NEW HEADER CONSTRUCTION options are disabled in this action since no modification is required, only drop.

Existing Header Transformation

This option is only available in actions Transform and forward and Transform existing, generate if missing.

The format is:

/match_expression/replacement_expression/flags

  • match_expression - POSIX regular expression
  • replacement_expression - replacement expression with back references to matched tokes: \1, \2, …, \9
  • flags (optional):
    • i - match ignore case
    • g - replace all matches

More information here.

New Header Construction

This option is only available in actions Transform existing, generate if missing and Overwrite.

The format is a plain text value that will be added to a header.

Custom headers

It is also possible to add a custom header to the empty header field.

Limitations

  • Only the outgoing Invite request is available for modifications.
  • Some actions cannot be applied to specific headers. For example, you can't modify Call-ID, Via, Contact headers as these headers are required for internal operations and should be left as is.



Enable

When rules are created, they should be enabled at Termination Point settings: Termination Point Signaling Settings
Termination point rules settings.png



User-Agent header

Due to technical limitations, User-Agent header cannot be changed using Header Transformation Rules. Please contact support to change this header for all calls.



See also