Dial Plan Question - Variable Modification of DisplayName

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
neils21
Posts: 17
Joined: Tue Jul 22, 2014 8:47 am

Dial Plan Question - Variable Modification of DisplayName

Post by neils21 »

1. Brekeke Product Name and Version:
Brekeke SIP Server, Version 3.7.4.8

2. Java version:
8.121 64bit

3. OS type and the version:
Win Server 2012R2 Standard

4. UA (phone), gateway or other hardware/software involved:
Ascom Myco / Cisco CUCM w/ Various Sets / Counterpath Xlite 4.9.8


5. Your problem:

This is question relating to a topic answered for me here
http://www.brekeke-sip.com/bbs/viewtopi ... highlight=

I am modifying the displayname to eliminate specific characters in a set amount of the string. So as described Displayname has

5031_2 Call Type
5031_1 Call Type
503102 Call Type

Which this pattern to remove the bold works great

$request = ^INVITE
$registered = false
To = sip:(.+)@
$getDisplayName(From) = .{4}(.{4})\S* (.+)

My question is what if the leading characters on the DisplayName are Alphanumeric and beyond that character limit but I still need to retain the ability to remove the bold from that DisplayName

Example

5031_2 Call Type = 5031 Display Name
Location Name Call Type = Location Name Call Type

Specific Example

500503101 Nurse Call = 5031 Nurse Call
9FrontLobby Nurse Call = FrontLobby Nurse Call

I've tried playing around with the above dialplan in a test environment where changing the

$getDisplayName(From) = .{4}(.{4})\S* (.+)

to this for instance

$getDisplayName(From) = .{1}(.{9})\S* (.+)

Get's closer to fixing the latter of the two examples

9FrontLobby Nurse Call = FrontLobby Nurse Call

But totally breaks the former

500503101 Nurse Call = 00503101 Nurse Call

Is there a way to do this in a single dial plan, or will I need to setup specific plan rules for odd areas like the above example?

Thanks in advance


[/b]
redroof
Posts: 97
Joined: Fri Nov 16, 2007 1:46 pm

Post by redroof »

According to your previous post, Display Name always starts with "5CHP" like a "5CHP503102 Call Type".

So.. Is the actual original display name of "9FrontLobby Nurse Call " the following?
"5CHP9FrontLobby Nurse Call"
neils21
Posts: 17
Joined: Tue Jul 22, 2014 8:47 am

Post by neils21 »

Unfortunately in this instance no

For this particular example there are multiple character lead ins. Some are only 4 in length, some are 1 or 3 in length. Also the description of the area can be alphanumeric Some examples

9301_1 Call Type
OB322_1 Call Type
114353_1 Call Type
7thF703301 Call Type
7thF7033_1 Call Type
11FrontLobby Call Type

With the bold in each example being the set of characters I'd like to try and remove. Like mentioned with the previous dial example I can do this by playing with the first two variables but when one is working the other will not because wrong character selection.

I'm guessing then that I would have to have a matching rule for each possible entry IE

IF
9301_1 Call Type

Then Use

$getDisplayName(From) = .{1}(.{3})\S* (.+)

If
114353_1 Call Type

Then Use

$getDisplayName(From) = .{2}(.{4})\S* (.+)

And so on for each incoming match. I'm just not sure how that would look on the matching side if that is possible? Also would the priority of the rule affect the call also? And then in the last example with the description being placed

11FrontLobby Call Type

I'd only want to remove those first few characters (or 4 it could vary on those)

Hope that makes sense.
redroof
Posts: 97
Joined: Fri Nov 16, 2007 1:46 pm

Post by redroof »

Try following rules. You need to replace "CISCOIP" with the actual Cisco's IP address.


Rule-1: Prefix 5CHP
[Matching Patterns]
$request = ^INVITE
$registered = false
To = sip:(.+)@
$getDisplayName(From) = ^5CHP(\d{4})\S* (.+)

[Deploy Patterns]
Session-Expires =
Min-SE =
To = sip:%1@CISCOIP
From/displayname = %2 %3


Rule-2: Prefix 9
[Matching Patterns]
$request = ^INVITE
$registered = false
To = sip:(.+)@
$getDisplayName(From) = ^9(\d{3})\S* (.+)

[Deploy Patterns]
Session-Expires =
Min-SE =
To = sip:%1@CISCOIP
From/displayname = %2 %3


Rule-3: Prefix OB
[Matching Patterns]
$request = ^INVITE
$registered = false
To = sip:(.+)@
$getDisplayName(From) = ^OB(\d{3})\S* (.+)

[Deploy Patterns]
Session-Expires =
Min-SE =
To = sip:%1@CISCOIP
From/displayname = %2 %3


Rule-4: Prefix 11 with digit
[Matching Patterns]
$request = ^INVITE
$registered = false
To = sip:(.+)@
$getDisplayName(From) = ^11(\d{4})\S* (.+)

[Deploy Patterns]
Session-Expires =
Min-SE =
To = sip:%1@CISCOIP
From/displayname = %2 %3


Rule-5: Prefix 11 with non digit
(Note: the last line doesn't need %3)
[Matching Patterns]
$request = ^INVITE
$registered = false
To = sip:(.+)@
$getDisplayName(From) = ^11(.+)

[Deploy Patterns]
Session-Expires =
Min-SE =
To = sip:%1@CISCOIP
From/displayname = %2


Rule-6: Prefix 7th
[Matching Patterns]
$request = ^INVITE
$registered = false
To = sip:(.+)@
$getDisplayName(From) = ^7thF(\d{4})\S* (.+)

[Deploy Patterns]
Session-Expires =
Min-SE =
To = sip:%1@CISCOIP
From/displayname = %2 %3
neils21
Posts: 17
Joined: Tue Jul 22, 2014 8:47 am

Post by neils21 »

That worked perfectly. The only issue is making sure that the naming convention of the location falls at least in line with the order in which the rules are. Meaning like in the above example having 2 locations in the same dial group I have to place the non digit rules after the digit rules.

So

ONC66218_1 Call Type

Matches

$getDisplayName(From) = ^ONC6(\d{4})\S* (.+)


Displays

6218 Call Type

And then another rule for the same area for say

ONC6TestRoom Call Type

Matches

$getDisplayName(From) = ^ONC6(.+)

And displays

TestRoom Call Type

Kind of curious how this one will go since they have 22 individual calling areas and each one has locations with either digit, or no digit.
redroof
Posts: 97
Joined: Fri Nov 16, 2007 1:46 pm

Post by redroof »

In the above example, you need to place rules with the correct order.

Rule-1: For picking up digits display name.
$getDisplayName(From) = ^ONC6(\d{4})\S* (.+)

Rule-2: For pinking up non-digits display name.
$getDisplayName(From) = ^ONC6(.+)
Post Reply