2
0
Эх сурвалжийг харах

modules/rtpproxy: allowing rtpproxy_manage to take the flags parameter as a pseudo-variable

- Feature added by Hugh Waite @ Crocodile RCS
Peter Dunkley 12 жил өмнө
parent
commit
222166ef3a

+ 54 - 51
modules/rtpproxy/README

@@ -30,13 +30,13 @@ Carsten Bock
 
    ng-voice GmbH
 
-   Copyright (c) 2003-2008 Sippy Software, Inc.
+   Copyright © 2003-2008 Sippy Software, Inc.
 
-   Copyright (c) 2005 Voice Sistem SRL
+   Copyright © 2005 Voice Sistem SRL
 
-   Copyright (c) 2009-2012 TuTPro Inc.
+   Copyright © 2009-2012 TuTPro Inc.
 
-   Copyright (c) 2010 VoIPEmbedded Inc.
+   Copyright © 2010 VoIPEmbedded Inc.
      __________________________________________________________________
 
    Table of Contents
@@ -169,7 +169,7 @@ Chapter 1. Admin Guide
    The module allows definition of several sets of rtpproxies.
    Load-balancing will be performed over a set and the admin has the
    ability to choose what set should be used. The set is selected via its
-   id - the id being defined with the set. Refer to the "rtpproxy_sock"
+   id - the id being defined with the set. Refer to the “rtpproxy_sock”
    module parameter definition for syntax description.
 
    The balancing inside a set is done automatically by the module based on
@@ -219,7 +219,7 @@ Chapter 1. Admin Guide
    Definition of socket(s) used to connect to (a set) RTPProxy. It may
    specify a UNIX socket or an IPv4/IPv6 UDP socket.
 
-   Default value is "NONE" (disabled).
+   Default value is “NONE” (disabled).
 
    Example 1.1. Set rtpproxy_sock parameter
 ...
