<div dir="ltr"><div>Thanks a lot for the Detailed Explanation.<br><br></div>I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:<br><br><div><span class="gmail-im"><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><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: <br><br></span></div><div><span style="font-size:12.8px">But the First three Digit is not Removed. Please find the below log:<br><br> 5(16152) INFO: <script>: Request : INVITE <a href="mailto:sip%3A000919629897172@209.95.52.97">sip:000919629897172@209.95.52.97</a> SIP/2.0<br>Record-Route: <sip:209.95.52.97;lr><br>Record-Route: <sip:209.95.52.97;lr><br>To: <<a href="mailto:sip%3A000919629897172@45.249.123.97">sip:000919629897172@45.249.123.97</a>><br>From: 7777<<a href="mailto:sip%3A7777@45.249.123.97">sip:7777@45.249.123.97</a>>;tag=501aa976<br>Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d36.636d0921d672f2d0bdb3fc87c52a3caa.0<br>Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch=z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0<br>Via: SIP/2.0/UDP 45.249.123.97:6107;received=45.249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107<br>Call-ID: db4777505114995c<br>CSeq: 1 INVITE<br>Contact: <<a href="http://sip:7777@45.249.123.97:6107">sip:7777@45.249.123.97:6107</a>><br>Max-Forwards: 68<br>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO<br>Content-Type: application/sdp<br>User-Agent: eyeBeam release 3004t stamp 16741<br>Content-Length: 191<br><br>v=0<br>o=- 355180136 355180140 IN IP4 45.249.123.97<br>s=eyeBeam<br>c=IN IP4 45.249.123.97<br>t=0 0<br>m=audio 31444 RTP/AVP 18 0 8 101<br>a=fmtp:101 0-15<br>a=rtpmap:101 telephone-event/8000<br>a=sendrecv<br><br><br></span></div><div><span style="font-size:12.8px"><br></span></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 5, 2017 at 10:30 AM, 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 dir="ltr"><div>Ok, so clearly you have not tried what Daniel suggested...<span class=""><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></span><span class=""><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></span><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 class=""><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><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" target="_blank">https://www.kamailio.org/<wbr>docs/modules/devel/modules/<wbr>dialplan.html#dialplan.<wbr>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><span class="HOEnZb"><font color="#888888"><div><br></div><div>Joel.</div><div><br></div><div><br></div></font></span></div><div class="HOEnZb"><div class="h5"><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="m_-7368919931937381573HOEnZb"><div class="m_-7368919931937381573h5"><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_-7368919931937381573m_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_-7368919931937381573m_5203093025418876868m_4695810456044670450m_1331479273089557748HOEnZb"><div class="m_-7368919931937381573m_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" 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>