Преглед на файлове

modules/rtpproxy-ng: added setid_avp module param
which can be used (instead of set_rtp_proxy_set function) to select
used rtpproxy set

Juha Heinanen преди 11 години
родител
ревизия
e005b899b2
променени са 4 файла, в които са добавени 191 реда и са изтрити 52 реда
  1. 76 51
      modules/rtpproxy-ng/README
  2. 1 1
      modules/rtpproxy-ng/doc/rtpproxy-ng.xml
  3. 33 0
      modules/rtpproxy-ng/doc/rtpproxy_admin.xml
  4. 81 0
      modules/rtpproxy-ng/rtpproxy.c

+ 76 - 51
modules/rtpproxy-ng/README

@@ -36,15 +36,15 @@ Richard Fuchs
 
 
    Sipwise GmbH
    Sipwise GmbH
 
 
-   Copyright © 2003-2008 Sippy Software, Inc.
+   Copyright (c) 2003-2008 Sippy Software, Inc.
 
 
-   Copyright © 2005 Voice Sistem SRL
+   Copyright (c) 2005 Voice Sistem SRL
 
 
-   Copyright © 2009-2012 TuTPro Inc.
+   Copyright (c) 2009-2014 TuTPro Inc.
 
 
-   Copyright © 2010 VoIPEmbedded Inc.
+   Copyright (c) 2010 VoIPEmbedded Inc.
 
 
-   Copyright © 2013 Sipwise GmbH
+   Copyright (c) 2013 Sipwise GmbH
      __________________________________________________________________
      __________________________________________________________________
 
 
    Table of Contents
    Table of Contents
@@ -65,6 +65,7 @@ Richard Fuchs
               4.3. rtpproxy_tout (integer)
               4.3. rtpproxy_tout (integer)
               4.4. rtpproxy_retr (integer)
               4.4. rtpproxy_retr (integer)
               4.5. extra_id_pv (string)
               4.5. extra_id_pv (string)
+              4.6. setid_avp (string)
 
 
         5. Functions
         5. Functions
 
 
@@ -94,15 +95,16 @@ Richard Fuchs
    1.3. Set rtpproxy_tout parameter
    1.3. Set rtpproxy_tout parameter
    1.4. Set rtpproxy_retr parameter
    1.4. Set rtpproxy_retr parameter
    1.5. Set extra_id_pv parameter
    1.5. Set extra_id_pv parameter
-   1.6. set_rtp_proxy_set usage
-   1.7. rtpproxy_offer usage
-   1.8. rtpproxy_answer usage
-   1.9. rtpproxy_destroy usage
-   1.10. rtpproxy_manage usage
-   1.11. start_recording usage
-   1.12. $rtpstat Usage
-   1.13. nh_enable_rtpp usage
-   1.14. nh_show_rtpp usage
+   1.6. Set setid_avp parameter
+   1.7. set_rtp_proxy_set usage
+   1.8. rtpproxy_offer usage
+   1.9. rtpproxy_answer usage
+   1.10. rtpproxy_destroy usage
+   1.11. rtpproxy_manage usage
+   1.12. start_recording usage
+   1.13. $rtpstat Usage
+   1.14. nh_enable_rtpp usage
+   1.15. nh_show_rtpp usage
 
 
 Chapter 1. Admin Guide
 Chapter 1. Admin Guide
 
 
@@ -122,6 +124,7 @@ Chapter 1. Admin Guide
         4.3. rtpproxy_tout (integer)
         4.3. rtpproxy_tout (integer)
         4.4. rtpproxy_retr (integer)
         4.4. rtpproxy_retr (integer)
         4.5. extra_id_pv (string)
         4.5. extra_id_pv (string)
+        4.6. setid_avp (string)
 
 
    5. Functions
    5. Functions
 
 
@@ -171,12 +174,20 @@ Chapter 1. Admin Guide
    unforce_rtp_proxy(), rtpproxy_offer() or rtpproxy_answer() functions -
    unforce_rtp_proxy(), rtpproxy_offer() or rtpproxy_answer() functions -
    see the set_rtp_proxy_set() function.
    see the set_rtp_proxy_set() function.
 
 
