| 201 | |
| 202 | |
| 203 | int t_relay_to( struct sip_msg *p_msg , struct proxy_l *proxy, int flags) |
| 204 | { |
| 205 | int ret; |
| 206 | int new_tran; |
| 207 | int reply_ret; |
| 208 | struct cell *t; |
| 209 | |
| 210 | ret=0; |
| 211 | |
| 212 | new_tran = t_newtran( p_msg, 1/*full UAS cloning*/ ); |
| 213 | |
| 214 | /* parsing error, memory alloc, whatever ... */ |
| 215 | if (new_tran<0) { |
| 216 | ret = new_tran; |
| 217 | goto done; |
| 218 | } |
| 219 | /* if that was a retransmission, break from script */ |
| 220 | if (new_tran==0) { |
| 221 | goto done; |
| 222 | } |
| 223 | |
| 224 | /* new transaction */ |
| 225 | |
| 226 | /* ACKs do not establish a transaction and are fwd-ed statelessly */ |
| 227 | if ( p_msg->REQ_METHOD==METHOD_ACK) { |
| 228 | LM_DBG("forwarding ACK\n"); |
| 229 | /* send it out */ |
| 230 | if (proxy==0) { |
| 231 | proxy=uri2proxy(GET_NEXT_HOP(p_msg), |
| 232 | p_msg->force_send_socket ? |
| 233 | p_msg->force_send_socket->proto : PROTO_NONE ); |
| 234 | if (proxy==0) { |
| 235 | ret=E_BAD_ADDRESS; |
| 236 | goto done; |
| 237 | } |
| 238 | ret=forward_request( p_msg , proxy); |
| 239 | if (ret>=0) ret=1; |
| 240 | free_proxy( proxy ); |
| 241 | pkg_free( proxy ); |
| 242 | } else { |
| 243 | ret=forward_request( p_msg , proxy); |
| 244 | if (ret>=0) ret=1; |
| 245 | } |
| 246 | goto done; |
| 247 | } |
| 248 | |
| 249 | /* if replication flag is set, mark the transaction as local |
| 250 | so that replies will not be relaied */ |
| 251 | t=get_t(); |
| 252 | if (flags&TM_T_RELAY_repl_FLAG) t->flags|=T_IS_LOCAL_FLAG; |
| 253 | if (flags&TM_T_RELAY_nodnsfo_FLAG) t->flags|=T_NO_DNS_FAILOVER_FLAG; |
| 254 | if (flags&TM_T_RELAY_reason_FLAG) t->flags|=T_CANCEL_REASON_FLAG; |
| 255 | if ((flags&TM_T_RELAY_do_cancel_dis_FLAG) && |
| 256 | tm_has_request_disponsition_no_cancel(p_msg)==0 ) |
| 257 | t->flags|=T_MULTI_200OK_FLAG; |
| 258 | |
| 259 | /* now go ahead and forward ... */ |
| 260 | ret=t_forward_nonack( t, p_msg, proxy, 0/*no reset*/, 0/*unlocked*/); |
no test coverage detected