mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 23:08:35 +00:00
[mod_dialplan_xml] Fix $N substitution of <regex> captures (#3293)
Keep the subject string of a saved match alive and substitute only when a regex matched. Add unit-tests.
This commit is contained in:
1 parent
f7ec023dc1
commit
1af2909bb6
3 files changed
+232
-6
No files matched your search
@@ -73,5 +73,64 @@
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
|
||||
<context name="regex_all_capture">
|
||||
<extension name="regex_all_capture">
|
||||
<condition regex="all">
|
||||
<regex field="${regex_test_unset}" expression="^$"/>
|
||||
<regex field="${regex_test_uri}" expression="^sip:1(\d+)@"/>
|
||||
<action application="set" data="captured=$1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
|
||||
<context name="regex_all_fail_after_capture">
|
||||
<extension name="regex_all_fail_after_capture">
|
||||
<condition regex="all">
|
||||
<regex field="${regex_test_uri}" expression="^sip:1(\d+)@"/>
|
||||
<regex field="${regex_test_uri}" expression="^tel:"/>
|
||||
<action application="set" data="captured=$1"/>
|
||||
<anti-action application="set" data="captured=none"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
|
||||
<context name="regex_any_capture">
|
||||
<extension name="regex_any_capture">
|
||||
<condition regex="any">
|
||||
<regex field="${regex_test_uri}" expression="^sip:1(\d+)@"/>
|
||||
<action application="set" data="captured=$1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
|
||||
<context name="regex_xor_capture_then_fail">
|
||||
<extension name="regex_xor_capture_then_fail">
|
||||
<condition regex="xor">
|
||||
<regex field="${regex_test_uri}" expression="^sip:1(\d+)@"/>
|
||||
<regex field="${regex_test_uri}" expression="^tel:(\d+)"/>
|
||||
<action application="set" data="captured=$1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
|
||||
<context name="regex_xor_no_capture_then_fail">
|
||||
<extension name="regex_xor_no_capture_then_fail">
|
||||
<condition regex="xor">
|
||||
<regex field="${regex_test_uri}" expression="^sip:"/>
|
||||
<regex field="${regex_test_uri}" expression="^tel:(\d+)"/>
|
||||
<action application="set" data="captured=$1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
|
||||
<context name="regex_any_expanded_expression_capture">
|
||||
<extension name="regex_any_expanded_expression_capture">
|
||||
<condition regex="any">
|
||||
<regex field="${regex_test_uri}" expression="^sip:${regex_test_prefix}(\d+)@"/>
|
||||
<action application="set" data="captured=$1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
</section>
|
||||
</document>
|
||||
Reference in new issue
Block a user