<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>  &lt;extension name=&quot;test-dialplan&quot;&gt;</div><div>    &lt;condition field=&quot;destination_number&quot; expression=&quot;^(\+\d{3,20})$&quot; break=&quot;never&quot;&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;dialed_number=$1&quot; inline=&quot;true&quot;/&gt;</div><div>    &lt;/condition&gt;</div><div>    &lt;condition field=&quot;destination_number&quot; expression=&quot;^(\d{3,20})$&quot; break=&quot;never&quot;&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;dialed_number=${country_code}$1&quot; inline=&quot;true&quot;/&gt;</div><div>    &lt;/condition&gt;</div><div>    &lt;condition&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;user_exists=${user_exists id ${dialed_number} ${domain_name}}&quot; inline=&quot;true&quot;/&gt;</div><div>    &lt;/condition&gt;</div><div>    &lt;condition field=&quot;${user_exists}&quot; expression=&quot;^true$&quot; break=&quot;never&quot;&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;call_timeout=20&quot;/&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot;/&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;</div><div>      &lt;action application=&quot;bridge&quot; data=&quot;user/${dialed_number}@${domain_name}&quot;/&gt;</div><div>      &lt;action application=&quot;answer&quot;/&gt;</div><div>      &lt;action application=&quot;sleep&quot; data=&quot;1000&quot;/&gt;</div><div>      &lt;action application=&quot;bridge&quot; data=&quot;loopback/app=voicemail:default ${domain_name} ${dialed_number}&quot;/&gt;</div><div>    &lt;/condition&gt;</div><div>    &lt;condition field=&quot;${user_exists}&quot; expression=&quot;^false$&quot; break=&quot;never&quot;&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_number=${effective_caller_id_number}&quot;/&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_name=${effective_caller_id_number}&quot;/&gt;</div><div>      &lt;action application=&quot;bridge&quot; data=&quot;sofia/gateway/pstn-outbound/${dialed_number}&quot;/&gt;</div><div>    &lt;/condition&gt;</div><div>  &lt;/extension&gt;</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">&lt;<a href="mailto:mic.niel84@gmail.com" target="_blank">mic.niel84@gmail.com</a>&gt;</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>    &lt;condition field=&quot;destination_number&quot; expression=&quot;^(\+\d{3,20})$&quot;&gt;</div></span><div>      &lt;action application=&quot;set&quot; data=&quot;dialed_number=$1&quot; inline=&quot;true&quot;/&gt;</div><div>      &lt;action application=&quot;export&quot; data=&quot;dialed_number=$1&quot; inline=&quot;true&quot;/&gt;</div><span class=""><div>    &lt;/condition&gt;</div><div>    &lt;condition field=&quot;destination_number&quot; expression=&quot;^(\d{3,20})$&quot;&gt;</div></span><div>      &lt;action application=&quot;set&quot; data=&quot;dialed_number=${country_code}$1&quot; inline=&quot;true&quot;/&gt;</div><div>      &lt;action application=&quot;export&quot; data=&quot;dialed_number=${country_code}$1&quot; inline=&quot;true&quot;/&gt;</div><div>    &lt;/condition&gt;</div><div>    &lt;condition field=&quot;${dialed_number}&quot; IF-USER-EXISTS&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;call_timeout=20&quot;/&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot;/&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;</div><div>      &lt;action application=&quot;bridge&quot; data=&quot;user/${dialed_number}@${domain_name}&quot;/&gt;</div><div>      &lt;action application=&quot;answer&quot;/&gt;</div><div>      &lt;action application=&quot;sleep&quot; data=&quot;1000&quot;/&gt;</div><div>      &lt;action application=&quot;bridge&quot; data=&quot;loopback/app=voicemail:default ${domain_name} ${dialed_number}&quot;/&gt;</div><div>    &lt;/condition&gt;   </div><div>    &lt;condition field=&quot;${dialed_number}&quot; IF-USER-DO-NOT-EXISTS&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_number=${effective_caller_id_number}&quot;/&gt;</div><div>      &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_name=${effective_caller_id_number}&quot;/&gt;</div><div>      &lt;action application=&quot;bridge&quot; data=&quot;sofia/gateway/pstn-outbound/${dialed_number}&quot;/&gt;</div><div>    &lt;/condition&gt;</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">&lt;<a href="mailto:mic.niel84@gmail.com" target="_blank">mic.niel84@gmail.com</a>&gt;</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&#39;ve got a variable in my user&#39;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>&lt;condition</span><span> field=&quot;destination_number&quot; expression=&quot;^(\+\d{3,20})$&quot;</span><span>&gt;</span></p>
<p><span>      </span><span>&lt;action</span><span> application=&quot;export&quot; data=&quot;dialed_extension=$1&quot;/</span><span>&gt;</span></p>
<p><span>    </span><span>&lt;/condition&gt;</span></p>
<p><span>    </span><span>&lt;condition</span><span> field=&quot;destination_number&quot; expression=&quot;^00(\d{3,20})$&quot;</span><span>&gt;</span></p>
<p><span>      </span><span>&lt;action</span><span> application=&quot;export&quot; data=&quot;dialed_extension=+$1&quot;/</span><span>&gt;</span></p>
<p><span>    </span><span>&lt;/condition&gt;</span></p>
<p><span>    </span><span>&lt;condition</span><span> field=&quot;destination_number&quot; expression=&quot;^(\d{3,20})$&quot;</span><span>&gt;</span></p>
<p><span>      </span><span>&lt;action</span><span> application=&quot;export&quot; data=&quot;dialed_extension=${country_code}$1&quot;/</span><span>&gt;</span></p>
<p><span>    </span><span>&lt;/condition&gt;</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>