11 Dial String Rewriting

11.1 Get

GET https://<HOST>:<PORT>/api/dialStringRewriting/get?version=0

Returns the specified dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read Access

Request parameters

  • dialStringRewriting

    Display name or ID of the dial string rewriting object. If not provided, all dial string rewriting objects will be returned.

Response Body Structure

The response body is strutured as an array. The array consists of DialStringRewriting JSON objects. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Example

GET http://127.0.0.1:8888/api/dialStringRewriting/get?version=0
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
[
  {
    "displayName": "",
    "rules": [{
      "clearDisplayName": false,
      "prefix": "+41",
      "rewriteType": "prefixAndSuffix",
      "skipRulesBelow": false,
      "index": 0,
      "skipFurtherRules": false,
      "applyToSourceDialString": true,
      "deleteLeadingCharacters": 3,
      "addPrefix": "0"
    }],
    "id": "5d6fe5e7-5f38-4a9f-bdb7-277601f6c172"
  },
  {
    "displayName": "RD 1",
    "rules": [
      {
        "prefix": "123",
        "displayName": "test",
        "addSuffix": "3",
        "matchTags": {
          "tagSet": [
            "userIp",
            "userPhone"
          ],
          "type": "xor"
        },
        "index": 0,
        "deleteTrailingCharacters": 2,
        "suffix": "456",
        "deleteLeadingCharacters": 1,
        "clearDisplayName": false,
        "rewriteType": "prefixAndSuffix",
        "skipRulesBelow": false,
        "skipFurtherRules": true,
        "comment": "Prefix Suffix Rewrite",
        "tagRewrite": {
          "operations": [
            {
              "tag": "userIp",
              "type": "keep"
            },
            {
              "tag": "userPhone",
              "type": "delete"
            }
          ],
          "clearTags": false
        },
        "applyToSourceDialString": true,
        "case": "lowercase",
        "addPrefix": "2"
      },
      {
        "clearDisplayName": false,
        "rewriteType": "prefixAndSuffix",
        "skipRulesBelow": false,
        "index": 1,
        "skipFurtherRules": true,
        "comment": "Add EXT",
        "applyToSourceDialString": true
      }
    ],
    "id": "c3c83ba4-be7d-43f7-9db1-424b9207b000"
  }
]

11.2 Set

PUT https://<HOST>:<PORT>/api/dialStringRewriting/set?version=0

Modifies the selected dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read/Write Access

Request parameters

  • dialStringRewriting

    The ID of the dial string rewriting object.

Request Body Structure

The request body is structured as DialStringRewriting JSON object. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Response Body Structure

The response body is structured as DialStringRewriting JSON object. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Example

PUT http://127.0.0.1:8888/api/dialStringRewriting/set?dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Request Body
{
  "displayName": "RD 1",
  "rules": []
}
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
{
  "displayName": "RD 1",
  "rules": [],
  "id": "c3c83ba4-be7d-43f7-9db1-424b9207b000"
}

11.3 Add

POST https://<HOST>:<PORT>/api/dialStringRewriting/add?version=0

Adds a new dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read/Write Access

Request Body Structure

The request body is structured as DialStringRewriting JSON object. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Response Body Structure

The response body is structured as DialStringRewriting JSON object. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Example

