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

Function faked_env

modules/tm/t_reply.c:558–590  ·  view source on GitHub ↗

if msg is set -> it will fake the env. vars conforming with the msg; if NULL * the env. will be restore to original */

Source from the content-addressed store, hash-verified

556/*if msg is set -> it will fake the env. vars conforming with the msg; if NULL
557 * the env. will be restore to original */
558static inline void faked_env( struct cell *t,struct sip_msg *msg)
559{
560 static struct cell *backup_t;
561 static struct usr_avp **backup_list;
562 static const struct socket_info* backup_si;
563 static int backup_route_type;
564
565 if (msg) {
566 swap_route_type( backup_route_type, FAILURE_ROUTE);
567 /* tm actions look in beginning whether transaction is
568 * set -- whether we are called from a reply-processing
569 * or a timer process, we need to set current transaction;
570 * otherwise the actions would attempt to look the transaction
571 * up (unnecessary overhead, refcounting)
572 */
573 /* backup */
574 backup_t = get_t();
575 /* fake transaction */
576 set_t(t);
577 /* make available the avp list from transaction */
578 backup_list = set_avp_list( &t->user_avps );
579 /* set default send address to the saved value */
580 backup_si = bind_address;
581 bind_address = TM_BRANCH(t,0).request.dst.send_sock;
582 } else {
583 /* restore original environment */
584 set_t(backup_t);
585 set_route_type( backup_route_type );
586 /* restore original avp list */
587 set_avp_list( backup_list );
588 bind_address = backup_si;
589 }
590}
591
592
593/* return 1 if a failure_route processes */

Callers 2

run_failure_handlersFunction · 0.85
do_dns_failoverFunction · 0.85

Calls 3

get_tFunction · 0.85
set_tFunction · 0.85
set_avp_listFunction · 0.85

Tested by

no test coverage detected