<div dir="ltr"><div>Ok, so clearly you have not tried what Daniel suggested...<div><i><br></i></div><div><i><span style="font-size:12.8px">IN a regexp ^ matches the beginning of the line/string, and $ matches</span><br style="font-size:12.8px"><span style="font-size:12.8px">the end. </span><span style="font-size:12.8px">So "^000$" only matches exactly "000" and not "000xxxx"</span><br style="font-size:12.8px"><span style="font-size:12.8px">Remove the $ to match strings begining with 000.</span></i><br></div><div><br></div><div><span style="font-size:12.8px">Rules:</span><br style="font-size:12.8px"><span style="font-size:12.8px">======</span><br style="font-size:12.8px"><span style="font-size:12.8px">dpid: 1</span><br style="font-size:12.8px"><span style="font-size:12.8px">pr: 1</span><br style="font-size:12.8px"><span style="font-size:12.8px">match_op: 1</span><br style="font-size:12.8px"><span style="font-size:12.8px">match_exp: ^000<font color="#ff0000">$</font></span><br style="font-size:12.8px"><span style="font-size:12.8px">match_len: 0</span><br style="font-size:12.8px"><span style="font-size:12.8px">subst_exp: ^0000<font color="#ff0000">$</font></span><br style="font-size:12.8px"><span style="font-size:12.8px">repl_exp: </span><br style="font-size:12.8px"><span style="font-size:12.8px">attrs: </span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Can you see you still have the $ char at the end of match_exp and subst_exp? </span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">To begin with, </span>do you know how regular expressions work? Because that is the first thing you need to know to correctly use the dialplan module.</div><div><br></div><div>That said you need a match expression, a substitute expression, and a replace expression...</div><div><br></div><div>Try with:</div><div><br></div><div><span style="font-size:12.8px">Rules:</span><br style="font-size:12.8px"><span style="font-size:12.8px">======</span><br style="font-size:12.8px"><span style="font-size:12.8px">dpid: 1</span><br style="font-size:12.8px"><span style="font-size:12.8px">pr: 1</span><br style="font-size:12.8px"><span style="font-size:12.8px">match_op: 1</span><br style="font-size:12.8px"><span style="font-size:12.8px">match_exp: ^000[0-9]+<font color="#000000">$  <<<<<<< This will trigger a match on any number that will start with three zeros.</font></span><br style="font-size:12.8px"><span style="font-size:12.8px">match_len: 0</span><br style="font-size:12.8px"><span style="font-size:12.8px">subst_exp: ^000(</span><span style="font-size:12.8px">[0-9]+)<font color="#000000">$  </font></span><span style="color:rgb(0,0,0);font-size:12.8px"><<<<<<< If the match_exp is found, then create a group with the desired part of the number, in this case, everything after the three zeros.</span></div><div><span style="font-size:12.8px">repl_exp: \1   </span><span style="color:rgb(0,0,0);font-size:12.8px"><<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros.</span><br style="font-size:12.8px"><span style="font-size:12.8px">attrs: </span></div></div><div><br></div><div><br></div><div>What isn't clear to me is that 91 you are talking about in your email, you might have to exclude/include that in your regex.</div><div><br></div><div>Have a look at <a href="https://www.kamailio.org/docs/modules/devel/modules/dialplan.html#dialplan.installation">https://www.kamailio.org/docs/modules/devel/modules/dialplan.html#dialplan.installation</a> </div><div><br></div><div>You have a couple examples that might make it more clear.</div><div><br></div><div><br></div><div>Let me know if it helps.</div><div><br></div><div>Joel.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G <span dir="ltr"><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@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"><div><div><div><div><div><div>Yes I have Tried, please find below the Rules I have applied and the Result:<br><br></div>Rules:<br>======<br>dpid: 1<br>pr: 1<br>match_op: 1<br>match_exp: ^000$<br>match_len: 0<br>subst_exp: ^0000$<br>repl_exp: <br>attrs: <br><br><br></div>I am Calling to the number 00091xxxxxxxxxx , But its saying as Too many Hops.<br><br></div>Its only looking for 000, Its not taking the 91xxxxxxxxxx numbers, If I call 000 only its replacing with the given number in the Rule table.<br><br></div>I need to Remove only the first 3 digits, and the other numbers should go to the call.<br><br></div>For Example If I am calling 00091xxxxxxxxx, It should remove the first 3 digits 000 and 91xxxxxxxxx call should be place.<br><br></div>Please Guide me for removing the first three digits alone and other numbers should takes place.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano <span dir="ltr"><<a href="mailto:joel@gogii.net" target="_blank">joel@gogii.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">Have you tried what Daniel suggested?</div><div dir="auto"><br></div><div dir="auto">Share the results of the tests and we can go from there. </div><div><div class="m_5203093025418876868h5"><br><div class="gmail_quote"><div>On Thu, Aug 3, 2017 at 21:34 Logeshwaran G <<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Input Please!!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G <span><<a href="mailto:logeshwarangs@gmail.com" target="_blank">logeshwarangs@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><div><div><div><div><div>Thanks a lot!<br><br></div>But for my scenario,<br><br></div>If I am Dialling 000919999999999, need to remove the first three digits 000, so the call should go to 919999999999.<br><br></div>I am stucked to create the rule for the above scenario, Kindly help me for the same.<br><br></div>Kind Regards,<br></div>Logeshwaran </div><div class="m_5203093025418876868m_4695810456044670450m_1331479273089557748HOEnZb"><div class="m_5203093025418876868m_4695810456044670450m_1331479273089557748h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba <span><<a href="mailto:d.tryba@pocos.nl" target="_blank">d.tryba@pocos.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote:<br>
><br>
> +----+------+----+----------+-<wbr>----------+-----------+-------<wbr>----+----------+-------+<br>
> | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp<br>
> | attrs |<br>
> +----+------+----+----------+-<wbr>----------+-----------+-------<wbr>----+----------+-------+<br>
> |  1 |    1 |  1 |        1 | ^000$     |         0 | ^000$     |<br>
> |       | 111<br>
> +----+------+----+----------+-<wbr>----------+-----------+-------<wbr>----+----------+-------+<br>
><br>
> The above rule replacing only the 000, If we Dial 000xxxx its omitting,<br>
> While Dialing 000 its replacing that with 111.<br>
<br>
</span>IN a regexp ^ matches the beginning of the line/string, and $ matches<br>
the end.<br>
<br>
So "^000$" only matches exactly "000" and not "000xxxx"<br>
Remove the $ to match strings begining with 000.<br>
<br>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div></div></div></div>
<br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
<br></blockquote></div><br></div>