From 818202b607196c2458b7696018c94f0f668eb346 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Jan 21 2013 13:44:20 +0000 Subject: Allow rtpproxy module to accept avps Signed-off-by: Peter Lemenkov --- diff --git a/opensips-0001-Consistently-use-rtpproxy-switches.patch b/opensips-0001-Consistently-use-rtpproxy-switches.patch index 0d90224..88048c1 100644 --- a/opensips-0001-Consistently-use-rtpproxy-switches.patch +++ b/opensips-0001-Consistently-use-rtpproxy-switches.patch @@ -1,7 +1,7 @@ -From c8a672b0b7fd7850425fa3eb14b9f6f641624515 Mon Sep 17 00:00:00 2001 +From c9c84b8bba4ce4804fb017df49bcc8afa854ef89 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Thu, 11 Aug 2011 16:37:04 +0400 -Subject: [PATCH 1/6] Consistently use rtpproxy switches +Subject: [PATCH 1/8] Consistently use rtpproxy switches Signed-off-by: Peter Lemenkov --- @@ -10,7 +10,7 @@ Signed-off-by: Peter Lemenkov 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/rtpproxy/doc/rtpproxy_admin.xml b/modules/rtpproxy/doc/rtpproxy_admin.xml -index 01dbffd..fc3da42 100644 +index d54c1dc..5c735f2 100644 --- a/modules/rtpproxy/doc/rtpproxy_admin.xml +++ b/modules/rtpproxy/doc/rtpproxy_admin.xml @@ -545,7 +545,7 @@ rtpproxy_offer(); @@ -23,10 +23,10 @@ index 01dbffd..fc3da42 100644 diff --git a/modules/rtpproxy/rtpproxy.c b/modules/rtpproxy/rtpproxy.c -index 073d05f..eda5c84 100644 +index 7fc8d89..a9539be 100644 --- a/modules/rtpproxy/rtpproxy.c +++ b/modules/rtpproxy/rtpproxy.c -@@ -3028,8 +3028,6 @@ force_rtp_proxy_body(struct sip_msg* msg, struct force_rtpp_args *args) +@@ -3058,8 +3058,6 @@ force_rtp_proxy_body(struct sip_msg* msg, struct force_rtpp_args *args) enable_notification = 1; break; @@ -36,5 +36,5 @@ index 073d05f..eda5c84 100644 case 'S': if (append_opts(&opts, 'S') == -1) { -- -1.7.12.1 +1.8.1 diff --git a/opensips-0002-Cleanup-Oracle-s-makefiles.patch b/opensips-0002-Cleanup-Oracle-s-makefiles.patch index a2e612d..ad086cb 100644 --- a/opensips-0002-Cleanup-Oracle-s-makefiles.patch +++ b/opensips-0002-Cleanup-Oracle-s-makefiles.patch @@ -1,7 +1,7 @@ -From 0776358b0ab7cff82736e023c0c63f9cee8e0ed1 Mon Sep 17 00:00:00 2001 +From c062ab4950e9894f6dc8188b1516ade92267654b Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Thu, 14 Jun 2012 11:38:48 +0400 -Subject: [PATCH 2/6] Cleanup Oracle's makefiles +Subject: [PATCH 2/8] Cleanup Oracle's makefiles Signed-off-by: Peter Lemenkov --- @@ -137,5 +137,5 @@ index b1c8231..9565134 100644 include ../../Makefile.rules -- -1.7.12.1 +1.8.1 diff --git a/opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.patch b/opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.patch index 9154c36..c3a1b81 100644 --- a/opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.patch +++ b/opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.patch @@ -1,8 +1,8 @@ -From 832ef105219007e6ce826a3005d4fd62f2cde2b2 Mon Sep 17 00:00:00 2001 +From 232711c5bda3fe5b2680bbbaf6eb9a4b59e7b51b Mon Sep 17 00:00:00 2001 From: vladut-paiu Date: Tue, 3 Jul 2012 09:34:52 +0000 -Subject: [PATCH 3/6] Reset column types to NULL upon freeing resultset - columns Credit to Peter Lemenkov +Subject: [PATCH 3/8] Reset column types to NULL upon freeing resultset columns + Credit to Peter Lemenkov --- db/db_res.c | 1 + @@ -21,5 +21,5 @@ index 78868ec..cbba30f 100644 RES_NAMES(_r) = NULL; } -- -1.7.12.1 +1.8.1 diff --git a/opensips-0004-fixed-DB-type-inconsistency.patch b/opensips-0004-fixed-DB-type-inconsistency.patch index dc9fcab..5284b73 100644 --- a/opensips-0004-fixed-DB-type-inconsistency.patch +++ b/opensips-0004-fixed-DB-type-inconsistency.patch @@ -1,7 +1,7 @@ -From 4b4ee944764134013ffa51f4489341c79cd9a87c Mon Sep 17 00:00:00 2001 +From c9b560825a00f48edd81d380235aad0ff567232b Mon Sep 17 00:00:00 2001 From: vladut-paiu Date: Tue, 3 Jul 2012 10:01:52 +0000 -Subject: [PATCH 4/6] fixed DB type inconsistency Credits to Peter Lemenkov +Subject: [PATCH 4/8] fixed DB type inconsistency Credits to Peter Lemenkov --- modules/usrloc/ucontact.c | 4 ++-- @@ -26,5 +26,5 @@ index 17992d5..ea400d2 100644 vals2[4].val.bitmap_val = _c->cflags; -- -1.7.12.1 +1.8.1 diff --git a/opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch b/opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch index 0c5825d..0102671 100644 --- a/opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch +++ b/opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch @@ -1,8 +1,8 @@ -From 8d2e148eda2547805515eaf9f73225c475b00da7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A1=D0=B0=D0=BC=D1?= - =?UTF-8?q?=83=D1=81=D0=B5=D0=BD=D0=BA=D0=BE?= +From 80847a3200e71f3d0aefcf4505a5988b56decf9f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A1=D0=B0=D0=BC?= + =?UTF-8?q?=D1=83=D1=81=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Mon, 25 Jun 2012 17:54:27 +0400 -Subject: [PATCH 5/6] Removed all async Oracle operations - they didn't work +Subject: [PATCH 5/8] Removed all async Oracle operations - they didn't work well anyway --- @@ -606,5 +606,5 @@ index 0000000..24aa4a9 +#endif // ORA_TIMER_H \ No newline at end of file -- -1.7.12.1 +1.8.1 diff --git a/opensips-0006-db_oracle-Fix-default-ret-result.patch b/opensips-0006-db_oracle-Fix-default-ret-result.patch index 6a8db36..4a81ef9 100644 --- a/opensips-0006-db_oracle-Fix-default-ret-result.patch +++ b/opensips-0006-db_oracle-Fix-default-ret-result.patch @@ -1,7 +1,7 @@ -From f65cfdd3fd7fc695624f12db7fa427b1e3c5ca39 Mon Sep 17 00:00:00 2001 +From 69108e1ee4727b4c70e76b6d97e3a9402a98711d Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Tue, 14 Aug 2012 15:43:46 +0400 -Subject: [PATCH 6/6] [db_oracle] Fix default ret result +Subject: [PATCH 6/8] [db_oracle] Fix default ret result Signed-off-by: Peter Lemenkov --- @@ -24,5 +24,5 @@ index 2c625f8..22f10ee 100644 dtype = SQLT_CHR; len = 0; /* DATA_SIZE is ub2 */ -- -1.7.12.1 +1.8.1 diff --git a/opensips-0007-small-cleanup-on-STR-init-definition.patch b/opensips-0007-small-cleanup-on-STR-init-definition.patch new file mode 100644 index 0000000..3651428 --- /dev/null +++ b/opensips-0007-small-cleanup-on-STR-init-definition.patch @@ -0,0 +1,26 @@ +From d59a54a6ba7390d44ad92979f2cf6e149192aba8 Mon Sep 17 00:00:00 2001 +From: bogdan_iancu +Date: Thu, 17 Jan 2013 10:46:49 +0000 +Subject: [PATCH 7/8] - small cleanup on STR init definition Credits go to + Peter Lemenkov Closes patch #3600350 + +--- + modules/sipmsgops/codecs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/sipmsgops/codecs.c b/modules/sipmsgops/codecs.c +index f7cad95..480ebf3 100644 +--- a/modules/sipmsgops/codecs.c ++++ b/modules/sipmsgops/codecs.c +@@ -414,7 +414,7 @@ static int stream_process(struct sip_msg * msg, struct sdp_stream_cell *cell, + { NULL,0,{"32",2},{ "MPV",3},{"90000",5},{NULL,0},{NULL,0} }, /*32 - MPV/90000 */ + { NULL,0,{"33",2},{"MP2T",4},{"90000",5},{NULL,0},{NULL,0} }, /*33 - MP2T/90000 */ + { NULL,0,{"34",2},{"H263",4},{"90000",5},{NULL,0},{NULL,0} }, /*34 - H263/90000 */ +- { NULL,0,{NULL,1},{ NULL,3},{ NULL,0},{NULL,0},{NULL,0} } ++ { NULL,0,{NULL,0},{ NULL,0},{ NULL,0},{NULL,0},{NULL,0} } + }; + sdp_payload_attr_t *payload; + char *cur, *tmp, *buff, temp; +-- +1.8.1 + diff --git a/opensips-0008-allow-variables-into-both-params-of-rtpproxy_-answer.patch b/opensips-0008-allow-variables-into-both-params-of-rtpproxy_-answer.patch new file mode 100644 index 0000000..887f0cf --- /dev/null +++ b/opensips-0008-allow-variables-into-both-params-of-rtpproxy_-answer.patch @@ -0,0 +1,172 @@ +From 9c24e98009e1988abe0d89a8d935e9ec28d2d404 Mon Sep 17 00:00:00 2001 +From: bogdan_iancu +Date: Thu, 17 Jan 2013 15:44:54 +0000 +Subject: [PATCH 8/8] - allow variables into both params of + rtpproxy_[answer|offer] Based on a patch contributed by Peter Lemenkov. + Closes patch #3600377 + +--- + modules/rtpproxy/rtpproxy.c | 88 ++++++++++++++++++++++++++++++++++----------- + 1 file changed, 68 insertions(+), 20 deletions(-) + +diff --git a/modules/rtpproxy/rtpproxy.c b/modules/rtpproxy/rtpproxy.c +index a9539be..f6ef948 100644 +--- a/modules/rtpproxy/rtpproxy.c ++++ b/modules/rtpproxy/rtpproxy.c +@@ -161,6 +161,7 @@ + #include "../../error.h" + #include "../../forward.h" + #include "../../mem/mem.h" ++#include "../../mod_fix.h" + #include "../../timer.h" + #include "../../parser/parse_from.h" + #include "../../parser/parse_to.h" +@@ -359,43 +360,43 @@ static cmd_export_t cmds[] = { + {"set_rtp_proxy_set", (cmd_function)set_rtp_proxy_set_f, 1, + fixup_set_id, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"unforce_rtp_proxy", (cmd_function)unforce_rtp_proxy_f, 0, ++ {"unforce_rtp_proxy", (cmd_function)unforce_rtp_proxy_f, 0, + 0, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy0_f, 0, ++ {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy0_f, 0, + fixup_engage, 0, + REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy1_f, 1, ++ {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy1_f, 1, + fixup_engage, 0, + REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy2_f, 2, ++ {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy2_f, 2, + fixup_engage, 0, + REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"start_recording", (cmd_function)start_recording_f, 0, ++ {"start_recording", (cmd_function)start_recording_f, 0, + 0, 0, + REQUEST_ROUTE | ONREPLY_ROUTE }, +- {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 0, ++ {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 0, + 0, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 1, +- 0, 0, ++ {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 1, ++ fixup_spve_null, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 2, +- 0, 0, ++ {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 2, ++ fixup_spve_spve, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 0, ++ {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 0, + 0, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 1, +- 0, 0, ++ {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 1, ++ fixup_spve_null, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 2, +- 0, 0, ++ {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 2, ++ fixup_spve_spve, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, +- {"rtpproxy_stream2uac",(cmd_function)rtpproxy_stream2uac2_f, 2, ++ {"rtpproxy_stream2uac",(cmd_function)rtpproxy_stream2uac2_f, 2, + fixup_var_str_int, 0, + REQUEST_ROUTE | ONREPLY_ROUTE }, +- {"rtpproxy_stream2uas",(cmd_function)rtpproxy_stream2uas2_f, 2, ++ {"rtpproxy_stream2uas",(cmd_function)rtpproxy_stream2uas2_f, 2, + fixup_var_str_int, 0, + REQUEST_ROUTE | ONREPLY_ROUTE }, + {"rtpproxy_stop_stream2uac",(cmd_function)rtpproxy_stop_stream2uac2_f,0, +@@ -2335,9 +2336,33 @@ pkg_strdup(char *cp) + return (rval); + } + ++ ++static int rtpp_get_var_svalue(struct sip_msg *msg, gparam_p gp, str *val, int n) ++{ ++ #define MAX_BUF 64 ++ static char buf[2][MAX_BUF]; ++ str tmp; ++ ++ if (gp->type==GPARAM_TYPE_STR) { ++ *val = gp->v.sval; ++ return 0; ++ } ++ ++ if ( fixup_get_svalue(msg, gp, &tmp)!=0 ) ++ return -1; ++ val->s = buf[n]; ++ val->len = (tmp.len>MAX_BUF-1) ? MAX_BUF-1 : tmp.len ; ++ memcpy(val->s,tmp.s, val->len); ++ val->s[val->len] = 0; ++ return 0; ++} ++ + static int + rtpproxy_offer2_f(struct sip_msg *msg, char *param1, char *param2) + { ++ str flag_str; ++ str ip_str; ++ + if(rtpp_notify_socket.s) + { + if ( (!msg->to && parse_headers(msg, HDR_TO_F,0)<0) || !msg->to ) { +@@ -2345,24 +2370,47 @@ rtpproxy_offer2_f(struct sip_msg *msg, char *param1, char *param2) + return -1; + } + +- + /* if an initial request - create a new dialog */ + if(get_to(msg)->tag_value.s == NULL) + dlg_api.create_dlg(msg,0); + } + +- return force_rtp_proxy(msg, param1, param2, 1); ++ if (rtpp_get_var_svalue(msg, (gparam_p)param1, &flag_str, 0)<0) { ++ LM_ERR("bogus flags parameter\n"); ++ return -1; ++ } ++ if (param2!=NULL) { ++ if (rtpp_get_var_svalue(msg, (gparam_p)param2, &ip_str,1)<0) { ++ LM_ERR("bogus IP addr parameter\n"); ++ return -1; ++ } ++ return force_rtp_proxy(msg, flag_str.s, ip_str.s, 1); ++ } ++ return force_rtp_proxy(msg, flag_str.s, NULL, 1); + } + + static int + rtpproxy_answer2_f(struct sip_msg *msg, char *param1, char *param2) + { ++ str flag_str; ++ str ip_str; + + if (msg->first_line.type == SIP_REQUEST) + if (msg->first_line.u.request.method_value != METHOD_ACK) + return -1; + +- return force_rtp_proxy(msg, param1, param2, 0); ++ if (rtpp_get_var_svalue(msg, (gparam_p)param1, &flag_str, 0)<0) { ++ LM_ERR("bogus flags parameter\n"); ++ return -1; ++ } ++ if (param2!=NULL) { ++ if (rtpp_get_var_svalue(msg, (gparam_p)param2, &ip_str,1)<0) { ++ LM_ERR("bogus IP addr parameter\n"); ++ return -1; ++ } ++ return force_rtp_proxy(msg, flag_str.s, ip_str.s, 0); ++ } ++ return force_rtp_proxy(msg, flag_str.s, param2, 0); + } + + static void engage_callback(struct dlg_cell *dlg, int type, +-- +1.8.1 + diff --git a/opensips.spec b/opensips.spec index 07d1161..17570f2 100644 --- a/opensips.spec +++ b/opensips.spec @@ -18,7 +18,7 @@ Summary: Open Source SIP Server Name: opensips Version: 1.8.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: System Environment/Daemons Source0: http://opensips.org/pub/%{name}/%{version}/src/%{name}-%{version}_src.tar.gz @@ -28,6 +28,8 @@ Patch3: opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.pat Patch4: opensips-0004-fixed-DB-type-inconsistency.patch Patch5: opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch Patch6: opensips-0006-db_oracle-Fix-default-ret-result.patch +Patch7: opensips-0007-small-cleanup-on-STR-init-definition.patch +Patch8: opensips-0008-allow-variables-into-both-params-of-rtpproxy_-answer.patch URL: http://opensips.org BuildRequires: expat-devel @@ -72,9 +74,9 @@ BuildRequireS: json-c-devel %if 0%{?fedora} > 16 # Users and groups Requires(pre): shadow-utils -Requires(post): systemd-units -Requires(preun): systemd-units -Requires(postun): systemd-units +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd %else Requires(post): chkconfig Requires(preun):chkconfig @@ -632,6 +634,8 @@ clients. rm -f modules/db_oracle/asynch.* %patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch8 -p1 %build LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \ @@ -701,21 +705,14 @@ useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \ %post %if 0%{?fedora} > 16 -if [ $1 -eq 1 ] ; then - # Initial installation - /bin/systemctl daemon-reload >/dev/null 2>&1 || : -fi +%systemd_post %else /sbin/chkconfig --add %{name} %endif %preun %if 0%{?fedora} > 16 -if [ $1 -eq 0 ] ; then - # Package removal, not upgrade - /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : - /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : -fi +%systemd_preun %{name}.service %else if [ $1 = 0 ]; then /sbin/service %{name} stop > /dev/null 2>&1 @@ -1203,6 +1200,10 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %doc docdir/README.xmpp %changelog +* Thu Jan 10 2013 Peter Lemenkov - 1.8.2-2 +- Allow rtpproxy module to accept avps +- Few bugfixes + * Tue Nov 06 2012 Peter Lemenkov - 1.8.2-1 - Ver. 1.8.2 (Bugfix release) @@ -1211,7 +1212,7 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} * Fri Aug 17 2012 Peter Lemenkov - 1.8.1-2 - Enabled json module -- Enabled mi_xmlrpc module +- Enabled xmlrpc module - Enabled cachedb_memcached module on EL5, EL6 - Enabled cachedb_redis module on EL6 diff --git a/sources b/sources index 433d460..83dfc66 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4526d79ef93c31f96573e85a193e958c opensips-1.8.2_src.tar.gz +c466984e0afefdc7f93fbd63fe92b1f6 opensips-1.8.2_src.tar.gz