Jelajahi Sumber

modules_s/nathelper: rtpproxy functionality removed

 - for rtpproxy functionality please use rtpproxy module from modules
Ovidiu Sas 14 tahun lalu
induk
melakukan
59c8621c61

+ 0 - 113
modules_s/nathelper/examples/4to6.cfg

@@ -1,113 +0,0 @@
-# $Id$
-#
-# Simple application level gateway config script.
-#
-# Assumes that SER/rtpproxy run on a machine, which connected to
-# both IPv4 and IPv6 networks.
-#
-# Correspondingly, this machine has two IP addresses: one IPv4
-# and the second one IPv6
-#
-# For example:
-#
-# 192.168.0.1 - "internal" IPv4 address
-# 2002:1234:5678::1 - "external" IPv6 address
-#
-# rtpproxy started with `-l 192.168.0.1 -6 /2002:1234:5678::1' option.
-# ser started with `-l 192.168.0.1 -l [2002:1234:5678::1] option.
-#
-
-# ------------------ module loading ----------------------------------
-
-loadmodule "/usr/local/lib/ser/modules/sl.so"
-loadmodule "/usr/local/lib/ser/modules/tm.so"
-loadmodule "/usr/local/lib/ser/modules/rr.so"
-loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
-loadmodule "/usr/local/lib/ser/modules/usrloc.so"
-loadmodule "/usr/local/lib/ser/modules/registrar.so"
-loadmodule "/usr/local/lib/ser/modules/nathelper.so"
-
-# ----------------- setting module-specific parameters ---------------
-
-# -- nathelper params --
-
-modparam("nathelper", "natping_interval", 15)
-
-# ------------------ main fun below ----------------------------------
-
-route {
-	# initial sanity checks -- messages with
-	# max_forwars == 0, or excessively long requests,
-	# or those that don't addressed to us
-	if (!mf_process_maxfwd_header("10")) {
-		sl_send_reply("483", "Too Many Hops");
-		break;
-	};
-	if (msg:len > max_len) {
-		sl_send_reply("513", "Message too big");
-		break;
-	};
-	if (!(uri == myself) && method == "INVITE") {
-		sl_send_reply("403", "Call cannot be served here");
-		break;
-	};
-
-	if (method == "REGISTER") {
-		if (af == inet) {
-			save("location-inet4");
-		} else if (af == inet6) {
-			save("location-inet6");
-		} else {
-			sl_send_reply("403", "Call cannot be served here");
-		};
-		break;
-	};
-
-	if (method == "INVITE") {
-		if (lookup("location-inet4")) {
-			# Comment out three lines below if you want
-			# RTP for IPv4->IPv4 calls to go directly
-			# between UAs
-			if (af == inet)
-				if (rtpproxy_offer("FAII"))
-					t_on_reply("1");
-			if (af == inet6)
-				if (rtpproxy_offer("FAEI"))
-					t_on_reply("1");
-		} else if (lookup("location-inet6")) {
-			if (af == inet)
-				if (rtpproxy_offer("FAIE"))
-					t_on_reply("1");
-			# Comment out three lines below if you want
-			# RTP for IPv6->IPv6 calls to go directly
-			# between UAs
-			if (af == inet6)
-				if (rtpproxy_offer("FAEE"))
-					t_on_reply("1");
-		} else {
-			sl_send_reply("403", "Call cannot be served here");
-			break;
-		};
-	}
-
-	if (method == "BYE" || method == "CANCEL")
-		unforce_rtp_proxy();
-
-	# Do strict routing if pre-loaded route headers present
-	if (loose_route()) {
-		t_relay();
-		break;
-	};
-
-	if (method == "INVITE")
-		record_route();
-
-        if (!t_relay())
-        	sl_reply_error();
-}
-
-onreply_route[1] {
-	if (!(status=~"183" || status=~"200"))
-		break;
-	rtpproxy_answer("FA");
-}

+ 0 - 104
modules_s/nathelper/examples/alg.cfg

