[sr-dev] git:master: rtpproxy: return -2 for force_rtp_proxy if rtpproxy was already used

Daniel-Constantin Mierla miconda at gmail.com
Fri Sep 24 11:55:25 CEST 2010


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Sep 24 11:53:38 2010 +0200

rtpproxy: return -2 for force_rtp_proxy if rtpproxy was already used

- patch by Alex Hermann, closed SF#3035804

---

 modules_k/rtpproxy/README                 |  103 ++++++++++++++++++++++++-----
 modules_k/rtpproxy/doc/rtpproxy_admin.xml |    5 ++
 modules_k/rtpproxy/rtpproxy.c             |    2 +-
 3 files changed, 91 insertions(+), 19 deletions(-)

diff --git a/modules_k/rtpproxy/README b/modules_k/rtpproxy/README
index 94c2ec0..df60fb7 100644
--- a/modules_k/rtpproxy/README
+++ b/modules_k/rtpproxy/README
@@ -54,6 +54,8 @@ Sas Ovidiu
               4.4. rtpproxy_retr (integer)
               4.5. force_socket (string)
               4.6. nortpproxy_str (string)
+              4.7. timeout_socket (string)
+              4.8. timeout_socket_type (int)
 
         5. Exported Functions
 
@@ -69,6 +71,9 @@ Sas Ovidiu
               5.8. start_recording()
 
         6. Exported Pseudo Variables
+
+              6.1. $rtpstart
+
         7. MI Commands
 
               7.1. nh_enable_rtpp
@@ -84,15 +89,18 @@ Sas Ovidiu
    1.4. Set rtpproxy_retr parameter
    1.5. Set force_socket parameter
    1.6. Set nortpproxy_str parameter
-   1.7. fix_nated_contact usage
-   1.8. force_rtp_proxy usage
-   1.9. rtpproxy_offer usage
-   1.10.
-   1.11. unforce_rtp_proxy usage
-   1.12. rtpproxy_stream2xxx usage
-   1.13. start_recording usage
-   1.14. nh_enable_rtpp usage
-   1.15. nh_show_rtpp usage
+   1.7. Set timeout_socket parameter
+   1.8. Set timeout_socket_type parameter
+   1.9. fix_nated_contact usage
+   1.10. force_rtp_proxy usage
+   1.11. rtpproxy_offer usage
+   1.12.
+   1.13. unforce_rtp_proxy usage
+   1.14. rtpproxy_stream2xxx usage
+   1.15. start_recording usage
+   1.16. $rtpstat-Usage
+   1.17. nh_enable_rtpp usage
+   1.18. nh_show_rtpp usage
 
 Chapter 1. Admin Guide
 
@@ -113,6 +121,8 @@ Chapter 1. Admin Guide
         4.4. rtpproxy_retr (integer)
         4.5. force_socket (string)
         4.6. nortpproxy_str (string)
+        4.7. timeout_socket (string)
+        4.8. timeout_socket_type (int)
 
    5. Exported Functions
 
@@ -128,6 +138,9 @@ Chapter 1. Admin Guide
         5.8. start_recording()
 
    6. Exported Pseudo Variables
+
+        6.1. $rtpstart
+
    7. MI Commands
 
         7.1. nh_enable_rtpp
@@ -193,6 +206,8 @@ Chapter 1. Admin Guide
    4.4. rtpproxy_retr (integer)
    4.5. force_socket (string)
    4.6. nortpproxy_str (string)
+   4.7. timeout_socket (string)
+   4.8. timeout_socket_type (int)
 
 4.1. rtpproxy_sock (string)
 
@@ -281,6 +296,40 @@ Note
 modparam("rtpproxy", "nortpproxy_str", "a=sdpmangled:yes\r\n")
 ...
 
+4.7. timeout_socket (string)
+
+   The parameter sets timeout socket, which is transmitted to the
+   RTP-Proxy.
+
+   If it is an empty string, no timeout socket will be transmitted to the
+   RTP-Proxy.
+
+   Default value is “”.
+
+   Example 1.7. Set timeout_socket parameter
+...
+modparam("nathelper", "timeout_socket", "http://127.0.0.1:8000/RPC2")
+...
+
+4.8. timeout_socket_type (int)
+
+   The parameter sets type of the timeout socket, which is transmitted to
+   the RTP-Proxy.
+
+   If it is not set, type 1 (Kamailio XML-RPC-Socket) is transmitted to
+   the RTP-Proxy.
+
+   Default value is “1”.
+
+   Example 1.8. Set timeout_socket_type parameter
+...
+modparam("nathelper", "timeout_socket_type", 42)
+...
+
+   The only supported Type on the RTP-Proxy is currently “1” or “0” which
+   is the default socket-type of the RTP-Proxy which is not compatible to
+   Kamailio.
+
 5. Exported Functions
 
    5.1. set_rtp_proxy_set()
@@ -302,7 +351,7 @@ modparam("rtpproxy", "nortpproxy_str", "a=sdpmangled:yes\r\n")
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    BRANCH_ROUTE.
 
