Happy New Year,
Similar to old topic VCS source manipulation, in CPL alone, what is the smartest way of manipulating From header source address as follows:
- For PSTN calls, set source address to be CLIP (calllng line identification presentation) number
- For B2B calls, set source address to be email address
For example, assume that for hiding, authentication and user names are UUIDs, and we have two users, jon.doe and jane.doe at two devices uuid-1 and uuid-2 respectively and that the CLIP for both is +1-212-555-1212.
- Disregard any need to distinguish between a DDI and central answering point number
- Disregard any need to lookup the name, i.e. assume the domain is small and that hard-coding is practicable
Consider the CPL:
<?xml version="1.0" encoding="UTF-8"?>
<cpl xsi:schemaLocation="urn:ietf:params:xml:ns:cpl" xmlns="urn:ietf:params:xml:ns:cpl" xmlns:taa="http://www.tandberg.net/cpl-extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<taa:routed>
<taa:rule-switch>
<taa:rule origin="uuid-1"
<taa:proxy timeout="10">
<taa:location regex="^(sip:)?\+?\d{1,3}(\s|-)\d{2,3}(\s|-)?\d{2,4}(\s|-)?\d{4}|^(sip(s)?:)?\+?\d{1,3}(\s|-)?\d{1,14}((\s|-)?\d{1,13})?" origin="^uuid-1(@domain)?(;\d{4})?" clear="yes" source-url-for-message="+1-212-555-1212"/>
<taa:location regex="^(sip:)?.*@.*" origin="^uuid-1(@domain)?(;\d{4})?" clear="yes" source-url-for-message="jon.doe@domain"/>
</taa:proxy>
<taa:rule origin="uuid-2"
<taa:proxy timeout="10">
<taa:location regex="^(sip:)?\+?\d{1,3}(\s|-)\d{2,3}(\s|-)?\d{2,4}(\s|-)?\d{4}|^(sip(s)?:)?\+?\d{1,3}(\s|-)?\d{1,14}((\s|-)?\d{1,13})?" origin="^uuid-2(@domain)?(;\d{4})?" clear="yes" source-url-for-message="+1-212-555-1212"/>
<taa:location regex="^(sip:)?.*@.*" origin="^uuid-1(@domain)?(;\d{4})?" clear="yes" source-url-for-message="jane.doe@domain"/>
</taa:proxy>
</taa:rule>
</taa:rule-switch>
</taa:routed>
</cpl>
I take it that because both source and destination addresses are inspected, we lose the ability to use address-switch that would have removed the need to regex a phone number since the construction address-switch field=destination alias-type="Dialed Digits" is not available in rule-switch?
For illustration, this simplified version fudges that regex:
<?xml version="1.0" encoding="UTF-8"?>
<cpl xsi:schemaLocation="urn:ietf:params:xml:ns:cpl" xmlns="urn:ietf:params:xml:ns:cpl" xmlns:taa="http://www.tandberg.net/cpl-extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<taa:routed>
<taa:rule-switch>
<taa:rule origin="uuid-1"
<taa:proxy timeout="10">
<taa:location regex="Dialed Digits" origin="^uuid-1(@domain)?(;\d{4})?" clear="yes" source-url-for-message="+1-212-555-1212"/>
<taa:location regex="^(sip:)?.*@.*" origin="^uuid-1(@domain)?(;\d{4})?" clear="yes" source-url-for-message="jon.doe@domain"/>
</taa:proxy>
<taa:rule origin="uuid-2"
<taa:proxy timeout="10">
<taa:location regex="Dialed Digits" origin="^uuid-2(@domain)?(;\d{4})?" clear="yes" source-url-for-message="+1-212-555-1212"/>
<taa:location regex="^(sip:)?.*@.*" origin="^uuid-1(@domain)?(;\d{4})?" clear="yes" source-url-for-message="jane.doe@domain"/>
</taa:proxy>
</taa:rule>
</taa:rule-switch>
</taa:routed>
</cpl>
It validates, but is this the smartest CPL construction to achieve the desired result?