POST http://127.0.0.1:8888/api/dialStringRewriting/add?version=0
HTTP Request Body
{
  "displayName": "RD 1",
  "rules": [
    {
      "applyToDestinationDialString": null,
      "prefix": "123",
      "displayName": "test",
      "addSuffix": "3",
      "matchTags": {
        "tagSet": [
          "userIp",
          "userPhone"
        ],
        "type": "xor"
      },
      "index": 0,
      "deleteTrailingCharacters": 2,
      "suffix": "456",
      "deleteLeadingCharacters": 1,
      "clearDisplayName": false,
      "rewriteType": "prefixAndSuffix",
      "skipRulesBelow": null,
      "skipFurtherRules": true,
      "comment": "Prefix Suffix Rewrite",
      "tagRewrite": {
        "operations": [
          {
            "tag": "userIp",
            "type": "keep"
          },
          {
            "tag": "userPhone",
            "type": "delete"
          }
        ],
        "clearTags": false
      },
      "applyToSourceDialString": true,
      "applyToAllDialStrings": null,
      "addExtTrailingDigits": 0,
      "case": "lowercase",
      "addPrefix": "2"
    },
    {
      "clearDisplayName": null,
      "applyToDestinationDialString": null,
      "rewriteType": "addExt",
      "index": 1,
      "skipRulesBelow": null,
      "skipFurtherRules": true,
      "comment": "Add EXT",
      "applyToSourceDialString": true,
      "applyToAllDialStrings": null,
      "addExtTrailingDigits": 4,
      "case": null
    }
  ]
}
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
{
  "displayName": "RD 1",
  "rules": [
    {
      "prefix": "123",
      "displayName": "test",
      "addSuffix": "3",
      "matchTags": {
        "tagSet": [
          "userIp",
          "userPhone"
        ],
        "type": "xor"
      },
      "index": 0,
      "deleteTrailingCharacters": 2,
      "suffix": "456",
      "deleteLeadingCharacters": 1,
      "clearDisplayName": false,
      "rewriteType": "prefixAndSuffix",
      "skipRulesBelow": false,
      "skipFurtherRules": true,
      "comment": "Prefix Suffix Rewrite",
      "tagRewrite": {
        "operations": [
          {
            "tag": "userIp",
            "type": "keep"
          },
          {
            "tag": "userPhone",
            "type": "delete"
          }
        ],
        "clearTags": false
      },
      "applyToSourceDialString": true,
      "case": "lowercase",
      "addPrefix": "2"
    },
    {
      "clearDisplayName": false,
      "rewriteType": "prefixAndSuffix",
      "skipRulesBelow": false,
      "index": 1,
      "skipFurtherRules": true,
      "comment": "Add EXT",
      "applyToSourceDialString": true
    }
  ],
  "id": "c3c83ba4-be7d-43f7-9db1-424b9207b000"
}

11.4 Remove

DELETE https://<HOST>:<PORT>/api/dialStringRewriting/remove?version=0

Removes a dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read/Write Access

Request parameters

  • dialStringRewriting

    Display name or ID of the dial string rewriting object to be removed.

Example

DELETE http://127.0.0.1:8888/api/dialStringRewriting/remove?dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
[
  {
    "displayName": "",
    "rules": [{
      "clearDisplayName": false,
      "prefix": "+41",
      "rewriteType": "prefixAndSuffix",
      "skipRulesBelow": false,
      "index": 0,
      "skipFurtherRules": false,
      "applyToSourceDialString": true,
      "deleteLeadingCharacters": 3,
      "addPrefix": "0"
    }],
    "id": "5d6fe5e7-5f38-4a9f-bdb7-277601f6c172"
  },
  {
    "displayName": "",
    "rules": [
      {
        "clearDisplayName": false,
        "prefix": "00",
        "rewriteType": "prefixAndSuffix",
        "skipRulesBelow": false,
        "index": 0,
        "skipFurtherRules": false,
        "applyToAllDialStrings": true,
        "deleteLeadingCharacters": 2,
        "addPrefix": "+"
      },
      {
        "clearDisplayName": false,
        "prefix": "0",
        "rewriteType": "prefixAndSuffix",
        "skipRulesBelow": false,
        "index": 1,
        "skipFurtherRules": false,
        "applyToAllDialStrings": true,
        "deleteLeadingCharacters": 1,
        "addPrefix": "+41"
      }
    ],
    "id": "e945d828-3eb4-433e-a094-8209672d0186"
  }
]

11.5 Get Rules

GET https://<HOST>:<PORT>/api/dialStringRewriting/rules/get?version=0

Returns the rewriting rules of the chosen dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read Access

Request parameters

  • dialStringRewriting

    Display name or ID of the dial string rewriting object to request rules from.

Response Body Structure

The response body is strutured as an array. The array consists of DialStringRewriting JSON objects. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Example