@@ -241,7 +241,7 @@ modparam("rtpproxy", "rtpproxy_sock",
    rtpproxy module will not attempt to establish communication to RTPProxy
    for rtpproxy_disable_tout seconds.
 
-   Default value is "60".
+   Default value is “60”.
 
    Example 1.2. Set rtpproxy_disable_tout parameter
 ...
@@ -252,7 +252,7 @@ modparam("rtpproxy", "rtpproxy_disable_tout", 20)
 
    Timeout value in waiting for reply from RTPProxy.
 
-   Default value is "1".
+   Default value is “1”.
 
    Example 1.3. Set rtpproxy_tout parameter
 ...
@@ -264,7 +264,7 @@ modparam("rtpproxy", "rtpproxy_tout", 2)
    How many times the module should retry to send and receive after
    timeout was generated.
 
-   Default value is "5".
+   Default value is “5”.
 
    Example 1.4. Set rtpproxy_retr parameter
 ...
@@ -283,7 +283,7 @@ Note
 
    The string must be a complete SDP line, including the EOH (\r\n).
 
-   Default value is "a=nortpproxy:yes\r\n".
+   Default value is “a=nortpproxy:yes\r\n”.
 
    Example 1.5. Set nortpproxy_str parameter
 ...
@@ -299,7 +299,7 @@ modparam("rtpproxy", "nortpproxy_str", "a=sdpmangled:yes\r\n")
    If it is an empty string, no timeout socket will be transmitted to the
    RTP-Proxy.
 
-   Default value is "" (nothing).
+   Default value is “” (nothing).
 
    Example 1.6. Set timeout_socket parameter
 ...
@@ -325,11 +325,11 @@ modparam("rtpproxy", "ice_candidate_priority_avp", "$avp(ice_priority)")
 
 4.8. extra_id_pv (string)
 
-   The parameter sets the PV defination to use when the "b" parameter is
+   The parameter sets the PV defination to use when the “b” parameter is
    used on unforce_rtp_proxy(), rtpproxy_offer(), rtpproxy_answer() or
    rtpproxy_manage() command.
 
-   Default is empty, the "b" parameter may not be used then.
+   Default is empty, the “b” parameter may not be used then.
 
    Example 1.8. Set extra_id_pv parameter
 ...
@@ -376,16 +376,16 @@ rtpproxy_offer();
      * flags - flags to turn on some features.
           + 1 - append first Via branch to Call-ID when sending command to
             rtpproxy. This can be used to create one media session per
-            branch on the rtpproxy. When sending a subsequent "delete"
+            branch on the rtpproxy. When sending a subsequent “delete”
             command to the rtpproxy, you can then stop just the session
             for a specific branch when passing the flag '1' or '2' in the
-            "unforce_rtpproxy", or stop all sessions for a call when not
+            “unforce_rtpproxy”, or stop all sessions for a call when not
             passing one of those two flags there. This is especially
             useful if you have serially forked call scenarios where
-            rtpproxy gets an "update" command for a new branch, and then a
-            "delete" command for the previous branch, which would
+            rtpproxy gets an “update” command for a new branch, and then a
+            “delete” command for the previous branch, which would
             otherwise delete the full call, breaking the subsequent
-            "lookup" for the new branch. This flag is only supported by
+            “lookup” for the new branch. This flag is only supported by
             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.
@@ -399,12 +399,12 @@ rtpproxy_offer();
             but is usefull when forking to multiple destinations on
             different address families or network segments, requiring
             different rtpproxy parameters. The variable value is taken
-            from the "extra_id_pv". When used, it must be used in every
+            from the “extra_id_pv”. When used, it must be used in every
             call to rtpproxy_manage(), rtpproxy_offer(), rtpproxy_answer()
             and rtpproxy_destroy() with the same contents of the PV. The b
             parameter may not be used in conjunction with the 1, 2 or 3
             parameter to use the Via branch in the Call-ID.
-          + l - force "lookup", that is, only rewrite SDP when
+          + l - force “lookup”, that is, only rewrite SDP when
             corresponding session already exists in the RTP proxy. By
             default is on when the session is to be completed.
           + i, e - these flags specify the direction of the SIP message.
@@ -523,23 +523,24 @@ onreply_route[2]
      * flags - flags to turn on some features.
           + 1 - append first Via branch to Call-ID when sending command to
             rtpproxy. This can be used to create one media session per
-            branch on the rtpproxy. When sending a subsequent "delete"
+            branch on the rtpproxy. When sending a subsequent “delete”
             command to the rtpproxy, you can then stop just the session
             for a specific branch when passing the flag '1' or '2' in the
-            "unforce_rtpproxy", or stop all sessions for a call when not
+            “unforce_rtpproxy”, or stop all sessions for a call when not
             passing one of those two flags there. This is especially
             useful if you have serially forked call scenarios where
-            rtpproxy gets an "update" command for a new branch, and then a
-            "delete" command for the previous branch, which would
+            rtpproxy gets an “update” command for a new branch, and then a
+            “delete” command for the previous branch, which would
             otherwise delete the full call, breaking the subsequent
-            "lookup" for the new branch. This flag is only supported by
+            “lookup” for the new branch. This flag is only supported by
             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.
-          + b - append branch number to Call-ID when sending command to
-            rtpproxy. <listitem>
+          + b - append branch specific variable to Call-ID when sending
+            command to rtpproxy. See rtpproxy_offer() for details.
+            <listitem>
             </listitem>
-            t - do not include To tag to "delete" command to rtpproxy thus
+            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.
@@ -557,9 +558,11 @@ rtpproxy_destroy();
 
    Manage the RTPProxy session - it combines the functionality of
    rtpproxy_offer(), rtpproxy_answer() and unforce_rtpproxy(), detecting
-   internally based on message type and metod which one to execute.
+   internally based on message type and method which one to execute.
 
-   It can take the same parameters as rtpproxy_offer().
+   It can take the same parameters as rtpproxy_offer(). The flags
+   parameter to rtpproxy_manage() can be a configuration variable
+   containing the flags as a string.
 
    Functionality:
      * If INVITE with SDP, then do rtpproxy_offer()
@@ -707,45 +710,45 @@ $ kamctl fifo nh_show_rtpp
 
 Chapter 2. Frequently Asked Questions
 
-   2.1. What happend with "rtpproxy_disable" parameter?
+   2.1. What happend with “rtpproxy_disable” parameter?
    2.2. Where can I find more about Kamailio?
    2.3. Where can I post a question about this module?
    2.4. How can I report a bug?
 
    2.1.
 
-       What happend with "rtpproxy_disable" parameter?
+   What happend with “rtpproxy_disable” parameter?
 
-       It was removed as it became obsolete - now "rtpproxy_sock" can take
-       empty value to disable the rtpproxy functionality.
+   It was removed as it became obsolete - now “rtpproxy_sock” can take
+   empty value to disable the rtpproxy functionality.
 
    2.2.
 
-       Where can I find more about Kamailio?
+   Where can I find more about Kamailio?
 
-       Take a look at http://www.kamailio.org/.
+   Take a look at http://www.kamailio.org/.
 
    2.3.
 
-       Where can I post a question about this module?
+   Where can I post a question about this module?
 
-       First at all check if your question was already answered on one of our
-       mailing lists:
-         * User Mailing List -
-           http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-         * Developer Mailing List -
-           http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
+   First at all check if your question was already answered on one of our
+   mailing lists:
+     * User Mailing List -
+       http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
+     * Developer Mailing List -
+       http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
 
-       E-mails regarding any stable Kamailio release should be sent to
-       <[email protected]> and e-mails regarding development
-       versions should be sent to <[email protected]>.
+   E-mails regarding any stable Kamailio release should be sent to
+   <[email protected]> and e-mails regarding development
+   versions should be sent to <[email protected]>.
 
-       If you want to keep the mail private, send it to
-       <[email protected]>.
+   If you want to keep the mail private, send it to
+   <[email protected]>.
 
    2.4.
 
-       How can I report a bug?
+   How can I report a bug?
 
-       Please follow the guidelines provided at:
-       http://sip-router.org/tracker.
+   Please follow the guidelines provided at:
+   http://sip-router.org/tracker.

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

@@ -579,10 +579,12 @@ rtpproxy_destroy();
 		<para>
 		Manage the RTPProxy session - it combines the functionality of
 		rtpproxy_offer(), rtpproxy_answer() and unforce_rtpproxy(), detecting
-		internally based on message type and metod which one to execute.
+		internally based on message type and method which one to execute.
 		</para>
 		<para>
 		It can take the same parameters as <function>rtpproxy_offer().</function>
+		The flags parameter to rtpproxy_manage() can be a configuration variable
+		containing the flags as a string.
 		</para>
 		<para>
 		Functionality:

+ 10 - 4
modules/rtpproxy/rtpproxy.c

@@ -408,10 +408,10 @@ static cmd_export_t cmds[] = {
 		0, 0,
 		ANY_ROUTE},
 	{"rtpproxy_manage",	(cmd_function)rtpproxy_manage1,     1,
-		0, 0,
+		fixup_spve_null, fixup_free_spve_null,
 		ANY_ROUTE},
 	{"rtpproxy_manage",	(cmd_function)rtpproxy_manage2,     2,
-		0, 0,
+		fixup_spve_str, fixup_free_spve_str,
 		ANY_ROUTE},
 	{0, 0, 0, 0, 0, 0}
 };
@@ -2039,13 +2039,19 @@ rtpproxy_manage0(struct sip_msg *msg, char *flags, char *ip)
 static int
 rtpproxy_manage1(struct sip_msg *msg, char *flags, char *ip)
 {
-	return rtpproxy_manage(msg, flags, 0);
+	str flag_str;
+	fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
+	return rtpproxy_manage(msg, flag_str.s, 0);
 }
 
 static int
 rtpproxy_manage2(struct sip_msg *msg, char *flags, char *ip)
 {
-	return rtpproxy_manage(msg, flags, ip);
+	str flag_str;
+	str ip_str;
+	fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
+	fixup_get_svalue(msg, (gparam_p)ip, &ip_str);
+	return rtpproxy_manage(msg, flag_str.s, ip_str.s);
 }
 
 static int