Asterisk - How to handle multi-digit inputs
<p>I have an Asterisk server running with a (mostly) working dialplan.</p>

<p>I have this scenario:</p>

<p>At one point the caller hears "Enter any number".
He then enters a number on his phone.</p>

<p>If he enters 0 i want to jump to 'Context0' in the dialplan.
If he enters a number from 1 to 10000 i want to jump to 'Context1'.
If the entered number is higher than 10000 I want to jump to 'Context2'.</p>

<p>The context that handles this scenario looks like this:</p>

<pre><code>[Context]
exten =&gt; 100,1,Background(/var/lib/asterisk/sounds/sound)

exten =&gt; 0,1,Goto(Context0,100,1)
exten =&gt; _Z,1,Goto(Context1,100,1)
exten =&gt; _ZX,1,Goto(Context1,100,1)
exten =&gt; _ZXX,1,Goto(Context1,100,1)
exten =&gt; _ZXXX,1,Goto(Context1,100,1)
exten =&gt; 10000,1,Goto(Context1,100,1)

exten =&gt; i,1,Goto(Context2,100,1)
</code></pre>

<p>This works if I only enter 5 digits. If i enter f.e. 123456 then after 12345 it enters the 'i extension', goes to Context2 and applies the last digit (in this case number 6) in this context.</p>

<p>So my question is, how can I make the dialplan check if the input is greater than 10000 and if it is greater jump to Context2?</p>

<p>I hope you understand my problem, my English isn't so good.. :)</p>

<p>Many thanks and best regards</p>