+   Another way to select the set is to define setid_avp module parameter
+   and assign setid to the defined avp before calling rtpproxy_offer() or
+   rtpproxy_manage() function. If forwarding of the requests fails and
+   there is another branch to try, remember to unset the avp after calling
+   rtpproxy_destroy() function.
+
    For backward compatibility reasons, a set with no id take by default
    For backward compatibility reasons, a set with no id take by default
    the id 0. Also if no set is explicitly set before unforce_rtp_proxy(),
    the id 0. Also if no set is explicitly set before unforce_rtp_proxy(),
    rtpproxy_offer() or rtpproxy_answer() the 0 id set will be used.
    rtpproxy_offer() or rtpproxy_answer() the 0 id set will be used.
 
 
    IMPORTANT: if you use multiple sets, take care and use the same set for
    IMPORTANT: if you use multiple sets, take care and use the same set for
-   both rtpproxy_offer()/rtpproxy_answer() and unforce_rtpproxy()!!
+   both rtpproxy_offer()/rtpproxy_answer() and unforce_rtpproxy()!! If the
+   set was selected using setid_avp, the avp needs to be set only once
+   before rtpproxy_offer() or rtpproxy_manage() call.
 
 
 3. Dependencies
 3. Dependencies
 
 
@@ -202,6 +213,7 @@ Chapter 1. Admin Guide
    4.3. rtpproxy_tout (integer)
    4.3. rtpproxy_tout (integer)
    4.4. rtpproxy_retr (integer)
    4.4. rtpproxy_retr (integer)
    4.5. extra_id_pv (string)
    4.5. extra_id_pv (string)
+   4.6. setid_avp (string)
 
 
 4.1. rtpproxy_sock (string)
 4.1. rtpproxy_sock (string)
 
 
@@ -273,6 +285,19 @@ modparam("rtpproxy-ng", "rtpproxy_retr", 2)
 modparam("rtpproxy-ng", "extra_id_pv", "$avp(extra_id)")
 modparam("rtpproxy-ng", "extra_id_pv", "$avp(extra_id)")
 ...
 ...
 
 
+4.6. setid_avp (string)
+
+   The parameter defines an AVP that, if set, determines which rtpproxy
+   set rtpproxy_offer(), rtpproxy_answer(), rtpproxy_destroy(), and
+   rtpproxy_manage() functions use.
+
+   There is no default value.
+
+   Example 1.6. Set setid_avp parameter
+...
+modparam("rtpproxy-ng", "setid_avp", "$avp(setid)")
+...
+
 5. Functions
 5. Functions
 
 
    5.1. set_rtp_proxy_set(setid)
    5.1. set_rtp_proxy_set(setid)
@@ -283,7 +308,7 @@ modparam("rtpproxy-ng", "extra_id_pv", "$avp(extra_id)")
    5.6. rtpproxy_manage([flags [, ip_address]])
    5.6. rtpproxy_manage([flags [, ip_address]])
    5.7. start_recording()
    5.7. start_recording()
 
 
-5.1. set_rtp_proxy_set(setid)
+5.1.  set_rtp_proxy_set(setid)
 
 
    Sets the Id of the rtpproxy set to be used for the next
    Sets the Id of the rtpproxy set to be used for the next
    unforce_rtp_proxy(), rtpproxy_offer(), rtpproxy_answer() or
    unforce_rtp_proxy(), rtpproxy_offer(), rtpproxy_answer() or
@@ -293,13 +318,13 @@ modparam("rtpproxy-ng", "extra_id_pv", "$avp(extra_id)")
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    BRANCH_ROUTE.
    BRANCH_ROUTE.
 
 
-   Example 1.6. set_rtp_proxy_set usage
+   Example 1.7. set_rtp_proxy_set usage
 ...
 ...
 set_rtp_proxy_set("2");
 set_rtp_proxy_set("2");
 rtpproxy_offer();
 rtpproxy_offer();
 ...
 ...
 
 
-5.2. rtpproxy_offer([flags [, ip_address]])
+5.2.  rtpproxy_offer([flags [, ip_address]])
 
 
    Rewrites SDP body to ensure that media is passed through an RTP proxy.
    Rewrites SDP body to ensure that media is passed through an RTP proxy.
    To be invoked on INVITE for the cases the SDPs are in INVITE and 200 OK
    To be invoked on INVITE for the cases the SDPs are in INVITE and 200 OK
