Hi,
I am facing an Problem in Dialplan Module.
Scenario: ======== I am Dialling 00091xxxxxxxxxx number, I need to remove only the prefix 000, then the call placement will be 91xxxxxxxxxx.
My dialplan rule: ============== MariaDB [kamailio]> select * from dialplan; +----+------+----+----------+-----------+-----------+-----------+----------+-------+ | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs | +----+------+----+----------+-----------+-----------+-----------+----------+-------+ | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | | | +----+------+----+----------+-----------+-----------+-----------+----------+-------+
But the prefix 000 is not replaced. Please Guide me to Resolve this issue. Do I need to change somet rules??
Additional info: =============
But, With additional to the above dialplan data rule I used the below rule.
+----+------+----+----------+-----------+-----------+-----------+----------+-------+ | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs | +----+------+----+----------+-----------+-----------+-----------+----------+-------+ | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | | | 111 +----+------+----+----------+-----------+-----------+-----------+----------+-------+
The above rule replacing only the 000, If we Dial 000xxxx its omitting, While Dialing 000 its replacing that with 111.
Thanks & Regards, Logeshwaran
On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote:
+----+------+----+----------+-----------+-----------+-----------+----------+-------+ | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs | +----+------+----+----------+-----------+-----------+-----------+----------+-------+ | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | | | 111 +----+------+----+----------+-----------+-----------+-----------+----------+-------+
The above rule replacing only the 000, If we Dial 000xxxx its omitting, While Dialing 000 its replacing that with 111.
IN a regexp ^ matches the beginning of the line/string, and $ matches the end.
So "^000$" only matches exactly "000" and not "000xxxx" Remove the $ to match strings begining with 000.
Thanks a lot!
But for my scenario,
If I am Dialling 000919999999999, need to remove the first three digits 000, so the call should go to 919999999999.
I am stucked to create the rule for the above scenario, Kindly help me for the same.
Kind Regards, Logeshwaran
On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote:
+----+------+----+----------+-----------+-----------+-------
----+----------+-------+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp |
repl_exp
| attrs | +----+------+----+----------+-----------+-----------+-------
----+----------+-------+
| 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | | | 111 +----+------+----+----------+-----------+-----------+-------
----+----------+-------+
The above rule replacing only the 000, If we Dial 000xxxx its omitting, While Dialing 000 its replacing that with 111.
IN a regexp ^ matches the beginning of the line/string, and $ matches the end.
So "^000$" only matches exactly "000" and not "000xxxx" Remove the $ to match strings begining with 000.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Input Please!!
On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot!
But for my scenario,
If I am Dialling 000919999999999, need to remove the first three digits 000, so the call should go to 919999999999.
I am stucked to create the rule for the above scenario, Kindly help me for the same.
Kind Regards, Logeshwaran
On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote:
+----+------+----+----------+-----------+-----------+-------
----+----------+-------+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp |
repl_exp
| attrs | +----+------+----+----------+-----------+-----------+-------
----+----------+-------+
| 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | | | 111 +----+------+----+----------+-----------+-----------+-------
----+----------+-------+
The above rule replacing only the 000, If we Dial 000xxxx its omitting, While Dialing 000 its replacing that with 111.
IN a regexp ^ matches the beginning of the line/string, and $ matches the end.
So "^000$" only matches exactly "000" and not "000xxxx" Remove the $ to match strings begining with 000.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Have you tried what Daniel suggested?
Share the results of the tests and we can go from there.
On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com wrote:
Input Please!!
On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot!
But for my scenario,
If I am Dialling 000919999999999, need to remove the first three digits 000, so the call should go to 919999999999.
I am stucked to create the rule for the above scenario, Kindly help me for the same.
Kind Regards, Logeshwaran
On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote:
+----+------+----+----------+-----------+-----------+-----------+----------+-------+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp |
repl_exp
| attrs |
+----+------+----+----------+-----------+-----------+-----------+----------+-------+
| 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | | | 111
+----+------+----+----------+-----------+-----------+-----------+----------+-------+
The above rule replacing only the 000, If we Dial 000xxxx its omitting, While Dialing 000 its replacing that with 111.
IN a regexp ^ matches the beginning of the line/string, and $ matches the end.
So "^000$" only matches exactly "000" and not "000xxxx" Remove the $ to match strings begining with 000.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Yes I have Tried, please find below the Rules I have applied and the Result:
Rules: ====== dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
I am Calling to the number 00091xxxxxxxxxx , But its saying as Too many Hops.
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.
I need to Remove only the first 3 digits, and the other numbers should go to the call.
For Example If I am calling 00091xxxxxxxxx, It should remove the first 3 digits 000 and 91xxxxxxxxx call should be place.
Please Guide me for removing the first three digits alone and other numbers should takes place.
On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net wrote:
Have you tried what Daniel suggested?
Share the results of the tests and we can go from there.
On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com wrote:
Input Please!!
On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot!
But for my scenario,
If I am Dialling 000919999999999, need to remove the first three digits 000, so the call should go to 919999999999.
I am stucked to create the rule for the above scenario, Kindly help me for the same.
Kind Regards, Logeshwaran
On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote:
+----+------+----+----------+-----------+-----------+-------
----+----------+-------+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp |
repl_exp
| attrs | +----+------+----+----------+-----------+-----------+-------
----+----------+-------+
| 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | | | 111 +----+------+----+----------+-----------+-----------+-------
----+----------+-------+
The above rule replacing only the 000, If we Dial 000xxxx its
omitting,
While Dialing 000 its replacing that with 111.
IN a regexp ^ matches the beginning of the line/string, and $ matches the end.
So "^000$" only matches exactly "000" and not "000xxxx" Remove the $ to match strings begining with 000.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
You missed what Daniel said:
IN a regexp ^ matches the beginning of the line/string, and $ matches the end.
So "^000$" only matches exactly "000" and not "000xxxx" Remove the $ to match strings begining with 000.
Ok, so clearly you have not tried what Daniel suggested...
*IN a regexp ^ matches the beginning of the line/string, and $ matchesthe end. So "^000$" only matches exactly "000" and not "000xxxx"Remove the $ to match strings begining with 000.*
Rules: ====== dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
Can you see you still have the $ char at the end of match_exp and subst_exp?
To begin with, do you know how regular expressions work? Because that is the first thing you need to know to correctly use the dialplan module.
That said you need a match expression, a substitute expression, and a replace expression...
Try with:
Rules: ====== dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
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.
Have a look at https://www.kamailio.org/docs/modules/devel/modules/dialplan.html#dialplan.i...
You have a couple examples that might make it more clear.
Let me know if it helps.
Joel.
On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Yes I have Tried, please find below the Rules I have applied and the Result:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
I am Calling to the number 00091xxxxxxxxxx , But its saying as Too many Hops.
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.
I need to Remove only the first 3 digits, and the other numbers should go to the call.
For Example If I am calling 00091xxxxxxxxx, It should remove the first 3 digits 000 and 91xxxxxxxxx call should be place.
Please Guide me for removing the first three digits alone and other numbers should takes place.
On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net wrote:
Have you tried what Daniel suggested?
Share the results of the tests and we can go from there.
On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com wrote:
Input Please!!
On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot!
But for my scenario,
If I am Dialling 000919999999999, need to remove the first three digits 000, so the call should go to 919999999999.
I am stucked to create the rule for the above scenario, Kindly help me for the same.
Kind Regards, Logeshwaran
On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote:
+----+------+----+----------+-----------+-----------+-------
----+----------+-------+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp |
repl_exp
| attrs | +----+------+----+----------+-----------+-----------+-------
----+----------+-------+
| 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | | | 111 +----+------+----+----------+-----------+-----------+-------
----+----------+-------+
The above rule replacing only the 000, If we Dial 000xxxx its
omitting,
While Dialing 000 its replacing that with 111.
IN a regexp ^ matches the beginning of the line/string, and $ matches the end.
So "^000$" only matches exactly "000" and not "000xxxx" Remove the $ to match strings begining with 000.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Thanks a lot for the Detailed Explanation.
I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:
Rules: ====== dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
But the First three Digit is not Removed. Please find the below log:
5(16152) INFO: <script>: Request : INVITE sip:000919629897172@209.95.52.97 SIP/2.0 Record-Route: sip:209.95.52.97;lr Record-Route: sip:209.95.52.97;lr To: sip:000919629897172@45.249.123.97 From: 7777sip:7777@45.249.123.97;tag=501aa976 Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d36.636d0921d672f2d0bdb3fc87c52a3caa.0 Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch=z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 Via: SIP/2.0/UDP 45.249.123.97:6107 ;received=45.249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 Call-ID: db4777505114995c CSeq: 1 INVITE Contact: sip:7777@45.249.123.97:6107 Max-Forwards: 68 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 3004t stamp 16741 Content-Length: 191
v=0 o=- 355180136 355180140 IN IP4 45.249.123.97 s=eyeBeam c=IN IP4 45.249.123.97 t=0 0 m=audio 31444 RTP/AVP 18 0 8 101 a=fmtp:101 0-15 a=rtpmap:101 telephone-event/8000 a=sendrecv
On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net wrote:
Ok, so clearly you have not tried what Daniel suggested...
*IN a regexp ^ matches the beginning of the line/string, and $ matchesthe end. So "^000$" only matches exactly "000" and not "000xxxx"Remove the $ to match strings begining with 000.*
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
Can you see you still have the $ char at the end of match_exp and subst_exp?
To begin with, do you know how regular expressions work? Because that is the first thing you need to know to correctly use the dialplan module.
That said you need a match expression, a substitute expression, and a replace expression...
Try with:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
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.
Have a look at https://www.kamailio.org/docs/modules/devel/modules/ dialplan.html#dialplan.installation
You have a couple examples that might make it more clear.
Let me know if it helps.
Joel.
On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Yes I have Tried, please find below the Rules I have applied and the Result:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
I am Calling to the number 00091xxxxxxxxxx , But its saying as Too many Hops.
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.
I need to Remove only the first 3 digits, and the other numbers should go to the call.
For Example If I am calling 00091xxxxxxxxx, It should remove the first 3 digits 000 and 91xxxxxxxxx call should be place.
Please Guide me for removing the first three digits alone and other numbers should takes place.
On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net wrote:
Have you tried what Daniel suggested?
Share the results of the tests and we can go from there.
On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com wrote:
Input Please!!
On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot!
But for my scenario,
If I am Dialling 000919999999999, need to remove the first three digits 000, so the call should go to 919999999999.
I am stucked to create the rule for the above scenario, Kindly help me for the same.
Kind Regards, Logeshwaran
On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: > > +----+------+----+----------+-----------+-----------+------- ----+----------+-------+ > | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp > | attrs | > +----+------+----+----------+-----------+-----------+------- ----+----------+-------+ > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | > | | 111 > +----+------+----+----------+-----------+-----------+------- ----+----------+-------+ > > The above rule replacing only the 000, If we Dial 000xxxx its omitting, > While Dialing 000 its replacing that with 111.
IN a regexp ^ matches the beginning of the line/string, and $ matches the end.
So "^000$" only matches exactly "000" and not "000xxxx" Remove the $ to match strings begining with 000.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot for the Detailed Explanation.
I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
But the First three Digit is not Removed. Please find the below log:
5(16152) INFO: <script>: Request : INVITE sip:000919629897172@209.95.52. 97 SIP/2.0 Record-Route: sip:209.95.52.97;lr Record-Route: sip:209.95.52.97;lr To: sip:000919629897172@45.249.123.97 From: 7777sip:7777@45.249.123.97;tag=501aa976 Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d36. 636d0921d672f2d0bdb3fc87c52a3caa.0 Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch=z9hG4bK0d36. 4d76f923bd5cc7d64297898058440098.0 Via: SIP/2.0/UDP 45.249.123.97:6107;received=45.249.123.97;branch=z9hG4bK- d87543-1054953376-1--d87543-;rport=6107 Call-ID: db4777505114995c CSeq: 1 INVITE Contact: sip:7777@45.249.123.97:6107 Max-Forwards: 68 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 3004t stamp 16741 Content-Length: 191
v=0 o=- 355180136 355180140 IN IP4 45.249.123.97 s=eyeBeam c=IN IP4 45.249.123.97 t=0 0 m=audio 31444 RTP/AVP 18 0 8 101 a=fmtp:101 0-15 a=rtpmap:101 telephone-event/8000 a=sendrecv
On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net wrote:
Ok, so clearly you have not tried what Daniel suggested...
*IN a regexp ^ matches the beginning of the line/string, and $ matchesthe end. So "^000$" only matches exactly "000" and not "000xxxx"Remove the $ to match strings begining with 000.*
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
Can you see you still have the $ char at the end of match_exp and subst_exp?
To begin with, do you know how regular expressions work? Because that is the first thing you need to know to correctly use the dialplan module.
That said you need a match expression, a substitute expression, and a replace expression...
Try with:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
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.
Have a look at https://www.kamailio.org/docs/modules/devel/modules/dialp lan.html#dialplan.installation
You have a couple examples that might make it more clear.
Let me know if it helps.
Joel.
On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Yes I have Tried, please find below the Rules I have applied and the Result:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
I am Calling to the number 00091xxxxxxxxxx , But its saying as Too many Hops.
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.
I need to Remove only the first 3 digits, and the other numbers should go to the call.
For Example If I am calling 00091xxxxxxxxx, It should remove the first 3 digits 000 and 91xxxxxxxxx call should be place.
Please Guide me for removing the first three digits alone and other numbers should takes place.
On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net wrote:
Have you tried what Daniel suggested?
Share the results of the tests and we can go from there.
On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com wrote:
Input Please!!
On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G <logeshwarangs@gmail.com
wrote:
Thanks a lot!
But for my scenario,
If I am Dialling 000919999999999, need to remove the first three digits 000, so the call should go to 919999999999.
I am stucked to create the rule for the above scenario, Kindly help me for the same.
Kind Regards, Logeshwaran
On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl wrote:
> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: > > > > +----+------+----+----------+-----------+-----------+------- > ----+----------+-------+ > > | id | dpid | pr | match_op | match_exp | match_len | subst_exp | > repl_exp > > | attrs | > > +----+------+----+----------+-----------+-----------+------- > ----+----------+-------+ > > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | > > | | 111 > > +----+------+----+----------+-----------+-----------+------- > ----+----------+-------+ > > > > The above rule replacing only the 000, If we Dial 000xxxx its > omitting, > > While Dialing 000 its replacing that with 111. > > IN a regexp ^ matches the beginning of the line/string, and $ matches > the end. > > So "^000$" only matches exactly "000" and not "000xxxx" > Remove the $ to match strings begining with 000. > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU"); }
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot for the Detailed Explanation.
I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
But the First three Digit is not Removed. Please find the below log:
5(16152) INFO: <script>: Request : INVITE sip:000919629897172@209.95.52. 97 SIP/2.0 Record-Route: sip:209.95.52.97;lr Record-Route: sip:209.95.52.97;lr To: sip:000919629897172@45.249.123.97 From: 7777sip:7777@45.249.123.97;tag=501aa976 Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 6.636d0921d672f2d0bdb3fc87c52a3caa.0 Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 Call-ID: db4777505114995c CSeq: 1 INVITE Contact: sip:7777@45.249.123.97:6107 Max-Forwards: 68 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 3004t stamp 16741 Content-Length: 191
v=0 o=- 355180136 355180140 IN IP4 45.249.123.97 s=eyeBeam c=IN IP4 45.249.123.97 t=0 0 m=audio 31444 RTP/AVP 18 0 8 101 a=fmtp:101 0-15 a=rtpmap:101 telephone-event/8000 a=sendrecv
On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net wrote:
Ok, so clearly you have not tried what Daniel suggested...
*IN a regexp ^ matches the beginning of the line/string, and $ matchesthe end. So "^000$" only matches exactly "000" and not "000xxxx"Remove the $ to match strings begining with 000.*
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
Can you see you still have the $ char at the end of match_exp and subst_exp?
To begin with, do you know how regular expressions work? Because that is the first thing you need to know to correctly use the dialplan module.
That said you need a match expression, a substitute expression, and a replace expression...
Try with:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
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.
Have a look at https://www.kamailio.org/docs/modules/devel/modules/dialp lan.html#dialplan.installation
You have a couple examples that might make it more clear.
Let me know if it helps.
Joel.
On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Yes I have Tried, please find below the Rules I have applied and the Result:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
I am Calling to the number 00091xxxxxxxxxx , But its saying as Too many Hops.
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.
I need to Remove only the first 3 digits, and the other numbers should go to the call.
For Example If I am calling 00091xxxxxxxxx, It should remove the first 3 digits 000 and 91xxxxxxxxx call should be place.
Please Guide me for removing the first three digits alone and other numbers should takes place.
On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net wrote:
Have you tried what Daniel suggested?
Share the results of the tests and we can go from there.
On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com wrote:
Input Please!!
On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
> Thanks a lot! > > But for my scenario, > > If I am Dialling 000919999999999, need to remove the first three > digits 000, so the call should go to 919999999999. > > I am stucked to create the rule for the above scenario, Kindly help > me for the same. > > Kind Regards, > Logeshwaran > > On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl > wrote: > >> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >> > >> > +----+------+----+----------+-----------+-----------+------- >> ----+----------+-------+ >> > | id | dpid | pr | match_op | match_exp | match_len | subst_exp | >> repl_exp >> > | attrs | >> > +----+------+----+----------+-----------+-----------+------- >> ----+----------+-------+ >> > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | >> > | | 111 >> > +----+------+----+----------+-----------+-----------+------- >> ----+----------+-------+ >> > >> > The above rule replacing only the 000, If we Dial 000xxxx its >> omitting, >> > While Dialing 000 its replacing that with 111. >> >> IN a regexp ^ matches the beginning of the line/string, and $ >> matches >> the end. >> >> So "^000$" only matches exactly "000" and not "000xxxx" >> Remove the $ to match strings begining with 000. >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU");
}
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot for the Detailed Explanation.
I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
But the First three Digit is not Removed. Please find the below log:
5(16152) INFO: <script>: Request : INVITE sip:000919629897172@209.95.52.97 SIP/2.0 Record-Route: sip:209.95.52.97;lr Record-Route: sip:209.95.52.97;lr To: sip:000919629897172@45.249.123.97 From: 7777sip:7777@45.249.123.97;tag=501aa976 Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 6.636d0921d672f2d0bdb3fc87c52a3caa.0 Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 Call-ID: db4777505114995c CSeq: 1 INVITE Contact: sip:7777@45.249.123.97:6107 Max-Forwards: 68 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 3004t stamp 16741 Content-Length: 191
v=0 o=- 355180136 355180140 IN IP4 45.249.123.97 s=eyeBeam c=IN IP4 45.249.123.97 t=0 0 m=audio 31444 RTP/AVP 18 0 8 101 a=fmtp:101 0-15 a=rtpmap:101 telephone-event/8000 a=sendrecv
On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net wrote:
Ok, so clearly you have not tried what Daniel suggested...
*IN a regexp ^ matches the beginning of the line/string, and $ matchesthe end. So "^000$" only matches exactly "000" and not "000xxxx"Remove the $ to match strings begining with 000.*
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
Can you see you still have the $ char at the end of match_exp and subst_exp?
To begin with, do you know how regular expressions work? Because that is the first thing you need to know to correctly use the dialplan module.
That said you need a match expression, a substitute expression, and a replace expression...
Try with:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
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.
Have a look at https://www.kamailio.org/do cs/modules/devel/modules/dialplan.html#dialplan.installation
You have a couple examples that might make it more clear.
Let me know if it helps.
Joel.
On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Yes I have Tried, please find below the Rules I have applied and the Result:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
I am Calling to the number 00091xxxxxxxxxx , But its saying as Too many Hops.
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.
I need to Remove only the first 3 digits, and the other numbers should go to the call.
For Example If I am calling 00091xxxxxxxxx, It should remove the first 3 digits 000 and 91xxxxxxxxx call should be place.
Please Guide me for removing the first three digits alone and other numbers should takes place.
On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net wrote:
Have you tried what Daniel suggested?
Share the results of the tests and we can go from there.
On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com wrote:
> Input Please!! > > On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < > logeshwarangs@gmail.com> wrote: > >> Thanks a lot! >> >> But for my scenario, >> >> If I am Dialling 000919999999999, need to remove the first three >> digits 000, so the call should go to 919999999999. >> >> I am stucked to create the rule for the above scenario, Kindly help >> me for the same. >> >> Kind Regards, >> Logeshwaran >> >> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl >> wrote: >> >>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >>> > >>> > +----+------+----+----------+-----------+-----------+------- >>> ----+----------+-------+ >>> > | id | dpid | pr | match_op | match_exp | match_len | subst_exp >>> | repl_exp >>> > | attrs | >>> > +----+------+----+----------+-----------+-----------+------- >>> ----+----------+-------+ >>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ | >>> > | | 111 >>> > +----+------+----+----------+-----------+-----------+------- >>> ----+----------+-------+ >>> > >>> > The above rule replacing only the 000, If we Dial 000xxxx its >>> omitting, >>> > While Dialing 000 its replacing that with 111. >>> >>> IN a regexp ^ matches the beginning of the line/string, and $ >>> matches >>> the end. >>> >>> So "^000$" only matches exactly "000" and not "000xxxx" >>> Remove the $ to match strings begining with 000. >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> >> > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU");
}
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Thanks a lot for the Detailed Explanation.
I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
But the First three Digit is not Removed. Please find the below log:
5(16152) INFO: <script>: Request : INVITE sip:000919629897172@209.95.52.97 SIP/2.0 Record-Route: sip:209.95.52.97;lr Record-Route: sip:209.95.52.97;lr To: sip:000919629897172@45.249.123.97 From: 7777sip:7777@45.249.123.97;tag=501aa976 Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 6.636d0921d672f2d0bdb3fc87c52a3caa.0 Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 Call-ID: db4777505114995c CSeq: 1 INVITE Contact: sip:7777@45.249.123.97:6107 Max-Forwards: 68 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 3004t stamp 16741 Content-Length: 191
v=0 o=- 355180136 355180140 IN IP4 45.249.123.97 s=eyeBeam c=IN IP4 45.249.123.97 t=0 0 m=audio 31444 RTP/AVP 18 0 8 101 a=fmtp:101 0-15 a=rtpmap:101 telephone-event/8000 a=sendrecv
On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net wrote:
Ok, so clearly you have not tried what Daniel suggested...
*IN a regexp ^ matches the beginning of the line/string, and $ matchesthe end. So "^000$" only matches exactly "000" and not "000xxxx"Remove the $ to match strings begining with 000.*
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
Can you see you still have the $ char at the end of match_exp and subst_exp?
To begin with, do you know how regular expressions work? Because that is the first thing you need to know to correctly use the dialplan module.
That said you need a match expression, a substitute expression, and a replace expression...
Try with:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
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.
Have a look at https://www.kamailio.org/do cs/modules/devel/modules/dialplan.html#dialplan.installation
You have a couple examples that might make it more clear.
Let me know if it helps.
Joel.
On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G <logeshwarangs@gmail.com
wrote:
Yes I have Tried, please find below the Rules I have applied and the Result:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
I am Calling to the number 00091xxxxxxxxxx , But its saying as Too many Hops.
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.
I need to Remove only the first 3 digits, and the other numbers should go to the call.
For Example If I am calling 00091xxxxxxxxx, It should remove the first 3 digits 000 and 91xxxxxxxxx call should be place.
Please Guide me for removing the first three digits alone and other numbers should takes place.
On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net wrote:
> Have you tried what Daniel suggested? > > Share the results of the tests and we can go from there. > > On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com > wrote: > >> Input Please!! >> >> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >> logeshwarangs@gmail.com> wrote: >> >>> Thanks a lot! >>> >>> But for my scenario, >>> >>> If I am Dialling 000919999999999, need to remove the first three >>> digits 000, so the call should go to 919999999999. >>> >>> I am stucked to create the rule for the above scenario, Kindly >>> help me for the same. >>> >>> Kind Regards, >>> Logeshwaran >>> >>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl >>> wrote: >>> >>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >>>> > >>>> > +----+------+----+----------+-----------+-----------+------- >>>> ----+----------+-------+ >>>> > | id | dpid | pr | match_op | match_exp | match_len | subst_exp >>>> | repl_exp >>>> > | attrs | >>>> > +----+------+----+----------+-----------+-----------+------- >>>> ----+----------+-------+ >>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ >>>> | >>>> > | | 111 >>>> > +----+------+----+----------+-----------+-----------+------- >>>> ----+----------+-------+ >>>> > >>>> > The above rule replacing only the 000, If we Dial 000xxxx its >>>> omitting, >>>> > While Dialing 000 its replacing that with 111. >>>> >>>> IN a regexp ^ matches the beginning of the line/string, and $ >>>> matches >>>> the end. >>>> >>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>> Remove the $ to match strings begining with 000. >>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> >>> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
I mean to say by applying the Rule mentioned from Joel is also not worked.
Rules: ====== dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
On Mon, Aug 7, 2017 at 11:43 AM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU");
}
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G <logeshwarangs@gmail.com
wrote:
Thanks a lot for the Detailed Explanation.
I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
But the First three Digit is not Removed. Please find the below log:
5(16152) INFO: <script>: Request : INVITE sip:000919629897172@209.95.52.97 SIP/2.0 Record-Route: sip:209.95.52.97;lr Record-Route: sip:209.95.52.97;lr To: sip:000919629897172@45.249.123.97 From: 7777sip:7777@45.249.123.97;tag=501aa976 Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 6.636d0921d672f2d0bdb3fc87c52a3caa.0 Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 Call-ID: db4777505114995c CSeq: 1 INVITE Contact: sip:7777@45.249.123.97:6107 Max-Forwards: 68 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 3004t stamp 16741 Content-Length: 191
v=0 o=- 355180136 355180140 IN IP4 45.249.123.97 s=eyeBeam c=IN IP4 45.249.123.97 t=0 0 m=audio 31444 RTP/AVP 18 0 8 101 a=fmtp:101 0-15 a=rtpmap:101 telephone-event/8000 a=sendrecv
On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net wrote:
Ok, so clearly you have not tried what Daniel suggested...
*IN a regexp ^ matches the beginning of the line/string, and $ matchesthe end. So "^000$" only matches exactly "000" and not "000xxxx"Remove the $ to match strings begining with 000.*
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000$ match_len: 0 subst_exp: ^0000$ repl_exp: attrs:
Can you see you still have the $ char at the end of match_exp and subst_exp?
To begin with, do you know how regular expressions work? Because that is the first thing you need to know to correctly use the dialplan module.
That said you need a match expression, a substitute expression, and a replace expression...
Try with:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
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.
Have a look at https://www.kamailio.org/do cs/modules/devel/modules/dialplan.html#dialplan.installation
You have a couple examples that might make it more clear.
Let me know if it helps.
Joel.
On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
> Yes I have Tried, please find below the Rules I have applied and the > Result: > > Rules: > ====== > dpid: 1 > pr: 1 > match_op: 1 > match_exp: ^000$ > match_len: 0 > subst_exp: ^0000$ > repl_exp: > attrs: > > > I am Calling to the number 00091xxxxxxxxxx , But its saying as Too > many Hops. > > 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. > > I need to Remove only the first 3 digits, and the other numbers > should go to the call. > > For Example If I am calling 00091xxxxxxxxx, It should remove the > first 3 digits 000 and 91xxxxxxxxx call should be place. > > Please Guide me for removing the first three digits alone and other > numbers should takes place. > > On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net wrote: > >> Have you tried what Daniel suggested? >> >> Share the results of the tests and we can go from there. >> >> On Thu, Aug 3, 2017 at 21:34 Logeshwaran G logeshwarangs@gmail.com >> wrote: >> >>> Input Please!! >>> >>> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >>> logeshwarangs@gmail.com> wrote: >>> >>>> Thanks a lot! >>>> >>>> But for my scenario, >>>> >>>> If I am Dialling 000919999999999, need to remove the first three >>>> digits 000, so the call should go to 919999999999. >>>> >>>> I am stucked to create the rule for the above scenario, Kindly >>>> help me for the same. >>>> >>>> Kind Regards, >>>> Logeshwaran >>>> >>>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl >>>> wrote: >>>> >>>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >>>>> > >>>>> > +----+------+----+----------+-----------+-----------+------- >>>>> ----+----------+-------+ >>>>> > | id | dpid | pr | match_op | match_exp | match_len | >>>>> subst_exp | repl_exp >>>>> > | attrs | >>>>> > +----+------+----+----------+-----------+-----------+------- >>>>> ----+----------+-------+ >>>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ >>>>> | >>>>> > | | 111 >>>>> > +----+------+----+----------+-----------+-----------+------- >>>>> ----+----------+-------+ >>>>> > >>>>> > The above rule replacing only the 000, If we Dial 000xxxx its >>>>> omitting, >>>>> > While Dialing 000 its replacing that with 111. >>>>> >>>>> IN a regexp ^ matches the beginning of the line/string, and $ >>>>> matches >>>>> the end. >>>>> >>>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>>> Remove the $ to match strings begining with 000. >>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> >>>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi,
I don't see the problem...
checked with online tester and the regex looks OK:
[image: Inline image 1]
Can you enable debug logs and try again, then send the logs?
On Sun, Aug 6, 2017 at 11:19 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I mean to say by applying the Rule mentioned from Joel is also not worked.
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
On Mon, Aug 7, 2017 at 11:43 AM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU");
}
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
Thanks a lot for the Detailed Explanation.
I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
But the First three Digit is not Removed. Please find the below log:
5(16152) INFO: <script>: Request : INVITE sip:000919629897172@209.95.52.97 SIP/2.0 Record-Route: sip:209.95.52.97;lr Record-Route: sip:209.95.52.97;lr To: sip:000919629897172@45.249.123.97 From: 7777sip:7777@45.249.123.97;tag=501aa976 Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 6.636d0921d672f2d0bdb3fc87c52a3caa.0 Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 Call-ID: db4777505114995c CSeq: 1 INVITE Contact: sip:7777@45.249.123.97:6107 Max-Forwards: 68 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 3004t stamp 16741 Content-Length: 191
v=0 o=- 355180136 355180140 IN IP4 45.249.123.97 s=eyeBeam c=IN IP4 45.249.123.97 t=0 0 m=audio 31444 RTP/AVP 18 0 8 101 a=fmtp:101 0-15 a=rtpmap:101 telephone-event/8000 a=sendrecv
On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net wrote:
> Ok, so clearly you have not tried what Daniel suggested... > > > > *IN a regexp ^ matches the beginning of the line/string, and $ > matchesthe end. So "^000$" only matches exactly "000" and not > "000xxxx"Remove the $ to match strings begining with 000.* > > Rules: > ====== > dpid: 1 > pr: 1 > match_op: 1 > match_exp: ^000$ > match_len: 0 > subst_exp: ^0000$ > repl_exp: > attrs: > > Can you see you still have the $ char at the end of match_exp and > subst_exp? > > To begin with, do you know how regular expressions work? Because > that is the first thing you need to know to correctly use the dialplan > module. > > That said you need a match expression, a substitute expression, and > a replace expression... > > Try with: > > Rules: > ====== > dpid: 1 > pr: 1 > match_op: 1 > match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any > number that will start with three zeros. > match_len: 0 > subst_exp: ^000([0-9]+)$ <<<<<<< 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. > repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this > case the number you selected in subst_exp, without the three zeros. > attrs: > > > 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. > > Have a look at https://www.kamailio.org/do > cs/modules/devel/modules/dialplan.html#dialplan.installation > > You have a couple examples that might make it more clear. > > > Let me know if it helps. > > Joel. > > > > On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G < > logeshwarangs@gmail.com> wrote: > >> Yes I have Tried, please find below the Rules I have applied and >> the Result: >> >> Rules: >> ====== >> dpid: 1 >> pr: 1 >> match_op: 1 >> match_exp: ^000$ >> match_len: 0 >> subst_exp: ^0000$ >> repl_exp: >> attrs: >> >> >> I am Calling to the number 00091xxxxxxxxxx , But its saying as Too >> many Hops. >> >> 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. >> >> I need to Remove only the first 3 digits, and the other numbers >> should go to the call. >> >> For Example If I am calling 00091xxxxxxxxx, It should remove the >> first 3 digits 000 and 91xxxxxxxxx call should be place. >> >> Please Guide me for removing the first three digits alone and other >> numbers should takes place. >> >> On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net >> wrote: >> >>> Have you tried what Daniel suggested? >>> >>> Share the results of the tests and we can go from there. >>> >>> On Thu, Aug 3, 2017 at 21:34 Logeshwaran G < >>> logeshwarangs@gmail.com> wrote: >>> >>>> Input Please!! >>>> >>>> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >>>> logeshwarangs@gmail.com> wrote: >>>> >>>>> Thanks a lot! >>>>> >>>>> But for my scenario, >>>>> >>>>> If I am Dialling 000919999999999, need to remove the first three >>>>> digits 000, so the call should go to 919999999999. >>>>> >>>>> I am stucked to create the rule for the above scenario, Kindly >>>>> help me for the same. >>>>> >>>>> Kind Regards, >>>>> Logeshwaran >>>>> >>>>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl >>>>> wrote: >>>>> >>>>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >>>>>> > >>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>> ----+----------+-------+ >>>>>> > | id | dpid | pr | match_op | match_exp | match_len | >>>>>> subst_exp | repl_exp >>>>>> > | attrs | >>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>> ----+----------+-------+ >>>>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ >>>>>> | >>>>>> > | | 111 >>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>> ----+----------+-------+ >>>>>> > >>>>>> > The above rule replacing only the 000, If we Dial 000xxxx its >>>>>> omitting, >>>>>> > While Dialing 000 its replacing that with 111. >>>>>> >>>>>> IN a regexp ^ matches the beginning of the line/string, and $ >>>>>> matches >>>>>> the end. >>>>>> >>>>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>>>> Remove the $ to match strings begining with 000. >>>>>> >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Please find the below rules I am using:
+----+------+----+----------+--------------+-----------+---------------+----------+-------+ | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs | +----+------+----+----------+--------------+-----------+---------------+----------+-------+ | 1 | 1 | 1 | 1 | ^000[0-9]+$ | 0 | ^000([0-9]+)$ | 1 | |
Correct me If I am Wrong,
I will enable the logs and send you for the clarity.
On Mon, Aug 7, 2017 at 7:11 PM, Joel Serrano joel@gogii.net wrote:
Hi,
I don't see the problem...
checked with online tester and the regex looks OK:
[image: Inline image 1]
Can you enable debug logs and try again, then send the logs?
On Sun, Aug 6, 2017 at 11:19 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I mean to say by applying the Rule mentioned from Joel is also not worked.
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
On Mon, Aug 7, 2017 at 11:43 AM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G <logeshwarangs@gmail.com
wrote:
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU");
}
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
> Thanks a lot for the Detailed Explanation. > > I am Beginner to Kamailio, As per Your Suggestion I have used the > below Rule: > > Rules: > ====== > dpid: 1 > pr: 1 > match_op: 1 > match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any > number that will start with three zeros. > match_len: 0 > subst_exp: ^000([0-9]+)$ <<<<<<< 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. > repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this > case the number you selected in subst_exp, without the three zeros. > attrs: > > But the First three Digit is not Removed. Please find the below log: > > 5(16152) INFO: <script>: Request : INVITE > sip:000919629897172@209.95.52.97 SIP/2.0 > Record-Route: sip:209.95.52.97;lr > Record-Route: sip:209.95.52.97;lr > To: sip:000919629897172@45.249.123.97 > From: 7777sip:7777@45.249.123.97;tag=501aa976 > Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 > 6.636d0921d672f2d0bdb3fc87c52a3caa.0 > Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch > =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 > Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 > .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 > Call-ID: db4777505114995c > CSeq: 1 INVITE > Contact: sip:7777@45.249.123.97:6107 > Max-Forwards: 68 > Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, > SUBSCRIBE, INFO > Content-Type: application/sdp > User-Agent: eyeBeam release 3004t stamp 16741 > Content-Length: 191 > > v=0 > o=- 355180136 355180140 IN IP4 45.249.123.97 > s=eyeBeam > c=IN IP4 45.249.123.97 > t=0 0 > m=audio 31444 RTP/AVP 18 0 8 101 > a=fmtp:101 0-15 > a=rtpmap:101 telephone-event/8000 > a=sendrecv > > > > > > On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net > wrote: > >> Ok, so clearly you have not tried what Daniel suggested... >> >> >> >> *IN a regexp ^ matches the beginning of the line/string, and $ >> matchesthe end. So "^000$" only matches exactly "000" and not >> "000xxxx"Remove the $ to match strings begining with 000.* >> >> Rules: >> ====== >> dpid: 1 >> pr: 1 >> match_op: 1 >> match_exp: ^000$ >> match_len: 0 >> subst_exp: ^0000$ >> repl_exp: >> attrs: >> >> Can you see you still have the $ char at the end of match_exp and >> subst_exp? >> >> To begin with, do you know how regular expressions work? Because >> that is the first thing you need to know to correctly use the dialplan >> module. >> >> That said you need a match expression, a substitute expression, and >> a replace expression... >> >> Try with: >> >> Rules: >> ====== >> dpid: 1 >> pr: 1 >> match_op: 1 >> match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any >> number that will start with three zeros. >> match_len: 0 >> subst_exp: ^000([0-9]+)$ <<<<<<< 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. >> repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this >> case the number you selected in subst_exp, without the three zeros. >> attrs: >> >> >> 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. >> >> Have a look at https://www.kamailio.org/do >> cs/modules/devel/modules/dialplan.html#dialplan.installation >> >> You have a couple examples that might make it more clear. >> >> >> Let me know if it helps. >> >> Joel. >> >> >> >> On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G < >> logeshwarangs@gmail.com> wrote: >> >>> Yes I have Tried, please find below the Rules I have applied and >>> the Result: >>> >>> Rules: >>> ====== >>> dpid: 1 >>> pr: 1 >>> match_op: 1 >>> match_exp: ^000$ >>> match_len: 0 >>> subst_exp: ^0000$ >>> repl_exp: >>> attrs: >>> >>> >>> I am Calling to the number 00091xxxxxxxxxx , But its saying as Too >>> many Hops. >>> >>> 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. >>> >>> I need to Remove only the first 3 digits, and the other numbers >>> should go to the call. >>> >>> For Example If I am calling 00091xxxxxxxxx, It should remove the >>> first 3 digits 000 and 91xxxxxxxxx call should be place. >>> >>> Please Guide me for removing the first three digits alone and >>> other numbers should takes place. >>> >>> On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net >>> wrote: >>> >>>> Have you tried what Daniel suggested? >>>> >>>> Share the results of the tests and we can go from there. >>>> >>>> On Thu, Aug 3, 2017 at 21:34 Logeshwaran G < >>>> logeshwarangs@gmail.com> wrote: >>>> >>>>> Input Please!! >>>>> >>>>> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >>>>> logeshwarangs@gmail.com> wrote: >>>>> >>>>>> Thanks a lot! >>>>>> >>>>>> But for my scenario, >>>>>> >>>>>> If I am Dialling 000919999999999, need to remove the first >>>>>> three digits 000, so the call should go to 919999999999. >>>>>> >>>>>> I am stucked to create the rule for the above scenario, Kindly >>>>>> help me for the same. >>>>>> >>>>>> Kind Regards, >>>>>> Logeshwaran >>>>>> >>>>>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl >>>>>> wrote: >>>>>> >>>>>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >>>>>>> > >>>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>>> ----+----------+-------+ >>>>>>> > | id | dpid | pr | match_op | match_exp | match_len | >>>>>>> subst_exp | repl_exp >>>>>>> > | attrs | >>>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>>> ----+----------+-------+ >>>>>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ >>>>>>> | >>>>>>> > | | 111 >>>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>>> ----+----------+-------+ >>>>>>> > >>>>>>> > The above rule replacing only the 000, If we Dial 000xxxx >>>>>>> its omitting, >>>>>>> > While Dialing 000 its replacing that with 111. >>>>>>> >>>>>>> IN a regexp ^ matches the beginning of the line/string, and $ >>>>>>> matches >>>>>>> the end. >>>>>>> >>>>>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>>>>> Remove the $ to match strings begining with 000. >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>>> >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi,
The 'subst_exp' is incorrect, it should be "\1" instead of "1" (note the backslash).
Send the debug logs when you have them.
J.
On Mon, Aug 7, 2017 at 11:56 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below rules I am using:
+----+------+----+----------+--------------+-----------+---- -----------+----------+-------+ | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs | +----+------+----+----------+--------------+-----------+---- -----------+----------+-------+ | 1 | 1 | 1 | 1 | ^000[0-9]+$ | 0 | ^000([0-9]+)$ | 1 | |
Correct me If I am Wrong,
I will enable the logs and send you for the clarity.
On Mon, Aug 7, 2017 at 7:11 PM, Joel Serrano joel@gogii.net wrote:
Hi,
I don't see the problem...
checked with online tester and the regex looks OK:
[image: Inline image 1]
Can you enable debug logs and try again, then send the logs?
On Sun, Aug 6, 2017 at 11:19 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I mean to say by applying the Rule mentioned from Joel is also not worked.
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
On Mon, Aug 7, 2017 at 11:43 AM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU");
}
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
> Can you post your block of config related to dialplan module from > kamailio.cfg? > > Also, how are you calling the dp_* functions? > > > On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G < > logeshwarangs@gmail.com> wrote: > >> Thanks a lot for the Detailed Explanation. >> >> I am Beginner to Kamailio, As per Your Suggestion I have used the >> below Rule: >> >> Rules: >> ====== >> dpid: 1 >> pr: 1 >> match_op: 1 >> match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any >> number that will start with three zeros. >> match_len: 0 >> subst_exp: ^000([0-9]+)$ <<<<<<< 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. >> repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this >> case the number you selected in subst_exp, without the three zeros. >> attrs: >> >> But the First three Digit is not Removed. Please find the below log: >> >> 5(16152) INFO: <script>: Request : INVITE >> sip:000919629897172@209.95.52.97 SIP/2.0 >> Record-Route: sip:209.95.52.97;lr >> Record-Route: sip:209.95.52.97;lr >> To: sip:000919629897172@45.249.123.97 >> From: 7777sip:7777@45.249.123.97;tag=501aa976 >> Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 >> 6.636d0921d672f2d0bdb3fc87c52a3caa.0 >> Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch >> =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 >> Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 >> .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 >> Call-ID: db4777505114995c >> CSeq: 1 INVITE >> Contact: sip:7777@45.249.123.97:6107 >> Max-Forwards: 68 >> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, >> SUBSCRIBE, INFO >> Content-Type: application/sdp >> User-Agent: eyeBeam release 3004t stamp 16741 >> Content-Length: 191 >> >> v=0 >> o=- 355180136 355180140 IN IP4 45.249.123.97 >> s=eyeBeam >> c=IN IP4 45.249.123.97 >> t=0 0 >> m=audio 31444 RTP/AVP 18 0 8 101 >> a=fmtp:101 0-15 >> a=rtpmap:101 telephone-event/8000 >> a=sendrecv >> >> >> >> >> >> On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net >> wrote: >> >>> Ok, so clearly you have not tried what Daniel suggested... >>> >>> >>> >>> *IN a regexp ^ matches the beginning of the line/string, and $ >>> matchesthe end. So "^000$" only matches exactly "000" and not >>> "000xxxx"Remove the $ to match strings begining with 000.* >>> >>> Rules: >>> ====== >>> dpid: 1 >>> pr: 1 >>> match_op: 1 >>> match_exp: ^000$ >>> match_len: 0 >>> subst_exp: ^0000$ >>> repl_exp: >>> attrs: >>> >>> Can you see you still have the $ char at the end of match_exp and >>> subst_exp? >>> >>> To begin with, do you know how regular expressions work? Because >>> that is the first thing you need to know to correctly use the dialplan >>> module. >>> >>> That said you need a match expression, a substitute expression, >>> and a replace expression... >>> >>> Try with: >>> >>> Rules: >>> ====== >>> dpid: 1 >>> pr: 1 >>> match_op: 1 >>> match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any >>> number that will start with three zeros. >>> match_len: 0 >>> subst_exp: ^000([0-9]+)$ <<<<<<< 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. >>> repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this >>> case the number you selected in subst_exp, without the three zeros. >>> attrs: >>> >>> >>> 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. >>> >>> Have a look at https://www.kamailio.org/do >>> cs/modules/devel/modules/dialplan.html#dialplan.installation >>> >>> You have a couple examples that might make it more clear. >>> >>> >>> Let me know if it helps. >>> >>> Joel. >>> >>> >>> >>> On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G < >>> logeshwarangs@gmail.com> wrote: >>> >>>> Yes I have Tried, please find below the Rules I have applied and >>>> the Result: >>>> >>>> Rules: >>>> ====== >>>> dpid: 1 >>>> pr: 1 >>>> match_op: 1 >>>> match_exp: ^000$ >>>> match_len: 0 >>>> subst_exp: ^0000$ >>>> repl_exp: >>>> attrs: >>>> >>>> >>>> I am Calling to the number 00091xxxxxxxxxx , But its saying as >>>> Too many Hops. >>>> >>>> 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. >>>> >>>> I need to Remove only the first 3 digits, and the other numbers >>>> should go to the call. >>>> >>>> For Example If I am calling 00091xxxxxxxxx, It should remove the >>>> first 3 digits 000 and 91xxxxxxxxx call should be place. >>>> >>>> Please Guide me for removing the first three digits alone and >>>> other numbers should takes place. >>>> >>>> On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net >>>> wrote: >>>> >>>>> Have you tried what Daniel suggested? >>>>> >>>>> Share the results of the tests and we can go from there. >>>>> >>>>> On Thu, Aug 3, 2017 at 21:34 Logeshwaran G < >>>>> logeshwarangs@gmail.com> wrote: >>>>> >>>>>> Input Please!! >>>>>> >>>>>> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >>>>>> logeshwarangs@gmail.com> wrote: >>>>>> >>>>>>> Thanks a lot! >>>>>>> >>>>>>> But for my scenario, >>>>>>> >>>>>>> If I am Dialling 000919999999999, need to remove the first >>>>>>> three digits 000, so the call should go to 919999999999. >>>>>>> >>>>>>> I am stucked to create the rule for the above scenario, Kindly >>>>>>> help me for the same. >>>>>>> >>>>>>> Kind Regards, >>>>>>> Logeshwaran >>>>>>> >>>>>>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba <d.tryba@pocos.nl >>>>>>> > wrote: >>>>>>> >>>>>>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >>>>>>>> > >>>>>>>> > +----+------+----+----------+- >>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>> > | id | dpid | pr | match_op | match_exp | match_len | >>>>>>>> subst_exp | repl_exp >>>>>>>> > | attrs | >>>>>>>> > +----+------+----+----------+- >>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | >>>>>>>> ^000$ | >>>>>>>> > | | 111 >>>>>>>> > +----+------+----+----------+- >>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>> > >>>>>>>> > The above rule replacing only the 000, If we Dial 000xxxx >>>>>>>> its omitting, >>>>>>>> > While Dialing 000 its replacing that with 111. >>>>>>>> >>>>>>>> IN a regexp ^ matches the beginning of the line/string, and $ >>>>>>>> matches >>>>>>>> the end. >>>>>>>> >>>>>>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>>>>>> Remove the $ to match strings begining with 000. >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>> sr-users@lists.kamailio.org >>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>> >>>>>>> >>>>>>> >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>>> >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
I have given the below query,
INSERT INTO dialplan(id, dpid, pr, match_op, match_exp, match_len, subst_exp, repl_exp, attrs) VALUES (1, "1", "1", 1, "^000[0-9]+$ ", 0, "^000([0-9]+)$", "\1", " ");
But the Rule is tking as "1"
====== dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ match_len: 0 subst_exp: ^000([0-9]+)$ repl_exp: \1 (instead of this, it is taking as "1") attrs:
Thanks & Kind Regards, Logeshwaran G
On Wed, Aug 9, 2017 at 12:59 AM, Joel Serrano joel@gogii.net wrote:
Hi,
The 'subst_exp' is incorrect, it should be "\1" instead of "1" (note the backslash).
Send the debug logs when you have them.
J.
On Mon, Aug 7, 2017 at 11:56 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below rules I am using:
+----+------+----+----------+--------------+-----------+---- -----------+----------+-------+ | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs | +----+------+----+----------+--------------+-----------+---- -----------+----------+-------+ | 1 | 1 | 1 | 1 | ^000[0-9]+$ | 0 | ^000([0-9]+)$ | 1 | |
Correct me If I am Wrong,
I will enable the logs and send you for the clarity.
On Mon, Aug 7, 2017 at 7:11 PM, Joel Serrano joel@gogii.net wrote:
Hi,
I don't see the problem...
checked with online tester and the regex looks OK:
[image: Inline image 1]
Can you enable debug logs and try again, then send the logs?
On Sun, Aug 6, 2017 at 11:19 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I mean to say by applying the Rule mentioned from Joel is also not worked.
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
On Mon, Aug 7, 2017 at 11:43 AM, Logeshwaran G <logeshwarangs@gmail.com
wrote:
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
> I am using the below function: > > if (is_method("INVITE")) { > > dp_translate("1", "$rU/$rU"); > } > > > On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote: > >> Can you post your block of config related to dialplan module from >> kamailio.cfg? >> >> Also, how are you calling the dp_* functions? >> >> >> On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G < >> logeshwarangs@gmail.com> wrote: >> >>> Thanks a lot for the Detailed Explanation. >>> >>> I am Beginner to Kamailio, As per Your Suggestion I have used the >>> below Rule: >>> >>> Rules: >>> ====== >>> dpid: 1 >>> pr: 1 >>> match_op: 1 >>> match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any >>> number that will start with three zeros. >>> match_len: 0 >>> subst_exp: ^000([0-9]+)$ <<<<<<< 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. >>> repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this >>> case the number you selected in subst_exp, without the three zeros. >>> attrs: >>> >>> But the First three Digit is not Removed. Please find the below >>> log: >>> >>> 5(16152) INFO: <script>: Request : INVITE >>> sip:000919629897172@209.95.52.97 SIP/2.0 >>> Record-Route: sip:209.95.52.97;lr >>> Record-Route: sip:209.95.52.97;lr >>> To: sip:000919629897172@45.249.123.97 >>> From: 7777sip:7777@45.249.123.97;tag=501aa976 >>> Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 >>> 6.636d0921d672f2d0bdb3fc87c52a3caa.0 >>> Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch >>> =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 >>> Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 >>> .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 >>> Call-ID: db4777505114995c >>> CSeq: 1 INVITE >>> Contact: sip:7777@45.249.123.97:6107 >>> Max-Forwards: 68 >>> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, >>> SUBSCRIBE, INFO >>> Content-Type: application/sdp >>> User-Agent: eyeBeam release 3004t stamp 16741 >>> Content-Length: 191 >>> >>> v=0 >>> o=- 355180136 355180140 IN IP4 45.249.123.97 >>> s=eyeBeam >>> c=IN IP4 45.249.123.97 >>> t=0 0 >>> m=audio 31444 RTP/AVP 18 0 8 101 >>> a=fmtp:101 0-15 >>> a=rtpmap:101 telephone-event/8000 >>> a=sendrecv >>> >>> >>> >>> >>> >>> On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net >>> wrote: >>> >>>> Ok, so clearly you have not tried what Daniel suggested... >>>> >>>> >>>> >>>> *IN a regexp ^ matches the beginning of the line/string, and $ >>>> matchesthe end. So "^000$" only matches exactly "000" and not >>>> "000xxxx"Remove the $ to match strings begining with 000.* >>>> >>>> Rules: >>>> ====== >>>> dpid: 1 >>>> pr: 1 >>>> match_op: 1 >>>> match_exp: ^000$ >>>> match_len: 0 >>>> subst_exp: ^0000$ >>>> repl_exp: >>>> attrs: >>>> >>>> Can you see you still have the $ char at the end of match_exp and >>>> subst_exp? >>>> >>>> To begin with, do you know how regular expressions work? Because >>>> that is the first thing you need to know to correctly use the dialplan >>>> module. >>>> >>>> That said you need a match expression, a substitute expression, >>>> and a replace expression... >>>> >>>> Try with: >>>> >>>> Rules: >>>> ====== >>>> dpid: 1 >>>> pr: 1 >>>> match_op: 1 >>>> match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any >>>> number that will start with three zeros. >>>> match_len: 0 >>>> subst_exp: ^000([0-9]+)$ <<<<<<< 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. >>>> repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in >>>> this case the number you selected in subst_exp, without the three zeros. >>>> attrs: >>>> >>>> >>>> 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. >>>> >>>> Have a look at https://www.kamailio.org/do >>>> cs/modules/devel/modules/dialplan.html#dialplan.installation >>>> >>>> You have a couple examples that might make it more clear. >>>> >>>> >>>> Let me know if it helps. >>>> >>>> Joel. >>>> >>>> >>>> >>>> On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G < >>>> logeshwarangs@gmail.com> wrote: >>>> >>>>> Yes I have Tried, please find below the Rules I have applied and >>>>> the Result: >>>>> >>>>> Rules: >>>>> ====== >>>>> dpid: 1 >>>>> pr: 1 >>>>> match_op: 1 >>>>> match_exp: ^000$ >>>>> match_len: 0 >>>>> subst_exp: ^0000$ >>>>> repl_exp: >>>>> attrs: >>>>> >>>>> >>>>> I am Calling to the number 00091xxxxxxxxxx , But its saying as >>>>> Too many Hops. >>>>> >>>>> 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. >>>>> >>>>> I need to Remove only the first 3 digits, and the other numbers >>>>> should go to the call. >>>>> >>>>> For Example If I am calling 00091xxxxxxxxx, It should remove the >>>>> first 3 digits 000 and 91xxxxxxxxx call should be place. >>>>> >>>>> Please Guide me for removing the first three digits alone and >>>>> other numbers should takes place. >>>>> >>>>> On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net >>>>> wrote: >>>>> >>>>>> Have you tried what Daniel suggested? >>>>>> >>>>>> Share the results of the tests and we can go from there. >>>>>> >>>>>> On Thu, Aug 3, 2017 at 21:34 Logeshwaran G < >>>>>> logeshwarangs@gmail.com> wrote: >>>>>> >>>>>>> Input Please!! >>>>>>> >>>>>>> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >>>>>>> logeshwarangs@gmail.com> wrote: >>>>>>> >>>>>>>> Thanks a lot! >>>>>>>> >>>>>>>> But for my scenario, >>>>>>>> >>>>>>>> If I am Dialling 000919999999999, need to remove the first >>>>>>>> three digits 000, so the call should go to 919999999999. >>>>>>>> >>>>>>>> I am stucked to create the rule for the above scenario, >>>>>>>> Kindly help me for the same. >>>>>>>> >>>>>>>> Kind Regards, >>>>>>>> Logeshwaran >>>>>>>> >>>>>>>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba < >>>>>>>> d.tryba@pocos.nl> wrote: >>>>>>>> >>>>>>>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G >>>>>>>>> wrote: >>>>>>>>> > >>>>>>>>> > +----+------+----+----------+- >>>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>>> > | id | dpid | pr | match_op | match_exp | match_len | >>>>>>>>> subst_exp | repl_exp >>>>>>>>> > | attrs | >>>>>>>>> > +----+------+----+----------+- >>>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | >>>>>>>>> ^000$ | >>>>>>>>> > | | 111 >>>>>>>>> > +----+------+----+----------+- >>>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>>> > >>>>>>>>> > The above rule replacing only the 000, If we Dial 000xxxx >>>>>>>>> its omitting, >>>>>>>>> > While Dialing 000 its replacing that with 111. >>>>>>>>> >>>>>>>>> IN a regexp ^ matches the beginning of the line/string, and >>>>>>>>> $ matches >>>>>>>>> the end. >>>>>>>>> >>>>>>>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>>>>>>> Remove the $ to match strings begining with 000. >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>>> >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
I am not Sure how to take the debug logs,
I have enabled #!ifdef WITH_DEBUG # ----- debugger params ----- modparam("debugger", "cfgtrace", 1) modparam("debugger", "log_level_name", "exec") modparam("debugger", "mod_facility", "core=LOG_LOCAL0")
I am not sure where these logs will be stored and how to take those logs.
Thanks & Kind Regards, Logeshwaran G
On Wed, Aug 9, 2017 at 1:34 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I have given the below query,
INSERT INTO dialplan(id, dpid, pr, match_op, match_exp, match_len, subst_exp, repl_exp, attrs) VALUES (1, "1", "1", 1, "^000[0-9]+$ ", 0, "^000([0-9]+)$", "\1", " ");
But the Rule is tking as "1"
====== dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ match_len: 0 subst_exp: ^000([0-9]+)$ repl_exp: \1 (instead of this, it is taking as "1") attrs:
Thanks & Kind Regards, Logeshwaran G
On Wed, Aug 9, 2017 at 12:59 AM, Joel Serrano joel@gogii.net wrote:
Hi,
The 'subst_exp' is incorrect, it should be "\1" instead of "1" (note the backslash).
Send the debug logs when you have them.
J.
On Mon, Aug 7, 2017 at 11:56 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below rules I am using:
+----+------+----+----------+--------------+-----------+---- -----------+----------+-------+ | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs | +----+------+----+----------+--------------+-----------+---- -----------+----------+-------+ | 1 | 1 | 1 | 1 | ^000[0-9]+$ | 0 | ^000([0-9]+)$ | 1 | |
Correct me If I am Wrong,
I will enable the logs and send you for the clarity.
On Mon, Aug 7, 2017 at 7:11 PM, Joel Serrano joel@gogii.net wrote:
Hi,
I don't see the problem...
checked with online tester and the regex looks OK:
[image: Inline image 1]
Can you enable debug logs and try again, then send the logs?
On Sun, Aug 6, 2017 at 11:19 PM, Logeshwaran G <logeshwarangs@gmail.com
wrote:
I mean to say by applying the Rule mentioned from Joel is also not worked.
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
On Mon, Aug 7, 2017 at 11:43 AM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
> Can you add logging and post results? > > if (is_method("INVITE")) { > xlog("R-URI User: $rU\n"); > dp_translate("1", "$rU/$rU"); > xlog("R-URI User: $rU\n"); > } > > > > On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G < > logeshwarangs@gmail.com> wrote: > >> I am using the below function: >> >> if (is_method("INVITE")) { >> >> dp_translate("1", "$rU/$rU"); >> } >> >> >> On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net >> wrote: >> >>> Can you post your block of config related to dialplan module from >>> kamailio.cfg? >>> >>> Also, how are you calling the dp_* functions? >>> >>> >>> On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G < >>> logeshwarangs@gmail.com> wrote: >>> >>>> Thanks a lot for the Detailed Explanation. >>>> >>>> I am Beginner to Kamailio, As per Your Suggestion I have used the >>>> below Rule: >>>> >>>> Rules: >>>> ====== >>>> dpid: 1 >>>> pr: 1 >>>> match_op: 1 >>>> match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any >>>> number that will start with three zeros. >>>> match_len: 0 >>>> subst_exp: ^000([0-9]+)$ <<<<<<< 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. >>>> repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in >>>> this case the number you selected in subst_exp, without the three zeros. >>>> attrs: >>>> >>>> But the First three Digit is not Removed. Please find the below >>>> log: >>>> >>>> 5(16152) INFO: <script>: Request : INVITE >>>> sip:000919629897172@209.95.52.97 SIP/2.0 >>>> Record-Route: sip:209.95.52.97;lr >>>> Record-Route: sip:209.95.52.97;lr >>>> To: sip:000919629897172@45.249.123.97 >>>> From: 7777sip:7777@45.249.123.97;tag=501aa976 >>>> Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 >>>> 6.636d0921d672f2d0bdb3fc87c52a3caa.0 >>>> Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch >>>> =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 >>>> Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 >>>> .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rpor >>>> t=6107 >>>> Call-ID: db4777505114995c >>>> CSeq: 1 INVITE >>>> Contact: sip:7777@45.249.123.97:6107 >>>> Max-Forwards: 68 >>>> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, >>>> SUBSCRIBE, INFO >>>> Content-Type: application/sdp >>>> User-Agent: eyeBeam release 3004t stamp 16741 >>>> Content-Length: 191 >>>> >>>> v=0 >>>> o=- 355180136 355180140 IN IP4 45.249.123.97 >>>> s=eyeBeam >>>> c=IN IP4 45.249.123.97 >>>> t=0 0 >>>> m=audio 31444 RTP/AVP 18 0 8 101 >>>> a=fmtp:101 0-15 >>>> a=rtpmap:101 telephone-event/8000 >>>> a=sendrecv >>>> >>>> >>>> >>>> >>>> >>>> On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net >>>> wrote: >>>> >>>>> Ok, so clearly you have not tried what Daniel suggested... >>>>> >>>>> >>>>> >>>>> *IN a regexp ^ matches the beginning of the line/string, and $ >>>>> matchesthe end. So "^000$" only matches exactly "000" and not >>>>> "000xxxx"Remove the $ to match strings begining with 000.* >>>>> >>>>> Rules: >>>>> ====== >>>>> dpid: 1 >>>>> pr: 1 >>>>> match_op: 1 >>>>> match_exp: ^000$ >>>>> match_len: 0 >>>>> subst_exp: ^0000$ >>>>> repl_exp: >>>>> attrs: >>>>> >>>>> Can you see you still have the $ char at the end of match_exp >>>>> and subst_exp? >>>>> >>>>> To begin with, do you know how regular expressions work? >>>>> Because that is the first thing you need to know to correctly use the >>>>> dialplan module. >>>>> >>>>> That said you need a match expression, a substitute expression, >>>>> and a replace expression... >>>>> >>>>> Try with: >>>>> >>>>> Rules: >>>>> ====== >>>>> dpid: 1 >>>>> pr: 1 >>>>> match_op: 1 >>>>> match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on >>>>> any number that will start with three zeros. >>>>> match_len: 0 >>>>> subst_exp: ^000([0-9]+)$ <<<<<<< 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. >>>>> repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in >>>>> this case the number you selected in subst_exp, without the three zeros. >>>>> attrs: >>>>> >>>>> >>>>> 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. >>>>> >>>>> Have a look at https://www.kamailio.org/do >>>>> cs/modules/devel/modules/dialplan.html#dialplan.installation >>>>> >>>>> You have a couple examples that might make it more clear. >>>>> >>>>> >>>>> Let me know if it helps. >>>>> >>>>> Joel. >>>>> >>>>> >>>>> >>>>> On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G < >>>>> logeshwarangs@gmail.com> wrote: >>>>> >>>>>> Yes I have Tried, please find below the Rules I have applied >>>>>> and the Result: >>>>>> >>>>>> Rules: >>>>>> ====== >>>>>> dpid: 1 >>>>>> pr: 1 >>>>>> match_op: 1 >>>>>> match_exp: ^000$ >>>>>> match_len: 0 >>>>>> subst_exp: ^0000$ >>>>>> repl_exp: >>>>>> attrs: >>>>>> >>>>>> >>>>>> I am Calling to the number 00091xxxxxxxxxx , But its saying as >>>>>> Too many Hops. >>>>>> >>>>>> 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. >>>>>> >>>>>> I need to Remove only the first 3 digits, and the other numbers >>>>>> should go to the call. >>>>>> >>>>>> For Example If I am calling 00091xxxxxxxxx, It should remove >>>>>> the first 3 digits 000 and 91xxxxxxxxx call should be place. >>>>>> >>>>>> Please Guide me for removing the first three digits alone and >>>>>> other numbers should takes place. >>>>>> >>>>>> On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net >>>>>> wrote: >>>>>> >>>>>>> Have you tried what Daniel suggested? >>>>>>> >>>>>>> Share the results of the tests and we can go from there. >>>>>>> >>>>>>> On Thu, Aug 3, 2017 at 21:34 Logeshwaran G < >>>>>>> logeshwarangs@gmail.com> wrote: >>>>>>> >>>>>>>> Input Please!! >>>>>>>> >>>>>>>> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >>>>>>>> logeshwarangs@gmail.com> wrote: >>>>>>>> >>>>>>>>> Thanks a lot! >>>>>>>>> >>>>>>>>> But for my scenario, >>>>>>>>> >>>>>>>>> If I am Dialling 000919999999999, need to remove the first >>>>>>>>> three digits 000, so the call should go to 919999999999. >>>>>>>>> >>>>>>>>> I am stucked to create the rule for the above scenario, >>>>>>>>> Kindly help me for the same. >>>>>>>>> >>>>>>>>> Kind Regards, >>>>>>>>> Logeshwaran >>>>>>>>> >>>>>>>>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba < >>>>>>>>> d.tryba@pocos.nl> wrote: >>>>>>>>> >>>>>>>>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G >>>>>>>>>> wrote: >>>>>>>>>> > >>>>>>>>>> > +----+------+----+----------+- >>>>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>>>> > | id | dpid | pr | match_op | match_exp | match_len | >>>>>>>>>> subst_exp | repl_exp >>>>>>>>>> > | attrs | >>>>>>>>>> > +----+------+----+----------+- >>>>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | >>>>>>>>>> ^000$ | >>>>>>>>>> > | | 111 >>>>>>>>>> > +----+------+----+----------+- >>>>>>>>>> ----------+-----------+-----------+----------+-------+ >>>>>>>>>> > >>>>>>>>>> > The above rule replacing only the 000, If we Dial 000xxxx >>>>>>>>>> its omitting, >>>>>>>>>> > While Dialing 000 its replacing that with 111. >>>>>>>>>> >>>>>>>>>> IN a regexp ^ matches the beginning of the line/string, and >>>>>>>>>> $ matches >>>>>>>>>> the end. >>>>>>>>>> >>>>>>>>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>>>>>>>> Remove the $ to match strings begining with 000. >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>>> https://lists.kamailio.org/cgi >>>>>>>>>> -bin/mailman/listinfo/sr-users >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>> sr-users@lists.kamailio.org >>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>>> >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Wed, Aug 09, 2017 at 01:34:13PM +0530, Logeshwaran G wrote:
I have given the below query,
INSERT INTO dialplan(id, dpid, pr, match_op, match_exp, match_len, subst_exp, repl_exp, attrs) VALUES (1, "1", "1", 1, "^000[0-9]+$ ", 0, "^000([0-9]+)$", "\1", " ");
But the Rule is tking as "1"
See https://dev.mysql.com/doc/refman/5.7/en/string-literals.html "Within a string, certain sequences have special meaning unless the NO_BACKSLASH_ESCAPES SQL mode is enabled. Each of these sequences begins with a backslash (), known as the escape character. MySQL recognizes the escape sequences shown in Table 9.1, “Special Character Escape Sequences”. For all other escape sequences, backslash is ignored. That is, the escaped character is interpreted as if it was not escaped. For example, \x is just x. These sequences are case sensitive. For example, \b is interpreted as a backspace, but \B is interpreted as B. "
Hi, I have changed the rules as you mentioned
INSERT INTO dialplan(id, dpid, pr, match_op, match_exp, match_len, subst_exp, repl_exp, attrs) VALUES (1, "1", "1", 1, "^000[0-9]+$ ", 0, "^000([0-9]+)$", "\1", " ");
Eventhough its failing.
Thanks & Kind Regards, Logeshwaran G
On Wed, Aug 9, 2017 at 5:05 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Wed, Aug 09, 2017 at 01:34:13PM +0530, Logeshwaran G wrote:
I have given the below query,
INSERT INTO dialplan(id, dpid, pr, match_op, match_exp, match_len, subst_exp, repl_exp, attrs) VALUES (1, "1", "1", 1, "^000[0-9]+$ ", 0, "^000([0-9]+)$", "\1", " ");
But the Rule is tking as "1"
See https://dev.mysql.com/doc/refman/5.7/en/string-literals.html "Within a string, certain sequences have special meaning unless the NO_BACKSLASH_ESCAPES SQL mode is enabled. Each of these sequences begins with a backslash (), known as the escape character. MySQL recognizes the escape sequences shown in Table 9.1, “Special Character Escape Sequences”. For all other escape sequences, backslash is ignored. That is, the escaped character is interpreted as if it was not escaped. For example, \x is just x. These sequences are case sensitive. For example, \b is interpreted as a backspace, but \B is interpreted as B. "
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Issue Resolved.. Thanks a lot For you Inputs.
INSERT INTO dialplan(id, dpid, pr, match_op, match_exp, match_len, subst_exp, repl_exp, attrs) VALUES (2, "1", "2", 1, "^000[0-9]+\$ ", 0, "^000([0-9]+)$", "", " ");
Thanks & Kind Regards, Logeshwaran G
On Thu, Aug 10, 2017 at 10:13 AM, Logeshwaran G logeshwarangs@gmail.com wrote:
Hi, I have changed the rules as you mentioned
INSERT INTO dialplan(id, dpid, pr, match_op, match_exp, match_len, subst_exp, repl_exp, attrs) VALUES (1, "1", "1", 1, "^000[0-9]+$ ", 0, "^000([0-9]+)$", "\1", " ");
Eventhough its failing.
Thanks & Kind Regards, Logeshwaran G
On Wed, Aug 9, 2017 at 5:05 PM, Daniel Tryba d.tryba@pocos.nl wrote:
On Wed, Aug 09, 2017 at 01:34:13PM +0530, Logeshwaran G wrote:
I have given the below query,
INSERT INTO dialplan(id, dpid, pr, match_op, match_exp, match_len, subst_exp, repl_exp, attrs) VALUES (1, "1", "1", 1, "^000[0-9]+$ ", 0, "^000([0-9]+)$", "\1", " ");
But the Rule is tking as "1"
See https://dev.mysql.com/doc/refman/5.7/en/string-literals.html "Within a string, certain sequences have special meaning unless the NO_BACKSLASH_ESCAPES SQL mode is enabled. Each of these sequences begins with a backslash (), known as the escape character. MySQL recognizes the escape sequences shown in Table 9.1, “Special Character Escape Sequences”. For all other escape sequences, backslash is ignored. That is, the escaped character is interpreted as if it was not escaped. For example, \x is just x. These sequences are case sensitive. For example, \b is interpreted as a backspace, but \B is interpreted as B. "
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi,
(Sorry, my previous reply got blocked due to email size). Can you enable debug logs and try again, then send the logs?
I tried the regex with the number 000919629897172 and it worked for me.. We must be missing something..
On Sun, Aug 6, 2017 at 11:19 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I mean to say by applying the Rule mentioned from Joel is also not worked.
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
On Mon, Aug 7, 2017 at 11:43 AM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU");
}
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
Thanks a lot for the Detailed Explanation.
I am Beginner to Kamailio, As per Your Suggestion I have used the below Rule:
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
But the First three Digit is not Removed. Please find the below log:
5(16152) INFO: <script>: Request : INVITE sip:000919629897172@209.95.52.97 SIP/2.0 Record-Route: sip:209.95.52.97;lr Record-Route: sip:209.95.52.97;lr To: sip:000919629897172@45.249.123.97 From: 7777sip:7777@45.249.123.97;tag=501aa976 Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 6.636d0921d672f2d0bdb3fc87c52a3caa.0 Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 Call-ID: db4777505114995c CSeq: 1 INVITE Contact: sip:7777@45.249.123.97:6107 Max-Forwards: 68 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 3004t stamp 16741 Content-Length: 191
v=0 o=- 355180136 355180140 IN IP4 45.249.123.97 s=eyeBeam c=IN IP4 45.249.123.97 t=0 0 m=audio 31444 RTP/AVP 18 0 8 101 a=fmtp:101 0-15 a=rtpmap:101 telephone-event/8000 a=sendrecv
On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net wrote:
> Ok, so clearly you have not tried what Daniel suggested... > > > > *IN a regexp ^ matches the beginning of the line/string, and $ > matchesthe end. So "^000$" only matches exactly "000" and not > "000xxxx"Remove the $ to match strings begining with 000.* > > Rules: > ====== > dpid: 1 > pr: 1 > match_op: 1 > match_exp: ^000$ > match_len: 0 > subst_exp: ^0000$ > repl_exp: > attrs: > > Can you see you still have the $ char at the end of match_exp and > subst_exp? > > To begin with, do you know how regular expressions work? Because > that is the first thing you need to know to correctly use the dialplan > module. > > That said you need a match expression, a substitute expression, and > a replace expression... > > Try with: > > Rules: > ====== > dpid: 1 > pr: 1 > match_op: 1 > match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any > number that will start with three zeros. > match_len: 0 > subst_exp: ^000([0-9]+)$ <<<<<<< 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. > repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this > case the number you selected in subst_exp, without the three zeros. > attrs: > > > 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. > > Have a look at https://www.kamailio.org/do > cs/modules/devel/modules/dialplan.html#dialplan.installation > > You have a couple examples that might make it more clear. > > > Let me know if it helps. > > Joel. > > > > On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G < > logeshwarangs@gmail.com> wrote: > >> Yes I have Tried, please find below the Rules I have applied and >> the Result: >> >> Rules: >> ====== >> dpid: 1 >> pr: 1 >> match_op: 1 >> match_exp: ^000$ >> match_len: 0 >> subst_exp: ^0000$ >> repl_exp: >> attrs: >> >> >> I am Calling to the number 00091xxxxxxxxxx , But its saying as Too >> many Hops. >> >> 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. >> >> I need to Remove only the first 3 digits, and the other numbers >> should go to the call. >> >> For Example If I am calling 00091xxxxxxxxx, It should remove the >> first 3 digits 000 and 91xxxxxxxxx call should be place. >> >> Please Guide me for removing the first three digits alone and other >> numbers should takes place. >> >> On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net >> wrote: >> >>> Have you tried what Daniel suggested? >>> >>> Share the results of the tests and we can go from there. >>> >>> On Thu, Aug 3, 2017 at 21:34 Logeshwaran G < >>> logeshwarangs@gmail.com> wrote: >>> >>>> Input Please!! >>>> >>>> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >>>> logeshwarangs@gmail.com> wrote: >>>> >>>>> Thanks a lot! >>>>> >>>>> But for my scenario, >>>>> >>>>> If I am Dialling 000919999999999, need to remove the first three >>>>> digits 000, so the call should go to 919999999999. >>>>> >>>>> I am stucked to create the rule for the above scenario, Kindly >>>>> help me for the same. >>>>> >>>>> Kind Regards, >>>>> Logeshwaran >>>>> >>>>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl >>>>> wrote: >>>>> >>>>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >>>>>> > >>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>> ----+----------+-------+ >>>>>> > | id | dpid | pr | match_op | match_exp | match_len | >>>>>> subst_exp | repl_exp >>>>>> > | attrs | >>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>> ----+----------+-------+ >>>>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ >>>>>> | >>>>>> > | | 111 >>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>> ----+----------+-------+ >>>>>> > >>>>>> > The above rule replacing only the 000, If we Dial 000xxxx its >>>>>> omitting, >>>>>> > While Dialing 000 its replacing that with 111. >>>>>> >>>>>> IN a regexp ^ matches the beginning of the line/string, and $ >>>>>> matches >>>>>> the end. >>>>>> >>>>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>>>> Remove the $ to match strings begining with 000. >>>>>> >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi ,
Please find the below logs , The call is not placing Its in Trying state.
To: 7777sip:7777@209.95.52.97 From: 7777sip:7777@209.95.52.97;tag=e4269c5e Via: SIP/2.0/UDP 192.168.3.5:6090 ;branch=z9hG4bK-d87543-161839468-1--d87543-;rport Call-ID: e01ac670234a8675 CSeq: 3 REGISTER Contact: sip:7777@192.168.3.5:6090;expires=0 Max-Forwards: 70 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO User-Agent: eyeBeam release 3004t stamp 16741 Authorization: Digest username="7777",realm="209.95.52.97",nonce="WYlDhVmJQlmWGnZELD+8UBwWgX2NmBdu",uri="sip:209.95.52.97",response="2b4efd8c09e8ce2de0a56fab38157c72",algorithm=MD5 Content-Length: 0
10:18:23.5 SENDING TO: 209.95.52.97:5060 REGISTER sip:209.95.52.97 SIP/2.0 To: 7777sip:7777@209.95.52.97 From: 7777sip:7777@209.95.52.97;tag=e4269c5e Via: SIP/2.0/UDP 192.168.3.5:6090 ;branch=z9hG4bK-d87543-161839468-1--d87543-;rport Call-ID: e01ac670234a8675 CSeq: 3 REGISTER Contact: sip:7777@192.168.3.5:6090;expires=0 Max-Forwards: 70 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO User-Agent: eyeBeam release 3004t stamp 16741 Authorization: Digest username="7777",realm="209.95.52.97",nonce="WYlDhVmJQlmWGnZELD+8UBwWgX2NmBdu",uri="sip:209.95.52.97",response="2b4efd8c09e8ce2de0a56fab38157c72",algorithm=MD5 Content-Length: 0
10:18:25.5 SENDING TO: 209.95.52.97:5060 REGISTER sip:209.95.52.97 SIP/2.0 To: 7777sip:7777@209.95.52.97 From: 7777sip:7777@209.95.52.97;tag=e4269c5e Via: SIP/2.0/UDP 192.168.3.5:6090 ;branch=z9hG4bK-d87543-161839468-1--d87543-;rport Call-ID: e01ac670234a8675 CSeq: 3 REGISTER Contact: sip:7777@192.168.3.5:6090;expires=0 Max-Forwards: 70 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO User-Agent: eyeBeam release 3004t stamp 16741 Authorization: Digest username="7777",realm="209.95.52.97",nonce="WYlDhVmJQlmWGnZELD+8UBwWgX2NmBdu",uri="sip:209.95.52.97",response="2b4efd8c09e8ce2de0a56fab38157c72",algorithm=MD5 Content-Length: 0
10:18:29.5 SENDING TO: 209.95.52.97:5060 REGISTER sip:209.95.52.97 SIP/2.0 To: 7777sip:7777@209.95.52.97 From: 7777sip:7777@209.95.52.97;tag=e4269c5e Via: SIP/2.0/UDP 192.168.3.5:6090 ;branch=z9hG4bK-d87543-161839468-1--d87543-;rport Call-ID: e01ac670234a8675 CSeq: 3 REGISTER Contact: sip:7777@192.168.3.5:6090;expires=0 Max-Forwards: 70 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO User-Agent: eyeBeam release 3004t stamp 16741 Authorization: Digest username="7777",realm="209.95.52.97",nonce="WYlDhVmJQlmWGnZELD+8UBwWgX2NmBdu",uri="sip:209.95.52.97",response="2b4efd8c09e8ce2de0a56fab38157c72",algorithm=MD5 Content-Length: 0
10:18:33.5 SENDING TO: 209.95.52.97:5060 REGISTER sip:209.95.52.97 SIP/2.0 To: 7777sip:7777@209.95.52.97 From: 7777sip:7777@209.95.52.97;tag=e4269c5e Via: SIP/2.0/UDP 192.168.3.5:6090 ;branch=z9hG4bK-d87543-161839468-1--d87543-;rport Call-ID: e01ac670234a8675 CSeq: 3 REGISTER Contact: sip:7777@192.168.3.5:6090;expires=0 Max-Forwards: 70 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO User-Agent: eyeBeam release 3004t stamp 16741 Authorization: Digest username="7777",realm="209.95.52.97",nonce="WYlDhVmJQlmWGnZELD+8UBwWgX2NmBdu",uri="sip:209.95.52.97",response="2b4efd8c09e8ce2de0a56fab38157c72",algorithm=MD5 Content-Length: 0
10:18:34.3 RECEIVING FROM: 209.95.52.97:5060 SIP/2.0 200 OK To: 7777sip:7777@209.95.52.97;tag=9dd61ff61e802d8e2bef5f14621ef3c2.8904 From: 7777sip:7777@209.95.52.97;tag=e4269c5e Via: SIP/2.0/UDP 192.168.3.5:6090 ;branch=z9hG4bK-d87543-161839468-1--d87543-;rport=6090;received=192.168.3.5 Call-ID: e01ac670234a8675 CSeq: 3 REGISTER Server: kamailio (5.0.2 (x86_64/linux)) Content-Length: 0
10:18:37.7 Proxy slot #0 () - Shutting down DUM took 16.115001 seconds.
On Tue, Aug 8, 2017 at 2:04 AM, Joel Serrano joel@gogii.net wrote:
Hi,
(Sorry, my previous reply got blocked due to email size). Can you enable debug logs and try again, then send the logs?
I tried the regex with the number 000919629897172 and it worked for me.. We must be missing something..
On Sun, Aug 6, 2017 at 11:19 PM, Logeshwaran G logeshwarangs@gmail.com wrote:
I mean to say by applying the Rule mentioned from Joel is also not worked.
Rules:
dpid: 1 pr: 1 match_op: 1 match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any number that will start with three zeros. match_len: 0 subst_exp: ^000([0-9]+)$ <<<<<<< 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. repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this case the number you selected in subst_exp, without the three zeros. attrs:
On Mon, Aug 7, 2017 at 11:43 AM, Logeshwaran G logeshwarangs@gmail.com wrote:
Please find the below output
5(12951) ERROR: <script>: R-URI User: 000919629897172 5(12951) ERROR: <script>: R-URI User: 000919629897172
On Mon, Aug 7, 2017 at 11:10 AM, Joel Serrano joel@gogii.net wrote:
Can you add logging and post results?
if (is_method("INVITE")) { xlog("R-URI User: $rU\n"); dp_translate("1", "$rU/$rU"); xlog("R-URI User: $rU\n"); }
On Sun, Aug 6, 2017 at 10:05 PM, Logeshwaran G <logeshwarangs@gmail.com
wrote:
I am using the below function:
if (is_method("INVITE")) {
dp_translate("1", "$rU/$rU");
}
On Sat, Aug 5, 2017 at 9:19 PM, Joel Serrano joel@gogii.net wrote:
Can you post your block of config related to dialplan module from kamailio.cfg?
Also, how are you calling the dp_* functions?
On Fri, Aug 4, 2017 at 10:34 PM, Logeshwaran G < logeshwarangs@gmail.com> wrote:
> Thanks a lot for the Detailed Explanation. > > I am Beginner to Kamailio, As per Your Suggestion I have used the > below Rule: > > Rules: > ====== > dpid: 1 > pr: 1 > match_op: 1 > match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any > number that will start with three zeros. > match_len: 0 > subst_exp: ^000([0-9]+)$ <<<<<<< 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. > repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this > case the number you selected in subst_exp, without the three zeros. > attrs: > > But the First three Digit is not Removed. Please find the below log: > > 5(16152) INFO: <script>: Request : INVITE > sip:000919629897172@209.95.52.97 SIP/2.0 > Record-Route: sip:209.95.52.97;lr > Record-Route: sip:209.95.52.97;lr > To: sip:000919629897172@45.249.123.97 > From: 7777sip:7777@45.249.123.97;tag=501aa976 > Via: SIP/2.0/UDP 209.95.52.97;branch=z9hG4bK0d3 > 6.636d0921d672f2d0bdb3fc87c52a3caa.0 > Via: SIP/2.0/UDP 209.95.52.97;rport=5060;branch > =z9hG4bK0d36.4d76f923bd5cc7d64297898058440098.0 > Via: SIP/2.0/UDP 45.249.123.97:6107;received=45 > .249.123.97;branch=z9hG4bK-d87543-1054953376-1--d87543-;rport=6107 > Call-ID: db4777505114995c > CSeq: 1 INVITE > Contact: sip:7777@45.249.123.97:6107 > Max-Forwards: 68 > Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, > SUBSCRIBE, INFO > Content-Type: application/sdp > User-Agent: eyeBeam release 3004t stamp 16741 > Content-Length: 191 > > v=0 > o=- 355180136 355180140 IN IP4 45.249.123.97 > s=eyeBeam > c=IN IP4 45.249.123.97 > t=0 0 > m=audio 31444 RTP/AVP 18 0 8 101 > a=fmtp:101 0-15 > a=rtpmap:101 telephone-event/8000 > a=sendrecv > > > > > > On Sat, Aug 5, 2017 at 10:30 AM, Joel Serrano joel@gogii.net > wrote: > >> Ok, so clearly you have not tried what Daniel suggested... >> >> >> >> *IN a regexp ^ matches the beginning of the line/string, and $ >> matchesthe end. So "^000$" only matches exactly "000" and not >> "000xxxx"Remove the $ to match strings begining with 000.* >> >> Rules: >> ====== >> dpid: 1 >> pr: 1 >> match_op: 1 >> match_exp: ^000$ >> match_len: 0 >> subst_exp: ^0000$ >> repl_exp: >> attrs: >> >> Can you see you still have the $ char at the end of match_exp and >> subst_exp? >> >> To begin with, do you know how regular expressions work? Because >> that is the first thing you need to know to correctly use the dialplan >> module. >> >> That said you need a match expression, a substitute expression, and >> a replace expression... >> >> Try with: >> >> Rules: >> ====== >> dpid: 1 >> pr: 1 >> match_op: 1 >> match_exp: ^000[0-9]+$ <<<<<<< This will trigger a match on any >> number that will start with three zeros. >> match_len: 0 >> subst_exp: ^000([0-9]+)$ <<<<<<< 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. >> repl_exp: \1 <<<<<<< \1 is a back reference to group 1, in this >> case the number you selected in subst_exp, without the three zeros. >> attrs: >> >> >> 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. >> >> Have a look at https://www.kamailio.org/do >> cs/modules/devel/modules/dialplan.html#dialplan.installation >> >> You have a couple examples that might make it more clear. >> >> >> Let me know if it helps. >> >> Joel. >> >> >> >> On Fri, Aug 4, 2017 at 9:18 PM, Logeshwaran G < >> logeshwarangs@gmail.com> wrote: >> >>> Yes I have Tried, please find below the Rules I have applied and >>> the Result: >>> >>> Rules: >>> ====== >>> dpid: 1 >>> pr: 1 >>> match_op: 1 >>> match_exp: ^000$ >>> match_len: 0 >>> subst_exp: ^0000$ >>> repl_exp: >>> attrs: >>> >>> >>> I am Calling to the number 00091xxxxxxxxxx , But its saying as Too >>> many Hops. >>> >>> 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. >>> >>> I need to Remove only the first 3 digits, and the other numbers >>> should go to the call. >>> >>> For Example If I am calling 00091xxxxxxxxx, It should remove the >>> first 3 digits 000 and 91xxxxxxxxx call should be place. >>> >>> Please Guide me for removing the first three digits alone and >>> other numbers should takes place. >>> >>> On Fri, Aug 4, 2017 at 6:43 PM, Joel Serrano joel@gogii.net >>> wrote: >>> >>>> Have you tried what Daniel suggested? >>>> >>>> Share the results of the tests and we can go from there. >>>> >>>> On Thu, Aug 3, 2017 at 21:34 Logeshwaran G < >>>> logeshwarangs@gmail.com> wrote: >>>> >>>>> Input Please!! >>>>> >>>>> On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G < >>>>> logeshwarangs@gmail.com> wrote: >>>>> >>>>>> Thanks a lot! >>>>>> >>>>>> But for my scenario, >>>>>> >>>>>> If I am Dialling 000919999999999, need to remove the first >>>>>> three digits 000, so the call should go to 919999999999. >>>>>> >>>>>> I am stucked to create the rule for the above scenario, Kindly >>>>>> help me for the same. >>>>>> >>>>>> Kind Regards, >>>>>> Logeshwaran >>>>>> >>>>>> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba d.tryba@pocos.nl >>>>>> wrote: >>>>>> >>>>>>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote: >>>>>>> > >>>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>>> ----+----------+-------+ >>>>>>> > | id | dpid | pr | match_op | match_exp | match_len | >>>>>>> subst_exp | repl_exp >>>>>>> > | attrs | >>>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>>> ----+----------+-------+ >>>>>>> > | 1 | 1 | 1 | 1 | ^000$ | 0 | ^000$ >>>>>>> | >>>>>>> > | | 111 >>>>>>> > +----+------+----+----------+-----------+-----------+------- >>>>>>> ----+----------+-------+ >>>>>>> > >>>>>>> > The above rule replacing only the 000, If we Dial 000xxxx >>>>>>> its omitting, >>>>>>> > While Dialing 000 its replacing that with 111. >>>>>>> >>>>>>> IN a regexp ^ matches the beginning of the line/string, and $ >>>>>>> matches >>>>>>> the end. >>>>>>> >>>>>>> So "^000$" only matches exactly "000" and not "000xxxx" >>>>>>> Remove the $ to match strings begining with 000. >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>>> >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users