Howto modify what goes into From/P-Preferred-Identity/Callerid and so on

From berofix - professional SIP gateway
Jump to: navigation, search


beroFix is a modular SIP Gateway, which translates the SIP Protocol according to RFC3261 [1] into the technologies:

  • ISDN PRI and BRI, according to the EuroISDN Standards ITU/T Q.931 [2]
  • FXO, FXS
  • GSM, via a GSM Module according to the ETSI GSM AT commandset [3]

Each technology has at least 1 Information Element which contains the caller id. Since SIP is a rather loosely defined standard. It has several recommendations and drafts which define where caller ids can be present.


technology caller id options
SIP From:, P-Preferred-Identity:, P-Asserted-Identity:, Remote-Party-Id:
ISDN OAD, OAD2, QSIG Name
Analog Caller ID, Calling Name
GSM Caller ID


beroFix has also the ability to match dialplan rules against the caller id. It uses the Source in the dialplan for matching and the NewSource to generate the caller id for the outbound technology.

This document describes how to configure the caller id matching and output behaviour of berofix.

New Dialplan

The beroFix Dialplan allows to match the dialed Number (Destination) and the Callerid (Source) against Patterns. It also allows to modify the Destination and Callerid, for example to put a prefix (like 0) before a Number. Each Dialplan Rule can carry additional Configuration options that are only valid for this rule. With these tools it is possible to modify the call handling behavior of berofix per Destination Number or per CallerID. One usage example is to enable or disable CLIR per Destination prefix.

Dialplan-overview.png

Destination

As you can see it is quite simple to say which field in SIP or PSTN is the Destination (To Header and DAD), so there is a simple 1:1 Mapping between the SIP Header "To:" and the PSTN Destination Number DAD. To make it possible to match against certain Destination all incoming calls are first processed by the Dialplan.

Dialplan-to.png

If the call comes from SIP, the To: Header is matched against all Dialplan Destination fields. If one line matches the configured CallerID is checked against the Dialplan Source field (see below). If one rule matches, then the PSTN DAD (Destination Address) is filled with NewDestination. The Destination matches with regular expressions and the NewDestination contains the results.

Source

If we take a closer look at the callerid we find out that both SIP and PSTN have multiple Fields to carry callerid Information. In general there are at least 2 Fields (Number and Name). Since the beroFix Dialplan can only match against one Source it is now possible to define which of the SIP Headers or which of the PSTN Callerid Fields is used for matching and mangling. This setting is Called "Dialplan Source" and can be found both in the SIP Account Settings or in the PSTN Group Settings.

Source (from SIP)

The Dialplan Source Setting coming From SIP is editable under "more":

Dp-from-sip.jpg

the Default Setting is "from_user" which means that beroFix will use the from_user SIP Header as it's Diaplan Source.

If the call comes from sip there are other SIP Headers: from_display, from_user, p-asserted-identy, p-preferred-identy or Remote-Party-Id which can carry the callerid. You can choose to use those fields in the dialplan-source Setting.

Dialplan-from-sip.png


Source (to SIP)

In the Direction towards SIP, you can also define which SIP Header contains which Information. Normally the Callerid is contained in the NewSource in the Dialplan, so you want to use NewSource as the SIP Header which is understood as Callerid at the Remote Party.

Dp-to-sip.jpg

The SIP Headers which contain the callerid as default are: From_User and From_Display. Sometimes, especially when beroFix is registered at a remote SIP Server the From_User needs to be identical with the Username, so you need to set the From_User to "Account_Username". In those cases you still have some SIP Headers left to transmit the callerid: from_display, p-asserted-identy (user,display), p-preferred-identy(user,display) or Remote-Party-Id (user,display).

To set the specific SIP Headers use the following Additional Configuration options:

sip_pai_user_setting      - P-Asserted-Identity_UserPart
sip_pai_display_setting   - P-Asserted-Identity_DisplayPart
sip_ppi_user_setting      - P-Preferred-Identity_UserPart
sip_ppi_display_setting   - P-Preferred-Identity_DisplayPart 
sip_rpi_user_setting      - Remote-Party-Identity_UserPart
sip_rpi_display_setting   - Remote-Party-Identity_DisplayPart


The Values for these settings are:

${new_source}         - Callerid Result from the Dialplan 
${oad}                - ISDN Oad
${oad2}               - ISDN Oad2
${clip}               - Analog CLIP
${cnip}               - Analog CNIP
${qsigname}           - ISDN Qsigname
${account_username}   - SIP Account Username


Example:

You want to have the Remote-Party-Id User Part to be the Callerid from the beroFix Dialplan:

sip_rpi_user_setting=${new_source}

Source (from PSTN)

If the call comes from isdn the callerid is in most cases carried in the oad (originator address) field.

Dialplan-from-isdn.png


Callerid Restriction/ Anonymity and Privacy

If you want to hide the Callerid in ISDN you need to indicate that by using the Presentation Flag, SIP has depending on the Header which is used as CallerID Transport different methods. In case of the P-Asserted-Identity there is the Privacy Header, in case of the Remote-Party-Id there is the Anonymity Flag.

If you want that berofix translates the ISDN Presentation Indicator into the SIP Privacy/Anonymity Headers, you need to modify the addition configuration options of the corresponding Dialplan. When you click on "more" you will be able to set the options:

rpi_anonymity_flags       - Remote Party Id Anonymity Flags Header
use_privacy_header (1/0)  - P-Asserted-Id Privacy Header 

The possible Values for rpi_anonymity_flags are:

full    - Hide the URI, Name and IP Address
uri     - Just hide the URI
name    - Just hide the Name
ipaddr  - Just hide the IP Address
off     - don't use the Anonymity Flags Header

Example:

you want to translate the ISDN Presentation Flag of the Callerid in a ISDN->SIP Direction, into the Remote-Party-Id:

rpi_anonymity_flags=full

you want to translate the P-Asserted-Id Privacy Header into the ISDN Presentation Flag, in a SIP->ISDN Direction:

use_privacy_header=1

X-BF Headers and IE on SIP

If you enable "IE on SIP" beroFix will tranport all ISDN Information Elements which it understand in proprietary X-BF Headers. Especially the ISDN Called_Party_Number with all it's ISDN Elements are encoded.

These headers can be used, to transmit ISDN Information Elements between 2 sperate beroFix devices, that are connected via SIP.

Note: beroFix will overwrite all above Settings (Privacy) with the ISDN Information Elements contained in the 
          X_BF Headers. Only the callerid itself will be taken from the Dialplan NewSource.

References:

[1] http://www.ietf.org/rfc/rfc3261.txt
[2] http://www.itu.int/rec/T-REC-Q.931/e
[3] http://www.3gpp.org/ftp/Specs/archive/07_series/07.07/