MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / w_replace_from

Function w_replace_from

modules/uac/uac.c:425–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423
424
425static int w_replace_from(struct sip_msg* msg, str* dsp, str* uri)
426{
427 unsigned flags = (unsigned)context_get_int(
428 CONTEXT_GLOBAL, current_processing_ctx, uac_replace_flags);
429
430 if (flags & UAC_INUSE_REPLACE_FROM) {
431 LM_ERR("scripting bug: uac_replace_from() already called!\n");
432 return E_SCRIPT;
433 }
434
435 if (parse_from_header(msg)<0 ) {
436 LM_ERR("failed to find/parse FROM hdr\n");
437 return -1;
438 }
439
440 LM_DBG("dsp=%p (len=%d) , uri=%p (len=%d)\n",
441 dsp,dsp?dsp->len:0,uri,uri?uri->len:0);
442
443 if (route_type == REQUEST_ROUTE && !route_stack[route_stack_start])
444 context_put_int(CONTEXT_GLOBAL, current_processing_ctx,
445 uac_replace_flags, (int)(flags|UAC_INUSE_REPLACE_FROM));
446
447 return (replace_uri(msg, dsp, uri, msg->from, 0)==0)?1:-1;
448}
449
450
451static int w_restore_to(struct sip_msg *msg)

Callers

nothing calls this directly

Calls 4

context_get_intFunction · 0.85
parse_from_headerFunction · 0.85
context_put_intFunction · 0.85
replace_uriFunction · 0.85

Tested by

no test coverage detected