I'm having a problem with the route sections below. When my proxy receives an Invite to proxy to a PSTN gateway, the proxy is sending 2 invites very fast to the gateway in the first route block which ends up creating a mess with the gateway.
Either I have something wrong in the routing code or I have an SER/OS/hardware timing problem.
Any suggestions ?
route[1] { xlog("L_INFO", "Sending to route 1\n%mb\n"); rewritehostport ("1.1.1.1:5060"); append_branch(); t_on_failure("1"); t_relay(); }
failure_route[1] { if(t_check_status("487")) { break; } xlog( "L_INFO", "failure on route 1\n%mb\n"); append_branch(); route(2); break; }
route[2] { xlog("L_INFO", "Sending to route 2\n%mb\n"); rewritehostport ("2.2.2.2:5060"); append_branch(); t_on_failure("2"); t_relay(); }
failure_route[2] { if(t_check_status("487")) { break; } xlog( "L_INFO", "failure on route 2\n%mb\n"); append_branch(); route(3); break; }
route[3] { xlog("L_INFO", "Sending to rout 3\n%mb\n"); rewritehostport ("3.3.3.3:5060"); t_relay(); }
Thanks, Matt
El Martes, 9 de Septiembre de 2008, Matthew McGuire escribió:
I'm having a problem with the route sections below. When my proxy receives an Invite to proxy to a PSTN gateway, the proxy is sending 2 invites very fast to the gateway in the first route block which ends up creating a mess with the gateway.
Either I have something wrong in the routing code or I have an SER/OS/hardware timing problem.
You have a big problem in your code since you are using append_branch() with no reason. append_branch() adds a new branch, this is, it "clones" the current request. Later you could modify each branch using on_branch_route but I think you don't need it.
You should delete the append_branch in route[1] and route[2]. append_branch() is needed in failure route since the previous branches ended with a failure result ([3456]XX code), that is why you need to create a *new* one. But in your code there is not justification to use append_branch() in route[1] and route[2].
El Tuesday 09 September 2008 19:42:05 Matthew McGuire escribió:
I'm having a problem with the route sections below. When my proxy receives an Invite to proxy to a PSTN gateway, the proxy is sending 2 invites very fast to the gateway in the first route block which ends up creating a mess with the gateway.
Either I have something wrong in the routing code or I have an SER/OS/hardware timing problem.
Any suggestions ?
Yes, why are you calling append_branch() on route blocks? I guess you have missundestood how it works and here it must be used.
Remove all those append_branch() calls and your gateway will be happier ..
Best regards
Thanks for the pointers.
When I remove append_branch from the route blocks, for some reason, rewritehostport fails in subsequent routes. No errors show up in the log, but the call will proceed through each block, traceable by the log statements, but the host ip address on the new invites is the same as the first invite.
Thanks, matt
Raúl Alexis Betancor Santana wrote:
El Tuesday 09 September 2008 19:42:05 Matthew McGuire escribió:
I'm having a problem with the route sections below. When my proxy receives an Invite to proxy to a PSTN gateway, the proxy is sending 2 invites very fast to the gateway in the first route block which ends up creating a mess with the gateway.
Either I have something wrong in the routing code or I have an SER/OS/hardware timing problem.
Any suggestions ?
Yes, why are you calling append_branch() on route blocks? I guess you have missundestood how it works and here it must be used.
Remove all those append_branch() calls and your gateway will be happier ..
Best regards
El Martes, 9 de Septiembre de 2008, Matthew McGuire escribió:
Thanks for the pointers.
When I remove append_branch from the route blocks, for some reason, rewritehostport fails in subsequent routes. No errors show up in the log, but the call will proceed through each block, traceable by the log statements, but the host ip address on the new invites is the same as the first invite.
I just can sure you that these append_branch() in route[1] and route[2] are completely wrongs since they are duplicating the original request, no more.
What you mean with "rewritehostport fails in subsequent routes"?
I understand regarding append_branch in the route blocks being wrong. However, without it, here is what a call looks like if the first gateway fails:
Invite ------> 1.1.1.1 Fail <------ 1.1.1.1 OK, proceed to route(2) Invite ------> 1.1.1.1 Fail <------ 1.1.1.1 OK, proceed to route(3) Invite ------> 1.1.1.1 Fail <------ 1.1.1.1 OK, give up.
For some reason, the gateway ip address in the 2nd and 3rd invites doesn't get altered by rewritehostport. Any guidance is most appreciated.
Thanks, Matt
Iñaki Baz Castillo wrote:
El Martes, 9 de Septiembre de 2008, Matthew McGuire escribió:
Thanks for the pointers.
When I remove append_branch from the route blocks, for some reason, rewritehostport fails in subsequent routes. No errors show up in the log, but the call will proceed through each block, traceable by the log statements, but the host ip address on the new invites is the same as the first invite.
I just can sure you that these append_branch() in route[1] and route[2] are completely wrongs since they are duplicating the original request, no more.
What you mean with "rewritehostport fails in subsequent routes"?
Hi, please, use text plain instead of formatted and superbig HTML text in bold. ;)
El Wednesday 10 September 2008 05:28:27 Matthew McGuire escribió:
I understand regarding append_branch in the route blocks being wrong. However, without it, here is what a call looks like if the first gateway fails:
Thus, there is something wrong more, but please, take in mind that your usage of append_branch is completely wrong.
Invite ------> 1.1.1.1 Fail <------ 1.1.1.1 OK, proceed to route(2) Invite ------> 1.1.1.1 Fail <------ 1.1.1.1 OK, proceed to route(3) Invite ------> 1.1.1.1 Fail <------ 1.1.1.1 OK, give up.
For some reason, the gateway ip address in the 2nd and 3rd invites doesn't get altered by rewritehostport. Any guidance is most appreciated.
Well, it must work but try logging it. Also, instead of using "rewritehostport" use:
$rd = "2.2.2.2"; xlog("L_INFO","--- RURI now is $ru ---\n");
And show what the xlogs saysin each route and failure route.
El Wednesday 10 September 2008 09:56:10 Iñaki Baz Castillo escribió:
Thus, there is something wrong more, but please, take in mind that your usage of append_branch is completely wrong.
Also, why do you use "break"? It's completely WRONG. Read the doc:
http://www.kamailio.org/dokuwiki/doku.php/core-cookbook:1.3.x#break
--------- break() Since v0.10.0-dev3, 'break' can no longer be used to stop the execution of a route. The only place to use is to end a 'case' block in a 'switch' statement. 'return' must be now used instead of old 'break'. 'return' and 'break' have now a similar meaning as in c/shell. --------
Use "exit" instead:
http://www.kamailio.org/dokuwiki/doku.php/core-cookbook:1.3.x#exit
Probably your problem is related to this.
Iñaki Baz Castillo schrieb:
El Martes, 9 de Septiembre de 2008, Matthew McGuire escribió:
Thanks for the pointers.
When I remove append_branch from the route blocks, for some reason, rewritehostport fails in subsequent routes. No errors show up in the log, but the call will proceed through each block, traceable by the log statements, but the host ip address on the new invites is the same as the first invite.
I just can sure you that these append_branch() in route[1] and route[2] are completely wrongs since they are duplicating the original request, no more.
Route[2] is called from the failure_route. Thus, the append_branch in route[2] is necessary.
klaus
What you mean with "rewritehostport fails in subsequent routes"?
El Wednesday 10 September 2008 07:44:49 Klaus Darilion escribió:
Iñaki Baz Castillo schrieb:
El Martes, 9 de Septiembre de 2008, Matthew McGuire escribió:
Thanks for the pointers.
When I remove append_branch from the route blocks, for some reason, rewritehostport fails in subsequent routes. No errors show up in the log, but the call will proceed through each block, traceable by the log statements, but the host ip address on the new invites is the same as the first invite.
I just can sure you that these append_branch() in route[1] and route[2] are completely wrongs since they are duplicating the original request, no more.
Route[2] is called from the failure_route. Thus, the append_branch in route[2] is necessary.
But it's wrongly called, because he calls append_branch() on failure_route[1] BEFORE calling route[2] and then inside route[2] he calls append_branch again, so it's called twice.
Raúl Alexis Betancor Santana schrieb:
El Wednesday 10 September 2008 07:44:49 Klaus Darilion escribió:
Iñaki Baz Castillo schrieb:
El Martes, 9 de Septiembre de 2008, Matthew McGuire escribió:
Thanks for the pointers.
When I remove append_branch from the route blocks, for some reason, rewritehostport fails in subsequent routes. No errors show up in the log, but the call will proceed through each block, traceable by the log statements, but the host ip address on the new invites is the same as the first invite.
I just can sure you that these append_branch() in route[1] and route[2] are completely wrongs since they are duplicating the original request, no more.
Route[2] is called from the failure_route. Thus, the append_branch in route[2] is necessary.
But it's wrongly called, because he calls append_branch() on failure_route[1] BEFORE calling route[2] and then inside route[2] he calls append_branch again, so it's called twice.
Yes. That is true.
The logic for the failure route handling is: 1. set the new destination (e.g. rewriteuri ....) 2. append branch 3. t_relay It does not matter if this happens directly in the failure route or in another route which is caklled by the failure route.
regards klaus
El Wednesday 10 September 2008 08:44:49 Klaus Darilion escribió:
Iñaki Baz Castillo schrieb:
El Martes, 9 de Septiembre de 2008, Matthew McGuire escribió:
Thanks for the pointers.
When I remove append_branch from the route blocks, for some reason, rewritehostport fails in subsequent routes. No errors show up in the log, but the call will proceed through each block, traceable by the log statements, but the host ip address on the new invites is the same as the first invite.
I just can sure you that these append_branch() in route[1] and route[2] are completely wrongs since they are duplicating the original request, no more.
Route[2] is called from the failure_route. Thus, the append_branch in route[2] is necessary.
No no, he calls append_branch in failure_route[1] and later in route[2]. He is wrong.