05-22-2018 02:58 PM - edited 03-18-2019 02:07 PM
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>
05-22-2018 05:44 PM
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.
Please remember to mark helpful responses and to set your question as answered if appropriate.
05-23-2018 07:04 AM
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"
08-08-2018 11:33 PM
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.
Please remember to mark helpful responses and to set your question as answered if appropriate.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide