<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10631">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip: New function PJSIP_PARSE_URI to parse URI and return part of URI<br><br>Added tests to parse pre-defined URIs and extract specified part of the URI<br>using the PJSIP_PARSE_URI function.<br><br>Test examples taken from the pjproject source<br>pjsip/src/test/uri_test.c<br><br>ASTERISK-28144 #close<br><br>Change-Id: Iea0d8bbd4bf96ad68dbd6395ca80905d19924771<br>---<br>A tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/extensions.conf<br>A tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/manager.users.conf.inc<br>A tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/test-config.yaml<br>M tests/channels/pjsip/dialplan_functions/tests.yaml<br>5 files changed, 109 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/extensions.conf b/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/extensions.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..0653994</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/extensions.conf</span><br><span>@@ -0,0 +1,53 @@</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[default]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+exten => uri_test,1,NoOp()</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,Set(uri=${LOCAL(ARG1)})</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,Set(type=${LOCAL(ARG2)})</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,Set(expected=${LOCAL(ARG3)})</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,Verbose(1, Calling PJSIP_PARSE_URI for URI ${uri}, type ${type})</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GotoIf($["${PJSIP_PARSE_URI(${uri},${type})}"="${expected}"]?pass)</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,UserEvent(Result, Status: failed, Message: ${uri}, ${type} did not match expected value ${expected} - actual ${PJSIP_PARSE_URI(${uri},${type})})</span><br><span style="color: hsl(120, 100%, 40%);">+same => n(pass),NoOp()</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,Return()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+exten => s,1,NoOp()</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+; Test entries</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:localhost,host,localhost))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user@localhost,user,user))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user@localhost,host,localhost))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user:password@localhost:5060,user,user))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user:password@localhost:5060,passwd,password))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user:password@localhost:5060,host,localhost))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user:password@localhost:5060,port,5060))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:localhost\;transport=tcp\;user=ip\;ttl=255\;lr\;maddr=127.0.0.1\;method=ACK,host,localhost))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:localhost\;transport=tcp\;user=ip\;ttl=255\;lr\;maddr=127.0.0.1\;method=ACK,transport_param,tcp))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:localhost\;transport=tcp\;user=ip\;ttl=255\;lr\;maddr=127.0.0.1\;method=ACK,user_param,ip))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:localhost\;transport=tcp\;user=ip\;ttl=255\;lr\;maddr=127.0.0.1\;method=ACK,ttl_param,255))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:localhost\;transport=tcp\;user=ip\;ttl=255\;lr\;maddr=127.0.0.1\;method=ACK,lr_param,1))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:localhost\;transport=tcp\;user=ip\;ttl=255\;lr\;maddr=127.0.0.1\;method=ACK,maddr_param,127.0.0.1))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:localhost\;transport=tcp\;user=ip\;ttl=255\;lr\;maddr=127.0.0.1\;method=ACK,method_param,ACK))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sips:localhost,scheme,sips))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sips:localhost,host,localhost))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(  Power Administrator  <sips:localhost>,display,Power Administrator))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(  Power Administrator  <sips:localhost>,host,localhost))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1( "User" <sip:user@localhost:5071>,display,User))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1( "User" <sip:user@localhost:5071>,user,user))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1( "User" <sip:user@localhost:5071>,host,localhost))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1( "User" <sip:user@localhost:5071>,port,5071))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(This is -. !% *_+`'~ me <sip:a19A&=+$\;?/%2d:%40a&Zz=+$@my_proxy09.MY-domain.com:9801>,display,This is -. !% *_+`'~ me))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(This is -. !% *_+`'~ me <sip:a19A&=+$\;?/%2d:%40a&Zz=+$@my_proxy09.MY-domain.com:9801>,user,a19A&=+$\;?/-))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(This is -. !% *_+`'~ me <sip:a19A&=+$\;?/%2d:%40a&Zz=+$@my_proxy09.MY-domain.com:9801>,passwd,@a&Zz=+$))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(This is -. !% *_+`'~ me <sip:a19A&=+$\;?/%2d:%40a&Zz=+$@my_proxy09.MY-domain.com:9801>,host,my_proxy09.MY-domain.com))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(This is -. !% *_+`'~ me <sip:a19A&=+$\;?/%2d:%40a&Zz=+$@my_proxy09.MY-domain.com:9801>,port,9801))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.com,host,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.com))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user@[::1]\;maddr=[::01],user,user))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user@[::1]\;maddr=[::01],host,::1))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:user@[::1]\;maddr=[::01],maddr_param,[::01]))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:[::1]\;maddr=[::01],host,::1))</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,GoSub(default,uri_test,1(sip:[::1]\;maddr=[::01],maddr_param,[::01]))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,UserEvent(Result, Status: passed)</span><br><span style="color: hsl(120, 100%, 40%);">+same => n,Hangup()</span><br><span>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/manager.users.conf.inc b/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/manager.users.conf.inc</span><br><span>new file mode 100644</span><br><span>index 0000000..1ba0710</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/manager.users.conf.inc</span><br><span>@@ -0,0 +1 @@</span><br><span style="color: hsl(120, 100%, 40%);">+writetimeout=1000</span><br><span>\ No newline at end of file</span><br><span>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/pjsip.conf b/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/pjsip.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..e69de29</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/configs/ast1/pjsip.conf</span><br><span>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/test-config.yaml b/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/test-config.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..d95a9c1</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_parse_uri/test-config.yaml</span><br><span>@@ -0,0 +1,54 @@</span><br><span style="color: hsl(120, 100%, 40%);">+testinfo:</span><br><span style="color: hsl(120, 100%, 40%);">+    summary:     'Tests the PJSIP_PARSE_URI function'</span><br><span style="color: hsl(120, 100%, 40%);">+    description: |</span><br><span style="color: hsl(120, 100%, 40%);">+        'Parse pre-defined test URIs and extract specified part of the URI</span><br><span style="color: hsl(120, 100%, 40%);">+        using the PJSIP_PARSE_URI function.</span><br><span style="color: hsl(120, 100%, 40%);">+        Test examples taken from the pjproject source:</span><br><span style="color: hsl(120, 100%, 40%);">+        pjsip/src/test/uri_test.c'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-modules:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-object:</span><br><span style="color: hsl(120, 100%, 40%);">+        config-section: test-object-config</span><br><span style="color: hsl(120, 100%, 40%);">+        typename: 'test_case.SimpleTestCase'</span><br><span style="color: hsl(120, 100%, 40%);">+    modules:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            config-section: ami-config</span><br><span style="color: hsl(120, 100%, 40%);">+            typename: 'ami.AMIEventModule'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-object-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    spawn-after-hangup: True</span><br><span style="color: hsl(120, 100%, 40%);">+    test-iterations:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            channel: 'Local/s@default'</span><br><span style="color: hsl(120, 100%, 40%);">+            application: 'Echo'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ami-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        id: '0'</span><br><span style="color: hsl(120, 100%, 40%);">+        type: 'headermatch'</span><br><span style="color: hsl(120, 100%, 40%);">+        count: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+        conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+            match:</span><br><span style="color: hsl(120, 100%, 40%);">+                Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+        requirements:</span><br><span style="color: hsl(120, 100%, 40%);">+            match:</span><br><span style="color: hsl(120, 100%, 40%);">+                Status: 'passed'</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        id: '0'</span><br><span style="color: hsl(120, 100%, 40%);">+        type: 'headermatch'</span><br><span style="color: hsl(120, 100%, 40%);">+        count: '0'</span><br><span style="color: hsl(120, 100%, 40%);">+        conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+            match:</span><br><span style="color: hsl(120, 100%, 40%);">+                Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+                Status: 'failed'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+properties:</span><br><span style="color: hsl(120, 100%, 40%);">+    dependencies:</span><br><span style="color: hsl(120, 100%, 40%);">+        - python : 'twisted'</span><br><span style="color: hsl(120, 100%, 40%);">+        - python : 'starpy'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk : 'res_pjsip'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk : 'chan_pjsip'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk : 'app_userevent'</span><br><span style="color: hsl(120, 100%, 40%);">+    tags:</span><br><span style="color: hsl(120, 100%, 40%);">+        - pjsip</span><br><span>diff --git a/tests/channels/pjsip/dialplan_functions/tests.yaml b/tests/channels/pjsip/dialplan_functions/tests.yaml</span><br><span>index a2e26a0..59821e5 100644</span><br><span>--- a/tests/channels/pjsip/dialplan_functions/tests.yaml</span><br><span>+++ b/tests/channels/pjsip/dialplan_functions/tests.yaml</span><br><span>@@ -8,4 +8,5 @@</span><br><span>     - test: 'pjsip_dtmfmode'</span><br><span>     - test: 'pjsip_endpoint'</span><br><span>     - test: 'pjsip_header'</span><br><span style="color: hsl(120, 100%, 40%);">+    - test: 'pjsip_parse_uri'</span><br><span>     - test: 'pjsip_session_refresh'</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10631">change 10631</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10631"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Iea0d8bbd4bf96ad68dbd6395ca80905d19924771 </div>
<div style="display:none"> Gerrit-Change-Number: 10631 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>