Module: sip-router
Branch: master
Commit: 19aafcfc262c16f98793ef135900cd65fca44522
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=19aafcf…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Fri Aug 3 14:37:20 2012 +0100
modules/tm: Enhanced t_replicate so that if a NULL string is used it replicates to $du
- Added by Hugh Waite @ Crocodile RCS
---
modules/tm/tm.c | 35 ++++++++++++++++++++---------------
1 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index 3c60bbe..861b5eb 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -1532,27 +1532,32 @@ inline static int w_t_relay_to_avp( struct sip_msg *p_msg ,
int t_replicate_uri(struct sip_msg *msg, str *suri)
{
- struct proxy_l *proxy;
+ struct proxy_l *proxy = NULL;
struct sip_uri turi;
int r = -1;
- memset(&turi, 0, sizeof(struct sip_uri));
- if(parse_uri(suri->s, suri->len, &turi)!=0)
+ if (suri != NULL && suri->s != NULL)
{
- LM_ERR("bad replicate SIP address!\n");
- return -1;
- }
+ memset(&turi, 0, sizeof(struct sip_uri));
+ if(parse_uri(suri->s, suri->len, &turi)!=0)
+ {
+ LM_ERR("bad replicate SIP address!\n");
+ return -1;
+ }
- proxy=mk_proxy(&turi.host, turi.port_no, turi.proto);
- if (proxy==0) {
- LM_ERR("cannot create proxy from URI <%.*s>\n",
- suri->len, suri->s );
- return -1;
- }
+ proxy=mk_proxy(&turi.host, turi.port_no, turi.proto);
+ if (proxy==0) {
+ LM_ERR("cannot create proxy from URI <%.*s>\n",
+ suri->len, suri->s );
+ return -1;
+ }
- r = t_replicate(msg, proxy, proxy->proto);
- free_proxy(proxy);
- pkg_free(proxy);
+ r = t_replicate(msg, proxy, proxy->proto);
+ free_proxy(proxy);
+ pkg_free(proxy);
+ } else {
+ r = t_replicate(msg, NULL, 0);
+ }
return r;
}