<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'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"><<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">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> <extension name="test-dialplan"></div><div> <condition field="destination_number" expression="^(\+\d{3,20})$" break="never"></div><span class=""><div> <action application="set" data="dialed_number=$1" inline="true"/></div></span><div> </condition></div><div> <condition field="destination_number" expression="^(\d{3,20})$" break="never"></div><span class=""><div> <action application="set" data="dialed_number=${country_code}$1" inline="true"/></div></span><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><span class=""><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></span><div> <condition field="${user_exists}" expression="^false$" break="never"></div><span class=""><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></span><div> </extension></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"><<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><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><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><div><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>
</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>