Are you sure there is no other set for failure route before getting to route[RELAY]? Inside it, there is an IF for setting the failure route.
If not set in other place, I can check the code once I get a chance, but I don't remember any filtering out 401. Maybe you can give a quick try without dialog event route to see if there is any relation.
Cheers, Daniel
On 31/01/14 11:17, Daniel Tryba wrote:
On Friday 31 January 2014 06:17:35 Daniel-Constantin Mierla wrote:
But to my suprise the 401 doesn't end up in the failure_route but in the onreply_route. Why? What am I missing?
if you don't drop it in the onreply route, then you should have the failure route executed as well. Also, in case there are many branches, the failure route is executed only when all branches fail and the branch with the response code having the highest priority is executed. 401 is among ones with high priority, but there are others over it, like redirects, transaction cancelled...
That is what I thought, except I'm not seeing anything happening in the failure route.
For the initial invite in route[RELAY]:
if (is_method("INVITE|SUBSCRIBE|UPDATE")) { xlog("t_on_failure(MANAGE_BRANCH)"); if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH"); } if (is_method("INVITE|SUBSCRIBE|UPDATE")) { xlog("t_on_failure(MANAGE_REPLY)"); if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY"); } if (is_method("INVITE")) { xlog("t_on_failure(MANAGE_FAILURE)"); if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE"); }
xlog("RELAY: ru: $ru");
Which I see being applied in syslog: Jan 31 10:50:22 ALERT: <script>: AUTHENTICATE[1]: INVITE from sip:test@test to sip:0880100705@test (IP:109.235.34.226:5071) Jan 31 10:50:22 ERROR: <script>: t_on_failure(MANAGE_BRANCH) Jan 31 10:50:22 ERROR: <script>: t_on_failure(MANAGE_REPLY) Jan 31 10:50:22 ERROR: <script>: t_on_failure(MANAGE_FAILURE) Jan 31 10:50:22 ERROR: <script>: RELAY: ru: sip: +31880100705@sip.pocos.nl:5060;transport=udp
The 401 comes back and gets logged in MANAGE_REPLY:
onreply_route[MANAGE_REPLY] { xlog("onreply: $rs $rr");
if(status=~"[12][0-9][0-9]") route(NATMANAGE);
}
failure_route[MANAGE_FAILURE] { xlog("failure: $rs $rr"); ... }
event_route[dialog:failed] { xlog("===== noanswer of dialog [$dlg(h_entry):$dlg(h_id)]\n"); }
Jan 31 10:50:22 ERROR: <script>: onreply: 401 Unauthorized Jan 31 10:50:22 ERROR: <script>: ===== noanswer of dialog [2990:9928] Jan 31 10:50:22 ERROR: <script>: route[WITHINDLG] Jan 31 10:50:22 ERROR: <script>: route[WITHINDLG] Jan 31 10:50:22 ALERT: <script>: AUTHENTICATE[-1]: INVITE from sip:test@test to sip:0880100705@test (IP:109.235.34.226:5071) Jan 31 10:50:22 ALERT: <script>: AUTHENTICATE: INVITE from sip:test@test to sip:0880100705@test (IP:109.235.34.226:5071)
So the 401 triggers a dialog failed event and then is handled WITHINDLG which is only called from the request_route.
SIP traffic:
T 109.235.34.226:5071 -> 109.235.36.148:5060 [A] INVITE sip:0880100705@test SIP/2.0. Via: SIP/2.0/TCP 10.0.3.175:5071;branch=z9hG4bK-4dfd0797. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 101 INVITE. Max-Forwards: 70. Contact: "test" sip:test@10.0.3.175:5071;transport=tcp. Expires: 240. User-Agent: Linksys/SPA962-6.1.3(a). Content-Length: 198. Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER. Supported: replaces. Content-Type: application/sdp. . v=0. o=- 1977 1977 IN IP4 10.0.3.175. s=-. c=IN IP4 10.0.3.175. t=0 0. m=audio 16384 RTP/AVP 8 101. a=rtpmap:8 PCMA/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=ptime:30. a=sendrecv.
# T 109.235.36.148:5060 -> 109.235.34.226:5071 [AP] SIP/2.0 401 Unauthorized. Via: SIP/2.0/TCP 10.0.3.175:5071;branch=z9hG4bK-4dfd0797;rport=5071;received=109.235.34.226. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test;tag=09ad8b5e6adf88220a126c2faf3dd6ad.e41d. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 101 INVITE. WWW-Authenticate: Digest realm="test", nonce="UutzClLrcd4DHPyXRQqbkGiV9IG0O775", qop="auth". Content-Length: 0. .
# T 109.235.34.226:5071 -> 109.235.36.148:5060 [A] ACK sip:0880100705@test SIP/2.0. Via: SIP/2.0/TCP 10.0.3.175:5071;branch=z9hG4bK-4dfd0797. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test;tag=09ad8b5e6adf88220a126c2faf3dd6ad.e41d. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 101 ACK. Max-Forwards: 70. Contact: "test" sip:test@10.0.3.175:5071;transport=tcp. User-Agent: Linksys/SPA962-6.1.3(a). Content-Length: 0. .
## T 109.235.34.226:5071 -> 109.235.36.148:5060 [AP] INVITE sip:0880100705@test SIP/2.0. Via: SIP/2.0/TCP 10.0.3.175:5071;branch=z9hG4bK-c94437af. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 102 INVITE. Max-Forwards: 70. Authorization: Digest username="test",realm="test",nonce="UutzClLrcd4DHPyXRQqbkGiV9IG0O775",uri="sip:0880100705@test",algorithm=MD5,response="0f1879f1bb7fb047290949077b9ed4e8",qop=auth,nc=00000001,cnonce="b10a7f95". Contact: "test" sip:test@10.0.3.175:5071;transport=tcp. Expires: 240. User-Agent: Linksys/SPA962-6.1.3(a). Content-Length: 198. Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER. Supported: replaces. Content-Type: application/sdp. . v=0. o=- 1977 1977 IN IP4 10.0.3.175. s=-. c=IN IP4 10.0.3.175. t=0 0. m=audio 16384 RTP/AVP 8 101. a=rtpmap:8 PCMA/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=ptime:30. a=sendrecv.
## T 109.235.36.148:5060 -> 109.235.34.226:5071 [AP] SIP/2.0 100 trying -- your call is important to us. Via: SIP/2.0/TCP 10.0.3.175:5071;branch=z9hG4bK- c94437af;rport=5071;received=109.235.34.226. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 102 INVITE. Content-Length: 0. .
# U 109.235.36.148:5060 -> 109.235.32.40:5060 INVITE sip:+31880100705@sip.pocos.nl:5060;transport=udp SIP/2.0. Record-Route: sip:109.235.36.148;r2=on;lr=on;ftag=ade412afb1ed2f55o0;did=eab.8c62;vsf=AAAAAEBfUFpDCXdLWkEZXy8LAR9dGgocRgEfdGVkLm5s;nat=yes. Record-Route: sip:109.235.36.148;transport=tcp;r2=on;lr=on;ftag=ade412afb1ed2f55o0;did=eab.8c62;vsf=AAAAAEBfUFpDCXdLWkEZXy8LAR9dGgocRgEfdGVkLm5s;nat=yes. Via: SIP/2.0/UDP 109.235.36.148;branch=z9hG4bKe7af.0b8e50b08945d2c51c44b38bb2a6f840.0;i=1. Via: SIP/2.0/TCP 10.0.3.175:5071;rport=5071;received=109.235.34.226;branch=z9hG4bK-c94437af. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 102 INVITE. Max-Forwards: 16. Contact: "test" sip:test@10.0.3.175:5071;alias=109.235.34.226~5071~2;transport=tcp. Expires: 240. Content-Length: 224. Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER. Supported: replaces. Content-Type: application/sdp. . v=0. o=- 1977 1977 IN IP4 109.235.36.148. s=-. c=IN IP4 109.235.36.148. t=0 0. m=audio 55224 RTP/AVP 8 101. a=rtpmap:8 PCMA/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=ptime:30. a=sendrecv. a=nortpproxy:yes.
# U 109.235.32.40:5060 -> 109.235.36.148:5060 SIP/2.0 401 Unauthorized. Via: SIP/2.0/UDP 109.235.36.148;branch=z9hG4bKe7af.0b8e50b08945d2c51c44b38bb2a6f840.0;i=1;rport=5060. Via: SIP/2.0/TCP 10.0.3.175:5071;rport=5071;received=109.235.34.226;branch=z9hG4bK-c94437af. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test;tag=47dc960d0aec89efc47228ca957df0ae.2208. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 102 INVITE. WWW-Authenticate: Digest realm="test", nonce="UutzClLrcd7HrDEFx7D1Zd3UyDMMfekY", qop="auth". Content-Length: 0. .
# U 109.235.36.148:5060 -> 109.235.32.40:5060 ACK sip:+31880100705@sip.pocos.nl:5060;transport=udp SIP/2.0. Via: SIP/2.0/UDP 109.235.36.148;branch=z9hG4bKe7af.0b8e50b08945d2c51c44b38bb2a6f840.0;i=1. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test;tag=47dc960d0aec89efc47228ca957df0ae.2208. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 102 ACK. Max-Forwards: 16. Content-Length: 0. .
# T 109.235.36.148:5060 -> 109.235.34.226:5071 [AP] SIP/2.0 401 Unauthorized. Via: SIP/2.0/TCP 10.0.3.175:5071;rport=5071;received=109.235.34.226;branch=z9hG4bK-c94437af. From: "test" sip:test@test;tag=ade412afb1ed2f55o0. To: sip:0880100705@test;tag=47dc960d0aec89efc47228ca957df0ae.2208. Call-ID: 634f5137-8573c26d@10.0.3.175. CSeq: 102 INVITE. WWW-Authenticate: Digest realm="test", nonce="UutzClLrcd7HrDEFx7D1Zd3UyDMMfekY", qop="auth". Content-Length: 0. .