blob: fa6224c12370075e7209d52307fc0796ccb11110 [file] [log] [blame]
Holger Hans Peter Freytherf67945f2009-10-09 07:08:11 +02001/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
2
3/*
4 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
5 * (C) 2009 by on-waves.com
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24unsigned int rtp_base_port = 4000;
25
26/**
27 * Calculate the RTP audio port for the given multiplex
28 * and the direction. This allows a semi static endpoint
29 * to port calculation removing the need for the BSC
30 * and the MediaGateway to communicate.
31 *
32 * Port usage explained:
33 * base + (multiplex * 2) + 0 == local port to wait for network packets
34 * base + (multiplex * 2) + 1 == local port for rtcp
35 *
36 * The above port will receive packets from the BTS that need
37 * to be patched and forwarded to the network.
38 * The above port will receive packets from the network that
39 * need to be patched and forwarded to the BTS.
40 *
41 * We assume to have a static BTS IP address so we can differentiate
42 * network and BTS.
43 *
44 */
45int rtp_calculate_port(int multiplex, int base)
46{
47 return base + (multiplex * 2);
48}