-   Example 1.7. fix_nated_contact usage
+   Example 1.9. fix_nated_contact usage
 ...
 set_rtp_proxy_set("2");
 force_rtp_proxy();
@@ -384,10 +433,14 @@ force_rtp_proxy();
             100ms saves two thirds of the network bandwith.
      * ip_address - new SDP IP address.
 
+   It returns value -2 when a rtp proxy has already mangled the packet,
+   making possible to determine in the script if an rtpproxy is in the
+   audio path.
+
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE, BRANCH_ROUTE.
 
-   Example 1.8. force_rtp_proxy usage
+   Example 1.10. force_rtp_proxy usage
 ...
 if (search("User-Agent: Cisco ATA.*") {force_rtp_proxy();};
 if (src_ip=1.2.3.4) {force_rtp_proxy("i");};
@@ -407,7 +460,7 @@ if (search("User-Agent: Cisco ATA.*") {force_rtp_proxy("","1.2.3.4");};
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE, BRANCH_ROUTE.
 
-   Example 1.9. rtpproxy_offer usage
+   Example 1.11. rtpproxy_offer usage
 route {
 ...
     if (is_method("INVITE")) {
@@ -452,7 +505,7 @@ onreply_route[2]
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE, BRANCH_ROUTE.
 
-   Example 1.10.
+   Example 1.12.
 
    See rtpproxy_offer() function example above for example.
 
@@ -463,7 +516,7 @@ onreply_route[2]
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE, BRANCH_ROUTE.
 
-   Example 1.11. unforce_rtp_proxy usage
+   Example 1.13. unforce_rtp_proxy usage
 ...
 unforce_rtp_proxy();
 ...
@@ -500,7 +553,7 @@ rtpproxy_stream2uas(prompt_name, count)
        -1 means that it will be streaming in loop indefinitely, until
        appropriate rtpproxy_stop_stream2xxx is issued.
 
-   Example 1.12. rtpproxy_stream2xxx usage
+   Example 1.14. rtpproxy_stream2xxx usage
 ...
     if (is_method("INVITE")) {
         rtpproxy_offer();
@@ -528,13 +581,27 @@ rtpproxy_stream2uas(prompt_name, count)
 
    This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
 
-   Example 1.13. start_recording usage
+   Example 1.15. start_recording usage
 ...
 start_recording();
 ...
 
 6. Exported Pseudo Variables
 
+   6.1. $rtpstart
+
+6.1. $rtpstart
+
+   Returns the RTP-Statistics from the RTP-Proxy. The RTP-Statistics from
+   the RTP-Proxy are provided as a string and it does contain several
+   packet-counters. The statistics must be retrieved before the session is
+   deleted (before unforce_rtpproxy).
+
+   Example 1.16. $rtpstat-Usage
+...
+    append_hf("X-RTP-Statistics: $rtpstat\r\n");
+...
+
 7. MI Commands
 
    7.1. nh_enable_rtpp
@@ -553,7 +620,7 @@ start_recording();
    NOTE: if a rtpproxy is defined multiple times (in the same or diferente
    sete), all its instances will be enables/disabled.
 
-   Example 1.14.  nh_enable_rtpp usage
+   Example 1.17.  nh_enable_rtpp usage
 ...
 $ kamctl fifo nh_enable_rtpp udp:192.168.2.133:8081 0
 ...
@@ -565,7 +632,7 @@ $ kamctl fifo nh_enable_rtpp udp:192.168.2.133:8081 0
 
    No parameter.
 
-   Example 1.15.  nh_show_rtpp usage
+   Example 1.18.  nh_show_rtpp usage
 ...
 $ kamctl fifo nh_show_rtpp
 ...
diff --git a/modules_k/rtpproxy/doc/rtpproxy_admin.xml b/modules_k/rtpproxy/doc/rtpproxy_admin.xml
index 0074b6d..2bf5cac 100644
--- a/modules_k/rtpproxy/doc/rtpproxy_admin.xml
+++ b/modules_k/rtpproxy/doc/rtpproxy_admin.xml
@@ -419,6 +419,11 @@ force_rtp_proxy();
 		</para></listitem>
 		</itemizedlist>
 		<para>
+			It returns value -2 when a rtp proxy has already mangled the
+			packet, making possible to determine in the script if an
+			rtpproxy is in the audio path.
+		</para>
+		<para>
 		This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
 		FAILURE_ROUTE, BRANCH_ROUTE.
 		</para>
diff --git a/modules_k/rtpproxy/rtpproxy.c b/modules_k/rtpproxy/rtpproxy.c
index 3680099..494cda0 100644
--- a/modules_k/rtpproxy/rtpproxy.c
+++ b/modules_k/rtpproxy/rtpproxy.c
@@ -2005,7 +2005,7 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer)
 		}
 	}
 	if (proxied != 0 && force == 0) {
-		FORCE_RTP_PROXY_RET (-1);
+		FORCE_RTP_PROXY_RET (-2);
 	}
 	/*
 	 * Parsing of SDP body.




More information about the sr-dev mailing list