[sr-dev] git:master: tm: new function t_use_uac_headers()

Daniel-Constantin Mierla miconda at gmail.com
Tue Oct 1 09:36:29 CEST 2013


Module: sip-router
Branch: master
Commit: 0e71fec1e108e1c9b97486ced8c1328738ca13c2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0e71fec1e108e1c9b97486ced8c1328738ca13c2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Oct  1 09:27:46 2013 +0200

tm: new function t_use_uac_headers()

- set internal flags to tell tm to use UAC side for building headers for
  local generated requests (ACK, CANCEL) - useful when changing From/To
  headers using other functions than uac_replace_[from|to]()

---

 modules/tm/tm.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index 7df7ade..3bdc7fb 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -303,6 +303,7 @@ static int w_t_drop_replies(struct sip_msg* msg, char* foo, char* bar);
 static int w_t_save_lumps(struct sip_msg* msg, char* foo, char* bar);
 static int w_t_check_trans(struct sip_msg* msg, char* foo, char* bar);
 static int w_t_is_set(struct sip_msg* msg, char* target, char* bar);
+static int w_t_use_uac_headers(sip_msg_t* msg, char* foo, char* bar);
 
 
 /* by default the fr timers avps are not set, so that the avps won't be
@@ -483,6 +484,8 @@ static cmd_export_t cmds[]={
 			REQUEST_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE },
 	{"t_is_set",	      w_t_is_set,				1, fixup_t_is_set,
 			ANY_ROUTE },
+	{"t_use_uac_headers",  w_t_use_uac_headers,		0, 0,
+			ANY_ROUTE },
 
 	{"t_load_contacts", t_load_contacts,            0, 0,
 			REQUEST_ROUTE | FAILURE_ROUTE},
@@ -2304,6 +2307,18 @@ inline static int w_t_relay_to(struct sip_msg *msg, char *proxy, char *flags)
 }
 
 
+static int w_t_use_uac_headers(sip_msg_t* msg, char* foo, char* bar)
+{
+	tm_cell_t *t;
+
+	t=get_t();
+	if (t!=NULL && t!=T_UNDEFINED) {
+		t->uas.request->msg_flags |= FL_USE_UAC_FROM|FL_USE_UAC_TO;
+	}
+	msg->msg_flags |= FL_USE_UAC_FROM|FL_USE_UAC_TO;
+
+	return 1;
+}
 
 /* rpc docs */
 




More information about the sr-dev mailing list