GET http://127.0.0.1:8888/api/dialStringRewriting/rules/get?dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
[
  {
    "prefix": "123",
    "displayName": "test",
    "addSuffix": "3",
    "matchTags": {
      "tagSet": [
        "userIp",
        "userPhone"
      ],
      "type": "xor"
    },
    "index": 0,
    "deleteTrailingCharacters": 2,
    "suffix": "456",
    "deleteLeadingCharacters": 1,
    "clearDisplayName": false,
    "rewriteType": "prefixAndSuffix",
    "skipRulesBelow": false,
    "skipFurtherRules": true,
    "comment": "Prefix Suffix Rewrite",
    "tagRewrite": {
      "operations": [
        {
          "tag": "userIp",
          "type": "keep"
        },
        {
          "tag": "userPhone",
          "type": "delete"
        }
      ],
      "clearTags": false
    },
    "applyToSourceDialString": true,
    "case": "lowercase",
    "addPrefix": "2"
  },
  {
    "clearDisplayName": false,
    "rewriteType": "prefixAndSuffix",
    "skipRulesBelow": false,
    "index": 1,
    "skipFurtherRules": true,
    "comment": "Add EXT",
    "applyToSourceDialString": true
  }
]

11.6 Set Rules

PUT https://<HOST>:<PORT>/api/dialStringRewriting/rules/set?version=0

Replaces the rewriting rules of the chosen dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read/Write Access

Request parameters

  • dialStringRewriting

    Display name or ID of the dial string rewriting object the rewriting rules should be modified of.

Request Body Structure

The request body is strutured as JSON array. The array consists of DialStringRewrite JSON objects. A description for its fields is at section 30.15.1. For the JSON schema refer to section 30.15.2.

Response Body Structure

The response body is strutured as an array. The array consists of DialStringRewrite JSON objects. A description for its fields is at section 30.15.1. For the JSON schema refer to section 30.15.2.

Example

PUT http://127.0.0.1:8888/api/dialStringRewriting/rules/set?dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Request Body
[
  {
    "applyToDestinationDialString": null,
    "prefix": "123",
    "displayName": "test",
    "addSuffix": "3",
    "matchTags": {
      "tagSet": [
        "userIp",
        "userPhone"
      ],
      "type": "xor"
    },
    "index": 0,
    "deleteTrailingCharacters": 2,
    "suffix": "456",
    "deleteLeadingCharacters": 1,
    "clearDisplayName": false,
    "rewriteType": "prefixAndSuffix",
    "skipRulesBelow": null,
    "skipFurtherRules": true,
    "comment": "Prefix Suffix Rewrite",
    "tagRewrite": {
      "operations": [
        {
          "tag": "userIp",
          "type": "keep"
        },
        {
          "tag": "userPhone",
          "type": "delete"
        }
      ],
      "clearTags": false
    },
    "applyToSourceDialString": true,
    "applyToAllDialStrings": null,
    "addExtTrailingDigits": 0,
    "case": "lowercase",
    "addPrefix": "2"
  },
  {
    "clearDisplayName": null,
    "applyToDestinationDialString": null,
    "rewriteType": "addExt",
    "index": 1,
    "skipRulesBelow": null,
    "skipFurtherRules": true,
    "comment": "Add EXT",
    "applyToSourceDialString": true,
    "applyToAllDialStrings": null,
    "addExtTrailingDigits": 4,
    "case": null
  }
]
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
[
  {
    "prefix": "123",
    "displayName": "test",
    "addSuffix": "3",
    "matchTags": {
      "tagSet": [
        "userIp",
        "userPhone"
      ],
      "type": "xor"
    },
    "index": 0,
    "deleteTrailingCharacters": 2,
    "suffix": "456",
    "deleteLeadingCharacters": 1,
    "clearDisplayName": false,
    "rewriteType": "prefixAndSuffix",
    "skipRulesBelow": false,
    "skipFurtherRules": true,
    "comment": "Prefix Suffix Rewrite",
    "tagRewrite": {
      "operations": [
        {
          "tag": "userIp",
          "type": "keep"
        },
        {
          "tag": "userPhone",
          "type": "delete"
        }
      ],
      "clearTags": false
    },
    "applyToSourceDialString": true,
    "case": "lowercase",
    "addPrefix": "2"
  },
  {
    "clearDisplayName": false,
    "rewriteType": "prefixAndSuffix",
    "skipRulesBelow": false,
    "index": 1,
    "skipFurtherRules": true,
    "comment": "Add EXT",
    "applyToSourceDialString": true
  }
]

11.7 Import Rules

PUT https://<HOST>:<PORT>/api/dialStringRewriting/rules/import?version=0

Imports dial string rewriting rules into the specified dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read/Write Access

Request parameters

  • json

    Type: Boolean

    Determines if the uploaded file is in the JSON format. Defaults to false.

  • dialStringRewriting

    Display name or ID of the dial string rewriting object to add rewriting rules to.

Request Body Structure

The request expects the .csv or .json file that should be imported as "multipart/form-data".

Example

PUT http://127.0.0.1:8888/api/dialStringRewriting/rules/import?json=true&dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Request Headers
Content-type : "multipart/form-data"
Accept : "application/json"
HTTP Request Body
--fad1b652-3ebd-4c85-8bde-0e07ad7312b9
Content-Disposition: form-data; name="file"; filename="test_rewrites.json"
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
...
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
[
  {
    "prefix": "1234",
    "displayName": "test",
    "addSuffix": "3",
    "matchTags": {
      "tagSet": [
        "userIp",
        "userPhone"
      ],
      "type": "xor"
    },
    "index": 0,
    "deleteTrailingCharacters": 2,
    "suffix": "456",
    "deleteLeadingCharacters": 1,
    "clearDisplayName": false,
    "rewriteType": "prefixAndSuffix",
    "skipRulesBelow": false,
    "skipFurtherRules": true,
    "comment": "Prefix Suffix Rewrite",
    "tagRewrite": {
      "operations": [
        {
          "tag": "userIp",
          "type": "keep"
        },
        {
          "tag": "userPhone",
          "type": "delete"
        }
      ],
      "clearTags": false
    },
    "applyToSourceDialString": true,
    "case": "lowercase",
    "addPrefix": "2"
  },
  {
    "applyToDestinationDialString": true,
    "displayName": "test",
    "addSuffix": "3",
    "matchTags": {
      "tagSet": [
        "userIp",
        "userPhone"
      ],
      "type": "xor"
    },
    "index": 1,
    "deleteTrailingCharacters": 2,
    "deleteLeadingCharacters": 1,
    "wildcardPattern": "0123456789+\\+!?X.[]",
    "clearDisplayName": false,
    "rewriteType": "wildcardPattern",
    "skipRulesBelow": false,
    "skipFurtherRules": false,
    "comment": "Wildcard Pattern Rewrite",
    "tagRewrite": {
      "operations": [
        {
          "tag": "userIp",
          "type": "keep"
        },
        {
          "tag": "userPhone",
          "type": "delete"
        }
      ],
      "clearTags": false
    },
    "case": "casefold",
    "addPrefix": "2"
  }
]

11.8 Export Rules

GET https://<HOST>:<PORT>/api/dialStringRewriting/rules/export?version=0

Exports dial string rewriting rules from the specified dial string rewriting object as JSON.

Required Permissions

  • API

  • Configuration Mode Read Access

Request parameters

  • filename

    (Optional) Name of the exported file.

  • dialStringRewriting

    Display name or ID of the dial string rewriting object to add rewriting rules to.

Example

GET http://127.0.0.1:8888/api/dialStringRewriting/rules/export?dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Response
HTTP/1.1 200 OK

11.9 Add Rules

POST https://<HOST>:<PORT>/api/dialStringRewriting/rules/add?version=0

Add dial string rewriting rules to the specified dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read/Write Access

Request parameters

  • dialStringRewriting

    Display name or ID of the dial string rewriting object the rewriting rules should be modified of.

Request Body Structure

