| 1361 | |
| 1362 | |
| 1363 | static int w_t_relay( struct sip_msg *p_msg , void *flags, struct proxy_l *proxy) |
| 1364 | { |
| 1365 | struct proxy_l *p = NULL; |
| 1366 | struct cell *t; |
| 1367 | int ret; |
| 1368 | |
| 1369 | t=get_t(); |
| 1370 | |
| 1371 | if (proxy && (p=clone_proxy(proxy))==0) { |
| 1372 | LM_ERR("failed to clone proxy, dropping packet\n"); |
| 1373 | return -1; |
| 1374 | } |
| 1375 | |
| 1376 | if (!t || t==T_UNDEFINED) { |
| 1377 | /* no transaction yet */ |
| 1378 | if (route_type==FAILURE_ROUTE) { |
| 1379 | LM_CRIT("BUG - undefined transaction in failure route\n"); |
| 1380 | return -1; |
| 1381 | } |
| 1382 | ret = t_relay_to( p_msg, p, (int)(long)flags ); |
| 1383 | if (ret<0) { |
| 1384 | ret = t_relay_inerr2scripterr(); |
| 1385 | } |
| 1386 | } else { |
| 1387 | /* transaction already created */ |
| 1388 | |
| 1389 | if ( route_type!=REQUEST_ROUTE && route_type!=FAILURE_ROUTE ) |
| 1390 | goto route_err; |
| 1391 | |
| 1392 | if (p_msg->REQ_METHOD==METHOD_ACK) { |
| 1393 | /* local ACK*/ |
| 1394 | t_release_transaction(t); |
| 1395 | return 1; |
| 1396 | } |
| 1397 | |
| 1398 | if (((int)(long)flags)&TM_T_RELAY_nodnsfo_FLAG) |
| 1399 | t->flags|=T_NO_DNS_FAILOVER_FLAG; |
| 1400 | if (((int)(long)flags)&TM_T_RELAY_reason_FLAG) |
| 1401 | t->flags|=T_CANCEL_REASON_FLAG; |
| 1402 | if ( (((int)(long)flags)&TM_T_RELAY_do_cancel_dis_FLAG) && |
| 1403 | tm_has_request_disponsition_no_cancel(p_msg)==0 ) |
| 1404 | t->flags|=T_MULTI_200OK_FLAG; |
| 1405 | |
| 1406 | if (route_type==FAILURE_ROUTE) { |
| 1407 | /* If called from failure route we need reset the branch counter to |
| 1408 | * ignore the previous set of branches (already terminated) */ |
| 1409 | ret = t_forward_nonack( t, p_msg, p, 1/*reset*/,1/*locked*/); |
| 1410 | } else { |
| 1411 | /* if called from request route and the transaction was previously |
| 1412 | * created, better lock here to avoid any overlapping with |
| 1413 | * branch injection from other processes */ |
| 1414 | LOCK_REPLIES(t); |
| 1415 | |
| 1416 | /* update the transaction only if in REQUEST route; for other types |
| 1417 | of routes we do not want to inherit the local changes */ |
| 1418 | if (route_type==REQUEST_ROUTE) |
| 1419 | update_cloned_msg_from_msg( t->uas.request, p_msg); |
| 1420 |
nothing calls this directly
no test coverage detected