@@ -396,7 +396,8 @@ static inline unsigned int count_local_rr(struct sip_msg *req)
396396 may break the function logic!
397397*/
398398static int add_uac ( struct cell * t , struct sip_msg * request , const str * uri ,
399- str * next_hop , unsigned int bflags , str * path , struct proxy_l * proxy )
399+ str * next_hop , unsigned int bflags , str * path ,
400+ int q , struct usr_avp * * attrs , struct proxy_l * proxy )
400401{
401402 unsigned short branch ;
402403 struct sip_msg_body * body_clone = NO_BODY_CLONE_MARKER ;
@@ -424,6 +425,16 @@ static int add_uac( struct cell *t, struct sip_msg *request, const str *uri,
424425 request -> path_vec = * path ;
425426 request -> ruri_bflags = bflags ;
426427
428+ /* we attach the attrs here as we need to see them in branch route
429+ * (inside pre_print_uac_request())
430+ * They will remain attached here if the UAC is successfully created;
431+ * if we exit with return the attrs will be freed by clean_branch().
432+ * Bottom line, we take over the attr list handling, so we NULL the
433+ * received holder (so the upper level will havve nothing to care furhter)
434+ */
435+ t -> uac [branch ].battrs = * attrs ;
436+ * attrs = NULL ;
437+
427438 if ( pre_print_uac_request ( t , branch , request , & body_clone )!= 0 ) {
428439 ret = -1 ;
429440 goto error01 ;
@@ -471,6 +482,7 @@ static int add_uac( struct cell *t, struct sip_msg *request, const str *uri,
471482 t -> uac [branch ].uri .len = request -> new_uri .len ;
472483 t -> uac [branch ].br_flags = request -> ruri_bflags ;
473484 t -> uac [branch ].added_rr = count_local_rr ( request );
485+ t -> uac [branch ].q = q ;
474486 t -> nr_of_outgoings ++ ;
475487
476488 /* done! */
@@ -766,7 +778,8 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
766778
767779 /* as first branch, use current R-URI, bflags, etc. */
768780 branch_ret = add_uac ( t , p_msg , & current_uri , & backup_dst ,
769- getb0flags (p_msg ), & p_msg -> path_vec , proxy );
781+ getb0flags (p_msg ), & p_msg -> path_vec , p_msg -> ruri_q ,
782+ ruri_branch_attrs_head () , proxy );
770783 if (branch_ret >=0 )
771784 added_branches |= 1 <<branch_ret ;
772785 else
@@ -776,7 +789,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
776789 for ( idx = 0 ; (branch = get_msg_branch (idx ))!= NULL ; idx ++ ) {
777790 p_msg -> force_send_socket = branch -> force_send_socket ;
778791 branch_ret = add_uac ( t , p_msg , & branch -> uri , & branch -> dst_uri ,
779- branch -> bflags , & branch -> path , proxy );
792+ branch -> bflags , & branch -> path , branch -> q , & branch -> attrs , proxy );
780793 /* pick some of the errors in case things go wrong;
781794 note that picking lowest error is just as good as
782795 any other algorithm which picks any other negative
0 commit comments