I need help setting up carrierroute using the rewrite prefix and the strip function. It seem like every time I use the Rewrite Prfix function the carrierroute module will rewrite the prefix, but then I don't get certain reply messages on kamailio. At least from what I can see on the log.
INFO:carrierroute:cr_do_route: uri 5555550001 was rewritten to sip:0115555550001@aslab.commx.net, carrier 1, domain 10 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 0115555550001, carrier 1, domain 10
Is this normal behavior? I also noticed that some messages coming back from the host are not being processed by kamailio. For example on this particular call I purposely get a 604 from the server. The thing is I can't process a failure route for this message, because kamailio doesn't see is, even though it is being sent back to the server.
Also when I use the Strip function is looks like carrierroute does a second lookup on the route table. In the example below I am calling a number using the prefix 551... The route table is below.
+----+---------+--------+--------------+-------+------+------+-------+-----------------+----------------+----------------+------------------------+ | id | carrier | domain | scan_prefix | flags | mask | prob | strip | rewrite_host | rewrite_prefix | rewrite_suffix | description | +----+---------+--------+--------------+-------+------+------+-------+-----------------+----------------+----------------+------------------------+ | 30 | 1 | 1 | 551 | 0 | 0 | 1 | 2 | 10.10.10.1 | | | LD-1 | 31 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 10.10.10.1 | | | LD |
Log for that call INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 INFO:carrierroute:cr_do_route: uri 15555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 Carrier found!! ("1", "131.226.0.144", "15555550004", "15555550004", "COMMX-LD");
Now please note that if I remove route id 31 then the call log looks like it is below:
INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 15555550004, carrier 1, domain 1
Please help!!!
Carlos
It will also help if there was complete routing example using carrierroute v 1.5.0, since the one in the wiki is outdated. Thanks.
Any one?
From: users-bounces@lists.kamailio.org [mailto:users-bounces@lists.kamailio.org] On Behalf Of Carlos A. Alvarez Sent: Monday, April 13, 2009 1:46 PM To: Users@lists.kamailio.org Subject: [Kamailio-Users] help using rewrite prefix
I need help setting up carrierroute using the rewrite prefix and the strip function. It seem like every time I use the Rewrite Prfix function the carrierroute module will rewrite the prefix, but then I don't get certain reply messages on kamailio. At least from what I can see on the log.
INFO:carrierroute:cr_do_route: uri 5555550001 was rewritten to sip:0115555550001@aslab.commx.net, carrier 1, domain 10 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 0115555550001, carrier 1, domain 10
Is this normal behavior? I also noticed that some messages coming back from the host are not being processed by kamailio. For example on this particular call I purposely get a 604 from the server. The thing is I can't process a failure route for this message, because kamailio doesn't see is, even though it is being sent back to the server.
Also when I use the Strip function is looks like carrierroute does a second lookup on the route table. In the example below I am calling a number using the prefix 551... The route table is below.
+----+---------+--------+--------------+-------+------+------+-------+-----------------+----------------+----------------+------------------------+ | id | carrier | domain | scan_prefix | flags | mask | prob | strip | rewrite_host | rewrite_prefix | rewrite_suffix | description | +----+---------+--------+--------------+-------+------+------+-------+-----------------+----------------+----------------+------------------------+ | 30 | 1 | 1 | 551 | 0 | 0 | 1 | 2 | 10.10.10.1 | | | LD-1 | 31 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 10.10.10.1 | | | LD |
Log for that call INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 INFO:carrierroute:cr_do_route: uri 15555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 Carrier found!! ("1", "131.226.0.144", "15555550004", "15555550004", "COMMX-LD");
Now please note that if I remove route id 31 then the call log looks like it is below:
INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 15555550004, carrier 1, domain 1
Please help!!!
Carlos
It will also help if there was complete routing example using carrierroute v 1.5.0, since the one in the wiki is outdated. Thanks.
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.287 / Virus Database: 270.11.54/2056 - Release Date: 04/13/09 05:51:00
On Monday 13 April 2009, Carlos A. Alvarez wrote:
I need help setting up carrierroute using the rewrite prefix and the strip function. It seem like every time I use the Rewrite Prfix function the carrierroute module will rewrite the prefix, but then I don't get certain reply messages on kamailio. At least from what I can see on the log.
Hi Carlos,
did i understand you correctly, the message request URI is correctly rewritten, and can also be relayed with e.g. t_relay? But you don't get any/ some replies (for this requests) back on your server?
INFO:carrierroute:cr_do_route: uri 5555550001 was rewritten to sip:0115555550001@aslab.commx.net, carrier 1, domain 10 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 0115555550001, carrier 1, domain 10
Is this normal behavior? I also noticed that some messages coming back from the host are not being processed by kamailio. For example on this particular call I purposely get a 604 from the server.
The first log message says that the msg R-URI was correctly rewritten. The second one means that cr was not able to find a match for the URI, either because of an empty URI, or an empty routing tree for this case. The third one is an information that the message was not routed.
The cr module doesn't generate any SIP failures itselfs, so the 604 should be come from your config or an upstream server.
The thing is I can't process a failure route for this message, because kamailio doesn't see is, even though it is being sent back to the server.
Have you checked if the reply actually arrive on kamailio? Do you arm the correct failure route with t_on_failure in your config before sending out the request?
Also when I use the Strip function is looks like carrierroute does a second lookup on the route table. In the example below I am calling a number using the prefix 551... The route table is below.
Usage of the strip functionality don't cause a second route lookup, i think.
+----+---------+--------+--------------+-------+------+------+-------+----- ------------+----------------+----------------+------------------------+
| id | carrier | domain | scan_prefix | flags | mask | prob | strip | | rewrite_host | rewrite_prefix | rewrite_suffix | description | |
+----+---------+--------+--------------+-------+------+------+-------+----- ------------+----------------+----------------+------------------------+
| 30 | 1 | 1 | 551 | 0 | 0 | 1 | 2 | | 10.10.10.1 | | | LD-1 31 | 1 | | 1 | 1 | 0 | 0 | 1 | 0 | 10.10.10.1 | | | | LD |
Log for that call INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1
The URI was correctly stripped.
INFO:carrierroute:cr_do_route: uri 15555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1
This is strange. Does this both logs belong to one INVITE?
Carrier found!! ("1", "131.226.0.144", "15555550004", "15555550004", "COMMX-LD");
Now please note that if I remove route id 31 then the call log looks like it is below:
INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 15555550004, carrier 1, domain 1
Do you relay the call after the first rewrite? Perhaps there is some routing loop, that causes the second lookup.
It will also help if there was complete routing example using carrierroute v 1.5.0, since the one in the wiki is outdated. Thanks.
Can you give the URL of the wiki do you refer to?
Cheers,
Henning
Yes sir that is correct. I have a b2bua and the requests are forwarded to it, this causes kamailio to loose track of the state of the call.
Invite! <uac>---->><b2bua>------->><kamailio>----->><carrier-GW>
Replies messages are sent like this
<carrier-GW>------->><b2bua>----->><uac>
Only happens when I strip a number or rewrite the prefix. All other cr calls are processed fine. Now if I add the prefix to the table this works fine... For example, I dial prefix 54011 to select carrier A, carrier A wants to see only CC NXXX XXXX from me, so I strip 5 digits to send the number, than I see this condition. If I add the CC prefix to the table, then CR module does a second look up and correctly routes the call.
Dial 54011 53 2339 2339 sent to carrier A 53 2339 2339... you can imagine how my tables are going to look if I have to add to routes per carrier... at least for those carriers that are not assigning me a prefix. Routing login is below.
route [11]{ xlog("L_INFO", "INFO: entering carrierroute routine\n"); cr_user_carrier("$fd", "$fd", "$avp(s:carrier)"); $avp(s:domain)=$fd; setflag(16); if (!cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "call_id", "$avp(s:host)")) { sl_send_reply("480", "Temporarily Unavailable"); setflag(2); exit; }
if (cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "call_id", "$avp(s:host)")) { xlog("L_INFO","Carrier found!! ("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "$avp(s:host)");\n"); force_rtp_proxy("o"); t_on_branch("2"); t_on_failure("11"); t_on_reply("3"); }
if (!t_relay()) { xlog("L_INFO", "INFO: t_relay error****************\n"); sl_reply_error(); exit;
failure_route[11] { xlog("L_INFO", "entering carrieroute-failure for reply code '$T_reply_code'\n");
if (t_was_cancelled()) { exit; } revert_uri(); xlog("L_INFO","INFO: Entering Revert URI\n");
if (t_check_status("408|404|5[0-9][0-9]|6[0-9][0-9]")) { if (!cr_next_domain("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$avp(s:host)", "$T_reply_code", "$avp(s:domain)")) { xlog("L_ERR", "ERROR: cr_next_domain failed\n"); t_reply("404","Not found"); exit; } if (!cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "call_id", "$avp(s:host)")) { t_reply("404","Not found"); xlog("L_ERR", "cr_route failed\n"); exit; } } else if (t_check_status("3[0-9][0-9]")) { t_reply("404","Not found"); exit; } xlog("L_INFO", "INFO: Trying the next domain for $ru\n"); t_on_failure("12"); append_branch();
if (!t_relay()) { xlog("L_ERR", "t_relay failed\n"); exit;
-----Original Message----- From: Henning Westerholt [mailto:henning.westerholt@1und1.de] Sent: Thursday, April 16, 2009 5:21 AM To: users@lists.kamailio.org Cc: Carlos A. Alvarez Subject: Re: [Kamailio-Users] help using rewrite prefix
On Monday 13 April 2009, Carlos A. Alvarez wrote:
I need help setting up carrierroute using the rewrite prefix and the strip function. It seem like every time I use the Rewrite Prfix function the carrierroute module will rewrite the prefix, but then I don't get certain reply messages on kamailio. At least from what I can see on the log.
Hi Carlos,
did i understand you correctly, the message request URI is correctly rewritten, and can also be relayed with e.g. t_relay? But you don't get any/ some replies (for this requests) back on your server?
INFO:carrierroute:cr_do_route: uri 5555550001 was rewritten to sip:0115555550001@aslab.commx.net, carrier 1, domain 10 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 0115555550001, carrier 1, domain 10
Is this normal behavior? I also noticed that some messages coming back from the host are not being processed by kamailio. For example on this particular call I purposely get a 604 from the server.
The first log message says that the msg R-URI was correctly rewritten. The second one means that cr was not able to find a match for the URI, either because of an empty URI, or an empty routing tree for this case. The third one is an information that the message was not routed.
The cr module doesn't generate any SIP failures itselfs, so the 604 should be come from your config or an upstream server.
The thing is I can't process a failure route for this message, because kamailio doesn't see is, even though it is being sent back to the server.
Have you checked if the reply actually arrive on kamailio? Do you arm the correct failure route with t_on_failure in your config before sending out the request?
Also when I use the Strip function is looks like carrierroute does a second lookup on the route table. In the example below I am calling a number using the prefix 551... The route table is below.
Usage of the strip functionality don't cause a second route lookup, i think.
+----+---------+--------+--------------+-------+------+------+-------+----- ------------+----------------+----------------+------------------------+
| id | carrier | domain | scan_prefix | flags | mask | prob | strip | | rewrite_host | rewrite_prefix | rewrite_suffix | description | |
+----+---------+--------+--------------+-------+------+------+-------+----- ------------+----------------+----------------+------------------------+
| 30 | 1 | 1 | 551 | 0 | 0 | 1 | 2 | | 10.10.10.1 | | | LD-1 31 | 1 | | 1 | 1 | 0 | 0 | 1 | 0 | 10.10.10.1 | | | | LD |
Log for that call INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1
The URI was correctly stripped.
INFO:carrierroute:cr_do_route: uri 15555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1
This is strange. Does this both logs belong to one INVITE?
Carrier found!! ("1", "131.226.0.144", "15555550004", "15555550004", "COMMX-LD");
Now please note that if I remove route id 31 then the call log looks like it is below:
INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 15555550004, carrier 1, domain 1
Do you relay the call after the first rewrite? Perhaps there is some routing loop, that causes the second lookup.
It will also help if there was complete routing example using carrierroute v 1.5.0, since the one in the wiki is outdated. Thanks.
Can you give the URL of the wiki do you refer to?
Cheers,
Henning
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.287 / Virus Database: 270.11.57/2060 - Release Date: 04/15/09 06:34:00
On Thursday 16 April 2009, Carlos A. Alvarez wrote:
Yes sir that is correct. I have a b2bua and the requests are forwarded to it, this causes kamailio to loose track of the state of the call.
Invite! <uac>---->><b2bua>------->><kamailio>----->><carrier-GW>
Replies messages are sent like this
<carrier-GW>------->><b2bua>----->><uac>
Hi Carlos,
perhaps you forgot to enable record-routing, so kamailio is removed from the path?
Only happens when I strip a number or rewrite the prefix. All other cr calls are processed fine. Now if I add the prefix to the table this works fine... For example, I dial prefix 54011 to select carrier A, carrier A wants to see only CC NXXX XXXX from me, so I strip 5 digits to send the number, than I see this condition. If I add the CC prefix to the table, then CR module does a second look up and correctly routes the call.
Ok, but normally it should work just fine with only one lookup.
Dial 54011 53 2339 2339 sent to carrier A 53 2339 2339... you can imagine how my tables are going to look if I have to add to routes per carrier... at least for those carriers that are not assigning me a prefix. Routing login is below.
route [11]{ xlog("L_INFO", "INFO: entering carrierroute routine\n"); cr_user_carrier("$fd", "$fd", "$avp(s:carrier)"); $avp(s:domain)=$fd; setflag(16);
Ok.
if (!cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU",
"call_id", "$avp(s:host)")) { sl_send_reply("480", "Temporarily Unavailable"); setflag(2); exit; } if (cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "call_id", "$avp(s:host)")) { xlog("L_INFO","Carrier found!! ("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "$avp(s:host)");\n"); force_rtp_proxy("o");
Why do you use the routing function two times? I can't imagine a good reason for this. If you want to log the success, just do this after the first cr_route. And also move all your logic in the second if case after the first one. If the lookup in the first cr_route fails then your routing tables are not correct.
Cheers,
Henning
-----Original Message----- From: Henning Westerholt [mailto:henning.westerholt@1und1.de] Sent: Friday, April 17, 2009 8:33 AM To: Carlos A. Alvarez Cc: users@lists.kamailio.org Subject: Re: [Kamailio-Users] help using rewrite prefix
On Thursday 16 April 2009, Carlos A. Alvarez wrote:
Yes sir that is correct. I have a b2bua and the requests are forwarded to it, this causes kamailio to loose track of the state of the call.
Invite! <uac>---->><b2bua>------->><kamailio>----->><carrier-GW>
Replies messages are sent like this
<carrier-GW>------->><b2bua>----->><uac>
Hi Carlos,
perhaps you forgot to enable record-routing, so kamailio is removed from the path?
No I do use record-route, like I said, it only failes after a re-write.
Only happens when I strip a number or rewrite the prefix. All other cr calls are processed fine. Now if I add the prefix to the table this works fine... For example, I dial prefix 54011 to select carrier A, carrier A wants to see only CC NXXX XXXX from me, so I strip 5 digits to send the number, than I see this condition. If I add the CC prefix to the table, then CR module does a second look up and correctly routes the call.
Ok, but normally it should work just fine with only one lookup.
Dial 54011 53 2339 2339 sent to carrier A 53 2339 2339... you can imagine how my tables are going to look if I have to add to routes per carrier... at least for those carriers that are not assigning me a prefix. Routing login is below.
route [11]{ xlog("L_INFO", "INFO: entering carrierroute routine\n"); cr_user_carrier("$fd", "$fd", "$avp(s:carrier)"); $avp(s:domain)=$fd; setflag(16);
Ok.
if (!cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU",
"call_id", "$avp(s:host)")) { sl_send_reply("480", "Temporarily Unavailable"); setflag(2); exit; } if (cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "call_id", "$avp(s:host)")) { xlog("L_INFO","Carrier found!! ("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "$avp(s:host)");\n"); force_rtp_proxy("o");
Why do you use the routing function two times? I can't imagine a good reason for this. If you want to log the success, just do this after the first cr_route. And also move all your logic in the second if case after the first one. If the lookup in the first cr_route fails then your routing tables are not correct.
I am only following the few examples that I can find. The message is missing something, the second route is the failure route. But in your reply it seems to be truncated. I wish there was a few implementation examples that we could follow, I really like the carrierroute vs lcr.
Cheers,
Henning
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.287 / Virus Database: 270.11.58/2062 - Release Date: 04/16/09 16:38:00
On Friday 17 April 2009, Carlos A. Alvarez wrote:
perhaps you forgot to enable record-routing, so kamailio is removed from the path?
No I do use record-route, like I said, it only failes after a re-write.
Hi Carlos,
ok, strange.
Only happens when I strip a number or rewrite the prefix. All other cr calls are processed fine. Now if I add the prefix to the table this works fine... For example, I dial prefix 54011 to select carrier A, carrier A wants to see only CC NXXX XXXX from me, so I strip 5 digits to send the number, than I see this condition. If I add the CC prefix to the table, then CR module does a second look up and correctly routes the call.
Ok, but normally it should work just fine with only one lookup.
Dial 54011 53 2339 2339 sent to carrier A 53 2339 2339... you can imagine how my tables are going to look if I have to add to routes per carrier... at least for those carriers that are not assigning me a prefix. Routing login is below.
route [11]{ xlog("L_INFO", "INFO: entering carrierroute routine\n"); cr_user_carrier("$fd", "$fd", "$avp(s:carrier)"); $avp(s:domain)=$fd; setflag(16);
Ok.
if (!cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU",
"call_id", "$avp(s:host)")) { sl_send_reply("480", "Temporarily Unavailable"); setflag(2); exit; } if (cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "call_id", "$avp(s:host)")) { xlog("L_INFO","Carrier found!! ("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "$avp(s:host)");\n"); force_rtp_proxy("o");
Why do you use the routing function two times? I can't imagine a good reason for this. If you want to log the success, just do this after the first cr_route. And also move all your logic in the second if case after the first one. If the lookup in the first cr_route fails then your routing tables are not correct.
I am only following the few examples that I can find. The message is missing something, the second route is the failure route. But in your reply it seems to be truncated. I wish there was a few implementation examples that we could follow, I really like the carrierroute vs lcr.
Hm, then the example you've found is wrong. I guess you already read the README and found the examples. There are some other examples in the test/ directory in the source tree. Take a look to test/26.cfg, which shows a normal routing with failure_route. The 26.sh shows the DB setup for this case.
Back to your config: you've two cr_route calls in them, in route[11]. Another one is in the failure_route[11]. You need to remove one of the cr_route calls in route[11], double rewrite is not valid.
Cheers,
Henning
Thanks for your reply!! I see what you are saying. -----Original Message----- From: Henning Westerholt [mailto:henning.westerholt@1und1.de] Sent: Monday, April 20, 2009 5:33 AM To: Carlos A. Alvarez Cc: users@lists.kamailio.org Subject: Re: [Kamailio-Users] help using rewrite prefix
On Friday 17 April 2009, Carlos A. Alvarez wrote:
perhaps you forgot to enable record-routing, so kamailio is removed from the path?
No I do use record-route, like I said, it only failes after a re-write.
Hi Carlos,
ok, strange.
Only happens when I strip a number or rewrite the prefix. All other cr calls are processed fine. Now if I add the prefix to the table this works fine... For example, I dial prefix 54011 to select carrier A, carrier A wants to see only CC NXXX XXXX from me, so I strip 5 digits to send the number, than I see this condition. If I add the CC prefix to the table, then CR module does a second look up and correctly routes the call.
Ok, but normally it should work just fine with only one lookup.
Dial 54011 53 2339 2339 sent to carrier A 53 2339 2339... you can imagine how my tables are going to look if I have to add to routes per carrier... at least for those carriers that are not assigning me a prefix. Routing login is below.
route [11]{ xlog("L_INFO", "INFO: entering carrierroute routine\n"); cr_user_carrier("$fd", "$fd", "$avp(s:carrier)"); $avp(s:domain)=$fd; setflag(16);
Ok.
if (!cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU",
"call_id", "$avp(s:host)")) { sl_send_reply("480", "Temporarily Unavailable"); setflag(2); exit; } if (cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "call_id", "$avp(s:host)")) { xlog("L_INFO","Carrier found!! ("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU", "$avp(s:host)");\n"); force_rtp_proxy("o");
Why do you use the routing function two times? I can't imagine a good reason for this. If you want to log the success, just do this after the first cr_route. And also move all your logic in the second if case after the first one. If the lookup in the first cr_route fails then your routing tables are not correct.
I am only following the few examples that I can find. The message is missing something, the second route is the failure route. But in your reply it seems to be truncated. I wish there was a few implementation examples that we could follow, I really like the carrierroute vs lcr.
Hm, then the example you've found is wrong. I guess you already read the README and found the examples. There are some other examples in the test/ directory in the source tree. Take a look to test/26.cfg, which shows a normal routing with failure_route. The 26.sh shows the DB setup for this case.
Back to your config: you've two cr_route calls in them, in route[11]. Another one is in the failure_route[11]. You need to remove one of the cr_route calls in route[11], double rewrite is not valid.
Cheers,
Henning
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.287 / Virus Database: 270.11.59/2064 - Release Date: 04/18/09 09:55:00
Thanks for your reply!!!
-----Original Message----- From: Henning Westerholt [mailto:henning.westerholt@1und1.de] Sent: Thursday, April 16, 2009 5:21 AM To: users@lists.kamailio.org Cc: Carlos A. Alvarez Subject: Re: [Kamailio-Users] help using rewrite prefix
On Monday 13 April 2009, Carlos A. Alvarez wrote:
I need help setting up carrierroute using the rewrite prefix and the strip function. It seem like every time I use the Rewrite Prfix function the carrierroute module will rewrite the prefix, but then I don't get certain reply messages on kamailio. At least from what I can see on the log.
Hi Carlos,
did i understand you correctly, the message request URI is correctly rewritten, and can also be relayed with e.g. t_relay? But you don't get any/ some replies (for this requests) back on your server?
INFO:carrierroute:cr_do_route: uri 5555550001 was rewritten to sip:0115555550001@aslab.commx.net, carrier 1, domain 10 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 0115555550001, carrier 1, domain 10
Is this normal behavior? I also noticed that some messages coming back from the host are not being processed by kamailio. For example on this particular call I purposely get a 604 from the server.
The first log message says that the msg R-URI was correctly rewritten. The second one means that cr was not able to find a match for the URI, either because of an empty URI, or an empty routing tree for this case. The third one is an information that the message was not routed.
The cr module doesn't generate any SIP failures itselfs, so the 604 should be come from your config or an upstream server.
The thing is I can't process a failure route for this message, because kamailio doesn't see is, even though it is being sent back to the server.
Have you checked if the reply actually arrive on kamailio? Do you arm the correct failure route with t_on_failure in your config before sending out the request?
Also when I use the Strip function is looks like carrierroute does a second lookup on the route table. In the example below I am calling a number using the prefix 551... The route table is below.
Usage of the strip functionality don't cause a second route lookup, i think.
It does... See my earlier reply.
+----+---------+--------+--------------+-------+------+------+-------+----- ------------+----------------+----------------+------------------------+
| id | carrier | domain | scan_prefix | flags | mask | prob | strip | | rewrite_host | rewrite_prefix | rewrite_suffix | description | |
+----+---------+--------+--------------+-------+------+------+-------+----- ------------+----------------+----------------+------------------------+
| 30 | 1 | 1 | 551 | 0 | 0 | 1 | 2 | | 10.10.10.1 | | | LD-1 31 | 1 | | 1 | 1 | 0 | 0 | 1 | 0 | 10.10.10.1 | | | | LD |
Log for that call INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1
The URI was correctly stripped.
INFO:carrierroute:cr_do_route: uri 15555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1
This is strange. Does this both logs belong to one INVITE?
Yes this is all one invite.
Carrier found!! ("1", "131.226.0.144", "15555550004", "15555550004", "COMMX-LD");
Now please note that if I remove route id 31 then the call log looks like it is below:
INFO:carrierroute:cr_do_route: uri 5515555550004 was rewritten to sip:15555550004@10.10.10.1, carrier 1, domain 1 INFO:carrierroute:rewrite_uri_recursor: URI or prefix tree nodes empty, empty rule list INFO:carrierroute:cr_do_route: rewrite_uri_recursor doesn't complete, uri 15555550004, carrier 1, domain 1
Do you relay the call after the first rewrite? Perhaps there is some routing loop, that causes the second lookup.
I rewrites and then looks up again. If I don’t have a route for the re-written prefix then it relays the call but I don’t see any replies after that.
It will also help if there was complete routing example using carrierroute v 1.5.0, since the one in the wiki is outdated. Thanks.
Can you give the URL of the wiki do you refer to?
Sure is referenced by the Kamailio Docu wiki at:
http://www.kamailio.org/dokuwiki/doku.php
http://voipembedded.com/resources/openser_cr.cfg
Cheers,
Henning
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.287 / Virus Database: 270.11.57/2060 - Release Date: 04/15/09 06:34:00