The request body is structured as DialStringRewrite JSON object. A description for its fields is at section 30.15.1. For the JSON schema refer to section 30.15.2.

Response Body Structure

The response body is structured as DialStringRewriting JSON object. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Example

POST http://127.0.0.1:8888/api/dialStringRewriting/rules/add?dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Request Body
{
  "applyToDestinationDialString": null,
  "prefix": "123",
  "displayName": "test",
  "addSuffix": "3",
  "matchTags": {
    "tagSet": [
      "userIp",
      "userPhone"
    ],
    "type": "xor"
  },
  "index": 0,
  "deleteTrailingCharacters": 2,
  "suffix": "456",
  "deleteLeadingCharacters": 1,
  "clearDisplayName": false,
  "rewriteType": "prefixAndSuffix",
  "skipRulesBelow": null,
  "skipFurtherRules": true,
  "comment": "Prefix Suffix Rewrite",
  "tagRewrite": {
    "operations": [
      {
        "tag": "userIp",
        "type": "keep"
      },
      {
        "tag": "userPhone",
        "type": "delete"
      }
    ],
    "clearTags": false
  },
  "applyToSourceDialString": true,
  "applyToAllDialStrings": null,
  "addExtTrailingDigits": 0,
  "case": "lowercase",
  "addPrefix": "2"
}
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
{
  "displayName": "RD 1",
  "rules": [{
    "prefix": "123",
    "displayName": "test",
    "addSuffix": "3",
    "matchTags": {
      "tagSet": [
        "userIp",
        "userPhone"
      ],
      "type": "xor"
    },
    "index": 0,
    "deleteTrailingCharacters": 2,
    "suffix": "456",
    "deleteLeadingCharacters": 1,
    "clearDisplayName": false,
    "rewriteType": "prefixAndSuffix",
    "skipRulesBelow": false,
    "skipFurtherRules": true,
    "comment": "Prefix Suffix Rewrite",
    "tagRewrite": {
      "operations": [
        {
          "tag": "userIp",
          "type": "keep"
        },
        {
          "tag": "userPhone",
          "type": "delete"
        }
      ],
      "clearTags": false
    },
    "applyToSourceDialString": true,
    "case": "lowercase",
    "addPrefix": "2"
  }],
  "id": "c3c83ba4-be7d-43f7-9db1-424b9207b000"
}

11.10 Remove Rules

DELETE https://<HOST>:<PORT>/api/dialStringRewriting/rules/remove?version=0

Removes a dial string rewriting rule of the specified dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read/Write Access

Request parameters

  • index

    The index of the rule that will be removed. Either this or the parameter rule must be provided.

  • rule

    The display name of the rule that will be removed. Either this or the parameter index must be provided.

  • dialStringRewriting

    Display name or ID of the dial string rewriting object the rewriting rules should be modified of.

Response Body Structure

The response body is structured as DialStringRewriting JSON object. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Example

DELETE http://127.0.0.1:8888/api/dialStringRewriting/rules/remove?index=0&dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
{
  "displayName": "RD 1",
  "rules": [],
  "id": "c3c83ba4-be7d-43f7-9db1-424b9207b000"
}

11.11 Clear Rules

DELETE https://<HOST>:<PORT>/api/dialStringRewriting/rules/clear?version=0

Removes all dial string rewriting rules of the specified dial string rewriting object.

Required Permissions

  • API

  • Configuration Mode Read/Write Access

Request parameters

  • dialStringRewriting

    Display name or ID of the dial string rewriting object the rewriting rules should be modified of.

Response Body Structure

The response body is structured as DialStringRewriting JSON object. A description for its fields is at section 30.14.1. For the JSON schema refer to section 30.14.2.

Example

DELETE http://127.0.0.1:8888/api/dialStringRewriting/rules/clear?dialStringRewriting=c3c83ba4-be7d-43f7-9db1-424b9207b000&version=0
HTTP Response
HTTP/1.1 200 OK
HTTP Response Body
{
  "displayName": "RD 1",
  "rules": [],
  "id": "c3c83ba4-be7d-43f7-9db1-424b9207b000"
}