[sr-dev] git:master: modules/rtpproxy: added 't' flag to rtpproxy_destroy and force_rtp_proxy

admin at sip-router.org admin at sip-router.org
Mon Oct 22 11:19:00 CEST 2012


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

Author: Juha Heinanen <jh at tutpro.com>
Committer: Juha Heinanen <jh at tutpro.com>
Date:   Mon Oct 22 12:15:54 2012 +0300

modules/rtpproxy:  added 't' flag to rtpproxy_destroy and force_rtp_proxy
- Added new flag 't' to rtpproxy_destroy function that makes it possible
  do delete whole call even when To tag is present in request/reply.  In
  force_rtp_proxy the flag is ignored.

---

 modules/rtpproxy/README                 |    6 +++++-
 modules/rtpproxy/doc/rtpproxy.xml       |    2 +-
 modules/rtpproxy/doc/rtpproxy_admin.xml |    3 +++
 modules/rtpproxy/rtpproxy.c             |   13 ++++++++++++-
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/modules/rtpproxy/README b/modules/rtpproxy/README
index f413832..eb2e1be 100644
--- a/modules/rtpproxy/README
+++ b/modules/rtpproxy/README
@@ -34,7 +34,7 @@ Carsten Bock
 
    Copyright © 2005 Voice Sistem SRL
 
-   Copyright © 2009 TuTPro Inc.
+   Copyright © 2009-2012 TuTPro Inc.
 
    Copyright © 2010 VoIPEmbedded Inc.
      __________________________________________________________________
@@ -491,6 +491,10 @@ onreply_route[2]
             the ngcp-mediaproxy-ng rtpproxy at the moment!
           + 2 - append second Via branch to Call-ID when sending command
             to rtpproxy. See flag '1' for its meaning.
+          + t - do not include To tag to “delete” command to rtpproxy thus
+            causing full call to be deleted. Useful for deleting unused
+            rtpproxy call when 200 OK is received on a branch, where
+            rtpproxy is not needed.
 
    Example 1.11. rtpproxy_destroy usage
 ...
diff --git a/modules/rtpproxy/doc/rtpproxy.xml b/modules/rtpproxy/doc/rtpproxy.xml
index 741a4d9..6956e4b 100644
--- a/modules/rtpproxy/doc/rtpproxy.xml
+++ b/modules/rtpproxy/doc/rtpproxy.xml
@@ -75,7 +75,7 @@
 		<holder>Voice Sistem SRL</holder>
 	</copyright>
 	<copyright>
-		<year>2009</year>
+		<year>2009-2012</year>
 		<holder>TuTPro Inc.</holder>
 	</copyright>
 	<copyright>
diff --git a/modules/rtpproxy/doc/rtpproxy_admin.xml b/modules/rtpproxy/doc/rtpproxy_admin.xml
index ca1a0a3..e3a403e 100644
--- a/modules/rtpproxy/doc/rtpproxy_admin.xml
+++ b/modules/rtpproxy/doc/rtpproxy_admin.xml
@@ -492,6 +492,9 @@ onreply_route[2]
 				<emphasis>2</emphasis> - append second Via branch to Call-ID when sending
 				command to rtpproxy. See flag '1' for its meaning.
 				</para></listitem>
+				<listitem><para>
+				<emphasis>t</emphasis> - do not include To tag to <quote>delete</quote> command to rtpproxy thus causing full call to be deleted. Useful for deleting unused rtpproxy call when 200 OK is received on a branch, where rtpproxy is not needed.
+				</para></listitem>
 			</itemizedlist>
 		</listitem>
 		</itemizedlist>
diff --git a/modules/rtpproxy/rtpproxy.c b/modules/rtpproxy/rtpproxy.c
index 72d1f00..cab92ad 100644
--- a/modules/rtpproxy/rtpproxy.c
+++ b/modules/rtpproxy/rtpproxy.c
@@ -1678,6 +1678,7 @@ unforce_rtp_proxy_f(struct sip_msg* msg, char* flags, char* str2)
 	str callid, from_tag, to_tag, viabranch;
 	char *cp;
 	int via = 0;
+	int to = 1;
 	int ret;
 	struct rtpp_node *node;
 	struct iovec v[1 + 4 + 3 + 2] = {{NULL, 0}, {"D", 1}, {" ", 1}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {" ", 1}, {NULL, 0}, {" ", 1}, {NULL, 0}};
@@ -1700,6 +1701,10 @@ unforce_rtp_proxy_f(struct sip_msg* msg, char* flags, char* str2)
 					via = 1;
 				break;
 
+ 		        case 't':
+		        case 'T':
+			    to = 0;
+			    break;
 			case 'a':
 			case 'A':
 			case 'i':
@@ -1736,7 +1741,8 @@ unforce_rtp_proxy_f(struct sip_msg* msg, char* flags, char* str2)
 		return -1;
 	}
 	to_tag.s = 0;
-	if (get_to_tag(msg, &to_tag) == -1) {
+	to_tag.len = 0;
+	if ((to == 1) && get_to_tag(msg, &to_tag) == -1) {
 		LM_ERR("can't get To tag\n");
 		return -1;
 	}
@@ -2150,6 +2156,11 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forc
 			}
 			break;
 
+		case 't':
+		case 'T':
+		        /* Only used in rtpproxy_destroy */
+		        break;
+
 		default:
 			LM_ERR("unknown option `%c'\n", *cp);
 			FORCE_RTP_PROXY_RET (-1);




More information about the sr-dev mailing list