@@ -1,104 +0,0 @@
-# $Id$
-#
-# Simple application level gateway config script.
-#
-# Assumes that SER/rtpproxy run on a machine, which connected to
-# two non-routable letworks: 192.168.0.0/24 and 192.168.1.1/24.
-#
-# Correspondingly, this machine has two IP addresses: 192.168.0.1
-# and 192.168.1.1.
-#
-# 192.168.0.0/24 - "internal" network
-# 192.168.1.0/24 - "external" network
-#
-# rtpproxy started with `-l 192.168.0.1/192.168.1.1' option.
-#
-
-# ------------------ module loading ----------------------------------
-
-loadmodule "/usr/local/lib/ser/modules/sl.so"
-loadmodule "/usr/local/lib/ser/modules/tm.so"
-loadmodule "/usr/local/lib/ser/modules/rr.so"
-loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
-loadmodule "/usr/local/lib/ser/modules/usrloc.so"
-loadmodule "/usr/local/lib/ser/modules/registrar.so"
-loadmodule "/usr/local/lib/ser/modules/nathelper.so"
-
-# ----------------- setting module-specific parameters ---------------
-
-# -- nathelper params --
-
-modparam("nathelper", "natping_interval", 15)
-
-# ------------------ main fun below ----------------------------------
-
-route {
-	# initial sanity checks -- messages with
-	# max_forwars == 0, or excessively long requests,
-	# or those that don't addressed to us
-	if (!mf_process_maxfwd_header("10")) {
-		sl_send_reply("483", "Too Many Hops");
-		break;
-	};
-	if (msg:len > max_len) {
-		sl_send_reply("513", "Message too big");
-		break;
-	};
-	if (!(uri == myself) && method == "INVITE") {
-		sl_send_reply("403", "Call cannot be served here");
-		break;
-	};
-
-	if (method == "REGISTER") {
-		if (dst_ip == 192.168.0.1) {
-			save("location-internal");
-		} else if (dst_ip == 192.168.1.1) {
-			save("location-external");
-		} else {
-			sl_send_reply("403", "Call cannot be served here");
-		};
-		break;
-	};
-
-	if (method == "INVITE") {
-		if (lookup("location-internal")) {
-			if (dst_ip == 192.168.0.1)
-				if (rtpproxy_offer("FAII"))
-					t_on_reply("1");
-			if (dst_ip == 192.168.1.1)
-				if (rtpproxy_offer("FAEI"))
-					t_on_reply("1");
-		} else if (lookup("location-external")) {
-			if (dst_ip == 192.168.0.1)
-				if (rtpproxy_offer("FAIE"))
-					t_on_reply("1");
-			if (dst_ip == 192.168.1.1)
-				if (rtpproxy_offer("FAEE"))
-					t_on_reply("1");
-		} else {
-			sl_send_reply("403", "Call cannot be served here");
-			break;
-		};
-	}
-
-	if (method == "BYE" || method == "CANCEL")
-		unforce_rtp_proxy();
-
-	# Do strict routing if pre-loaded route headers present
-	if (loose_route()) {
-		t_relay();
-		break;
-	};
-
-	if (method == "INVITE")
-		record_route();
-
-        if (!t_relay())
-        	sl_reply_error();
-}
-
-onreply_route[1] {
-	if (!(status=~"183" || status=~"200"))
-		break;
-	rtpproxy_answer("FA");
-}

+ 0 - 73
modules_s/nathelper/nathelper_rtpp.cfg

@@ -1,73 +0,0 @@
-#
-# $Id$
-#
-# example script showing use of nathelper module with RTP proxy
-# (incomplete for sake of brevity)
-#
-
-# ----------- global configuration parameters ------------------------
-
-# debugging mode
-debug=3          
-fork=no
-log_stderror=yes
-
-# ------------------ module loading ----------------------------------
-
-loadmodule "modules/nathelper/nathelper.so"
-loadmodule "modules/textops/textops.so"
-loadmodule "modules/tm/tm.so"
-loadmodule "modules/rr/rr.so"
-loadmodule "modules/registrar/registrar.so"
-loadmodule "modules/usrloc/usrloc.so"
-loadmodule "modules/sl/sl.so"
-
-
-# ------------------ request-routing script --------------------------
-
-# main routing logic
-
-route{
-
-	# compulsory processing of Route header fields and adding RR
-	loose_route();
-
-	# ATA's are symmetric but don't advertise it -- force use of rport 
-	if (search("User-Agent: Cisco ATA.*")) {
-		setflag(1); # remember this is ATA
-		force_rport();
-		fix_nated_contact();
-	};
-
-	/* registration (uses rewritten contacts) */
-	if (method=="REGISTER") {
-		save("foo.bar.com");
-		break;
-	};
-
-	if (method=="INVITE") {
-		record_route();
-		if (isflagset(1)) { # ATA ?
-			rtpproxy_offer();
-		};
-		/* set up reply processing */
-		t_on_reply("1");
-	};
-
-	if (method == "INVITE" || method == "CANCEL") {
-		if (!lookup("foo.bar.com")) {
-			sl_send_reply("404", "Not Found");
-			break;
-		};
-	};
-
-	/* set up reply processing and forward statefuly */
-	t_relay();
-}
-
-# all incoming replies for t_onrepli-ed transactions enter here
-onreply_route[1] {
-	if (status=~"2[0-9][0-9]" && search("Server: Cisco ATA.*"))
-		fix_nated_contact();
-	rtpproxy_answer();
-}

