| 1253 | |
| 1254 | |
| 1255 | static int w_t_reply(struct sip_msg* msg, unsigned int code, str* text) |
| 1256 | { |
| 1257 | struct cell *t; |
| 1258 | int r; |
| 1259 | |
| 1260 | if (msg->REQ_METHOD==METHOD_ACK) { |
| 1261 | LM_DBG("ACKs are not replied\n"); |
| 1262 | return 0; |
| 1263 | } |
| 1264 | switch (route_type) { |
| 1265 | case FAILURE_ROUTE: |
| 1266 | /* if called from reply_route, make sure that unsafe version |
| 1267 | * is called; we are already in a mutex and another mutex in |
| 1268 | * the safe version would lead to a deadlock */ |
| 1269 | t=get_t(); |
| 1270 | if ( t==0 || t==T_UNDEFINED ) { |
| 1271 | LM_ERR("BUG - no transaction found in Failure Route\n"); |
| 1272 | return -1; |
| 1273 | } |
| 1274 | return t_reply_unsafe(t, msg, code, text); |
| 1275 | case REQUEST_ROUTE: |
| 1276 | t=get_t(); |
| 1277 | if ( t==0 || t==T_UNDEFINED ) { |
| 1278 | r = t_newtran( msg , 0/*no full UAS cloning*/ ); |
| 1279 | if (r==0) { |
| 1280 | /* retransmission -> break the script */ |
| 1281 | return 0; |
| 1282 | } else if (r<0) { |
| 1283 | LM_ERR("could not create a new transaction\n"); |
| 1284 | return -1; |
| 1285 | } |
| 1286 | t=get_t(); |
| 1287 | } |
| 1288 | return t_reply( t, msg, code, text); |
| 1289 | default: |
| 1290 | LM_CRIT("unsupported route_type (%d)\n", route_type); |
| 1291 | return -1; |
| 1292 | } |
| 1293 | } |
| 1294 | |
| 1295 | |
| 1296 | static int w_pv_t_reply(struct sip_msg *msg, unsigned int* code, str* text) |
no test coverage detected