<div dir="ltr">Hi,<div><br></div><div>I use mod_translate as a dialplan module, it proprocesses such things before hitting the dialplan. I translate everything into E164 format. It can access channel variables as part of the replacement expression.</div><div><br></div><div>Don&#39;t forget that different countries use different international dialling codes too, such as the US is 011 rather than the 00 we europeans are used to.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 September 2015 at 12:48, 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">Ok, this seems to work (<a href="http://pastebin.com/BS4JY2gn" target="_blank">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><span class=""><div>      &lt;action application=&quot;set&quot; data=&quot;dialed_number=$1&quot; inline=&quot;true&quot;/&gt;</div></span><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><span class=""><div>      &lt;action application=&quot;set&quot; data=&quot;dialed_number=${country_code}$1&quot; inline=&quot;true&quot;/&gt;</div></span><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><span class=""><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></span><div>    &lt;condition field=&quot;${user_exists}&quot; expression=&quot;^false$&quot; break=&quot;never&quot;&gt;</div><span class=""><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></span><div>  &lt;/extension&gt;</div></div></div></div><div class="HOEnZb"><div class="h5"><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><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><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><div><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>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><b>Andrew Cassidy BSc (Hons) MBCS SSCA</b><div>Managing Director<div><div><img src="http://www.cassidywebservices.co.uk/static/emailsig.png"><br></div><div><br><div><b style="color:rgb(51,135,171);text-decoration:none;font-family:sans-serif"><a href="mailto:info@cassidywebservices.co.uk" style="color:rgb(51,135,171);text-decoration:none;font-family:sans-serif" target="_blank">T</a> </b>03300 100 960 
<b style="color:rgb(51,135,171);text-decoration:none;font-family:sans-serif"><a href="mailto:info@cassidywebservices.co.uk" style="color:rgb(51,135,171);text-decoration:none;font-family:sans-serif" target="_blank">F</a> </b>03300 100 961</div><div><b style="text-decoration:none;font-family:sans-serif"><a href="mailto:info@cassidywebservices.co.uk" style="color:rgb(51,135,171);text-decoration:none;font-family:sans-serif" target="_blank">E</a> </b><a href="mailto:andrew@cassidywebservices.co.uk" target="_blank">andrew@cassidywebservices.co.uk</a></div><div><b style="text-decoration:none;font-family:sans-serif"><a href="mailto:info@cassidywebservices.co.uk" style="color:rgb(51,135,171);text-decoration:none;font-family:sans-serif" target="_blank">W</a> </b><a href="http://www.cassidywebservices.co.uk" target="_blank">www.cassidywebservices.co.uk</a></div></div></div></div></div></div>
</div>