@@ -423,7 +448,7 @@ rtpproxy_offer();
 
 
    This function can be used from ANY_ROUTE.
    This function can be used from ANY_ROUTE.
 
 
-   Example 1.7. rtpproxy_offer usage
+   Example 1.8. rtpproxy_offer usage
 route {
 route {
 ...
 ...
     if (is_method("INVITE")) {
     if (is_method("INVITE")) {
@@ -455,7 +480,7 @@ onreply_route[2]
 ...
 ...
 }
 }
 
 
-5.3. rtpproxy_answer([flags [, ip_address]])
+5.3.  rtpproxy_answer([flags [, ip_address]])
 
 
    Rewrites SDP body to ensure that media is passed through an RTP proxy.
    Rewrites SDP body to ensure that media is passed through an RTP proxy.
    To be invoked on 200 OK for the cases the SDPs are in INVITE and 200 OK
    To be invoked on 200 OK for the cases the SDPs are in INVITE and 200 OK
@@ -467,11 +492,11 @@ onreply_route[2]
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE, BRANCH_ROUTE.
    FAILURE_ROUTE, BRANCH_ROUTE.
 
 
-   Example 1.8. rtpproxy_answer usage
+   Example 1.9. rtpproxy_answer usage
 
 
    See rtpproxy_offer() function example above for example.
    See rtpproxy_offer() function example above for example.
 
 
-5.4. rtpproxy_destroy([flags])
+5.4.  rtpproxy_destroy([flags])
 
 
    Tears down the RTPProxy session for the current call.
    Tears down the RTPProxy session for the current call.
 
 
@@ -503,16 +528,16 @@ onreply_route[2]
             rtpproxy call when 200 OK is received on a branch, where
             rtpproxy call when 200 OK is received on a branch, where
             rtpproxy is not needed.
             rtpproxy is not needed.
 
 
-   Example 1.9. rtpproxy_destroy usage
+   Example 1.10. rtpproxy_destroy usage
 ...
 ...
 rtpproxy_destroy();
 rtpproxy_destroy();
 ...
 ...
 
 
-5.5. unforce_rtp_proxy()
+5.5.  unforce_rtp_proxy()
 
 
    Same as rtpproxy_destroy().
    Same as rtpproxy_destroy().
 
 
-5.6. rtpproxy_manage([flags [, ip_address]])
+5.6.  rtpproxy_manage([flags [, ip_address]])
 
 
    Manage the RTPProxy session - it combines the functionality of
    Manage the RTPProxy session - it combines the functionality of
    rtpproxy_offer(), rtpproxy_answer() and unforce_rtpproxy(), detecting
    rtpproxy_offer(), rtpproxy_answer() and unforce_rtpproxy(), detecting
@@ -537,12 +562,12 @@ rtpproxy_destroy();
 
 
    This function can be used from ANY_ROUTE.
    This function can be used from ANY_ROUTE.
 
 
-   Example 1.10. rtpproxy_manage usage
+   Example 1.11. rtpproxy_manage usage
 ...
 ...
 rtpproxy_manage();
 rtpproxy_manage();
 ...
 ...
 
 
-5.7. start_recording()
+5.7.  start_recording()
 
 
    This function will send a signal to the RTP Proxy to record the RTP
    This function will send a signal to the RTP Proxy to record the RTP
    stream on the RTP Proxy. This function is not supported by
    stream on the RTP Proxy. This function is not supported by
@@ -550,7 +575,7 @@ rtpproxy_manage();
 
 
    This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
    This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
 
 
-   Example 1.11. start_recording usage
+   Example 1.12. start_recording usage
 ...
 ...
 start_recording();
 start_recording();
 ...
 ...
@@ -566,7 +591,7 @@ start_recording();
    packet counters. The statistics must be retrieved before the session is
    packet counters. The statistics must be retrieved before the session is
    deleted (before unforce_rtpproxy()).
    deleted (before unforce_rtpproxy()).
 
 
-   Example 1.12. $rtpstat Usage
+   Example 1.13. $rtpstat Usage
 ...
 ...
     append_hf("X-RTP-Statistics: $rtpstat\r\n");
     append_hf("X-RTP-Statistics: $rtpstat\r\n");
 ...
 ...
@@ -589,7 +614,7 @@ start_recording();
    NOTE: if a rtpproxy is defined multiple times (in the same or diferente
    NOTE: if a rtpproxy is defined multiple times (in the same or diferente
    sete), all of its instances will be enables/disabled.
    sete), all of its instances will be enables/disabled.
 
 
-   Example 1.13. nh_enable_rtpp usage
+   Example 1.14.  nh_enable_rtpp usage
 ...
 ...
 $ kamctl fifo nh_enable_rtpp udp:192.168.2.133:8081 0
 $ kamctl fifo nh_enable_rtpp udp:192.168.2.133:8081 0
 ...
 ...
@@ -601,7 +626,7 @@ $ kamctl fifo nh_enable_rtpp udp:192.168.2.133:8081 0
 
 
    No parameter.
    No parameter.
 
 
-   Example 1.14. nh_show_rtpp usage
+   Example 1.15.  nh_show_rtpp usage
 ...
 ...
 $ kamctl fifo nh_show_rtpp
 $ kamctl fifo nh_show_rtpp
 ...
 ...
@@ -615,38 +640,38 @@ Chapter 2. Frequently Asked Questions
 
 
    2.1.
    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.
    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.
    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.
    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.

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

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

+ 33 - 0
modules/rtpproxy-ng/doc/rtpproxy_admin.xml

@@ -53,6 +53,14 @@
 		unforce_rtp_proxy(), rtpproxy_offer() or rtpproxy_answer()
 		unforce_rtp_proxy(), rtpproxy_offer() or rtpproxy_answer()
 		functions - see the set_rtp_proxy_set() function.
 		functions - see the set_rtp_proxy_set() function.
 	</para>
 	</para>
+	<para>
+	        Another way to select the set is to define setid_avp
+	        module parameter and assign setid to the defined avp
+	        before calling rtpproxy_offer() or rtpproxy_manage()
+	        function.  If forwarding of the requests fails and
+	        there is another branch to try, remember to unset the
+	        avp after calling rtpproxy_destroy() function.
+	</para>
 	<para>
 	<para>
 		For backward compatibility reasons, a set with no id take by default
 		For backward compatibility reasons, a set with no id take by default
 		the id 0. Also if no set is explicitly set before
 		the id 0. Also if no set is explicitly set before
@@ -62,6 +70,8 @@
 	<para>
 	<para>
 		IMPORTANT: if you use multiple sets, take care and use the same set for
 		IMPORTANT: if you use multiple sets, take care and use the same set for
 		both rtpproxy_offer()/rtpproxy_answer() and unforce_rtpproxy()!!
 		both rtpproxy_offer()/rtpproxy_answer() and unforce_rtpproxy()!!
+		If the set was selected using setid_avp, the avp needs to be
+		set only once before rtpproxy_offer() or rtpproxy_manage() call.
 	</para>
 	</para>
 	</section>
 	</section>
 
 
@@ -232,6 +242,29 @@ modparam("rtpproxy-ng", "extra_id_pv", "$avp(extra_id)")
 </programlisting>
 </programlisting>
 		</example>
 		</example>
 	</section>
 	</section>
+
+	<section id="rtpproxy-ng.p.setid_pv">
+		<title><varname>setid_avp</varname> (string)</title>
+		<para>
+			The parameter defines an AVP that, if set,
+			determines which rtpproxy set
+			rtpproxy_offer(), rtpproxy_answer(),
+			rtpproxy_destroy(), and rtpproxy_manage()
+			functions use.
+		</para>
+		<para>
+			There is no default value.
+		</para>
+		<example>
+		<title>Set <varname>setid_avp</varname> parameter</title>
+<programlisting format="linespecific">
+...
+modparam("rtpproxy-ng", "setid_avp", "$avp(setid)")
+...
+</programlisting>
+		</example>
+	</section>
+
 	</section>
 	</section>
 
 
 	<section>
 	<section>

+ 81 - 0
modules/rtpproxy-ng/rtpproxy.c

@@ -339,6 +339,7 @@ static int rtpproxy_tout = 1;
 static pid_t mypid;
 static pid_t mypid;
 static unsigned int myseqn = 0;
 static unsigned int myseqn = 0;
 static str extra_id_pv_param = {NULL, 0};
 static str extra_id_pv_param = {NULL, 0};
+static char *setid_avp_param = NULL;
 
 
 static char ** rtpp_strings=0;
 static char ** rtpp_strings=0;
 static int rtpp_sets=0; /*used in rtpproxy_set_store()*/
 static int rtpp_sets=0; /*used in rtpproxy_set_store()*/
@@ -353,6 +354,8 @@ struct rtpp_set * default_rtpp_set=0;
 static unsigned int rtpp_no = 0;
 static unsigned int rtpp_no = 0;
 static int *rtpp_socks = 0;
 static int *rtpp_socks = 0;
 
 
+static int     setid_avp_type;
+static int_str setid_avp;
 
 
 typedef struct rtpp_set_link {
 typedef struct rtpp_set_link {
 	struct rtpp_set *rset;
 	struct rtpp_set *rset;
@@ -449,6 +452,7 @@ static param_export_t params[] = {
 	{"timeout_socket",    	  STR_PARAM, &timeout_socket_str.s  },
 	{"timeout_socket",    	  STR_PARAM, &timeout_socket_str.s  },
 #endif
 #endif
 	{"extra_id_pv",           STR_PARAM, &extra_id_pv_param.s },
 	{"extra_id_pv",           STR_PARAM, &extra_id_pv_param.s },
+	{"setid_avp",             STR_PARAM, &setid_avp_param },
 	{0, 0, 0}
 	{0, 0, 0}
 };
 };
 
 
@@ -892,6 +896,9 @@ static int
 mod_init(void)
 mod_init(void)
 {
 {
 	int i;
 	int i;
+	pv_spec_t *avp_spec;
+	unsigned short avp_flags;
+	str s;
 
 
 	if(register_mi_mod(exports.name, mi_cmds)!=0)
 	if(register_mi_mod(exports.name, mi_cmds)!=0)
 	{
 	{
@@ -934,6 +941,22 @@ mod_init(void)
 		extra_id_pv = NULL;
 		extra_id_pv = NULL;
 	}
 	}
 
 
+	if (setid_avp_param) {
+	    s.s = setid_avp_param; s.len = strlen(s.s);
+	    avp_spec = pv_cache_get(&s);
+	    if (avp_spec==NULL || (avp_spec->type != PVT_AVP)) {
+		LM_ERR("malformed or non AVP definition <%s>\n",
+		       setid_avp_param);
+		return -1;
+	    }
+	    if (pv_get_avp_name(0, &(avp_spec->pvp), &setid_avp,
+				&avp_flags) != 0) {
+		LM_ERR("invalid AVP definition <%s>\n", setid_avp_param);
+		return -1;
+	    }
+	    setid_avp_type = avp_flags;
+	}
+
 	if (rtpp_strings)
 	if (rtpp_strings)
 		pkg_free(rtpp_strings);
 		pkg_free(rtpp_strings);
 
 
@@ -1665,11 +1688,41 @@ get_extra_id(struct sip_msg* msg, str *id_str) {
 
 
 }
 }
 
 
+static int
+set_rtp_proxy_set_from_avp(struct sip_msg *msg)
+{
+    struct usr_avp *avp;
+    int_str setid_val;
+
+    if ((setid_avp_param == NULL) ||
+	(avp = search_first_avp(setid_avp_type, setid_avp, &setid_val, 0))
+	== NULL)
+	return 1;
 
 
+    if (avp->flags&AVP_VAL_STR) {
+	LM_ERR("setid_avp must hold an integer value\n");
+	return -1;
+    }
+    
+    selected_rtpp_set = select_rtpp_set(setid_val.n);
+    if(selected_rtpp_set == NULL) {
+	LM_ERR("could not locate rtpproxy set %d\n", setid_val.n);
+	return -1;
+    }
+
+    LM_DBG("using rtpproxy set %d\n", setid_val.n);
+
+    current_msg_id = msg->id;
+    
+    return 1;
+}
 
 
 static int
 static int
 unforce_rtp_proxy_f(struct sip_msg* msg, const char* str1, char* str2)
 unforce_rtp_proxy_f(struct sip_msg* msg, const char* str1, char* str2)
 {
 {
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	return rtpp_function_call_simple(msg, OP_DELETE, str1);
 	return rtpp_function_call_simple(msg, OP_DELETE, str1);
 }
 }
 
 
@@ -1677,6 +1730,10 @@ static int
 unforce_rtp_proxy1_f(struct sip_msg* msg, char* str1, char* str2)
 unforce_rtp_proxy1_f(struct sip_msg* msg, char* str1, char* str2)
 {
 {
 	str flags;
 	str flags;
+
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	get_str_fparam(&flags, msg, (fparam_t *) str1);
 	get_str_fparam(&flags, msg, (fparam_t *) str1);
 	return rtpp_function_call_simple(msg, OP_DELETE, flags.s);
 	return rtpp_function_call_simple(msg, OP_DELETE, flags.s);
 }
 }
@@ -1777,6 +1834,10 @@ rtpproxy_manage(struct sip_msg *msg, const char *flags, const str *force_addr)
 static int
 static int
 rtpproxy_manage0(struct sip_msg *msg, char *flags, char *ip)
 rtpproxy_manage0(struct sip_msg *msg, char *flags, char *ip)
 {
 {
+
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	return rtpproxy_manage(msg, 0, 0);
 	return rtpproxy_manage(msg, 0, 0);
 }
 }
 
 
@@ -1784,6 +1845,10 @@ static int
 rtpproxy_manage1(struct sip_msg *msg, char *flags, char *ip)
 rtpproxy_manage1(struct sip_msg *msg, char *flags, char *ip)
 {
 {
 	str flag_str;
 	str flag_str;
+
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
 	fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
 	return rtpproxy_manage(msg, flag_str.s, 0);
 	return rtpproxy_manage(msg, flag_str.s, 0);
 }
 }
@@ -1793,6 +1858,10 @@ rtpproxy_manage2(struct sip_msg *msg, char *flags, char *ip)
 {
 {
 	str flag_str;
 	str flag_str;
 	str ip_str;
 	str ip_str;
+
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
 	fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
 	fixup_get_svalue(msg, (gparam_p)ip, &ip_str);
 	fixup_get_svalue(msg, (gparam_p)ip, &ip_str);
 	return rtpproxy_manage(msg, flag_str.s, &ip_str);
 	return rtpproxy_manage(msg, flag_str.s, &ip_str);
@@ -1803,6 +1872,9 @@ rtpproxy_offer1_f(struct sip_msg *msg, char *str1, char *str2)
 {
 {
 	str flags;
 	str flags;
 
 
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	if (str1)
 	if (str1)
 		get_str_fparam(&flags, msg, (fparam_t *) str1);
 		get_str_fparam(&flags, msg, (fparam_t *) str1);
 	else
 	else
@@ -1815,6 +1887,9 @@ rtpproxy_offer2_f(struct sip_msg *msg, char *param1, char *param2)
 {
 {
 	str flags, new_ip;
 	str flags, new_ip;
 
 
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	get_str_fparam(&flags, msg, (fparam_t *) param1);
 	get_str_fparam(&flags, msg, (fparam_t *) param1);
 	get_str_fparam(&new_ip, msg, (fparam_t *) param2);
 	get_str_fparam(&new_ip, msg, (fparam_t *) param2);
 	return force_rtp_proxy(msg, flags.s, &new_ip, OP_OFFER);
 	return force_rtp_proxy(msg, flags.s, &new_ip, OP_OFFER);
@@ -1825,6 +1900,9 @@ rtpproxy_answer1_f(struct sip_msg *msg, char *str1, char *str2)
 {
 {
 	str flags;
 	str flags;
 
 
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	if (msg->first_line.type == SIP_REQUEST)
 	if (msg->first_line.type == SIP_REQUEST)
 		if (msg->first_line.u.request.method_value != METHOD_ACK)
 		if (msg->first_line.u.request.method_value != METHOD_ACK)
 			return -1;
 			return -1;
@@ -1842,6 +1920,9 @@ rtpproxy_answer2_f(struct sip_msg *msg, char *param1, char *param2)
 
 
 	str flags, new_ip;
 	str flags, new_ip;
 
 
+	if (set_rtp_proxy_set_from_avp(msg) == -1)
+	    return -1;
+
 	if (msg->first_line.type == SIP_REQUEST)
 	if (msg->first_line.type == SIP_REQUEST)
 		if (msg->first_line.u.request.method_value != METHOD_ACK)
 		if (msg->first_line.u.request.method_value != METHOD_ACK)
 			return -1;
 			return -1;