<div dir="ltr">Ok, this seems to work (<a href="http://pastebin.com/BS4JY2gn">http://pastebin.com/BS4JY2gn</a>):<div><br></div><div>Can anyone see anything inappropriate or does this dial plan seems OK?<br><div><br></div><div><div> <extension name="test-dialplan"></div><div> <condition field="destination_number" expression="^(\+\d{3,20})$" break="never"></div><div> <action application="set" data="dialed_number=$1" inline="true"/></div><div> </condition></div><div> <condition field="destination_number" expression="^(\d{3,20})$" break="never"></div><div> <action application="set" data="dialed_number=${country_code}$1" inline="true"/></div><div> </condition></div><div> <condition></div><div> <action application="set" data="user_exists=${user_exists id ${dialed_number} ${domain_name}}" inline="true"/></div><div> </condition></div><div> <condition field="${user_exists}" expression="^true$" break="never"></div><div> <action application="set" data="call_timeout=20"/></div><div> <action application="set" data="hangup_after_bridge=true"/></div><div> <action application="set" data="continue_on_fail=true"/></div><div> <action application="bridge" data="user/${dialed_number}@${domain_name}"/></div><div> <action application="answer"/></div><div> <action application="sleep" data="1000"/></div><div> <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_number}"/></div><div> </condition></div><div> <condition field="${user_exists}" expression="^false$" break="never"></div><div> <action application="set" data="effective_caller_id_number=${effective_caller_id_number}"/></div><div> <action application="set" data="effective_caller_id_name=${effective_caller_id_number}"/></div><div> <action application="bridge" data="sofia/gateway/pstn-outbound/${dialed_number}"/></div><div> </condition></div><div> </extension></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 8, 2015 at 11:20 AM, Michael Nielsen <span dir="ltr"><<a href="mailto:mic.niel84@gmail.com" target="_blank">mic.niel84@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is my dialplan so far, where I want to add this functionality (<a href="http://pastebin.com/k1hffPBp" target="_blank">http://pastebin.com/k1hffPBp</a>):<div><br></div><div><span class=""><div> <condition field="destination_number" expression="^(\+\d{3,20})$"></div></span><div> <action application="set" data="dialed_number=$1" inline="true"/></div><div> <action application="export" data="dialed_number=$1" inline="true"/></div><span class=""><div> </condition></div><div> <condition field="destination_number" expression="^(\d{3,20})$"></div></span><div> <action application="set" data="dialed_number=${country_code}$1" inline="true"/></div><div> <action application="export" data="dialed_number=${country_code}$1" inline="true"/></div><div> </condition></div><div> <condition field="${dialed_number}" IF-USER-EXISTS></div><div> <action application="set" data="call_timeout=20"/></div><div> <action application="set" data="hangup_after_bridge=true"/></div><div> <action application="set" data="continue_on_fail=true"/></div><div> <action application="bridge" data="user/${dialed_number}@${domain_name}"/></div><div> <action application="answer"/></div><div> <action application="sleep" data="1000"/></div><div> <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_number}"/></div><div> </condition> </div><div> <condition field="${dialed_number}" IF-USER-DO-NOT-EXISTS></div><div> <action application="set" data="effective_caller_id_number=${effective_caller_id_number}"/></div><div> <action application="set" data="effective_caller_id_name=${effective_caller_id_number}"/></div><div> <action application="bridge" data="sofia/gateway/pstn-outbound/${dialed_number}"/></div><div> </condition></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 8, 2015 at 9:32 AM, Michael Nielsen <span dir="ltr"><<a href="mailto:mic.niel84@gmail.com" target="_blank">mic.niel84@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I would like to check if the called number contains a country code, if not then one should be added.<div>I've got a variable in my user's XML file called country_code containing +44.</div><div><br></div><div>This is my code so far, however, I think the last to conditions overlap:</div><div><br></div><div>
<p><span> </span><span><condition</span><span> field="destination_number" expression="^(\+\d{3,20})$"</span><span>></span></p>
<p><span> </span><span><action</span><span> application="export" data="dialed_extension=$1"/</span><span>></span></p>
<p><span> </span><span></condition></span></p>
<p><span> </span><span><condition</span><span> field="destination_number" expression="^00(\d{3,20})$"</span><span>></span></p>
<p><span> </span><span><action</span><span> application="export" data="dialed_extension=+$1"/</span><span>></span></p>
<p><span> </span><span></condition></span></p>
<p><span> </span><span><condition</span><span> field="destination_number" expression="^(\d{3,20})$"</span><span>></span></p>
<p><span> </span><span><action</span><span> application="export" data="dialed_extension=${country_code}$1"/</span><span>></span></p>
<p><span> </span><span></condition></span></p><p><span><br></span></p><p><span>I would like to change 00 to +, and if no + is on the number then use country_code from the user. If it does contain a +, then just use the dialled number.</span></p></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>