| 461 | |
| 462 | |
| 463 | static int w_replace_to(struct sip_msg* msg, str *dsp, str *uri) |
| 464 | { |
| 465 | unsigned flags = (unsigned)context_get_int( |
| 466 | CONTEXT_GLOBAL, current_processing_ctx, uac_replace_flags); |
| 467 | |
| 468 | if (flags & UAC_INUSE_REPLACE_TO) { |
| 469 | LM_ERR("scripting bug: uac_replace_to() already called!\n"); |
| 470 | return E_SCRIPT; |
| 471 | } |
| 472 | |
| 473 | /* parse TO hdr */ |
| 474 | if ( msg->to==0 && (parse_headers(msg,HDR_TO_F,0)!=0 || msg->to==0) ) { |
| 475 | LM_ERR("failed to parse TO hdr\n"); |
| 476 | return -1; |
| 477 | } |
| 478 | |
| 479 | if (route_type == REQUEST_ROUTE && !route_stack[route_stack_start]) |
| 480 | context_put_int(CONTEXT_GLOBAL, current_processing_ctx, |
| 481 | uac_replace_flags, (int)(flags|UAC_INUSE_REPLACE_TO)); |
| 482 | |
| 483 | return (replace_uri(msg, dsp, uri, msg->to, 1)==0)?1:-1; |
| 484 | } |
| 485 | |
| 486 | |
| 487 |
nothing calls this directly
no test coverage detected