On 23 August 2013 08:13, Steve Davies <st...@connection-telecom.com> wrote:
> Here's all that is said about return codes from t_relay in the 4.0.x > module documentation ( > http://kamailio.org/docs/modules/4.0.x/modules/tm.html#t_relay). Looks > like there are docs that I didn't find? > > "Returns a negative value on failure -- you may still want to send a >> negative reply upstream statelessly not to leave upstream UAC in lurch." > > > > All the examples about re-routing calls are all about doing append_route > out of the to_on_failure route. Which works beautifully for "soft" > failures etc. Seems a shame this exception must be done differently? > > Hi Olle, Here's what I put in RELAY route block: $var(rr) = t_relay(); xlog("L_NOTICE","SLD: in RELAY, t_relay returned $var(rr)\n"); if (!$var(rr)) { sl_reply_error(); } In 4.0.3, t_relay gives a -1 in the case that there is a physical network issue (in my test I have a "-j DROP" iptables rule) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [dns_cache.c:569]: _dns_hash_find(): dns_hash_find(_sip._ udp.vc2.connection-telecom.com(36), 33), h=940 Aug 23 10:41:02 ubuntu voipmonitor[1935]: packetbuffer interface: datalink number [0] is not supported Aug 23 10:41:02 voipmonitor[1935]: last message repeated 17 times Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [resolve.c:757]: get_record(): get_record: lookup(_sip._ udp.vc2.connection-telecom.com, 33) failed Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [dns_cache.c:897]: dns_cache_mk_bad_entry(): dns_cache_mk_bad_entry(_sip._ udp.vc2.connection-telecom.com, 3 3, 60, 1) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [dns_cache.c:830]: dns_cache_add(): dns_cache_add: adding _sip._ udp.vc2.connection-telecom.com(36) 33 (flag s=1) at 940 Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [dns_cache.c:569]: _dns_hash_find(): dns_hash_find( vc2.connection-telecom.com(26), 1), h=1021 Aug 23 10:41:02 ubuntu voipmonitor[1935]: packetbuffer interface: datalink number [0] is not supported Aug 23 10:41:02 voipmonitor[1935]: last message repeated 3 times Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [resolve.c:954]: get_record(): get_record: skipping 0 NS (p=0x82b143c, end=0x82b143c) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [resolve.c:970]: get_record(): get_record: parsing 0 ARs (p=0x82b143c, end=0x82b143c) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [dns_cache.c:1779]: dns_get_related(): dns_get_related(0xb2f5cd68 ( vc2.connection-telecom.com, 1), 1, *(nil )) (0) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [dns_cache.c:872]: dns_cache_add_unsafe(): dns_cache_add: adding vc2.connection-telecom.com(26) 1 (flags=0) at 1021 Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [forward.c:213]: get_out_socket(): DEBUG: get_out_socket: socket determined: 0xb716bae8 Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [msg_translator.c:206]: check_via_address(): check_via_address(172.16.230.1, 172.16.230.1, 0) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: ERROR: <core> [udp_server.c:611]: udp_send(): ERROR: udp_send: sendto(sock,0xb2f5cdd8,1099,0,41.221.230.60:5060,16): Oper ation not permitted(1) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: ERROR: tm [../../forward.h:196]: msg_send(): msg_send: ERROR: udp_send failed Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: tm [t_fwd.c:1369]: t_send_branch(): t_send_branch: send to 41.221.230.60:5060(1) failed Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: ERROR: tm [t_fwd.c:1387]: t_send_branch(): ERROR: t_send_branch: sending request on branch 0 failed Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: tm [t_funcs.c:357]: t_relay_to(): ERROR:tm:t_relay_to: t_forward_nonack returned error Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: tm [t_funcs.c:365]: t_relay_to(): -477 error reply generation delayed Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: ERROR: *** cfgtrace: c=[/usr/local/etc/kamailio/kamailio.cfg] l=560 a=26 n=xlog Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: NOTICE: <script>: SLD: in RELAY, t_relay returned -1 Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: ERROR: *** cfgtrace: c=[/usr/local/etc/kamailio/kamailio.cfg] l=564 a=16 n=if Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: ERROR: *** cfgtrace: c=[/usr/local/etc/kamailio/kamailio.cfg] l=564 a=2 n=exit Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: tm [t_lookup.c:1553]: t_unref(): t_unref: delayed error reply generation(-477) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: <core> [msg_translator.c:206]: check_via_address(): check_via_address(172.16.230.1, 172.16.230.1, 0) Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: tm [t_reply.c:1547]: cleanup_uac_timers(): DEBUG: cleanup_uac_timers: RETR/FR timers reset Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: tm [t_hooks.c:288]: run_trans_callbacks_internal(): DBG: trans=0xb2f5aeb8, callback type 512, id 0 entered Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: acc [acc_logic.c:539]: tmcb_func(): acc callback called for t(0xb2f5aeb8) event type 512, reply code 477 Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: tm [t_reply.c:706]: _reply_light(): DEBUG: reply sent out. buf=0xb7157938: SIP/2.0 477 Unfortun..., shmem=0xb2f5c7 18: SIP/2.0 477 Unfortun Aug 23 10:41:02 ubuntu /usr/local/sbin/kamailio[7136]: DEBUG: tm [t_reply.c:716]: _reply_light(): DEBUG: _reply_light: finished So I don't get a specific response; not sure how to tell if I'm facing a case where the t_on_failure branch was executed or a case where it was not. Is there a way to get hold of that "-477" error reply referred to in the trace? Thanks, Steve
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users