+ 0 - 216
modules_s/nathelper/rtpproxy_stream.c

@@ -1,216 +0,0 @@
-/* $Id$
- *
- * Copyright (C) 2008 Sippy Software, Inc., http://www.sippysoft.com
- *
- * This file is part of ser, a free SIP server.
- *
- * ser is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * For a license to use the ser software under conditions
- * other than those described here, or to purchase support for this
- * software, please contact iptel.org by e-mail at the following addresses:
- *    [email protected]
- *
- * ser is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-#include <stdio.h>
-
-#include "../../ip_addr.h"
-#include "../../parser/msg_parser.h"
-#include "../../sr_module.h"
-#include "nathelper.h"
-#include "nhelpr_funcs.h"
-
-int
-fixup_var_str_int(void **param, int param_no)
-{
-    int ret;
-
-    if (param_no == 1) {
-        ret = fix_param(FPARAM_AVP, param);
-        if (ret <= 0)
-            return ret;
-        if (fix_param(FPARAM_STR, param) != 0)
-            return -1;
-    } else if (param_no == 2) {
-        if (fix_param(FPARAM_INT, param) != 0)
-            return -1;
-    }
-    return 0;
-}
-
-static int
-rtpproxy_stream(struct sip_msg* msg, str *pname, int count, int stream2uac)
-{
-    int nitems;
-    str callid, from_tag, to_tag;
-    struct rtpp_node *node;
-    char cbuf[16];
-    struct iovec v[] = {
-        {NULL,        0},
-        {cbuf,        0}, /* 1 P<count> */
-        {" ",         1},
-        {NULL,        0}, /* 3 callid */
-        {" ",         1},
-        {NULL,        0}, /* 5 pname */
-        {" session ", 9},
-        {NULL,        0}, /* 7 from tag */
-        {";1 ",       3},
-        {NULL,        0}, /* 9 to tag */
-        {";1",        2}
-    };
-
-    if (get_callid(msg, &callid) == -1 || callid.len == 0) {
-        LOG(L_ERR, "ERROR: rtpproxy_stream: can't get Call-Id field\n");
-        return -1;
-    }
-    if (get_to_tag(msg, &to_tag) == -1) {
-        LOG(L_ERR, "ERROR: rtpproxy_stream: can't get To tag\n");
-        return -1;
-    }
-    if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
-        LOG(L_ERR, "ERROR: rtpproxy_stream: can't get From tag\n");
-        return -1;
-    }
-    v[1].iov_len = sprintf(cbuf, "P%d", count);
-    STR2IOVEC(callid, v[3]);
-    STR2IOVEC(*pname, v[5]);
-    node = select_rtpp_node(callid, 1, -1);
-    if (!node) {
-        LOG(L_ERR, "ERROR: rtpproxy_stream: no available proxies\n");
-        return -1;
-    }
-    if (node->rn_ptl_supported == 0) {
-        LOG(L_ERR, "ERROR: rtpproxy_stream: required functionality is not "
-          "supported by the version of the RTPproxy running on the selected "
-          "node.  Please upgrade the RTPproxy and try again.\n");
-        return -1;
-    }
-    nitems = 11;
-    if (stream2uac == 0) {
-        if (to_tag.len == 0)
-            return -1;
-        STR2IOVEC(to_tag, v[7]);
-        STR2IOVEC(from_tag, v[9]);
-    } else {
-        STR2IOVEC(from_tag, v[7]);
-        STR2IOVEC(to_tag, v[9]);
-        if (to_tag.len <= 0)
-            nitems -= 2;
-    }
-    send_rtpp_command(node, v, nitems);
-
-    return 1;
-}
-
-static int
-rtpproxy_stream2_f(struct sip_msg *msg, char *str1, char *str2, int stream2uac)
-{
-    int count;
-    str pname;
-
-    if (get_str_fparam(&pname, msg, (fparam_t*) str1) < 0)
-        return -1;
-    if (get_int_fparam(&count, msg, (fparam_t*) str2) < 0)
-        return -1;
-    return rtpproxy_stream(msg, &pname, count, stream2uac);
-}
-
-int
-rtpproxy_stream2uac2_f(struct sip_msg* msg, char* str1, char* str2)
-{
-
-    return rtpproxy_stream2_f(msg, str1, str2, 1);
-}
-
-int
-rtpproxy_stream2uas2_f(struct sip_msg* msg, char* str1, char* str2)
-{
-
-    return rtpproxy_stream2_f(msg, str1, str2, 0);
-}
-
-static int
-rtpproxy_stop_stream(struct sip_msg* msg, int stream2uac)
-{
-    int nitems;
-    str callid, from_tag, to_tag;
-    struct rtpp_node *node;
-    struct iovec v[] = {
-        {NULL,        0},
-        {"S",         1}, /* 1 */
-        {" ",         1},
-        {NULL,        0}, /* 3 callid */
-        {" ",         1},
-        {NULL,        0}, /* 5 from tag */
-        {";1 ",       3},
-        {NULL,        0}, /* 7 to tag */
-        {";1",        2}
-    };
-
-    if (get_callid(msg, &callid) == -1 || callid.len == 0) {
-        LOG(L_ERR, "ERROR: rtpproxy_stop_stream: can't get Call-Id field\n");
-        return -1;
-    }
-    if (get_to_tag(msg, &to_tag) == -1) {
-        LOG(L_ERR, "ERROR: rtpproxy_stop_stream: can't get To tag\n");
-        return -1;
-    }
-    if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
-        LOG(L_ERR, "ERROR: rtpproxy_stop_stream: can't get From tag\n");
-        return -1;
-    }
-    STR2IOVEC(callid, v[3]);
-    node = select_rtpp_node(callid, 1, -1);
-    if (!node) {
-        LOG(L_ERR, "ERROR: rtpproxy_stop_stream: no available proxies\n");
-        return -1;
-    }
-    if (node->rn_ptl_supported == 0) {
-        LOG(L_ERR, "ERROR: rtpproxy_stream: required functionality is not "
-          "supported by the version of the RTPproxy running on the selected "
-          "node.  Please upgrade the RTPproxy and try again.\n");
-        return -1;
-    }
-    nitems = 9;
-    if (stream2uac == 0) {
-        if (to_tag.len == 0)
-            return -1;
-        STR2IOVEC(to_tag, v[5]);
-        STR2IOVEC(from_tag, v[7]);
-    } else {
-        STR2IOVEC(from_tag, v[5]);
-        STR2IOVEC(to_tag, v[7]);
-        if (to_tag.len <= 0)
-            nitems -= 2;
-    }
-    send_rtpp_command(node, v, nitems);
-
-    return 1;
-}
-
-int
-rtpproxy_stop_stream2uac2_f(struct sip_msg* msg, char* str1, char* str2)
-{
-
-    return rtpproxy_stop_stream(msg, 1);
-}
-
-int
-rtpproxy_stop_stream2uas2_f(struct sip_msg* msg, char* str1, char* str2)
-{
-
-    return rtpproxy_stop_stream(msg, 0);
-}

+ 0 - 37
modules_s/nathelper/rtpproxy_stream.h

@@ -1,37 +0,0 @@
-/* $Id$
- *
- * Copyright (C) 2008 Sippy Software, Inc., http://www.sippysoft.com
- *
- * This file is part of ser, a free SIP server.
- *
- * ser is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * For a license to use the ser software under conditions
- * other than those described here, or to purchase support for this
- * software, please contact iptel.org by e-mail at the following addresses:
- *    [email protected]
- *
- * ser is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-#ifndef _RTPPROXY_STREAM_H
-#define  _RTPPROXY_STREAM_H
-
-int fixup_var_str_int(void **, int);
-int rtpproxy_stream2uac2_f(struct sip_msg *, char *, char *);
-int rtpproxy_stream2uas2_f(struct sip_msg *, char *, char *);
-int rtpproxy_stop_stream2uac2_f(struct sip_msg *, char *, char *);
-int rtpproxy_stop_stream2uas2_f(struct sip_msg *, char *, char *);
-
-#endif