MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / t_forward_nonack

Function t_forward_nonack

modules/tm/t_fwd.c:742–956  ·  view source on GitHub ↗

function returns: * 1 - forward successful * -1 - error during forward */

Source from the content-addressed store, hash-verified

740 * -1 - error during forward
741 */
742int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
743 struct proxy_l * proxy, int reset_bcounter, int locked)
744{
745 str reply_reason_487 = str_init("Request Terminated");
746 str backup_uri;
747 str backup_dst;
748 int branch_ret, lowest_ret;
749 str current_uri;
750 branch_bm_t added_branches = BRANCH_BM_ZERO;
751 struct cell *t_invite;
752 int i, success_branch;
753 const struct socket_info *bk_sock;
754 unsigned int bk_bflags;
755 struct msg_branch *branch;
756 struct ua_client* uac;
757 int idx;
758 str bk_path;
759
760 /* before doing enything, update the t flags from msg */
761 t->uas.request->flags = p_msg->flags;
762
763 if (p_msg->REQ_METHOD==METHOD_CANCEL) {
764 t_invite=t_lookupOriginalT( p_msg );
765 if (t_invite!=T_NULL_CELL) {
766 t_invite->flags |= T_WAS_CANCELLED_FLAG;
767 cancel_invite( p_msg, t, t_invite, locked );
768 return 1;
769 }
770 }
771
772 /* do not forward requests which were already cancelled*/
773 if (no_new_branches(t)) {
774 LM_INFO("discarding fwd for a 6xx transaction\n");
775 ser_error = E_NO_DESTINATION;
776 return -1;
777 }
778 if (was_cancelled(t)) {
779 /* is this the first attempt of sending a branch out ? */
780 if (t->nr_of_outgoings==0) {
781 /* if no other signalling was performed on the transaction
782 * and the transaction was already canceled, better
783 * internally generate the 487 reply here */
784 if (locked)
785 t_reply_unsafe( t, p_msg , 487 , &reply_reason_487);
786 else
787 t_reply( t, p_msg , 487 , &reply_reason_487);
788 }
789 LM_INFO("discarding fwd for a cancelled transaction\n");
790 ser_error = E_NO_DESTINATION;
791 return -1;
792 }
793
794 /* backup current uri, sock and flags... add_uac changes it */
795 backup_uri = p_msg->new_uri;
796 backup_dst = p_msg->dst_uri;
797 bk_sock = p_msg->force_send_socket;
798 bk_path = p_msg->path_vec;
799 bk_bflags = p_msg->ruri_bflags;

Callers 5

t_relay_toFunction · 0.85
do_dns_failoverFunction · 0.85
w_t_relayFunction · 0.85
t_inject_branchFunction · 0.85
t_replicateFunction · 0.85

Calls 15

t_lookupOriginalTFunction · 0.85
cancel_inviteFunction · 0.85
t_reply_unsafeFunction · 0.85
t_replyFunction · 0.85
su_setportFunction · 0.85
add_uacFunction · 0.85
ruri_branch_attrs_headFunction · 0.85
get_msg_branchFunction · 0.85
clear_dsetFunction · 0.85
get_on_branchFunction · 0.85
set_extra_tmcb_paramsFunction · 0.85
run_trans_callbacksFunction · 0.85

Tested by

no test coverage detected