rem: if (new_code>=200 && new_code < 300  && #ifdef _BUG_FIX  Trans->uas.request->REQ_METHOD==METHOD_INVITE) { #endif Trans->is_invite ) {
add: if (inv_through) {
context: static enum rps t_should_relay_response( struct cell *Trans , int new_code,	int branch , int *should_store, int *should_relay,	branch_bm_t *cancel_bitmap, struct sip_msg *reply ){		int branch_cnt;	int picked_branch;	int picked_code;	/* note: this code never lets replies to CANCEL go through;	   we generate always a local 200 for CANCEL; 200s are	   not relayed because it's not an INVITE transaction;	   >= 300 are not relayed because 200 was already sent	   out	*/	DBG("->>>>>>>>> T_code=%d, new_code=%d\n",Trans->uas.status,new_code);	/* if final response sent out, allow only INVITE 2xx  */	if ( Trans->uas.status >= 200 ) {		if (new_code>=200 && new_code < 300  && #ifdef _BUG_FIX /* t may be local, in which case there is no request */			Trans->uas.request->REQ_METHOD==METHOD_INVITE) {#endif			Trans->is_invite ) {			DBG("DBG: t_should_relay: 200 INV after final sent\n");			*should_store=0;			Trans->uac[branch].last_received=new_code;			*should_relay=branch;			return RPS_PUSHED_AFTER_COMPLETION;		} else {			/* except the exception above, too late  messages will			   be discarded */			*should_store=0;			*should_relay=-1;			return RPS_DISCARDED;		}	} 	/* no final response sent yet */	/* negative replies subject to fork picking */	if (new_code >=300 ) {		/* negative reply received after we have received		   a final reply previously -- discard , unless		   a recoverable error occured, in which case		   retry	    */		if (Trans->uac[branch].last_received>=200) {			/* then drop! */			*should_store=0;			*should_relay=-1;			return RPS_DISCARDED;		}		Trans->uac[branch].last_received=new_code;		/* if all_final return lowest */		picked_branch=pick_branch(branch,new_code, Trans, &picked_code);		if (picked_branch==-2) { /* branches open yet */			*should_store=1;				*should_relay=-1;			return RPS_STORE;		}		if (picked_branch==-1) {			LOG(L_CRIT, "ERROR: t_should_relay_response: lowest==-1\n");			goto error;		}		/* no more pending branches -- try if that changes after		   a callback; save banch count to be able to determine		   later if new branches were initiated		*/		branch_cnt=Trans->nr_of_outgoings;		callback_event( TMCB_ON_FAILURE, Trans, 			picked_branch==branch?reply:Trans->uac[picked_branch].reply, 			picked_code);		/* here, we create a faked environment, from which we		 * return to request processing, if marked to do so */		failure_route(Trans);		/* look if the callback perhaps replied transaction; it also		   covers the case in which a transaction is replied localy		   on CANCEL -- then it would make no sense to proceed to		   new branches bellow		*/		if (Trans->uas.status >= 200) {			*should_store=0;			*should_relay=-1;			/* this might deserve an improvement -- if something			   was already replied, it was put on wait and then,			   returning RPS_COMPLETED will make t_on_reply			   put it on wait again; perhaps splitting put_on_wait			   from send_reply or a new RPS_ code would be healthy			*/			return RPS_COMPLETED;		}		/* look if the callback/failure_route introduced new branches ... */		if (branch_cnt<Trans->nr_of_outgoings)  {			/* await then result of new branches */			*should_store=1;			*should_relay=-1;			return RPS_STORE;		}		/* really no more pending branches -- return lowest code */		*should_store=0;		*should_relay=picked_branch;		/* we dont need 'which_cancel' here -- all branches 		   known to have completed */		/* which_cancel( Trans, cancel_bitmap ); */		return RPS_COMPLETED;	} 	/* not >=300 ... it must be 2xx or provisional 1xx */	if (new_code>=100) {		/* 1xx and 2xx except 100 will be relayed */		Trans->uac[branch].last_received=new_code;		*should_store=0;		*should_relay= new_code==100? -1 : branch;		if (new_code>=200 ) {			which_cancel( Trans, cancel_bitmap );			return RPS_COMPLETED;		} else return RPS_PROVISIONAL;	}error:	/* reply_status didn't match -- it must be something weird */	LOG(L_CRIT, "ERROR: Oh my gooosh! We don't know whether to relay %d\n",		new_code);	*should_store=0;	*should_relay=-1;	return RPS_DISCARDED;}