Переглянути джерело

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.

Juha Heinanen 13 роки тому
батько
коміт
d8d80082aa

+ 5 - 1
modules/rtpproxy/README

@@ -34,7 +34,7 @@ Carsten Bock
 
 
    Copyright © 2005 Voice Sistem SRL
    Copyright © 2005 Voice Sistem SRL
 
 
-   Copyright © 2009 TuTPro Inc.
+   Copyright © 2009-2012 TuTPro Inc.
 
 
    Copyright © 2010 VoIPEmbedded Inc.
    Copyright © 2010 VoIPEmbedded Inc.
      __________________________________________________________________
      __________________________________________________________________
@@ -491,6 +491,10 @@ onreply_route[2]
             the ngcp-mediaproxy-ng rtpproxy at the moment!
             the ngcp-mediaproxy-ng rtpproxy at the moment!
           + 2 - append second Via branch to Call-ID when sending command
           + 2 - append second Via branch to Call-ID when sending command
             to rtpproxy. See flag '1' for its meaning.
             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
    Example 1.11. rtpproxy_destroy usage
 ...
 ...

+ 1 - 1
modules/rtpproxy/doc/rtpproxy.xml

@@ -75,7 +75,7 @@
 		<holder>Voice Sistem SRL</holder>
 		<holder>Voice Sistem SRL</holder>
 	</copyright>
 	</copyright>
 	<copyright>
 	<copyright>
-		<year>2009</year>
+		<year>2009-2012</year>
 		<holder>TuTPro Inc.</holder>
 		<holder>TuTPro Inc.</holder>
 	</copyright>
 	</copyright>
 	<copyright>
 	<copyright>

+ 3 - 0
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
 				<emphasis>2</emphasis> - append second Via branch to Call-ID when sending
 				command to rtpproxy. See flag '1' for its meaning.
 				command to rtpproxy. See flag '1' for its meaning.
 				</para></listitem>
 				</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>
 			</itemizedlist>
 		</listitem>
 		</listitem>
 		</itemizedlist>
 		</itemizedlist>

+ 12 - 1
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;
 	str callid, from_tag, to_tag, viabranch;
 	char *cp;
 	char *cp;
 	int via = 0;
 	int via = 0;
+	int to = 1;
 	int ret;
 	int ret;
 	struct rtpp_node *node;
 	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}};
 	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;
 					via = 1;
 				break;
 				break;
 
 
+ 		        case 't':
+		        case 'T':
+			    to = 0;
+			    break;
 			case 'a':
 			case 'a':
 			case 'A':
 			case 'A':
 			case 'i':
 			case 'i':
@@ -1736,7 +1741,8 @@ unforce_rtp_proxy_f(struct sip_msg* msg, char* flags, char* str2)
 		return -1;
 		return -1;
 	}
 	}
 	to_tag.s = 0;
 	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");
 		LM_ERR("can't get To tag\n");
 		return -1;
 		return -1;
 	}
 	}
@@ -2150,6 +2156,11 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forc
 			}
 			}
 			break;
 			break;
 
 
+		case 't':
+		case 'T':
+		        /* Only used in rtpproxy_destroy */
+		        break;
+
 		default:
 		default:
 			LM_ERR("unknown option `%c'\n", *cp);
 			LM_ERR("unknown option `%c'\n", *cp);
 			FORCE_RTP_PROXY_RET (-1);
 			FORCE_RTP_PROXY_RET (-1);