i was playing with t_relay and tcp and noticed that when forwarding to a tcp contact fails, transaction is still created although README says:
* 0x02 - do not internally send a negative reply in case of forward failure (due internal error, bad RURI, bad message, etc). When a forward failure occurs, no SIP request is relayed and therefore no negative reply or timeout will show up on the failure_route (if one is set). It applies only when the transaction is created. By default one negative reply is sent. Useful if you want to implement a serial forking in case of failure. and In case of error, the function returns the following codes: ... * -6 - generic send failed while testing this i had two contacts with different q values: Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: DBG:tm:t_load_contacts: loaded contact <sip:t...@192.98.101.10:5074#012#012#012udp:192.98.101.10:5060#0120#012d> with q_flag <0> Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: DBG:tm:t_load_contacts: loaded contact <sip:j...@192.98.101.10:5555;transport=tcp#012#012#012#01216#0124> with q_flag <4> i then called next_contacts() followed by t_relay("0x03") and tested the result: while (1) { xlog("L_INFO", "INFO: Routing initial $rm to <$ru> and <$bR>\n"); t_relay("0x03"); switch ($retcode) { case 1: xlog("L_INFO", "INFO: retcode is <1>\n"); exit; case -1: case -2: case -3: sl_reply_error(); exit; case -4: xlog("L_INFO", "INFO: retcode is <-4>\n"); case -5: xlog("L_INFO", "INFO: retcode is <-5>\n"); case -6: xlog("L_INFO", "INFO: retcode is <-6>\n"); if (!t_next_contacts()) { send_reply("480", "Temporarily Unavailable"); exit; }; }; }; i got to syslog: Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: DBG:tm:t_next_contacts: entering next_contacts WITHOUT transaction Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: DBG:tm:t_next_contacts: R-URI contact is <sip:j...@192.98.101.10:5555;transport=tcp#012#012#012#01216#0124> Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: INFO: Routing initial INVITE to <sip:j...@192.98.101.10:5555;transport=tcp> and <<null>> Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: ERROR:core:tcp_blocking_connect: poll error: flags 18 Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: ERROR:core:tcp_blocking_connect: failed to retrieve SO_ERROR (111) Connection refused Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: ERROR:core:tcpconn_connect: tcp_blocking_connect failed Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: ERROR:core:tcp_send: connect failed Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: ERROR:tm:msg_send: tcp_send failed Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: ERROR:tm:t_forward_nonack: sending request failed Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: INFO: retcode is <-6> the first debug line above is a new one that i added to the beginning of next_contacts(): t = get_t(); if (!t || (t == T_UNDEFINED)) { LM_DBG("entering next_contacts WITHOUT transaction\n"); } else { LM_DBG("entering next_contacts WITH transaction\n"); } then the script goes on and calls t_next_contacts()/t_relay("0x03") again and now i get: Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: DBG:tm:t_next_contacts: entering next_contacts WITH transaction Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: DBG:tm:t_next_contacts: next branch contact is <sip:t...@192.98.101.10:5074#012#012#012udp:192.98.101.10:5060#0120#012d> Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: INFO: Routing initial INVITE to <sip:j...@192.98.101.10:5555;transport=tcp> and <<sip:t...@192.98.101.10:5074>;q=0> Mar 10 06:50:07 taimen /usr/sbin/kamailio[18101]: INFO: retcode is <1> how is it possible that the transaction was created even when the first t_relay failed with result code -6? this example should prove that scripting tm like this NOT user friendly and prone to errors. -- juha ps. i think we agreed earlier that failing forward to a tcp contact is NOT an error and should not be printed to syslog as an error. _______________________________________________ Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users