cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1280
Views
5
Helpful
3
Replies

CPL Explanation

JFerello
Beginner
Beginner

Can anyone explain how this CPL works?

I don't understand the first regex in location and the first replace in location either.

<cpl xsi:schemaLocation="urn:ietf:params:xml:ns:cpl cpl.xsd">

<taa:routed>

<taa:rule-switch>

<taa:rule unauthenticated-origin=".*" destination="(.+)@cisco\.com>

<taa:location clear="yes" regex="(?!.*@ciscotp\.com)" replace="\1" source-url-for-message-regex="(.*)@(ciscotp)\.com" source-url-for-message-replace="\1.@\2.net">

<taa:proxy/>

</taa:location>

</taa:rule>

</taa:rule-switch>

</taa:routed>

</cpl>

Thanks,
Justin Ferello
3 REPLIES 3

Wayne DeNardi
VIP Advisor VIP Advisor
VIP Advisor

Often when I want to check what a regex expression is doing if I am uncertain, I use https://regex101.com/.

So, if my interpretation is correct, it's checking for anything that has @ciscotp.com in the address, and then the second part makes it an address with @ciscotp.net instead.

Wayne
--
Please remember to mark helpful responses and to set your question as answered if appropriate.

Wayne,

Thanks for the reply, I totally understand regex as a language, I am getting tripped up on the CPL part though.

For example, in the <taa:location> line there are (4) arguments for something that I would think only needs (2), for a source re-write I would only think you need to match the original source and then have the replacement source.

As for the (4) arguments, what does each one do and why?

1) regex="(?!.*@ciscotp\.com)"

2) replace="\1"

3) source-url-for-message-regex="(.*)@(ciscotp)\.com"

4) source-url-for-message-replace="\1.@\2.net"

Thanks,
Justin Ferello

Hi Justin, if you haven't sorted the issue yet, there's a CPL Reference in the Expressway Admin Guide (see pages 371-379).

 

The first regex is a negative lookup - so matches anything that has a location (ie the call destination) that isn't (.*@ciscotp\.com) and the second bit replaces it with itself (essentially leaving it alone).

The third and fourth bits change the source-url for anything that is a domain of ciscotp.com to ciscotp.net,

 

So, if I interpret it correctly, any calls to a destination that isn't a domain of ciscotp.com will get their source URL re-written to come from the ciscotp.net domain.  Any calls from ciscotp.com will stay as coming from ciscotp.com.

 

Wayne
--
Please remember to mark helpful responses and to set your question as answered if appropriate.
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: