mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-03 21:43:32 +00:00 
			
		
		
		
	Compare commits
	
		
			141 Commits
		
	
	
		
			1.12.2
			...
			lynxis/pre
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					c56f68abd7 | ||
| 
						 | 
					01fc7fb239 | ||
| 
						 | 
					370f4e3867 | ||
| 
						 | 
					3acaadd44d | ||
| 
						 | 
					f6a9cd53f4 | ||
| 
						 | 
					f81151bd3f | ||
| 
						 | 
					9c0bab9b48 | ||
| 
						 | 
					2fa9279702 | ||
| 
						 | 
					a622828806 | ||
| 
						 | 
					2ab3af5263 | ||
| 
						 | 
					8571981205 | ||
| 
						 | 
					2930c2d8ad | ||
| 
						 | 
					6cd30366be | ||
| 
						 | 
					ffb3e8d2ec | ||
| 
						 | 
					b3f606a826 | ||
| 
						 | 
					838a381b49 | ||
| 
						 | 
					c5aed8c10e | ||
| 
						 | 
					5b2283ba68 | ||
| 
						 | 
					f42457ec98 | ||
| 
						 | 
					09db3b69ed | ||
| 
						 | 
					4ebab46847 | ||
| 
						 | 
					19c4fd0562 | ||
| 
						 | 
					e198087a15 | ||
| 
						 | 
					50643e419d | ||
| 
						 | 
					e21c93fc96 | ||
| 
						 | 
					956a2eb418 | ||
| 
						 | 
					90835e0083 | ||
| 
						 | 
					8643faad59 | ||
| 
						 | 
					03e1d5c7c5 | ||
| 
						 | 
					5bc821566f | ||
| 
						 | 
					b67fb4fc63 | ||
| 
						 | 
					4b36c7a34e | ||
| 
						 | 
					15b06b9d3c | ||
| 
						 | 
					241f119d8e | ||
| 
						 | 
					5938727956 | ||
| 
						 | 
					ec49e842fe | ||
| 
						 | 
					3ae6040afd | ||
| 
						 | 
					9b0db3860c | ||
| 
						 | 
					0317b106fe | ||
| 
						 | 
					920420284c | ||
| 
						 | 
					ae33266f6c | ||
| 
						 | 
					ea452c93ca | ||
| 
						 | 
					195cab61ab | ||
| 
						 | 
					23880357f2 | ||
| 
						 | 
					2fd3a60ed8 | ||
| 
						 | 
					569335bc34 | ||
| 
						 | 
					4c098cfb32 | ||
| 
						 | 
					d3f2ae8d6a | ||
| 
						 | 
					faa1b9dd0a | ||
| 
						 | 
					f85f656b18 | ||
| 
						 | 
					51442a7886 | ||
| 
						 | 
					88824c7c7d | ||
| 
						 | 
					6202b37a0b | ||
| 
						 | 
					dd93694587 | ||
| 
						 | 
					ead844e65e | ||
| 
						 | 
					d6278889c4 | ||
| 
						 | 
					2535d12377 | ||
| 
						 | 
					ed21f2eecf | ||
| 
						 | 
					31b05fe895 | ||
| 
						 | 
					e4b33dd303 | ||
| 
						 | 
					184892b371 | ||
| 
						 | 
					8a3c5a0699 | ||
| 
						 | 
					7d5e706964 | ||
| 
						 | 
					04d1ca7895 | ||
| 
						 | 
					e4dc412e7b | ||
| 
						 | 
					1f94ba58ea | ||
| 
						 | 
					104548372c | ||
| 
						 | 
					79b2387c0b | ||
| 
						 | 
					39bc234f9e | ||
| 
						 | 
					3a401548ce | ||
| 
						 | 
					cc12b708a7 | ||
| 
						 | 
					114c4ff913 | ||
| 
						 | 
					9fa9783dc6 | ||
| 
						 | 
					3d09bbbbc4 | ||
| 
						 | 
					34ed929877 | ||
| 
						 | 
					fef5ee84f2 | ||
| 
						 | 
					ad228e16cf | ||
| 
						 | 
					869842e16c | ||
| 
						 | 
					3bac10082a | ||
| 
						 | 
					158d842969 | ||
| 
						 | 
					a2ec888287 | ||
| 
						 | 
					1a331b5405 | ||
| 
						 | 
					83d75bb19a | ||
| 
						 | 
					7a8e4a0215 | ||
| 
						 | 
					d4d44cacbc | ||
| 
						 | 
					554488dee8 | ||
| 
						 | 
					d46c75dac9 | ||
| 
						 | 
					2a6629b27e | ||
| 
						 | 
					95e1a3b53c | ||
| 
						 | 
					00a0862e9c | ||
| 
						 | 
					d4195472f5 | ||
| 
						 | 
					741b987923 | ||
| 
						 | 
					3398964176 | ||
| 
						 | 
					c5bb5816cd | ||
| 
						 | 
					1c832b34b1 | ||
| 
						 | 
					88e9ecbfb5 | ||
| 
						 | 
					3386a8791e | ||
| 
						 | 
					2529f046e8 | ||
| 
						 | 
					ae819a1be4 | ||
| 
						 | 
					2878423b95 | ||
| 
						 | 
					714b2281b8 | ||
| 
						 | 
					c7aa82b109 | ||
| 
						 | 
					d69cdf75e0 | ||
| 
						 | 
					6cad4c3e7f | ||
| 
						 | 
					2238185739 | ||
| 
						 | 
					456dbb8070 | ||
| 
						 | 
					a3df1f8732 | ||
| 
						 | 
					e66311b1bd | ||
| 
						 | 
					7e77a293a5 | ||
| 
						 | 
					2932bc4955 | ||
| 
						 | 
					1168969378 | ||
| 
						 | 
					3d5990fc65 | ||
| 
						 | 
					21ca60807c | ||
| 
						 | 
					aba422a6cc | ||
| 
						 | 
					d0a25a05a2 | ||
| 
						 | 
					bbc26f444a | ||
| 
						 | 
					c49975de02 | ||
| 
						 | 
					6a87169a31 | ||
| 
						 | 
					3a0b3b2182 | ||
| 
						 | 
					3f8fdf0e7a | ||
| 
						 | 
					36e6e7f074 | ||
| 
						 | 
					03f51df03c | ||
| 
						 | 
					46f4f14024 | ||
| 
						 | 
					ecd8c048fc | ||
| 
						 | 
					ed739b9dac | ||
| 
						 | 
					5322912630 | ||
| 
						 | 
					772205aae1 | ||
| 
						 | 
					853883d1f6 | ||
| 
						 | 
					6a29d326e0 | ||
| 
						 | 
					2483f1b050 | ||
| 
						 | 
					b8b85a1b2e | ||
| 
						 | 
					53edff3c70 | ||
| 
						 | 
					625e05a6b2 | ||
| 
						 | 
					3355fd674f | ||
| 
						 | 
					f2ba81303e | ||
| 
						 | 
					cbafa255cc | ||
| 
						 | 
					14ce472225 | ||
| 
						 | 
					c00d016e20 | ||
| 
						 | 
					f29ff888a2 | ||
| 
						 | 
					29b9206e80 | ||
| 
						 | 
					9e3c66b181 | 
							
								
								
									
										118
									
								
								.clang-format
									
									
									
									
									
								
							
							
						
						
									
										118
									
								
								.clang-format
									
									
									
									
									
								
							@@ -1,118 +0,0 @@
 | 
				
			|||||||
# SPDX-License-Identifier: GPL-2.0
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# clang-format configuration file. Intended for clang-format >= 4.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# For more information, see:
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#   Documentation/process/clang-format.rst
 | 
					 | 
				
			||||||
#   https://clang.llvm.org/docs/ClangFormat.html
 | 
					 | 
				
			||||||
#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
AccessModifierOffset: -4
 | 
					 | 
				
			||||||
AlignAfterOpenBracket: Align
 | 
					 | 
				
			||||||
AlignConsecutiveAssignments: false
 | 
					 | 
				
			||||||
AlignConsecutiveDeclarations: false
 | 
					 | 
				
			||||||
#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
AlignOperands: true
 | 
					 | 
				
			||||||
AlignTrailingComments: false
 | 
					 | 
				
			||||||
AllowAllParametersOfDeclarationOnNextLine: false
 | 
					 | 
				
			||||||
AllowShortBlocksOnASingleLine: false
 | 
					 | 
				
			||||||
AllowShortCaseLabelsOnASingleLine: false
 | 
					 | 
				
			||||||
AllowShortFunctionsOnASingleLine: None
 | 
					 | 
				
			||||||
AllowShortIfStatementsOnASingleLine: false
 | 
					 | 
				
			||||||
AllowShortLoopsOnASingleLine: false
 | 
					 | 
				
			||||||
AlwaysBreakAfterDefinitionReturnType: None
 | 
					 | 
				
			||||||
AlwaysBreakAfterReturnType: None
 | 
					 | 
				
			||||||
AlwaysBreakBeforeMultilineStrings: false
 | 
					 | 
				
			||||||
AlwaysBreakTemplateDeclarations: false
 | 
					 | 
				
			||||||
BinPackArguments: true
 | 
					 | 
				
			||||||
BinPackParameters: true
 | 
					 | 
				
			||||||
BraceWrapping:
 | 
					 | 
				
			||||||
  AfterClass: false
 | 
					 | 
				
			||||||
  AfterControlStatement: false
 | 
					 | 
				
			||||||
  AfterEnum: false
 | 
					 | 
				
			||||||
  AfterFunction: true
 | 
					 | 
				
			||||||
  AfterNamespace: true
 | 
					 | 
				
			||||||
  AfterObjCDeclaration: false
 | 
					 | 
				
			||||||
  AfterStruct: false
 | 
					 | 
				
			||||||
  AfterUnion: false
 | 
					 | 
				
			||||||
  #AfterExternBlock: false # Unknown to clang-format-5.0
 | 
					 | 
				
			||||||
  BeforeCatch: false
 | 
					 | 
				
			||||||
  BeforeElse: false
 | 
					 | 
				
			||||||
  IndentBraces: false
 | 
					 | 
				
			||||||
  #SplitEmptyFunction: true # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
  #SplitEmptyRecord: true # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
  #SplitEmptyNamespace: true # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
BreakBeforeBinaryOperators: None
 | 
					 | 
				
			||||||
BreakBeforeBraces: Custom
 | 
					 | 
				
			||||||
#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
BreakBeforeTernaryOperators: false
 | 
					 | 
				
			||||||
BreakConstructorInitializersBeforeComma: false
 | 
					 | 
				
			||||||
#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
BreakAfterJavaFieldAnnotations: false
 | 
					 | 
				
			||||||
BreakStringLiterals: false
 | 
					 | 
				
			||||||
ColumnLimit: 120
 | 
					 | 
				
			||||||
CommentPragmas: '^ IWYU pragma:'
 | 
					 | 
				
			||||||
#CompactNamespaces: false # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
 | 
					 | 
				
			||||||
ConstructorInitializerIndentWidth: 8
 | 
					 | 
				
			||||||
ContinuationIndentWidth: 8
 | 
					 | 
				
			||||||
Cpp11BracedListStyle: false
 | 
					 | 
				
			||||||
DerivePointerAlignment: false
 | 
					 | 
				
			||||||
DisableFormat: false
 | 
					 | 
				
			||||||
ExperimentalAutoDetectBinPacking: false
 | 
					 | 
				
			||||||
#FixNamespaceComments: false # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#IncludeBlocks: Preserve # Unknown to clang-format-5.0
 | 
					 | 
				
			||||||
IncludeCategories:
 | 
					 | 
				
			||||||
  - Regex: '.*'
 | 
					 | 
				
			||||||
    Priority: 1
 | 
					 | 
				
			||||||
IncludeIsMainRegex: '(Test)?$'
 | 
					 | 
				
			||||||
IndentCaseLabels: false
 | 
					 | 
				
			||||||
#IndentPPDirectives: None # Unknown to clang-format-5.0
 | 
					 | 
				
			||||||
IndentWidth: 8
 | 
					 | 
				
			||||||
IndentWrappedFunctionNames: false
 | 
					 | 
				
			||||||
JavaScriptQuotes: Leave
 | 
					 | 
				
			||||||
JavaScriptWrapImports: true
 | 
					 | 
				
			||||||
KeepEmptyLinesAtTheStartOfBlocks: false
 | 
					 | 
				
			||||||
MacroBlockBegin: ''
 | 
					 | 
				
			||||||
MacroBlockEnd: ''
 | 
					 | 
				
			||||||
MaxEmptyLinesToKeep: 1
 | 
					 | 
				
			||||||
NamespaceIndentation: None
 | 
					 | 
				
			||||||
#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
 | 
					 | 
				
			||||||
ObjCBlockIndentWidth: 8
 | 
					 | 
				
			||||||
ObjCSpaceAfterProperty: true
 | 
					 | 
				
			||||||
ObjCSpaceBeforeProtocolList: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Taken from git's rules
 | 
					 | 
				
			||||||
#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
PenaltyBreakBeforeFirstCallParameter: 30
 | 
					 | 
				
			||||||
PenaltyBreakComment: 10
 | 
					 | 
				
			||||||
PenaltyBreakFirstLessLess: 0
 | 
					 | 
				
			||||||
PenaltyBreakString: 10
 | 
					 | 
				
			||||||
PenaltyExcessCharacter: 100
 | 
					 | 
				
			||||||
PenaltyReturnTypeOnItsOwnLine: 60
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
PointerAlignment: Right
 | 
					 | 
				
			||||||
ReflowComments: false
 | 
					 | 
				
			||||||
SortIncludes: false
 | 
					 | 
				
			||||||
#SortUsingDeclarations: false # Unknown to clang-format-4.0
 | 
					 | 
				
			||||||
SpaceAfterCStyleCast: false
 | 
					 | 
				
			||||||
SpaceAfterTemplateKeyword: true
 | 
					 | 
				
			||||||
SpaceBeforeAssignmentOperators: true
 | 
					 | 
				
			||||||
#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
 | 
					 | 
				
			||||||
#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
 | 
					 | 
				
			||||||
SpaceBeforeParens: ControlStatements
 | 
					 | 
				
			||||||
#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
 | 
					 | 
				
			||||||
SpaceInEmptyParentheses: false
 | 
					 | 
				
			||||||
SpacesBeforeTrailingComments: 1
 | 
					 | 
				
			||||||
SpacesInAngles: false
 | 
					 | 
				
			||||||
SpacesInContainerLiterals: false
 | 
					 | 
				
			||||||
SpacesInCStyleCastParentheses: false
 | 
					 | 
				
			||||||
SpacesInParentheses: false
 | 
					 | 
				
			||||||
SpacesInSquareBrackets: false
 | 
					 | 
				
			||||||
Standard: Cpp03
 | 
					 | 
				
			||||||
TabWidth: 8
 | 
					 | 
				
			||||||
UseTab: Always
 | 
					 | 
				
			||||||
...
 | 
					 | 
				
			||||||
							
								
								
									
										58
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										58
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -2,21 +2,26 @@ debian/*.log
 | 
				
			|||||||
*.o
 | 
					*.o
 | 
				
			||||||
*.lo
 | 
					*.lo
 | 
				
			||||||
*.a
 | 
					*.a
 | 
				
			||||||
*.la
 | 
					 | 
				
			||||||
.deps
 | 
					.deps
 | 
				
			||||||
Makefile
 | 
					Makefile
 | 
				
			||||||
Makefile.in
 | 
					Makefile.in
 | 
				
			||||||
bscconfig.h
 | 
					bscconfig.h
 | 
				
			||||||
bscconfig.h.in
 | 
					bscconfig.h.in
 | 
				
			||||||
src/osmo-mgw/osmo-mgw
 | 
					openbsc.pc
 | 
				
			||||||
 | 
					src/osmo-nitb/osmo-nitb
 | 
				
			||||||
 | 
					src/osmo-bsc_mgcp/osmo-bsc_mgcp
 | 
				
			||||||
 | 
					src/osmo-bsc/osmo-bsc
 | 
				
			||||||
 | 
					src/utils/meas_vis
 | 
				
			||||||
 | 
					src/utils/meas_json
 | 
				
			||||||
 | 
					src/utils/osmo-meas-pcap2db
 | 
				
			||||||
 | 
					src/utils/osmo-meas-udp2db
 | 
				
			||||||
 | 
					src/utils/smpp_mirror
 | 
				
			||||||
*.*~
 | 
					*.*~
 | 
				
			||||||
*.sw?
 | 
					*.sw?
 | 
				
			||||||
.libs
 | 
					.libs
 | 
				
			||||||
*.pyc
 | 
					*.pyc
 | 
				
			||||||
*.gcda
 | 
					*.gcda
 | 
				
			||||||
*.gcno
 | 
					*.gcno
 | 
				
			||||||
*.pc
 | 
					 | 
				
			||||||
*~
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#configure
 | 
					#configure
 | 
				
			||||||
aclocal.m4
 | 
					aclocal.m4
 | 
				
			||||||
@@ -33,16 +38,38 @@ missing
 | 
				
			|||||||
stamp-h1
 | 
					stamp-h1
 | 
				
			||||||
libtool
 | 
					libtool
 | 
				
			||||||
ltmain.sh
 | 
					ltmain.sh
 | 
				
			||||||
m4/*.m4
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# git-version-gen magic
 | 
					# git-version-gen magic
 | 
				
			||||||
.tarball-version
 | 
					.tarball-version
 | 
				
			||||||
.version
 | 
					.version
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# apps and app data
 | 
				
			||||||
 | 
					hlr.sqlite3
 | 
				
			||||||
 | 
					src/utils/bs11_config
 | 
				
			||||||
 | 
					src/ipaccess/ipaccess-config
 | 
				
			||||||
 | 
					src/ipaccess/abisip-find
 | 
				
			||||||
 | 
					src/ipaccess/ipaccess-firmware
 | 
				
			||||||
 | 
					src/ipaccess/ipaccess-proxy
 | 
				
			||||||
 | 
					src/utils/isdnsync
 | 
				
			||||||
 | 
					src/nat/bsc_nat
 | 
				
			||||||
 | 
					src/gprs/osmo-sgsn
 | 
				
			||||||
 | 
					src/gprs/osmo-gbproxy
 | 
				
			||||||
 | 
					src/gprs/osmo-gtphub
 | 
				
			||||||
 | 
					src/osmo-bsc_nat/osmo-bsc_nat
 | 
				
			||||||
 | 
					src/libcommon/gsup_test_client
 | 
				
			||||||
 | 
					src/osmo-msc/osmo-msc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#tests
 | 
					#tests
 | 
				
			||||||
tests/testsuite.dir
 | 
					tests/testsuite.dir
 | 
				
			||||||
tests/*/*_test
 | 
					tests/*/*_test
 | 
				
			||||||
 | 
					# ignore compiled binaries like msc_vlr_test_foo; do not ignore
 | 
				
			||||||
 | 
					# msc_vlr_test_foo.{c,ok,err}, but do still ignore the corresponding .o object
 | 
				
			||||||
 | 
					# files:
 | 
				
			||||||
 | 
					tests/msc_vlr/msc_vlr_test_*
 | 
				
			||||||
 | 
					!tests/msc_vlr/msc_vlr_test_*.*
 | 
				
			||||||
 | 
					tests/msc_vlr/msc_vlr_test_*.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tests/atconfig
 | 
					tests/atconfig
 | 
				
			||||||
tests/atlocal
 | 
					tests/atlocal
 | 
				
			||||||
@@ -50,22 +77,7 @@ tests/package.m4
 | 
				
			|||||||
tests/testsuite
 | 
					tests/testsuite
 | 
				
			||||||
tests/testsuite.log
 | 
					tests/testsuite.log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gsn_restart
 | 
				
			||||||
 | 
					src/openbsc.cfg*
 | 
				
			||||||
writtenconfig/
 | 
					writtenconfig/
 | 
				
			||||||
 | 
					gtphub_restart_count
 | 
				
			||||||
# manuals
 | 
					 | 
				
			||||||
doc/manuals/*.html
 | 
					 | 
				
			||||||
doc/manuals/*.svg
 | 
					 | 
				
			||||||
doc/manuals/*.pdf
 | 
					 | 
				
			||||||
doc/manuals/*__*.png
 | 
					 | 
				
			||||||
doc/manuals/*.check
 | 
					 | 
				
			||||||
doc/manuals/generated/
 | 
					 | 
				
			||||||
doc/manuals/osmomsc-usermanual.xml
 | 
					 | 
				
			||||||
doc/manuals/common
 | 
					 | 
				
			||||||
doc/manuals/build
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
contrib/osmo-mgw.spec
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#vs code
 | 
					 | 
				
			||||||
.cache
 | 
					 | 
				
			||||||
.vscode
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,3 @@
 | 
				
			|||||||
[gerrit]
 | 
					[gerrit]
 | 
				
			||||||
host=gerrit.osmocom.org
 | 
					host=gerrit.osmocom.org
 | 
				
			||||||
project=osmo-mgw
 | 
					project=openbsc
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										20
									
								
								Makefile.am
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								Makefile.am
									
									
									
									
									
								
							@@ -9,32 +9,18 @@ AM_CPPFLAGS = \
 | 
				
			|||||||
	$(NULL)
 | 
						$(NULL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SUBDIRS = \
 | 
					SUBDIRS = \
 | 
				
			||||||
 | 
						doc \
 | 
				
			||||||
	include \
 | 
						include \
 | 
				
			||||||
	src \
 | 
						src \
 | 
				
			||||||
	tests \
 | 
						tests \
 | 
				
			||||||
	doc \
 | 
					 | 
				
			||||||
	contrib \
 | 
						contrib \
 | 
				
			||||||
	$(NULL)
 | 
						$(NULL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pkgconfigdir = $(libdir)/pkgconfig
 | 
					pkgconfigdir = $(libdir)/pkgconfig
 | 
				
			||||||
pkgconfig_DATA = \
 | 
					pkgconfig_DATA = libosmo-legacy-mgcp.pc
 | 
				
			||||||
	libosmo-mgcp-client.pc \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
BUILT_SOURCES = $(top_srcdir)/.version
 | 
					BUILT_SOURCES = $(top_srcdir)/.version
 | 
				
			||||||
EXTRA_DIST = \
 | 
					EXTRA_DIST = git-version-gen osmoappdesc.py .version
 | 
				
			||||||
	     .version \
 | 
					 | 
				
			||||||
	     contrib/osmo-mgw.spec.in \
 | 
					 | 
				
			||||||
	     debian \
 | 
					 | 
				
			||||||
	     git-version-gen \
 | 
					 | 
				
			||||||
	     osmoappdesc.py \
 | 
					 | 
				
			||||||
	     $(NULL)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
AM_DISTCHECK_CONFIGURE_FLAGS = \
 | 
					 | 
				
			||||||
	--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@RELMAKE@
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$(top_srcdir)/.version:
 | 
					$(top_srcdir)/.version:
 | 
				
			||||||
	echo $(VERSION) > $@-t && mv $@-t $@
 | 
						echo $(VERSION) > $@-t && mv $@-t $@
 | 
				
			||||||
dist-hook:
 | 
					dist-hook:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										51
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								README
									
									
									
									
									
								
							@@ -1,24 +1,39 @@
 | 
				
			|||||||
About OsmoMGW
 | 
					About OpenBSC
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OsmoMGW originated from the OpenBSC project, which started as a minimalistic
 | 
					OpenBSC started as a minimalistic all-in-one implementation of the GSM Network,
 | 
				
			||||||
all-in-one implementation of the GSM Network. In 2017, OpenBSC had reached
 | 
					with particular emphasis on the functionality typically provided by the BSC,
 | 
				
			||||||
maturity and diversity (including M3UA SIGTRAN and 3G support in the form of
 | 
					MSC, HLR, VLR and SMSC.  Today it is a growing suite of libraries and programs,
 | 
				
			||||||
IuCS and IuPS interfaces) that naturally lead to a separation of the all-in-one
 | 
					implementing protocol stacks and functional elements, including
 | 
				
			||||||
approach to fully independent separate programs as in typical GSM networks.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
OsmoMGW was one of the parts split off from the old openbsc.git. It originated
 | 
					 * OsmoBSC - a pure GSM BSC, speaking Abis/IP to the BTS and A/IP to the MSC
 | 
				
			||||||
as a solution to merely navigate RTP streams through a NAT, but has since
 | 
					 * OsmoBSC-MGCP - MGCP helper to the OsmoBSC software
 | 
				
			||||||
matured to a Media Gateway implementation that is capable of streaming RTP for
 | 
					 * OsmoNITB - a BSC+MSC+VLR+HLR+SMSC "Network in the box".
 | 
				
			||||||
2G (AoIP) and 3G (IuCS) GSM networks as well as (still not implemented at time
 | 
					 * OsmoMSC - a voice CN with A/IP and IuCS/IP towards the BSC and/or HNB-GW
 | 
				
			||||||
of writing) transcoding between TRAU, various RTP payloads and IuUP.
 | 
					 * OsmoSGSN - a GPRS SGSN with Gb/IP and IuPS/IP towards the PCU and/or HNB-GW
 | 
				
			||||||
 | 
					 * Osmo-GbProxy - a Proxy to aggregate many Gb links as one Gb link to the SGSN
 | 
				
			||||||
 | 
					 * OsmoBSCNAT - a gateway aggregating many A links as one A link to the MSC
 | 
				
			||||||
 | 
					 * OsmoGTPHUB - a hub aggregating many GTP links (between SGSN and GGSN)
 | 
				
			||||||
 | 
					 * ipaccess-utils - some tools to discover + configure ip.access nanoBTS
 | 
				
			||||||
 | 
					 * bs11_config - a tool to configure the Siemens BS-11 microBTS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The OsmoMGW program exposes an MGCP interface towards clients like OsmoMSC and
 | 
					Various interfaces towards the BTS are supported, among which are:
 | 
				
			||||||
OsmoBSC, and receives and sends RTP streams as configured via MGCP.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
The libosmo-mgcp-client library exposes utilities used by e.g. OsmoMSC (found
 | 
					 * Classic A-bis over E1 using a mISDN based E1 interface. In other
 | 
				
			||||||
in osmo-msc.git) to instruct OsmoMGW via its MGCP service.
 | 
					   words, you can connect existing GSM Base Transceiver Station (BTS)
 | 
				
			||||||
 | 
					   through E1 to OpenBSC.  So far, we have made it work with the Siemens BS-11,
 | 
				
			||||||
 | 
					   various Ericsson RBS2xxx BTS models and the Nokia MetroSite.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Find OsmoMGW issue tracker and wiki online at
 | 
					 * A-bis over IP as used by the ip.access nanoBTS product family as well as
 | 
				
			||||||
https://osmocom.org/projects/osmo-mgw
 | 
					   the Open Source OsmoBTS software (by the same authors as OpenBSC).  OsmoBTS
 | 
				
			||||||
https://osmocom.org/projects/osmo-mgw/wiki
 | 
					   in turn supports various transceiver hardware, including the sysmoBTS
 | 
				
			||||||
 | 
					   product family, as well as SDR transceivers supported by OsmoTRX, such as
 | 
				
			||||||
 | 
					   the UmTRX or USRP boardss.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * IuCS and IuPS over IP towards an HNB-GW (see osmo-iuh) for UMTS (3G)
 | 
				
			||||||
 | 
					   voice and data links.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Find OpenBSC online at
 | 
				
			||||||
 | 
					http://openbsc.osmocom.org/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Harald Welte <laforge@gnumonks.org>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
To run the configuration parsing and output (VTY) test suite, first install
 | 
					To run the configuration parsing and output (VTY) test suite, first install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests
 | 
					  git://git.osmocom.org/python/osmo-python-tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
and pass the following configure options here:
 | 
					and pass the following configure options here:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										26
									
								
								TODO-RELEASE
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								TODO-RELEASE
									
									
									
									
									
								
							@@ -1,26 +0,0 @@
 | 
				
			|||||||
# When cleaning up this file upon a release:
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# - Note that the release version number is entirely unrelated to the API
 | 
					 | 
				
			||||||
#   versions. A release version 5.2.3 may happily have an API version of 42:7:5.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# - Bump API version in src/lib*/Makefile.am files according to chapter
 | 
					 | 
				
			||||||
#   "Library interface versions" of the libtool documentation.
 | 
					 | 
				
			||||||
#   https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# - Iff the 'current' API version has changed, rename debian/lib*.install
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# API version bumping for the impatient:
 | 
					 | 
				
			||||||
# LIBVERSION=c:r:a  (current:revision_of_current:backwards_compat_age)
 | 
					 | 
				
			||||||
# 5:2:4 means that
 | 
					 | 
				
			||||||
# - this implements version 5 of the API;
 | 
					 | 
				
			||||||
# - this is the 2nd (compatible) revision of API version 5;
 | 
					 | 
				
			||||||
# - this is backwards compatible to all APIs since 4 versions ago,
 | 
					 | 
				
			||||||
#   i.e. callers that need API versions from 1 to 5 can use this.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Bumping API versions recipe:
 | 
					 | 
				
			||||||
# If the library source code has changed at all since the last update, r++;
 | 
					 | 
				
			||||||
# If any interfaces have been added, removed, or changed since the last update, c++, r=0;
 | 
					 | 
				
			||||||
# If any interfaces have been added since the last public release, a++;
 | 
					 | 
				
			||||||
# If any interfaces have been removed or changed since the last public release, a=0.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#library		what		description / commit summary line
 | 
					 | 
				
			||||||
							
								
								
									
										171
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										171
									
								
								configure.ac
									
									
									
									
									
								
							@@ -9,26 +9,15 @@ AC_CONFIG_AUX_DIR([.])
 | 
				
			|||||||
AM_INIT_AUTOMAKE([dist-bzip2])
 | 
					AM_INIT_AUTOMAKE([dist-bzip2])
 | 
				
			||||||
AC_CONFIG_TESTDIR(tests)
 | 
					AC_CONFIG_TESTDIR(tests)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CFLAGS="$CFLAGS -std=gnu11"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
dnl kernel style compile messages
 | 
					dnl kernel style compile messages
 | 
				
			||||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 | 
					m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dnl include release helper
 | 
					 | 
				
			||||||
RELMAKE='-include osmo-release.mk'
 | 
					 | 
				
			||||||
AC_SUBST([RELMAKE])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
dnl checks for programs
 | 
					dnl checks for programs
 | 
				
			||||||
AC_PROG_MAKE_SET
 | 
					AC_PROG_MAKE_SET
 | 
				
			||||||
AC_PROG_CC
 | 
					AC_PROG_CC
 | 
				
			||||||
AC_PROG_INSTALL
 | 
					AC_PROG_INSTALL
 | 
				
			||||||
LT_INIT
 | 
					LT_INIT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
 | 
					 | 
				
			||||||
AS_CASE(["$LD"],[*clang*],
 | 
					 | 
				
			||||||
  [AS_CASE(["${host_os}"],
 | 
					 | 
				
			||||||
     [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
 | 
					dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
 | 
				
			||||||
AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
 | 
					AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
 | 
				
			||||||
if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
 | 
					if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
 | 
				
			||||||
@@ -36,56 +25,55 @@ if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
PKG_PROG_PKG_CONFIG([0.20])
 | 
					PKG_PROG_PKG_CONFIG([0.20])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dnl check for AX_CHECK_COMPILE_FLAG
 | 
				
			||||||
 | 
					m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [
 | 
				
			||||||
 | 
						AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.])
 | 
				
			||||||
 | 
						])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dnl checks for libraries
 | 
					dnl checks for libraries
 | 
				
			||||||
AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
 | 
					AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
 | 
				
			||||||
AC_SUBST(LIBRARY_DL)
 | 
					AC_SUBST(LIBRARY_DL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AC_SEARCH_LIBS([dlsym], [dl dld], [LIBRARY_DLSYM="$LIBS";LIBS=""])
 | 
					 | 
				
			||||||
AC_SUBST(LIBRARY_DLSYM)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5)
 | 
				
			||||||
 | 
					PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
 | 
				
			||||||
 | 
					PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.9.0)
 | 
					# Enable/disable transcoding within osmo-bsc_mgcp?
 | 
				
			||||||
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.9.0)
 | 
					AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
 | 
				
			||||||
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.9.0)
 | 
					    [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
 | 
				
			||||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.9.0)
 | 
					AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
 | 
				
			||||||
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.4.0)
 | 
					 | 
				
			||||||
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.5.0)
 | 
					 | 
				
			||||||
PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 1.5.0)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CFLAGS="$CFLAGS -DBUILDING_LIBOSMOMGCPCLIENT -pthread"
 | 
					if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
 | 
				
			||||||
CPPFLAGS="$CPPFLAGS -DBUILDING_LIBOSMOMGCPCLIENT -pthread"
 | 
					    AC_SEARCH_LIBS([gsm_create], [gsm], [LIBRARY_GSM="$LIBS";LIBS=""], [AC_MSG_ERROR([--enable-mgcp-transcoding: cannot find usable libgsm])])
 | 
				
			||||||
LDFLAGS="$LDFLAGS -pthread"
 | 
					    AC_SUBST(LIBRARY_GSM)
 | 
				
			||||||
 | 
					    if test "$osmo_ac_with_g729" = "yes" ; then
 | 
				
			||||||
AC_ARG_ENABLE(sanitize,
 | 
						PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
 | 
				
			||||||
	[AS_HELP_STRING(
 | 
					    fi
 | 
				
			||||||
		[--enable-sanitize],
 | 
					    AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
 | 
				
			||||||
		[Compile with address sanitizer enabled],
 | 
					 | 
				
			||||||
	)],
 | 
					 | 
				
			||||||
	[sanitize=$enableval], [sanitize="no"])
 | 
					 | 
				
			||||||
if test x"$sanitize" = x"yes"
 | 
					 | 
				
			||||||
then
 | 
					 | 
				
			||||||
	CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
 | 
					 | 
				
			||||||
	CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
 | 
					 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
 | 
				
			||||||
 | 
					AC_SUBST(osmo_ac_mgcp_transcoding)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AC_ARG_ENABLE(werror,
 | 
					dnl Checks for typedefs, structures and compiler characteristics
 | 
				
			||||||
	[AS_HELP_STRING(
 | 
					
 | 
				
			||||||
		[--enable-werror],
 | 
					# The following test is taken from WebKit's webkit.m4
 | 
				
			||||||
		[Turn all compiler warnings into errors, with exceptions:
 | 
					saved_CFLAGS="$CFLAGS"
 | 
				
			||||||
		 a) deprecation (allow upstream to mark deprecation without breaking builds);
 | 
					CFLAGS="$CFLAGS -fvisibility=hidden "
 | 
				
			||||||
		 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
 | 
					AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
 | 
				
			||||||
		]
 | 
					AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
 | 
				
			||||||
	)],
 | 
					      [ AC_MSG_RESULT([yes])
 | 
				
			||||||
	[werror=$enableval], [werror="no"])
 | 
					        SYMBOL_VISIBILITY="-fvisibility=hidden"],
 | 
				
			||||||
if test x"$werror" = x"yes"
 | 
					        AC_MSG_RESULT([no]))
 | 
				
			||||||
then
 | 
					CFLAGS="$saved_CFLAGS"
 | 
				
			||||||
	WERROR_FLAGS="-Werror"
 | 
					AC_SUBST(SYMBOL_VISIBILITY)
 | 
				
			||||||
	WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition"
 | 
					
 | 
				
			||||||
	WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
 | 
					AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
 | 
				
			||||||
	WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
 | 
					AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
 | 
				
			||||||
	CFLAGS="$CFLAGS $WERROR_FLAGS"
 | 
					AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
 | 
				
			||||||
	CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
 | 
					AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
 | 
				
			||||||
fi
 | 
					AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
 | 
				
			||||||
 | 
					AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Coverage build taken from WebKit's configure.in
 | 
					# Coverage build taken from WebKit's configure.in
 | 
				
			||||||
AC_MSG_CHECKING([whether to enable code coverage support])
 | 
					AC_MSG_CHECKING([whether to enable code coverage support])
 | 
				
			||||||
@@ -114,95 +102,28 @@ if test "x$enable_ext_tests" = "xyes" ; then
 | 
				
			|||||||
	AM_PATH_PYTHON
 | 
						AM_PATH_PYTHON
 | 
				
			||||||
	AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
 | 
						AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
 | 
				
			||||||
	 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
 | 
						 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
 | 
				
			||||||
		AC_MSG_ERROR([Please install https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests to run the VTY/CTRL tests.])
 | 
							AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.])
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
 | 
					AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
 | 
				
			||||||
AC_MSG_RESULT([$enable_ext_tests])
 | 
					AC_MSG_RESULT([$enable_ext_tests])
 | 
				
			||||||
AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
 | 
					AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generate manuals
 | 
					 | 
				
			||||||
AC_ARG_ENABLE(manuals,
 | 
					 | 
				
			||||||
	[AS_HELP_STRING(
 | 
					 | 
				
			||||||
		[--enable-manuals],
 | 
					 | 
				
			||||||
		[Generate manual PDFs [default=no]],
 | 
					 | 
				
			||||||
	)],
 | 
					 | 
				
			||||||
	[osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
 | 
					 | 
				
			||||||
AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
 | 
					 | 
				
			||||||
AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
 | 
					 | 
				
			||||||
	fallback])
 | 
					 | 
				
			||||||
if test x"$osmo_ac_build_manuals" = x"yes"
 | 
					 | 
				
			||||||
then
 | 
					 | 
				
			||||||
	# Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
 | 
					 | 
				
			||||||
	if test -n "$OSMO_GSM_MANUALS_DIR"; then
 | 
					 | 
				
			||||||
		echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
 | 
					 | 
				
			||||||
		if test -n "$OSMO_GSM_MANUALS_DIR"; then
 | 
					 | 
				
			||||||
			echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
 | 
					 | 
				
			||||||
			echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
 | 
					 | 
				
			||||||
		fi
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
 | 
					 | 
				
			||||||
		AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# Find and run check-depends
 | 
					 | 
				
			||||||
	CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
 | 
					 | 
				
			||||||
	if ! test -x "$CHECK_DEPENDS"; then
 | 
					 | 
				
			||||||
		CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	if ! $CHECK_DEPENDS; then
 | 
					 | 
				
			||||||
		AC_MSG_ERROR("missing dependencies for --enable-manuals")
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# Put in Makefile with absolute path
 | 
					 | 
				
			||||||
	OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
 | 
					 | 
				
			||||||
	AC_SUBST([OSMO_GSM_MANUALS_DIR])
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# https://www.freedesktop.org/software/systemd/man/daemon.html
 | 
					 | 
				
			||||||
AC_ARG_WITH([systemdsystemunitdir],
 | 
					 | 
				
			||||||
     [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
 | 
					 | 
				
			||||||
     [with_systemdsystemunitdir=auto])
 | 
					 | 
				
			||||||
AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
 | 
					 | 
				
			||||||
     def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
     AS_IF([test "x$def_systemdsystemunitdir" = "x"],
 | 
					 | 
				
			||||||
   [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
 | 
					 | 
				
			||||||
    [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
 | 
					 | 
				
			||||||
    with_systemdsystemunitdir=no],
 | 
					 | 
				
			||||||
   [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
 | 
					 | 
				
			||||||
AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
 | 
					 | 
				
			||||||
      [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
 | 
					 | 
				
			||||||
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
AC_MSG_RESULT([CFLAGS="$CFLAGS"])
 | 
					 | 
				
			||||||
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
dnl Generate the output
 | 
					dnl Generate the output
 | 
				
			||||||
AM_CONFIG_HEADER(bscconfig.h)
 | 
					AM_CONFIG_HEADER(bscconfig.h)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AC_OUTPUT(
 | 
					AC_OUTPUT(
 | 
				
			||||||
    libosmo-mgcp-client.pc
 | 
					    libosmo-legacy-mgcp.pc
 | 
				
			||||||
    include/Makefile
 | 
					    include/Makefile
 | 
				
			||||||
    include/osmocom/Makefile
 | 
					    include/osmocom/Makefile
 | 
				
			||||||
    include/osmocom/mgcp_client/Makefile
 | 
					    include/osmocom/legacy_mgcp/Makefile
 | 
				
			||||||
    include/osmocom/mgcp/Makefile
 | 
					 | 
				
			||||||
    src/Makefile
 | 
					    src/Makefile
 | 
				
			||||||
    src/libosmo-mgcp-client/Makefile
 | 
					    src/libosmo-legacy-mgcp/Makefile
 | 
				
			||||||
    src/libosmo-mgcp/Makefile
 | 
					    src/osmo-bsc_mgcp/Makefile
 | 
				
			||||||
    src/osmo-mgw/Makefile
 | 
					 | 
				
			||||||
    tests/Makefile
 | 
					    tests/Makefile
 | 
				
			||||||
    tests/atlocal
 | 
					    tests/atlocal
 | 
				
			||||||
    tests/mgcp_client/Makefile
 | 
					    tests/legacy_mgcp/Makefile
 | 
				
			||||||
    tests/mgcp/Makefile
 | 
					 | 
				
			||||||
    doc/Makefile
 | 
					    doc/Makefile
 | 
				
			||||||
    doc/examples/Makefile
 | 
					    doc/examples/Makefile
 | 
				
			||||||
    doc/manuals/Makefile
 | 
					 | 
				
			||||||
    contrib/Makefile
 | 
					    contrib/Makefile
 | 
				
			||||||
    contrib/systemd/Makefile
 | 
					 | 
				
			||||||
    contrib/osmo-mgw.spec
 | 
					 | 
				
			||||||
    Makefile)
 | 
					    Makefile)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1 @@
 | 
				
			|||||||
SUBDIRS = systemd
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
EXTRA_DIST = ipa.py
 | 
					EXTRA_DIST = ipa.py
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										274
									
								
								contrib/ipa.py
									
									
									
									
									
								
							
							
						
						
									
										274
									
								
								contrib/ipa.py
									
									
									
									
									
								
							@@ -1,274 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/python3
 | 
					 | 
				
			||||||
# -*- mode: python-mode; py-indent-tabs-mode: nil -*-
 | 
					 | 
				
			||||||
"""
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Copyright (C) 2016 sysmocom s.f.m.c. GmbH
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
"""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import struct, random, sys
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class IPA(object):
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    Stateless IPA protocol multiplexer: add/remove/parse (extended) header
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    version = "0.0.5"
 | 
					 | 
				
			||||||
    TCP_PORT_OML = 3002
 | 
					 | 
				
			||||||
    TCP_PORT_RSL = 3003
 | 
					 | 
				
			||||||
    # OpenBSC extensions: OSMO, MGCP_OLD
 | 
					 | 
				
			||||||
    PROTO = dict(RSL=0x00, CCM=0xFE, SCCP=0xFD, OML=0xFF, OSMO=0xEE, MGCP_OLD=0xFC)
 | 
					 | 
				
			||||||
    # ...OML Router Control, GSUP GPRS extension, Osmocom Authn Protocol
 | 
					 | 
				
			||||||
    EXT = dict(CTRL=0, MGCP=1, LAC=2, SMSC=3, ORC=4, GSUP=5, OAP=6)
 | 
					 | 
				
			||||||
    # OpenBSC extension: SCCP_OLD
 | 
					 | 
				
			||||||
    MSGT = dict(PING=0x00, PONG=0x01, ID_GET=0x04, ID_RESP=0x05, ID_ACK=0x06, SCCP_OLD=0xFF)
 | 
					 | 
				
			||||||
    _IDTAG = dict(SERNR=0, UNITNAME=1, LOCATION=2, TYPE=3, EQUIPVERS=4, SWVERSION=5, IPADDR=6, MACADDR=7, UNIT=8)
 | 
					 | 
				
			||||||
    CTRL_GET = 'GET'
 | 
					 | 
				
			||||||
    CTRL_SET = 'SET'
 | 
					 | 
				
			||||||
    CTRL_REP = 'REPLY'
 | 
					 | 
				
			||||||
    CTRL_ERR = 'ERR'
 | 
					 | 
				
			||||||
    CTRL_TRAP = 'TRAP'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def _l(self, d, p):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Reverse dictionary lookup: return key for a given value
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        if p is None:
 | 
					 | 
				
			||||||
            return 'UNKNOWN'
 | 
					 | 
				
			||||||
        return list(d.keys())[list(d.values()).index(p)]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def _tag(self, t, v):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Create TAG as TLV data
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return struct.pack(">HB", len(v) + 1, t) + v
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def proto(self, p):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Lookup protocol name
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._l(self.PROTO, p)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def ext(self, p):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Lookup protocol extension name
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._l(self.EXT, p)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def msgt(self, p):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Lookup message type name
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._l(self.MSGT, p)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def idtag(self, p):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Lookup ID tag name
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._l(self._IDTAG, p)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def ext_name(self, proto, exten):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Return proper extension byte name depending on the protocol used
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        if self.PROTO['CCM'] == proto:
 | 
					 | 
				
			||||||
            return self.msgt(exten)
 | 
					 | 
				
			||||||
        if self.PROTO['OSMO'] == proto:
 | 
					 | 
				
			||||||
            return self.ext(exten)
 | 
					 | 
				
			||||||
        return None
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def add_header(self, data, proto, ext=None):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Add IPA header (with extension if necessary), data must be represented as bytes
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        if ext is None:
 | 
					 | 
				
			||||||
            return struct.pack(">HB", len(data) + 1, proto) + data
 | 
					 | 
				
			||||||
        return struct.pack(">HBB", len(data) + 1, proto, ext) + data
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def del_header(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Strip IPA protocol header correctly removing extension if present
 | 
					 | 
				
			||||||
        Returns data length, IPA protocol, extension (or None if not defined for a give protocol) and the data without header
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        if not len(data):
 | 
					 | 
				
			||||||
            return None, None, None, None
 | 
					 | 
				
			||||||
        (dlen, proto) = struct.unpack('>HB', data[:3])
 | 
					 | 
				
			||||||
        if self.PROTO['OSMO'] == proto or self.PROTO['CCM'] == proto: # there's extension which we have to unpack
 | 
					 | 
				
			||||||
            return struct.unpack('>HBB', data[:4]) + (data[4:], ) # length, protocol, extension, data
 | 
					 | 
				
			||||||
        return dlen, proto, None, data[3:] # length, protocol, _, data
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def split_combined(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Split the data which contains multiple concatenated IPA messages into tuple (first, rest) where rest contains remaining messages, first is the single IPA message
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        (length, _, _, _) = self.del_header(data)
 | 
					 | 
				
			||||||
        return data[:(length + 3)], data[(length + 3):]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_serial(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for serial number
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['SERNR'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_name(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for unit name
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['UNITNAME'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_loc(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for location
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['LOCATION'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_type(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for unit type
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['TYPE'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_equip(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for equipment version
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['EQUIPVERS'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_sw(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for software version
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['SWVERSION'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_ip(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for IP address
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['IPADDR'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_mac(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for MAC address
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['MACADDR'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tag_unit(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TAG for unit ID
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self._tag(self._IDTAG['UNIT'], data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def identity(self, unit=b'', mac=b'', location=b'', utype=b'', equip=b'', sw=b'', name=b'', serial=b''):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make IPA IDENTITY tag list, by default returns empty concatenated bytes of tag list
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self.tag_unit(unit) + self.tag_mac(mac) + self.tag_loc(location) + self.tag_type(utype) + self.tag_equip(equip) + self.tag_sw(sw) + self.tag_name(name) + self.tag_serial(serial)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def ping(self):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make PING message
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PING'])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def pong(self):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make PONG message
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PONG'])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def id_ack(self):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make ID_ACK CCM message
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self.add_header(b'', self.PROTO['CCM'], self.MSGT['ID_ACK'])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def id_get(self):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make ID_GET CCM message
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self.add_header(self.identity(), self.PROTO['CCM'], self.MSGT['ID_GET'])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def id_resp(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make ID_RESP CCM message
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self.add_header(data, self.PROTO['CCM'], self.MSGT['ID_RESP'])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class Ctrl(IPA):
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    Osmocom CTRL protocol implemented on top of IPA multiplexer
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    def __init__(self):
 | 
					 | 
				
			||||||
        random.seed()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def add_header(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Add CTRL header
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return super(Ctrl, self).add_header(data.encode('utf-8'), IPA.PROTO['OSMO'], IPA.EXT['CTRL'])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def rem_header(self, data):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Remove CTRL header, check for appropriate protocol and extension
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        (_, proto, ext, d) = super(Ctrl, self).del_header(data)
 | 
					 | 
				
			||||||
        if self.PROTO['OSMO'] != proto or self.EXT['CTRL'] != ext:
 | 
					 | 
				
			||||||
            return None
 | 
					 | 
				
			||||||
        return d
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def parse(self, data, op=None):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Parse Ctrl string returning (var, value) pair
 | 
					 | 
				
			||||||
        var could be None in case of ERROR message
 | 
					 | 
				
			||||||
        value could be None in case of GET message
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        (s, i, v) = data.split(' ', 2)
 | 
					 | 
				
			||||||
        if s == self.CTRL_ERR:
 | 
					 | 
				
			||||||
            return None, v
 | 
					 | 
				
			||||||
        if s == self.CTRL_GET:
 | 
					 | 
				
			||||||
            return v, None
 | 
					 | 
				
			||||||
        (s, i, var, val) = data.split(' ', 3)
 | 
					 | 
				
			||||||
        if s == self.CTRL_TRAP and i != '0':
 | 
					 | 
				
			||||||
            return None, '%s with non-zero id %s' % (s, i)
 | 
					 | 
				
			||||||
        if op is not None and i != op:
 | 
					 | 
				
			||||||
            if s == self.CTRL_GET + '_' + self.CTRL_REP or s == self.CTRL_SET + '_' + self.CTRL_REP:
 | 
					 | 
				
			||||||
                return None, '%s with unexpected id %s' % (s, i)
 | 
					 | 
				
			||||||
        return var, val
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def trap(self, var, val):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make TRAP message with given (vak, val) pair
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        return self.add_header("%s 0 %s %s" % (self.CTRL_TRAP, var, val))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def cmd(self, var, val=None):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Make SET/GET command message: returns (r, m) tuple where r is random operation id and m is assembled message
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        r = random.randint(1, sys.maxsize)
 | 
					 | 
				
			||||||
        if val is not None:
 | 
					 | 
				
			||||||
            return r, self.add_header("%s %s %s %s" % (self.CTRL_SET, r, var, val))
 | 
					 | 
				
			||||||
        return r, self.add_header("%s %s %s" % (self.CTRL_GET, r, var))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def verify(self, reply, r, var, val=None):
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        Verify reply to SET/GET command: returns (b, v) tuple where v is True/False verification result and v is the variable value
 | 
					 | 
				
			||||||
        """
 | 
					 | 
				
			||||||
        (k, v) = self.parse(reply)
 | 
					 | 
				
			||||||
        if k != var or (val is not None and v != val):
 | 
					 | 
				
			||||||
            return False, v
 | 
					 | 
				
			||||||
        return True, v
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if __name__ == '__main__':
 | 
					 | 
				
			||||||
    print("IPA multiplexer v%s loaded." % IPA.version)
 | 
					 | 
				
			||||||
@@ -1,16 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
# jenkins build helper script for openbsc.  This is how we build on jenkins.osmocom.org
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# environment variables:
 | 
					 | 
				
			||||||
# * WITH_MANUALS: build manual PDFs if set to "1"
 | 
					 | 
				
			||||||
# * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1")
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
 | 
					 | 
				
			||||||
	echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
 | 
					 | 
				
			||||||
	exit 2
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -ex
 | 
					set -ex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -19,26 +7,23 @@ deps="$base/deps"
 | 
				
			|||||||
inst="$deps/install"
 | 
					inst="$deps/install"
 | 
				
			||||||
export deps inst
 | 
					export deps inst
 | 
				
			||||||
 | 
					
 | 
				
			||||||
osmo-clean-workspace.sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
mkdir "$deps" || true
 | 
					mkdir "$deps" || true
 | 
				
			||||||
 | 
					rm -rf "$inst"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
 | 
					osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
 | 
					"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
 | 
					export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
 | 
				
			||||||
export LD_LIBRARY_PATH="$inst/lib"
 | 
					export LD_LIBRARY_PATH="$inst/lib"
 | 
				
			||||||
export PATH="$inst/bin:$PATH"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
osmo-build-dep.sh libosmo-abis
 | 
					if [ "x$IU" = "x--enable-iu" ]; then
 | 
				
			||||||
osmo-build-dep.sh libosmo-netif
 | 
						sccp_branch="old_sua"
 | 
				
			||||||
 | 
						osmo_iuh_branch="old_sua"
 | 
				
			||||||
# Additional configure options and depends
 | 
					 | 
				
			||||||
CONFIG=""
 | 
					 | 
				
			||||||
if [ "$WITH_MANUALS" = "1" ]; then
 | 
					 | 
				
			||||||
	CONFIG="--enable-manuals"
 | 
					 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PARALLEL_MAKE="" osmo-build-dep.sh libsmpp34
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set +x
 | 
					set +x
 | 
				
			||||||
echo
 | 
					echo
 | 
				
			||||||
echo
 | 
					echo
 | 
				
			||||||
@@ -49,18 +34,11 @@ set -x
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cd "$base"
 | 
					cd "$base"
 | 
				
			||||||
autoreconf --install --force
 | 
					autoreconf --install --force
 | 
				
			||||||
./configure --enable-sanitize --enable-vty-tests --enable-external-tests --enable-werror $CONFIG
 | 
					./configure $MGCP --enable-vty-tests --enable-external-tests
 | 
				
			||||||
$MAKE $PARALLEL_MAKE
 | 
					$MAKE $PARALLEL_MAKE
 | 
				
			||||||
LD_LIBRARY_PATH="$inst/lib" $MAKE check \
 | 
					LD_LIBRARY_PATH="$inst/lib" $MAKE check \
 | 
				
			||||||
  || cat-testlogs.sh
 | 
					  || cat-testlogs.sh
 | 
				
			||||||
LD_LIBRARY_PATH="$inst/lib" \
 | 
					LD_LIBRARY_PATH="$inst/lib" \
 | 
				
			||||||
  DISTCHECK_CONFIGURE_FLAGS="--enable-vty-tests --enable-external-tests $CONFIG" \
 | 
					  DISTCHECK_CONFIGURE_FLAGS="--enable-osmo-bsc --enable-nat $SMPP $MGCP $IU --enable-vty-tests --enable-external-tests" \
 | 
				
			||||||
  $MAKE $PARALLEL_MAKE distcheck \
 | 
					  $MAKE distcheck \
 | 
				
			||||||
  || cat-testlogs.sh
 | 
					  || cat-testlogs.sh
 | 
				
			||||||
 | 
					 | 
				
			||||||
if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
 | 
					 | 
				
			||||||
	make -C "$base/doc/manuals" publish
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$MAKE $PARALLEL_MAKE maintainer-clean
 | 
					 | 
				
			||||||
osmo-clean-workspace.sh
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,137 +0,0 @@
 | 
				
			|||||||
#
 | 
					 | 
				
			||||||
# spec file for package osmo-mgw
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Copyright (c) 2017, Martin Hauke <mardnh@gmx.de>
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# All modifications and additions to the file contributed by third parties
 | 
					 | 
				
			||||||
# remain the property of their copyright owners, unless otherwise agreed
 | 
					 | 
				
			||||||
# upon. The license for this file, and modifications and additions to the
 | 
					 | 
				
			||||||
# file, is the same license as for the pristine package itself (unless the
 | 
					 | 
				
			||||||
# license for the pristine package is not an Open Source License, in which
 | 
					 | 
				
			||||||
# case the license is the MIT License). An "Open Source License" is a
 | 
					 | 
				
			||||||
# license that conforms to the Open Source Definition (Version 1.9)
 | 
					 | 
				
			||||||
# published by the Open Source Initiative.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Name:           osmo-mgw
 | 
					 | 
				
			||||||
Version:        @VERSION@
 | 
					 | 
				
			||||||
Release:        0
 | 
					 | 
				
			||||||
Summary:        Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks
 | 
					 | 
				
			||||||
License:        AGPL-3.0-or-later AND GPL-2.0-or-later
 | 
					 | 
				
			||||||
Group:          Hardware/Mobile
 | 
					 | 
				
			||||||
URL:            https://osmocom.org/projects/osmo-mgw
 | 
					 | 
				
			||||||
Source:         %{name}-%{version}.tar.xz
 | 
					 | 
				
			||||||
BuildRequires:  automake >= 1.9
 | 
					 | 
				
			||||||
BuildRequires:  libtool >= 2
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig >= 0.20
 | 
					 | 
				
			||||||
%if 0%{?suse_version}
 | 
					 | 
				
			||||||
BuildRequires:  systemd-rpm-macros
 | 
					 | 
				
			||||||
%endif
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig(libosmo-netif) >= 1.4.0
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig(libosmocore) >= 1.9.0
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig(libosmoctrl) >= 1.9.0
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig(libosmogsm) >= 1.9.0
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig(libosmovty) >= 1.9.0
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig(libosmocoding) >= 1.9.0
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig(libosmoabis) >= 1.5.0
 | 
					 | 
				
			||||||
BuildRequires:  pkgconfig(libosmotrau) >= 1.5.0
 | 
					 | 
				
			||||||
%{?systemd_requires}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%description
 | 
					 | 
				
			||||||
OsmoMGW is Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%package -n libosmo-mgcp-client12
 | 
					 | 
				
			||||||
Summary:        Osmocom's Media Gateway Control Protocol client library
 | 
					 | 
				
			||||||
Group:          System/Libraries
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%description -n libosmo-mgcp-client12
 | 
					 | 
				
			||||||
Osmocom's Media Gateway Control Protocol client library.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%package -n libosmo-mgcp-client-devel
 | 
					 | 
				
			||||||
Summary:        Development files for Osmocom's Media Gateway Control Protocol client library
 | 
					 | 
				
			||||||
Group:          Development/Libraries/C and C++
 | 
					 | 
				
			||||||
Requires:       libosmo-mgcp-client12 = %{version}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%description -n libosmo-mgcp-client-devel
 | 
					 | 
				
			||||||
Osmocom's Media Gateway Control Protocol client librarary.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This subpackage contains libraries and header files for developing
 | 
					 | 
				
			||||||
applications that want to make use of libosmo-mgcp-client.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%package -n libosmo-mgcp-devel
 | 
					 | 
				
			||||||
Summary:        Development files for Osmocom's Media Gateway server library
 | 
					 | 
				
			||||||
Group:          Development/Libraries/C and C++
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%description -n libosmo-mgcp-devel
 | 
					 | 
				
			||||||
Osmocom's Media Gateway Control Protocol server library.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This subpackage contains libraries and header files for developing
 | 
					 | 
				
			||||||
applications that want to make use of libosmo-mgcp.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%prep
 | 
					 | 
				
			||||||
%setup -q
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%build
 | 
					 | 
				
			||||||
echo "%{version}" >.tarball-version
 | 
					 | 
				
			||||||
autoreconf -fi
 | 
					 | 
				
			||||||
%configure \
 | 
					 | 
				
			||||||
  --disable-static \
 | 
					 | 
				
			||||||
  --docdir=%{_docdir}/%{name} \
 | 
					 | 
				
			||||||
  --with-systemdsystemunitdir=%{_unitdir}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
make %{?_smp_mflags}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%install
 | 
					 | 
				
			||||||
%make_install
 | 
					 | 
				
			||||||
find %{buildroot} -type f -name "*.la" -delete -print
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%check
 | 
					 | 
				
			||||||
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%post   -n libosmo-mgcp-client12 -p /sbin/ldconfig
 | 
					 | 
				
			||||||
%postun -n libosmo-mgcp-client12 -p /sbin/ldconfig
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%if 0%{?suse_version}
 | 
					 | 
				
			||||||
%preun
 | 
					 | 
				
			||||||
%service_del_preun osmo-mgw.service
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%postun
 | 
					 | 
				
			||||||
%service_del_postun osmo-mgw.service
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%pre
 | 
					 | 
				
			||||||
%service_add_pre osmo-mgw.service
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%post
 | 
					 | 
				
			||||||
%service_add_post osmo-mgw.service
 | 
					 | 
				
			||||||
%endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%files
 | 
					 | 
				
			||||||
%license COPYING
 | 
					 | 
				
			||||||
%doc AUTHORS README
 | 
					 | 
				
			||||||
%dir %{_docdir}/%{name}/examples
 | 
					 | 
				
			||||||
%dir %{_docdir}/%{name}/examples/osmo-mgw
 | 
					 | 
				
			||||||
%{_docdir}/%{name}/examples/osmo-mgw/osmo-mgw.cfg
 | 
					 | 
				
			||||||
%{_docdir}/%{name}/examples/osmo-mgw/osmo-mgw-abis_e1.cfg
 | 
					 | 
				
			||||||
%{_bindir}/osmo-mgw
 | 
					 | 
				
			||||||
%{_unitdir}/osmo-mgw.service
 | 
					 | 
				
			||||||
%dir %{_sysconfdir}/osmocom
 | 
					 | 
				
			||||||
%config(noreplace) %{_sysconfdir}/osmocom/osmo-mgw.cfg
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%files -n libosmo-mgcp-client12
 | 
					 | 
				
			||||||
%{_libdir}/libosmo-mgcp-client.so.12*
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%files -n libosmo-mgcp-client-devel
 | 
					 | 
				
			||||||
%{_libdir}/libosmo-mgcp-client.so
 | 
					 | 
				
			||||||
%{_libdir}/pkgconfig/libosmo-mgcp-client.pc
 | 
					 | 
				
			||||||
%dir %{_includedir}/osmocom
 | 
					 | 
				
			||||||
%dir %{_includedir}/osmocom/mgcp_client
 | 
					 | 
				
			||||||
%{_includedir}/osmocom/mgcp_client/*.h
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%files -n libosmo-mgcp-devel
 | 
					 | 
				
			||||||
%dir %{_includedir}/osmocom
 | 
					 | 
				
			||||||
%dir %{_includedir}/osmocom/mgcp
 | 
					 | 
				
			||||||
%{_includedir}/osmocom/mgcp/*.h
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%changelog
 | 
					 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
EXTRA_DIST = osmo-mgw.service
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if HAVE_SYSTEMD
 | 
					 | 
				
			||||||
systemdsystemunit_DATA = \
 | 
					 | 
				
			||||||
  osmo-mgw.service
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
							
								
								
									
										11
									
								
								contrib/systemd/osmo-bsc-mgcp.service
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								contrib/systemd/osmo-bsc-mgcp.service
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					[Unit]
 | 
				
			||||||
 | 
					Description=OpenBSC MGCP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Service]
 | 
				
			||||||
 | 
					Type=simple
 | 
				
			||||||
 | 
					Restart=always
 | 
				
			||||||
 | 
					ExecStart=/usr/bin/osmo-bsc_mgcp -s -c /etc/osmocom/osmo-bsc-mgcp.cfg
 | 
				
			||||||
 | 
					RestartSec=2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Install]
 | 
				
			||||||
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
@@ -1,20 +0,0 @@
 | 
				
			|||||||
[Unit]
 | 
					 | 
				
			||||||
Description=Osmocom Media Gateway (MGW)
 | 
					 | 
				
			||||||
After=network-online.target
 | 
					 | 
				
			||||||
Wants=network-online.target
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[Service]
 | 
					 | 
				
			||||||
Type=simple
 | 
					 | 
				
			||||||
StateDirectory=osmocom
 | 
					 | 
				
			||||||
WorkingDirectory=%S/osmocom
 | 
					 | 
				
			||||||
Restart=always
 | 
					 | 
				
			||||||
ExecStart=/usr/bin/osmo-mgw -s -c /etc/osmocom/osmo-mgw.cfg
 | 
					 | 
				
			||||||
RestartSec=2
 | 
					 | 
				
			||||||
# CPU scheduling policy:
 | 
					 | 
				
			||||||
CPUSchedulingPolicy=rr
 | 
					 | 
				
			||||||
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):
 | 
					 | 
				
			||||||
CPUSchedulingPriority=1
 | 
					 | 
				
			||||||
# See sched(7) for further details on real-time policies and priorities
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[Install]
 | 
					 | 
				
			||||||
WantedBy=multi-user.target
 | 
					 | 
				
			||||||
							
								
								
									
										1017
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1017
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2
									
								
								debian/compat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/compat
									
									
									
									
										vendored
									
									
								
							@@ -1 +1 @@
 | 
				
			|||||||
10
 | 
					9
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										51
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										51
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@@ -1,46 +1,49 @@
 | 
				
			|||||||
Source: osmo-mgw
 | 
					Source: osmo-mgw
 | 
				
			||||||
Section: net
 | 
					Section: net
 | 
				
			||||||
Priority: extra
 | 
					Priority: extra
 | 
				
			||||||
Maintainer: Osmocom team <openbsc@lists.osmocom.org>
 | 
					Maintainer: Alexander Couzens <lynxis@fe80.eu>
 | 
				
			||||||
Build-Depends: debhelper (>= 10),
 | 
					Build-Depends: debhelper (>=9),
 | 
				
			||||||
               dh-autoreconf,
 | 
					               dh-autoreconf,
 | 
				
			||||||
               pkg-config,
 | 
					               pkg-config,
 | 
				
			||||||
               autotools-dev,
 | 
					               autotools-dev,
 | 
				
			||||||
               libosmocore-dev (>= 1.9.0),
 | 
					               libosmocore-dev,
 | 
				
			||||||
               libosmo-netif-dev (>= 1.4.0),
 | 
					               libosmo-netif-dev
 | 
				
			||||||
               libosmo-abis-dev (>= 1.5.0),
 | 
					 | 
				
			||||||
               osmo-gsm-manuals-dev (>= 1.5.0)
 | 
					 | 
				
			||||||
Standards-Version: 3.9.8
 | 
					Standards-Version: 3.9.8
 | 
				
			||||||
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw
 | 
					Vcs-Git: git://git.osmocom.org/osmo-iuh.git
 | 
				
			||||||
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw
 | 
					Vcs-Browser: https://git.osmocom.org/osmo-iuh/
 | 
				
			||||||
Homepage: https://osmocom.org/projects/osmo-mgw
 | 
					Homepage: https://projects.osmocom.org/projects/osmohnbgw
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Package: osmo-mgw
 | 
					Package: osmo-mgw
 | 
				
			||||||
Architecture: any
 | 
					Architecture: any
 | 
				
			||||||
Multi-Arch: foreign
 | 
					Multi-Arch: foreign
 | 
				
			||||||
Depends: ${misc:Depends}, ${shlibs:Depends}
 | 
					Depends: libosmo-legacy-mgcp0, ${misc:Depends}, ${shlibs:Depends}
 | 
				
			||||||
Description: OsmoMGW: Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks
 | 
					Description: OsmoMGW: Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Package: libosmo-mgcp-client12
 | 
					Package: osmo-mgw-dbg
 | 
				
			||||||
 | 
					Section: debug
 | 
				
			||||||
 | 
					Architecture: any
 | 
				
			||||||
 | 
					Multi-Arch: same
 | 
				
			||||||
 | 
					Depends: osmo-mgw (= ${binary:Version}), ${misc:Depends}
 | 
				
			||||||
 | 
					Description: OsmoMGW: Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Package: libosmo-legacy-mgcp0
 | 
				
			||||||
Section: libs
 | 
					Section: libs
 | 
				
			||||||
Architecture: any
 | 
					Architecture: any
 | 
				
			||||||
Multi-Arch: same
 | 
					Multi-Arch: same
 | 
				
			||||||
Pre-Depends: ${misc:Pre-Depends}
 | 
					Pre-Depends: ${misc:Pre-Depends}
 | 
				
			||||||
Depends: ${misc:Depends}, ${shlibs:Depends}
 | 
					Depends: ${misc:Depends}, ${shlibs:Depends}
 | 
				
			||||||
Description: libosmo-mgcp-client: Osmocom's Media Gateway Control Protocol client utilities
 | 
					Description: OsmoMGW: Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Package: libosmo-mgcp-client-dev
 | 
					Package: libosmo-legacy-mgcp-dbg
 | 
				
			||||||
 | 
					Section: debug
 | 
				
			||||||
 | 
					Architecture: any
 | 
				
			||||||
 | 
					Multi-Arch: same
 | 
				
			||||||
 | 
					Depends: libosmo-legacy-mgcp0 (= ${binary:Version}), ${misc:Depends}
 | 
				
			||||||
 | 
					Description: OsmoMGW: Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Package: libosmo-legacy-mgcp-dev
 | 
				
			||||||
Section: libdevel
 | 
					Section: libdevel
 | 
				
			||||||
Architecture: any
 | 
					Architecture: any
 | 
				
			||||||
Multi-Arch: same
 | 
					Multi-Arch: same
 | 
				
			||||||
Depends: libosmo-mgcp-client12 (= ${binary:Version}), ${misc:Depends}
 | 
					Depends: libosmo-legacy-mgcp0 (= ${binary:Version}), ${misc:Depends}
 | 
				
			||||||
Description: libosmo-mgcp-client: Osmocom's Media Gateway Control Protocol client utilities
 | 
					Description: OsmoMGW: Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks
 | 
				
			||||||
 | 
					 | 
				
			||||||
Package: osmo-mgw-doc
 | 
					 | 
				
			||||||
Architecture: all
 | 
					 | 
				
			||||||
Section: doc
 | 
					 | 
				
			||||||
Priority: optional
 | 
					 | 
				
			||||||
Depends: ${misc:Depends}
 | 
					 | 
				
			||||||
Description: ${misc:Package} PDF documentation
 | 
					 | 
				
			||||||
 Various manuals: user manual, VTY reference manual and/or
 | 
					 | 
				
			||||||
 protocol/interface manuals.
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										33
									
								
								debian/copyright
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								debian/copyright
									
									
									
									
										vendored
									
									
								
							@@ -1,12 +1,12 @@
 | 
				
			|||||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 | 
					Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 | 
				
			||||||
Upstream-Name: osmo-mgw
 | 
					Upstream-Name: osmo-mgw
 | 
				
			||||||
Source: https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw
 | 
					Source: git://git.osmocom.org/osmo-mgw
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Files:     *
 | 
					Files:     *
 | 
				
			||||||
Copyright: 2009-2014 On-Waves
 | 
					Copyright: 2009-2014 On-Waves
 | 
				
			||||||
           2009-2015 Holger Hans Peter Freyther <zecke@selfish.org>
 | 
					           2009-2015 Holger Hans Peter Freyther <zecke@selfish.org>
 | 
				
			||||||
           2013 Jacob Erlbeck <jerlbeck@sysmocom.de>
 | 
					           2013 Jacob Erlbeck <jerlbeck@sysmocom.de>
 | 
				
			||||||
           2016-2017 sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					           2016 sysmocom s.m.f.c. GmbH <info@sysmocom.de>
 | 
				
			||||||
License:   AGPL-3.0+
 | 
					License:   AGPL-3.0+
 | 
				
			||||||
 This program is free software; you can redistribute it and/or modify
 | 
					 This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
 it under the terms of the GNU Affero General Public License as published by
 | 
					 it under the terms of the GNU Affero General Public License as published by
 | 
				
			||||||
@@ -21,12 +21,11 @@ License:   AGPL-3.0+
 | 
				
			|||||||
 You should have received a copy of the GNU Affero General Public License
 | 
					 You should have received a copy of the GNU Affero General Public License
 | 
				
			||||||
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Files:     src/libosmo-mgcp-client/* include/osmocom/mgcp_client/*
 | 
					Files:     src/libosmo-legacy-mgcp/g711common.h
 | 
				
			||||||
Copyright: 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					Copyright: 2000 Abramo Bagnara <abramo@alsa-project.org>
 | 
				
			||||||
           Based on OpenBSC interface to quagga VTY (libmsc/vty_interface_layer3.c)
 | 
					 | 
				
			||||||
           2009 by Harald Welte <laforge@gnumonks.org>
 | 
					 | 
				
			||||||
           2009-2011 by Holger Hans Peter Freyther
 | 
					 | 
				
			||||||
License:   GPL-2.0+
 | 
					License:   GPL-2.0+
 | 
				
			||||||
 | 
					 Wrapper for linphone Codec class by Simon Morlat <simon.morlat@linphone.org>
 | 
				
			||||||
 | 
					 .
 | 
				
			||||||
 This program is free software; you can redistribute it and/or modify
 | 
					 This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
 it under the terms of the GNU General Public License as published by
 | 
					 it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 the Free Software Foundation; either version 2 of the License, or
 | 
					 the Free Software Foundation; either version 2 of the License, or
 | 
				
			||||||
@@ -38,7 +37,13 @@ License:   GPL-2.0+
 | 
				
			|||||||
 GNU General Public License for more details.
 | 
					 GNU General Public License for more details.
 | 
				
			||||||
 .
 | 
					 .
 | 
				
			||||||
 You should have received a copy of the GNU General Public License
 | 
					 You should have received a copy of the GNU General Public License
 | 
				
			||||||
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
				
			||||||
 | 
					 .
 | 
				
			||||||
 | 
					 The FSF address in the above text is the old one.
 | 
				
			||||||
 | 
					 .
 | 
				
			||||||
 | 
					 On Debian systems, the complete text of the GNU General Public License
 | 
				
			||||||
 | 
					 Version 2 can be found in `/usr/share/common-licenses/GPL-2'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Files:     tests/vty_test_runner.py
 | 
					Files:     tests/vty_test_runner.py
 | 
				
			||||||
Copyright: 2013 Holger Hans Peter Freyther
 | 
					Copyright: 2013 Holger Hans Peter Freyther
 | 
				
			||||||
@@ -63,3 +68,15 @@ License:   GPL-3.0+
 | 
				
			|||||||
Files:     osmoappdesc.py
 | 
					Files:     osmoappdesc.py
 | 
				
			||||||
Copyright: 2013 Katerina Barone-Adesi <kat.obsc@gmail.com>
 | 
					Copyright: 2013 Katerina Barone-Adesi <kat.obsc@gmail.com>
 | 
				
			||||||
License:   GPL-3.0+
 | 
					License:   GPL-3.0+
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Files:     src/libosmo-legacy-mgcp/mgcp_osmux.c
 | 
				
			||||||
 | 
					Copyright: 2012-2013 On Waves ehf <http://www.on-waves.com>
 | 
				
			||||||
 | 
					           2012-2013 Pablo Neira Ayuso <pablo@gnumonks.org>
 | 
				
			||||||
 | 
					License:   AGPL-3.0+
 | 
				
			||||||
 | 
					 All rights not specifically granted under this license are reserved.
 | 
				
			||||||
 | 
					 .
 | 
				
			||||||
 | 
					 This program is free software; you can redistribute it and/or modify it
 | 
				
			||||||
 | 
					 under the terms of the GNU Affero General Public License as published by the
 | 
				
			||||||
 | 
					 Free Software Foundation; either version 3 of the License, or (at your
 | 
				
			||||||
 | 
					 option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								debian/libosmo-legacy-mgcp-dev.install
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								debian/libosmo-legacy-mgcp-dev.install
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					usr/include
 | 
				
			||||||
 | 
					usr/lib/*/*.so
 | 
				
			||||||
 | 
					usr/lib/*/pkgconfig/*.pc
 | 
				
			||||||
							
								
								
									
										1
									
								
								debian/libosmo-legacy-mgcp0.install
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								debian/libosmo-legacy-mgcp0.install
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					usr/lib/*/*.so.*
 | 
				
			||||||
							
								
								
									
										4
									
								
								debian/libosmo-mgcp-client-dev.install
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								debian/libosmo-mgcp-client-dev.install
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +0,0 @@
 | 
				
			|||||||
usr/include/osmocom/mgcp_client
 | 
					 | 
				
			||||||
usr/lib/*/libosmo-mgcp-client.so
 | 
					 | 
				
			||||||
usr/lib/*/libosmo-mgcp-client.a
 | 
					 | 
				
			||||||
usr/lib/*/pkgconfig/libosmo-mgcp-client.pc
 | 
					 | 
				
			||||||
							
								
								
									
										1
									
								
								debian/libosmo-mgcp-client12.install
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/libosmo-mgcp-client12.install
									
									
									
									
										vendored
									
									
								
							@@ -1 +0,0 @@
 | 
				
			|||||||
usr/lib/*/libosmo-mgcp-client.so.*
 | 
					 | 
				
			||||||
							
								
								
									
										1
									
								
								debian/osmo-mgw-doc.install
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/osmo-mgw-doc.install
									
									
									
									
										vendored
									
									
								
							@@ -1 +0,0 @@
 | 
				
			|||||||
usr/share/doc/osmo-mgw-doc/*.pdf
 | 
					 | 
				
			||||||
							
								
								
									
										6
									
								
								debian/osmo-mgw.install
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								debian/osmo-mgw.install
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1 @@
 | 
				
			|||||||
etc/osmocom/osmo-mgw.cfg
 | 
					usr/bin
 | 
				
			||||||
lib/systemd/system/osmo-mgw.service
 | 
					 | 
				
			||||||
usr/bin/osmo-mgw
 | 
					 | 
				
			||||||
usr/share/doc/osmo-mgw/examples/osmo-mgw/osmo-mgw.cfg
 | 
					 | 
				
			||||||
usr/share/doc/osmo-mgw/examples/osmo-mgw/osmo-mgw-abis_e1.cfg
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								debian/rules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								debian/rules
									
									
									
									
										vendored
									
									
								
							@@ -10,8 +10,6 @@ DEBIAN  := $(shell dpkg-parsechangelog | grep '^Version:' | cut -d' ' -f2)
 | 
				
			|||||||
DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
 | 
					DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
 | 
				
			||||||
VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
 | 
					VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CFLAGS += -g
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# main packaging script based on dh7 syntax
 | 
					# main packaging script based on dh7 syntax
 | 
				
			||||||
%:
 | 
					%:
 | 
				
			||||||
	dh $@ --with autoreconf 
 | 
						dh $@ --with autoreconf 
 | 
				
			||||||
@@ -26,14 +24,11 @@ CFLAGS += -g
 | 
				
			|||||||
#override_dh_install:
 | 
					#override_dh_install:
 | 
				
			||||||
#	dh_install --list-missing -X.la -X.pyc -X.pyo
 | 
					#	dh_install --list-missing -X.la -X.pyc -X.pyo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
override_dh_auto_test:
 | 
					override_dh_autoreconf:
 | 
				
			||||||
	dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false)
 | 
						echo $(VERSION) > .tarball-version
 | 
				
			||||||
 | 
						dh_autoreconf
 | 
				
			||||||
override_dh_auto_configure:
 | 
					 | 
				
			||||||
	dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system --enable-manuals
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Don't create .pdf.gz files (barely saves space and they can't be opened directly by most pdf readers)
 | 
					 | 
				
			||||||
override_dh_compress:
 | 
					 | 
				
			||||||
	dh_compress -X.pdf
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# See https://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.html#bpp-dbg
 | 
					# See https://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.html#bpp-dbg
 | 
				
			||||||
 | 
					override_dh_strip:
 | 
				
			||||||
 | 
						dh_strip --dbg-package=osmo-mgw-dbg
 | 
				
			||||||
 | 
						dh_strip --dbg-package=libosmo-legacy-mgcp-dbg
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										31
									
								
								doc/BS11-OML.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								doc/BS11-OML.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					The Siemens BS-11 supports the following additional GSM 12.21 OML operations:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CREATE OBJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					abis_om_fom_hdr.obj_class can be 
 | 
				
			||||||
 | 
					A3:
 | 
				
			||||||
 | 
					A5: ALCO, BBSIG, CCLK, GPSU, LI, PA
 | 
				
			||||||
 | 
					A8: EnvaBTSE
 | 
				
			||||||
 | 
					A9: BPORT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					the abis_om_obj_inst.trx_nr field indicates the index of object, whereas the
 | 
				
			||||||
 | 
					abis_om_fom_hdr.bts_nr indicates the type of the object.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum abis_bs11_objtype {
 | 
				
			||||||
 | 
						BS11_OBJ_ALCO		= 0x01,
 | 
				
			||||||
 | 
						BS11_OBJ_BBSIG		= 0x02,	/* obj_class: 0,1 */
 | 
				
			||||||
 | 
						BS11_OBJ_TRX1		= 0x03,	/* only DEACTIVATE TRX1 */
 | 
				
			||||||
 | 
						BS11_OBJ_CCLK		= 0x04,
 | 
				
			||||||
 | 
						BS11_OBJ_GPSU		= 0x06,
 | 
				
			||||||
 | 
						BS11_OBJ_LI		= 0x07,
 | 
				
			||||||
 | 
						BS11_OBJ_PA		= 0x09,	/* obj_class: 0, 1*/
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In case of CREATE ENVABTSE, the abis_om_obj_inst.trx_nr indicates the EnvaBTSEx
 | 
				
			||||||
 | 
					number.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In case of A9 (CREAETE BPORT), the abis_om_obj_inst.bts_nr indicates which BPORT
 | 
				
			||||||
 | 
					shall be used.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,4 +1,3 @@
 | 
				
			|||||||
SUBDIRS = \
 | 
					SUBDIRS = \
 | 
				
			||||||
	examples \
 | 
						examples \
 | 
				
			||||||
	manuals \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
						$(NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										25
									
								
								doc/call-routing.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								doc/call-routing.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					Call routing in OpenBSC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Flow of events:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 # MO call initiated by MS, CHANNEL RQD, IMMEDIATE ASSIGN
 | 
				
			||||||
 | 
					 # MS sends CC SETUP message, we assume already on TCH/H FACCH
 | 
				
			||||||
 | 
					 # OpenBSC does a subscriber lookup based on the target extension
 | 
				
			||||||
 | 
					  * If a subscriber is found:
 | 
				
			||||||
 | 
					   # send CALL PROCEEDING message to MO
 | 
				
			||||||
 | 
					   # page the MT subscriber and ask itI to ask for TCH/H
 | 
				
			||||||
 | 
					   # once paging completes, we have the TCH/H for the MT end
 | 
				
			||||||
 | 
					   # send SETUP to MT
 | 
				
			||||||
 | 
					   # receive CALL CONFIRMED from MT
 | 
				
			||||||
 | 
					   # set-up the TRAU mux mapping between the E1 subslots for both TCH/H
 | 
				
			||||||
 | 
					   # receive ALERTING from MT, route ALERTING to MO
 | 
				
			||||||
 | 
					   # receive CONNECT from MT, confirm to MT with CONNECT_ACK
 | 
				
			||||||
 | 
					   # send a CONNECT message to MO, receive CONNECT_ACK from MO
 | 
				
			||||||
 | 
					 * If subscriber is not found:
 | 
				
			||||||
 | 
					  # send RELEASE COMPLETE with apropriate cause to MO (1: unalloacated 3: no route)
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Thoughts about RR/MM:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* we allocate RR/MM entities on demand, when we need them
 | 
				
			||||||
							
								
								
									
										95
									
								
								doc/channel_release.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								doc/channel_release.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,95 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					GSM 04.08 7.1.7 / 9.1.7		RR CHANNEL RELESE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RSL 08.58 3.4 / ?		RLL Link Release Request
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RSL 08.58 4.6 / 8.4.5		DEACTivate SACCH
 | 
				
			||||||
 | 
						* Deactivate SACCH according to Channel Release Proc 04.08
 | 
				
			||||||
 | 
						* to be sent after RR CHANNEL RELEASE is sent to MS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RSL 08.58 4.7 / 8.4.14		RF CHANnel RELease
 | 
				
			||||||
 | 
						* tells the BTS to release a radio channel
 | 
				
			||||||
 | 
						* "when an activated radio channel is no longer needed"
 | 
				
			||||||
 | 
						* BTS responds with RF CHANnel RELease ACKnowledge
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GSM 04.08 3.4.13: RR connection release procedure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* network sends RR CHANNEL RELEASE to MS on the DCCH
 | 
				
			||||||
 | 
					  * start T3109
 | 
				
			||||||
 | 
					  * deactivate SACCH
 | 
				
			||||||
 | 
					* MS disconnects main signalling link (by sending DISC)
 | 
				
			||||||
 | 
					  * all other data links are disconnected by local end link release
 | 
				
			||||||
 | 
					* network receives DISC (BTS sends RLL REL IND to BSC)
 | 
				
			||||||
 | 
					  * stop T3109
 | 
				
			||||||
 | 
					  * start T3111 
 | 
				
			||||||
 | 
					* when T3111 times out, the network can reuse the channls
 | 
				
			||||||
 | 
					* if T3109 times out, the network deactivates the channels 
 | 
				
			||||||
 | 
					  and can reuse them
 | 
				
			||||||
 | 
					  * this probably means simply RF CHANnel RELease
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					== Implementation in OpenBSC ==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					There are two possible reasons a gsm_subscriber_connection
 | 
				
			||||||
 | 
					will be released. One is a network failure, the other is
 | 
				
			||||||
 | 
					the completion of an operation/transaction.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=== Failure ===
 | 
				
			||||||
 | 
					The BSC API will call the gsm_04_08.c:gsm0408_clear_request callback
 | 
				
			||||||
 | 
					and the MSC part will release all transactions, operations and such
 | 
				
			||||||
 | 
					and the channels will be released as error case.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=== Success ===
 | 
				
			||||||
 | 
					Every time an 'operation' or 'transaction' is finished msc_release_connection
 | 
				
			||||||
 | 
					will be called and it will determine if the gsm_subscriber_connection can
 | 
				
			||||||
 | 
					be released.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In case it can be released bsc_api.c:gsm0808_clear will be called
 | 
				
			||||||
 | 
					which will release all lchan's associated with the connection. For the
 | 
				
			||||||
 | 
					primary channel a SACH Deactivate will be send with the release
 | 
				
			||||||
 | 
					reason NORMAL RELEASE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bsc_api.c:gsm0808_clear
 | 
				
			||||||
 | 
						* Release a channel used for handover
 | 
				
			||||||
 | 
						* Release the primary lchan with normal release, SACH deactivate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					chan_alloc.c:lchan_release(chan, sacch_deactivate, reason)
 | 
				
			||||||
 | 
						* Start the release procedure. It is working in steps with callbacks
 | 
				
			||||||
 | 
						  coming from the abis_rsl.c code.
 | 
				
			||||||
 | 
						* Release all SAPI's > 0 as local end (The BTS should send a
 | 
				
			||||||
 | 
						  REL_CONF a message)
 | 
				
			||||||
 | 
						* Send SACH Deactivate on SAPI=0 if required.
 | 
				
			||||||
 | 
						* Start T3109 (stop it when the main signalling link is disconnected)
 | 
				
			||||||
 | 
						  or when the channel released. On timeout start the error handling.
 | 
				
			||||||
 | 
						* abis_rsl.c schedules the RSL_MT_RF_CHAN_REL once all SAPI's are
 | 
				
			||||||
 | 
						  released and after T3111 has timed out or there is an error.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RX of RELease INDication:
 | 
				
			||||||
 | 
					        * Calls internal rsl_handle_release which might release the RF.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RX of RELease CONFirmation:
 | 
				
			||||||
 | 
					        * Calls internal rsl_handle_release which might release the RF.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* RX of RF_CHAN_REL_ACK
 | 
				
			||||||
 | 
						* call lchan_free()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=== Integration with SMS ===
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* RX of CP_ERROR or unimplemented MT
 | 
				
			||||||
 | 
						* trigger trans_free() which will msc_release_connection()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* CP TC1* expired while waiting for CP-ACK
 | 
				
			||||||
 | 
						* trigger trans_free() which will msc_release_connection()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* RX of RP_ERROR
 | 
				
			||||||
 | 
						* trigger trans_free() which will msc_release_connection()
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					* TX of CP-ACK in MT DELIVER
 | 
				
			||||||
 | 
						* trigger trans_free() which will msc_release_connection()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* RX of CP-ACK in MO SUBMIT
 | 
				
			||||||
 | 
						* trigger trans_free() which will msc_release_connection()
 | 
				
			||||||
 | 
						
 | 
				
			||||||
							
								
								
									
										172
									
								
								doc/e1-data-model.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								doc/e1-data-model.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,172 @@
 | 
				
			|||||||
 | 
					E1 related data model
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This data model describes the physical relationship of the individual
 | 
				
			||||||
 | 
					parts in the network, it is not the logical/protocol side of the GSM
 | 
				
			||||||
 | 
					network.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A BTS is connected to the BSC by some physical link.  It could be an actual
 | 
				
			||||||
 | 
					E1 link, but it could also be abis-over-IP with a mixture of TCP and RTP/UDP.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To further complicate the fact, multiple BTS can share one such pysical
 | 
				
			||||||
 | 
					link.  On a single E1 line, we can easily accomodate up to three BTS with
 | 
				
			||||||
 | 
					two TRX each.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Thus, it is best for OpenBSC to have some kind of abstraction layer.  The BSC's
 | 
				
			||||||
 | 
					view of a BTS connected to it.  We call this 'bts_link'.  A bts_link can be
 | 
				
			||||||
 | 
					* all the TCP and UDP streams of a Abis-over-IP BTS
 | 
				
			||||||
 | 
					* a set of E1 timeslots for OML, RSL and TRAU connections on a E1 link
 | 
				
			||||||
 | 
					* a serial line exclusively used for OML messages (T-Link)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A bts_link can be registered with the OpenBSC core at runtime.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct trx_link {
 | 
				
			||||||
 | 
						struct gsm_bts_trx *trx;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct bts_link {
 | 
				
			||||||
 | 
						struct gsm_bts *bts;
 | 
				
			||||||
 | 
						struct trx_link trx_links[NUM_TRX];
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Interface from stack to input core:
 | 
				
			||||||
 | 
					======================================================================
 | 
				
			||||||
 | 
					int abis_rsl_sendmsg(struct msgb *msg);
 | 
				
			||||||
 | 
						send a message through a RSL link to the TRX specified by the caller in
 | 
				
			||||||
 | 
						msg->trx.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int abis_rsl_rcvmsg(struct msgb *msg);
 | 
				
			||||||
 | 
						receive a message from a RSL link from the TRX specified by the
 | 
				
			||||||
 | 
						caller in msg->trx.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int abis_nm_sendmsg(struct msgb *msg);
 | 
				
			||||||
 | 
						send a message through a OML link to the BTS specified by the caller in
 | 
				
			||||||
 | 
						msg->trx->bts.  The caller can just use bts->c0 to get the first TRX
 | 
				
			||||||
 | 
						in a BTS. (OML messages are not really sent to a TRX but to the BTS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int abis_nm_rcvmsg(struct msgb *msg);
 | 
				
			||||||
 | 
						receive a message from a OML link from the BTS specified by the caller
 | 
				
			||||||
 | 
						in msg->trx->bts.  The caller can just use bts->c0 to get the first
 | 
				
			||||||
 | 
						TRX in a BTS.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int abis_link_event(int event, void *data);
 | 
				
			||||||
 | 
						signal some event (such as layer 1 connect/disconnect) from the
 | 
				
			||||||
 | 
						input core to the stack.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int subch_demux_in(mx, const uint8_t *data, int len);
 | 
				
			||||||
 | 
						receive 'len' bytes from a given E1 timeslot (TRAU frames)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int subchan_mux_out(mx, uint8_t *data, int len);
 | 
				
			||||||
 | 
						obtain 'len' bytes of output data to be sent on E1 timeslot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Intrface by Input Core for Input Plugins
 | 
				
			||||||
 | 
					======================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int btslink_register_plugin();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Configuration for the E1 input module
 | 
				
			||||||
 | 
					======================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BTS
 | 
				
			||||||
 | 
						BTS number
 | 
				
			||||||
 | 
						number of TRX
 | 
				
			||||||
 | 
						OML link
 | 
				
			||||||
 | 
							E1 line number
 | 
				
			||||||
 | 
							timeslot number
 | 
				
			||||||
 | 
							[subslot number]
 | 
				
			||||||
 | 
							SAPI
 | 
				
			||||||
 | 
							TEI
 | 
				
			||||||
 | 
						for each TRX
 | 
				
			||||||
 | 
							RSL link
 | 
				
			||||||
 | 
								E1 line number
 | 
				
			||||||
 | 
								timeslot number
 | 
				
			||||||
 | 
								[subslot number]
 | 
				
			||||||
 | 
								SAPI
 | 
				
			||||||
 | 
								TEI
 | 
				
			||||||
 | 
							for each TS
 | 
				
			||||||
 | 
								E1 line number
 | 
				
			||||||
 | 
								timeslot number
 | 
				
			||||||
 | 
								subslot number
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					E1 input module data model
 | 
				
			||||||
 | 
					======================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum e1inp_sign_type {
 | 
				
			||||||
 | 
						E1INP_SIGN_NONE,
 | 
				
			||||||
 | 
						E1INP_SIGN_OML,
 | 
				
			||||||
 | 
						E1INP_SIGN_RSL,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct e1inp_sign_link {
 | 
				
			||||||
 | 
						/* list of signalling links */
 | 
				
			||||||
 | 
						struct llist_head list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						enum e1inp_sign_type type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* trx for msg->trx of received msgs */	
 | 
				
			||||||
 | 
						struct gsm_bts_trx *trx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* msgb queue of to-be-transmitted msgs */
 | 
				
			||||||
 | 
						struct llist_head tx_list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* SAPI and TEI on the E1 TS */
 | 
				
			||||||
 | 
						uint8_t sapi;
 | 
				
			||||||
 | 
						uint8_t tei;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum e1inp_ts_type {
 | 
				
			||||||
 | 
						E1INP_TS_TYPE_NONE,
 | 
				
			||||||
 | 
						E1INP_TS_TYPE_SIGN,
 | 
				
			||||||
 | 
						E1INP_TS_TYPE_TRAU,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* A timeslot in the E1 interface */
 | 
				
			||||||
 | 
					struct e1inp_ts {
 | 
				
			||||||
 | 
						enum e1inp_ts_type type;
 | 
				
			||||||
 | 
						struct e1inp_line *line;
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							struct {
 | 
				
			||||||
 | 
								struct llist_head sign_links;
 | 
				
			||||||
 | 
							} sign;
 | 
				
			||||||
 | 
							struct {
 | 
				
			||||||
 | 
								/* subchannel demuxer for frames from E1 */
 | 
				
			||||||
 | 
								struct subch_demux demux;
 | 
				
			||||||
 | 
								/* subchannel muxer for frames to E1 */
 | 
				
			||||||
 | 
								struct subch_mux mux;
 | 
				
			||||||
 | 
							} trau;
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							struct {
 | 
				
			||||||
 | 
								/* mISDN driver has one fd for each ts */
 | 
				
			||||||
 | 
								struct osmo_fd;
 | 
				
			||||||
 | 
							} misdn;
 | 
				
			||||||
 | 
						} driver;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct e1inp_line {
 | 
				
			||||||
 | 
						unsigned int num;
 | 
				
			||||||
 | 
						char *name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct e1inp_ts ts[NR_E1_TS];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char *e1inp_driver;
 | 
				
			||||||
 | 
						void *driver_data;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Call from the Stack: configuration of this TS has changed */
 | 
				
			||||||
 | 
					int e1inp_update_ts(struct e1inp_ts *ts);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Receive a packet from the E1 driver */
 | 
				
			||||||
 | 
					int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
 | 
				
			||||||
 | 
							uint8_t tei, uint8_t sapi);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Send a packet, callback function in the driver */
 | 
				
			||||||
 | 
					int e1driver_tx_ts(struct e1inp_ts *ts, struct msgb *msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct e1inp_driver {
 | 
				
			||||||
 | 
						const char *name;
 | 
				
			||||||
 | 
						int (*want_write)(struct e1inp_ts *ts);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -1,11 +1,3 @@
 | 
				
			|||||||
OSMOCONF_FILES = \
 | 
					 | 
				
			||||||
	osmo-mgw/osmo-mgw.cfg
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
osmoconfdir = $(sysconfdir)/osmocom
 | 
					 | 
				
			||||||
osmoconf_DATA = $(OSMOCONF_FILES)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
EXTRA_DIST = $(OSMOCONF_FILES)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CFG_FILES = find $(srcdir) -name '*.cfg*' | sed -e 's,^$(srcdir),,'
 | 
					CFG_FILES = find $(srcdir) -name '*.cfg*' | sed -e 's,^$(srcdir),,'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dist-hook:
 | 
					dist-hook:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										105
									
								
								doc/examples/osmo-bsc/osmo-bsc.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								doc/examples/osmo-bsc/osmo-bsc.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,105 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! OsmoBSC (0.9.14+gitr1+3d331c0062bb0c9694dbd4d1eab7adc58138c3ae) configuration saved from vty
 | 
				
			||||||
 | 
					!!
 | 
				
			||||||
 | 
					password foo
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					e1_input
 | 
				
			||||||
 | 
					 e1_line 0 driver ipa
 | 
				
			||||||
 | 
					network
 | 
				
			||||||
 | 
					 network country code 1
 | 
				
			||||||
 | 
					 mobile network code 1
 | 
				
			||||||
 | 
					 short name OsmoBSC
 | 
				
			||||||
 | 
					 long name OsmoBSC
 | 
				
			||||||
 | 
					 auth policy closed
 | 
				
			||||||
 | 
					 location updating reject cause 13
 | 
				
			||||||
 | 
					 encryption a5 0
 | 
				
			||||||
 | 
					 neci 1
 | 
				
			||||||
 | 
					 paging any use tch 0
 | 
				
			||||||
 | 
					 rrlp mode none
 | 
				
			||||||
 | 
					 mm info 1
 | 
				
			||||||
 | 
					 handover 0
 | 
				
			||||||
 | 
					 handover window rxlev averaging 10
 | 
				
			||||||
 | 
					 handover window rxqual averaging 1
 | 
				
			||||||
 | 
					 handover window rxlev neighbor averaging 10
 | 
				
			||||||
 | 
					 handover power budget interval 6
 | 
				
			||||||
 | 
					 handover power budget hysteresis 3
 | 
				
			||||||
 | 
					 handover maximum distance 9999
 | 
				
			||||||
 | 
					 timer t3101 10
 | 
				
			||||||
 | 
					 timer t3103 0
 | 
				
			||||||
 | 
					 timer t3105 0
 | 
				
			||||||
 | 
					 timer t3107 0
 | 
				
			||||||
 | 
					 timer t3109 0
 | 
				
			||||||
 | 
					 timer t3111 0
 | 
				
			||||||
 | 
					 timer t3113 60
 | 
				
			||||||
 | 
					 timer t3115 0
 | 
				
			||||||
 | 
					 timer t3117 0
 | 
				
			||||||
 | 
					 timer t3119 0
 | 
				
			||||||
 | 
					 timer t3122 0
 | 
				
			||||||
 | 
					 timer t3141 0
 | 
				
			||||||
 | 
					 bts 0
 | 
				
			||||||
 | 
					  type nanobts
 | 
				
			||||||
 | 
					  band DCS1800
 | 
				
			||||||
 | 
					  cell_identity 0
 | 
				
			||||||
 | 
					  location_area_code 1
 | 
				
			||||||
 | 
					  training_sequence_code 7
 | 
				
			||||||
 | 
					  base_station_id_code 63
 | 
				
			||||||
 | 
					  ms max power 15
 | 
				
			||||||
 | 
					  cell reselection hysteresis 4
 | 
				
			||||||
 | 
					  rxlev access min 0
 | 
				
			||||||
 | 
					  channel allocator ascending
 | 
				
			||||||
 | 
					  rach tx integer 9
 | 
				
			||||||
 | 
					  rach max transmission 7
 | 
				
			||||||
 | 
					  dtx uplink force
 | 
				
			||||||
 | 
					  dtx downlink
 | 
				
			||||||
 | 
					  ip.access unit_id 0 0
 | 
				
			||||||
 | 
					  oml ip.access stream_id 255 line 0
 | 
				
			||||||
 | 
					  neighbor-list mode manual-si5
 | 
				
			||||||
 | 
					  neighbor-list add arfcn 100
 | 
				
			||||||
 | 
					  neighbor-list add arfcn 200
 | 
				
			||||||
 | 
					  si5 neighbor-list add arfcn 10
 | 
				
			||||||
 | 
					  si5 neighbor-list add arfcn 20
 | 
				
			||||||
 | 
					  gprs mode none
 | 
				
			||||||
 | 
					  trx 0
 | 
				
			||||||
 | 
					   rf_locked 0
 | 
				
			||||||
 | 
					   arfcn 871
 | 
				
			||||||
 | 
					   nominal power 23
 | 
				
			||||||
 | 
					   max_power_red 20
 | 
				
			||||||
 | 
					   rsl e1 tei 0
 | 
				
			||||||
 | 
					   timeslot 0
 | 
				
			||||||
 | 
					    phys_chan_config CCCH+SDCCH4
 | 
				
			||||||
 | 
					    hopping enabled 0
 | 
				
			||||||
 | 
					   timeslot 1
 | 
				
			||||||
 | 
					    phys_chan_config TCH/F
 | 
				
			||||||
 | 
					    hopping enabled 0
 | 
				
			||||||
 | 
					   timeslot 2
 | 
				
			||||||
 | 
					    phys_chan_config TCH/F
 | 
				
			||||||
 | 
					    hopping enabled 0
 | 
				
			||||||
 | 
					   timeslot 3
 | 
				
			||||||
 | 
					    phys_chan_config TCH/F
 | 
				
			||||||
 | 
					    hopping enabled 0
 | 
				
			||||||
 | 
					   timeslot 4
 | 
				
			||||||
 | 
					    phys_chan_config TCH/F
 | 
				
			||||||
 | 
					    hopping enabled 0
 | 
				
			||||||
 | 
					   timeslot 5
 | 
				
			||||||
 | 
					    phys_chan_config TCH/F
 | 
				
			||||||
 | 
					    hopping enabled 0
 | 
				
			||||||
 | 
					   timeslot 6
 | 
				
			||||||
 | 
					    phys_chan_config TCH/F
 | 
				
			||||||
 | 
					    hopping enabled 0
 | 
				
			||||||
 | 
					   timeslot 7
 | 
				
			||||||
 | 
					    phys_chan_config TCH/F
 | 
				
			||||||
 | 
					    hopping enabled 0
 | 
				
			||||||
 | 
					msc
 | 
				
			||||||
 | 
					 ip.access rtp-base 4000
 | 
				
			||||||
 | 
					 timeout-ping 20
 | 
				
			||||||
 | 
					 timeout-pong 5
 | 
				
			||||||
 | 
					 dest 192.168.100.11 6666 0
 | 
				
			||||||
 | 
					 access-list-name msc-list
 | 
				
			||||||
 | 
					 no access-list-name
 | 
				
			||||||
 | 
					bsc
 | 
				
			||||||
 | 
					 no access-list-name
 | 
				
			||||||
 | 
					 access-list-name bsc-list
 | 
				
			||||||
							
								
								
									
										19
									
								
								doc/examples/osmo-bsc_mgcp/mgcp.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								doc/examples/osmo-bsc_mgcp/mgcp.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! MGCP configuration hand edited
 | 
				
			||||||
 | 
					!   !
 | 
				
			||||||
 | 
					password foo
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					mgcp
 | 
				
			||||||
 | 
					  local ip 10.23.24.2
 | 
				
			||||||
 | 
					  bts ip 10.24.24.1
 | 
				
			||||||
 | 
					  bind ip 10.23.24.1
 | 
				
			||||||
 | 
					  bind port 2427
 | 
				
			||||||
 | 
					  rtp base 4000
 | 
				
			||||||
 | 
					  rtp force-ptime 20
 | 
				
			||||||
 | 
					  sdp audio payload number 98
 | 
				
			||||||
 | 
					  sdp audio payload name AMR/8000
 | 
				
			||||||
 | 
					  number endpoints 31
 | 
				
			||||||
 | 
					  no rtcp-omit
 | 
				
			||||||
							
								
								
									
										1
									
								
								doc/examples/osmo-bsc_nat/black-list.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								doc/examples/osmo-bsc_nat/black-list.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					678012512671923:6:6:
 | 
				
			||||||
							
								
								
									
										13
									
								
								doc/examples/osmo-bsc_nat/bscs.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								doc/examples/osmo-bsc_nat/bscs.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					nat
 | 
				
			||||||
 | 
					 bsc 0
 | 
				
			||||||
 | 
					  token lol
 | 
				
			||||||
 | 
					  location_area_code 1234
 | 
				
			||||||
 | 
					  description bsc
 | 
				
			||||||
 | 
					  max-endpoints 32
 | 
				
			||||||
 | 
					  paging forbidden 0
 | 
				
			||||||
 | 
					 bsc 1
 | 
				
			||||||
 | 
					  token wat
 | 
				
			||||||
 | 
					  location_area_code 5678
 | 
				
			||||||
 | 
					  description bsc
 | 
				
			||||||
 | 
					  max-endpoints 32
 | 
				
			||||||
 | 
					  paging forbidden 0
 | 
				
			||||||
							
								
								
									
										66
									
								
								doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,66 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! OsmoBSCNAT (0.12.0.266-2daa9) configuration saved from vty
 | 
				
			||||||
 | 
					!!
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					log stderr
 | 
				
			||||||
 | 
					  logging filter all 1
 | 
				
			||||||
 | 
					  logging color 1
 | 
				
			||||||
 | 
					  logging timestamp 0
 | 
				
			||||||
 | 
					  logging level all debug
 | 
				
			||||||
 | 
					  logging level rll notice
 | 
				
			||||||
 | 
					  logging level cc notice
 | 
				
			||||||
 | 
					  logging level mm notice
 | 
				
			||||||
 | 
					  logging level rr notice
 | 
				
			||||||
 | 
					  logging level rsl notice
 | 
				
			||||||
 | 
					  logging level nm info
 | 
				
			||||||
 | 
					  logging level mncc notice
 | 
				
			||||||
 | 
					  logging level pag notice
 | 
				
			||||||
 | 
					  logging level meas notice
 | 
				
			||||||
 | 
					  logging level sccp notice
 | 
				
			||||||
 | 
					  logging level msc notice
 | 
				
			||||||
 | 
					  logging level mgcp notice
 | 
				
			||||||
 | 
					  logging level ho notice
 | 
				
			||||||
 | 
					  logging level db notice
 | 
				
			||||||
 | 
					  logging level ref notice
 | 
				
			||||||
 | 
					  logging level gprs debug
 | 
				
			||||||
 | 
					  logging level ns info
 | 
				
			||||||
 | 
					  logging level bssgp debug
 | 
				
			||||||
 | 
					  logging level llc debug
 | 
				
			||||||
 | 
					  logging level sndcp debug
 | 
				
			||||||
 | 
					  logging level nat notice
 | 
				
			||||||
 | 
					  logging level ctrl notice
 | 
				
			||||||
 | 
					  logging level smpp debug
 | 
				
			||||||
 | 
					  logging level lglobal notice
 | 
				
			||||||
 | 
					  logging level llapd notice
 | 
				
			||||||
 | 
					  logging level linp notice
 | 
				
			||||||
 | 
					  logging level lmux notice
 | 
				
			||||||
 | 
					  logging level lmi notice
 | 
				
			||||||
 | 
					  logging level lmib notice
 | 
				
			||||||
 | 
					  logging level lsms notice
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					mgcp
 | 
				
			||||||
 | 
					  bind ip 0.0.0.0
 | 
				
			||||||
 | 
					  bind port 2427
 | 
				
			||||||
 | 
					  rtp bts-base 4000
 | 
				
			||||||
 | 
					  rtp net-base 16000
 | 
				
			||||||
 | 
					  rtp ip-dscp 0
 | 
				
			||||||
 | 
					  no rtcp-omit
 | 
				
			||||||
 | 
					  sdp audio-payload number 126
 | 
				
			||||||
 | 
					  sdp audio-payload name AMR/8000
 | 
				
			||||||
 | 
					  loop 0
 | 
				
			||||||
 | 
					  number endpoints 1
 | 
				
			||||||
 | 
					  call-agent ip 127.0.0.1
 | 
				
			||||||
 | 
					  rtp transcoder-base 0
 | 
				
			||||||
 | 
					  transcoder-remote-base 4000
 | 
				
			||||||
 | 
					nat
 | 
				
			||||||
 | 
					 msc ip 127.0.0.1
 | 
				
			||||||
 | 
					 msc port 5000
 | 
				
			||||||
 | 
					 timeout auth 2
 | 
				
			||||||
 | 
					 timeout ping 20
 | 
				
			||||||
 | 
					 timeout pong 5
 | 
				
			||||||
 | 
					 ip-dscp 0
 | 
				
			||||||
 | 
					 bscs-config-file bscs.cfg
 | 
				
			||||||
 | 
					 access-list bla imsi-allow ^11$
 | 
				
			||||||
							
								
								
									
										44
									
								
								doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! OsmoGbProxy (UNKNOWN) configuration saved from vty
 | 
				
			||||||
 | 
					!!
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					log stderr
 | 
				
			||||||
 | 
					  logging filter all 1
 | 
				
			||||||
 | 
					  logging color 1
 | 
				
			||||||
 | 
					  logging timestamp 0
 | 
				
			||||||
 | 
					  logging level all debug
 | 
				
			||||||
 | 
					  logging level gprs debug
 | 
				
			||||||
 | 
					  logging level ns info
 | 
				
			||||||
 | 
					  logging level bssgp debug
 | 
				
			||||||
 | 
					  logging level lglobal notice
 | 
				
			||||||
 | 
					  logging level llapd notice
 | 
				
			||||||
 | 
					  logging level linp notice
 | 
				
			||||||
 | 
					  logging level lmux notice
 | 
				
			||||||
 | 
					  logging level lmi notice
 | 
				
			||||||
 | 
					  logging level lmib notice
 | 
				
			||||||
 | 
					  logging level lsms notice
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					ns
 | 
				
			||||||
 | 
					 nse 666 nsvci 666
 | 
				
			||||||
 | 
					 nse 666 remote-role sgsn
 | 
				
			||||||
 | 
					! nse 666 encapsulation framerelay-gre
 | 
				
			||||||
 | 
					! nse 666 remote-ip 172.16.1.70
 | 
				
			||||||
 | 
					! nse 666 fr-dlci 666
 | 
				
			||||||
 | 
					 timer tns-block 3
 | 
				
			||||||
 | 
					 timer tns-block-retries 3
 | 
				
			||||||
 | 
					 timer tns-reset 3
 | 
				
			||||||
 | 
					 timer tns-reset-retries 3
 | 
				
			||||||
 | 
					 timer tns-test 30
 | 
				
			||||||
 | 
					 timer tns-alive 3
 | 
				
			||||||
 | 
					 timer tns-alive-retries 10
 | 
				
			||||||
 | 
					 encapsulation udp local-port 23000
 | 
				
			||||||
 | 
					! encapsulation framerelay-gre enabled 1
 | 
				
			||||||
 | 
					gbproxy
 | 
				
			||||||
 | 
					 sgsn nsei 666
 | 
				
			||||||
 | 
					 core-mobile-country-code 666
 | 
				
			||||||
 | 
					 core-mobile-network-code 6
 | 
				
			||||||
 | 
					 core-access-point-name none match-imsi ^666066|^66607
 | 
				
			||||||
 | 
					 tlli-list max-length 200
 | 
				
			||||||
							
								
								
									
										25
									
								
								doc/examples/osmo-gbproxy/osmo-gbproxy.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								doc/examples/osmo-gbproxy/osmo-gbproxy.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! Osmocom Gb Proxy (0.9.0.404-6463) configuration saved from vty
 | 
				
			||||||
 | 
					!!
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					gbproxy
 | 
				
			||||||
 | 
					 sgsn nsei 101
 | 
				
			||||||
 | 
					ns
 | 
				
			||||||
 | 
					 nse 101 nsvci 101
 | 
				
			||||||
 | 
					 nse 101 remote-role sgsn
 | 
				
			||||||
 | 
					 nse 101 encapsulation udp
 | 
				
			||||||
 | 
					 nse 101 remote-ip 192.168.100.239
 | 
				
			||||||
 | 
					 nse 101 remote-port 7777
 | 
				
			||||||
 | 
					 timer tns-block 3
 | 
				
			||||||
 | 
					 timer tns-block-retries 3
 | 
				
			||||||
 | 
					 timer tns-reset 3
 | 
				
			||||||
 | 
					 timer tns-reset-retries 3
 | 
				
			||||||
 | 
					 timer tns-test 30
 | 
				
			||||||
 | 
					 timer tns-alive 3
 | 
				
			||||||
 | 
					 timer tns-alive-retries 10
 | 
				
			||||||
 | 
					 encapsulation framerelay-gre enabled 0
 | 
				
			||||||
 | 
					 encapsulation framerelay-gre local-ip 0.0.0.0
 | 
				
			||||||
 | 
					 encapsulation udp local-port 23000
 | 
				
			||||||
							
								
								
									
										90
									
								
								doc/examples/osmo-gtphub/gtphub-example.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								doc/examples/osmo-gtphub/gtphub-example.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,90 @@
 | 
				
			|||||||
 | 
					Here is a simple setup to test GTPHub operations. The IP addresses picked will
 | 
				
			||||||
 | 
					work well only on a system that creates local addresses (127.0.0.123) on the
 | 
				
			||||||
 | 
					fly (like linux) -- you may pick of course different IP addresses.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Overview of the example setup:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sgsnemu               gtphub             ggsn
 | 
				
			||||||
 | 
					    127.0.0.1 <--> 127.0.0.3  127.0.0.4 <--> 127.0.0.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Prerequisites: openggsn.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Have a local directory where you store config files and from which you launch
 | 
				
			||||||
 | 
					the GSNs and the hub (they will store restart counter files in that dir).
 | 
				
			||||||
 | 
					In it, have these config files:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ggsn.conf:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # GGSN local address
 | 
				
			||||||
 | 
					    listen 127.0.0.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # End User Addresses are picked from this range
 | 
				
			||||||
 | 
					    net 10.23.42.0/24
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pcodns1 8.8.8.8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    logfile /tmp/foo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gtphub.conf:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    gtphub
 | 
				
			||||||
 | 
					     bind-to-sgsns 127.0.0.3
 | 
				
			||||||
 | 
					     bind-to-ggsns 127.0.0.4
 | 
				
			||||||
 | 
					     ggsn-proxy 127.0.0.2
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					You may omit the ggsn-proxy if GRX ares is working, or if you add the GRX
 | 
				
			||||||
 | 
					address and GGSN IP address to /etc/hosts something like:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    127.0.0.2 internet.mnc070.mcc901.gprs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Once the config files are in place, start the programs, in separate terminals.
 | 
				
			||||||
 | 
					GGSN and SGSN need to be started with root priviliges to be able to create tun
 | 
				
			||||||
 | 
					interfaces. GTPHub may run as unprivileged user.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The LD_LIBRARY_PATH below may be needed if OpenGGSN installed to /usr/local.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1. GGSN:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sudo -s
 | 
				
			||||||
 | 
					    cd <your-test-dir>
 | 
				
			||||||
 | 
					    LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/ggsn -f -c ./ggsn.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2. GTPHub:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cd <your-test-dir>
 | 
				
			||||||
 | 
					    path/to/openbsc/openbsc/src/gprs/osmo-gtphub -c gtphub.conf #-e 1 #for DEBUG level
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					3. SGSN tests:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sudo -s
 | 
				
			||||||
 | 
					    cd <your-test-dir>
 | 
				
			||||||
 | 
					    /usr/local/bin/sgsnemu --createif -l 127.0.0.1 -r 127.0.0.3 --imsi 420001214365100 --contexts=3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Add more SGSNs using different IMSIs and local ports (if the same IMSI is used,
 | 
				
			||||||
 | 
					the GGSN will reuse TEIs and tunnels will be discarded automatically):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /usr/local/bin/sgsnemu --createif -l 127.0.0.11 -r 127.0.0.3 --imsi 420001214365300 --contexts=3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This shows the basic setup of GTPHub. Testing internet traffic via sgsnemu
 | 
				
			||||||
 | 
					still needs some effort to announce a mobile subscriber or the like (I have
 | 
				
			||||||
 | 
					used a real BTS, osmo-sgsn and a testing SIM in a web phone, instead).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The core capability of GTPHub is to manage more than two GSNs, e.g. an SGSN
 | 
				
			||||||
 | 
					contacting various GGSNs over the single GTPHub link. You would configure the
 | 
				
			||||||
 | 
					SGSN to use one fixed GGSN (sending to gtphub) and gtphub will resolve the
 | 
				
			||||||
 | 
					GGSNs once it has received the messages. So the SGSN may be behind NAT (add
 | 
				
			||||||
 | 
					"sgsn-use-sender" to gtphub.conf) and communicate to various GGSNs over a
 | 
				
			||||||
 | 
					single link to gtphub.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					I hope this helps to get you going.
 | 
				
			||||||
 | 
					Any suggestions/patches are welcome!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					~Neels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								doc/examples/osmo-gtphub/osmo-gtphub-1iface.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								doc/examples/osmo-gtphub/osmo-gtphub-1iface.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! Osmocom gtphub configuration
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					! This file is used for VTY tests, referenced by openbsc/osmoappdesc.py
 | 
				
			||||||
 | 
					! For the test, try to use most config commands.
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gtphub
 | 
				
			||||||
 | 
					 ! Local addresses to listen on and send from, both on one interface.
 | 
				
			||||||
 | 
					 ! The side towards SGSN uses nonstandard ports.
 | 
				
			||||||
 | 
					 bind-to-sgsns ctrl 127.0.0.1 12123 user 127.0.0.1 12153
 | 
				
			||||||
 | 
					 ! The GGSN side with standard ports.
 | 
				
			||||||
 | 
					 bind-to-ggsns 127.0.0.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 ! Proxy: unconditionally direct all traffic to...
 | 
				
			||||||
 | 
					 sgsn-proxy 127.0.0.4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 ! Proxy with nonstandard ports or separate IPs:
 | 
				
			||||||
 | 
					 ggsn-proxy ctrl 127.0.0.3 2123 user 127.0.0.5 2152
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 ! Add a name server for GGSN resolution
 | 
				
			||||||
 | 
					 grx-dns-add 192.168.0.1
 | 
				
			||||||
							
								
								
									
										25
									
								
								doc/examples/osmo-gtphub/osmo-gtphub.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								doc/examples/osmo-gtphub/osmo-gtphub.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! Osmocom gtphub configuration
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gtphub
 | 
				
			||||||
 | 
					 ! Local addresses to listen on and send from, each on standard ports
 | 
				
			||||||
 | 
					 ! 2123 and 2152. Setting these addresses is mandatory.
 | 
				
			||||||
 | 
					 bind-to-sgsns 127.0.0.1
 | 
				
			||||||
 | 
					 bind-to-ggsns 127.0.0.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 ! Local nonstandard ports or separate IPs:
 | 
				
			||||||
 | 
					 !bind-to-sgsns ctrl 127.0.0.1 2342 user 127.0.0.1 4223
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 ! Proxy: unconditionally direct all traffic to...
 | 
				
			||||||
 | 
					 !ggsn-proxy 127.0.0.3
 | 
				
			||||||
 | 
					 !sgsn-proxy 127.0.0.4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 ! Proxy with nonstandard ports or separate IPs:
 | 
				
			||||||
 | 
					 !ggsn-proxy ctrl 127.0.0.3 2123 user 127.0.0.5 2152
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 ! Add a name server for GGSN resolution
 | 
				
			||||||
 | 
					 !grx-dns-add 192.168.0.1
 | 
				
			||||||
@@ -1,25 +0,0 @@
 | 
				
			|||||||
!
 | 
					 | 
				
			||||||
! MGCP configuration example
 | 
					 | 
				
			||||||
!
 | 
					 | 
				
			||||||
e1_input
 | 
					 | 
				
			||||||
 e1_line 0 driver dahdi
 | 
					 | 
				
			||||||
 e1_line 0 port 0
 | 
					 | 
				
			||||||
mgcp
 | 
					 | 
				
			||||||
  bind ip 127.0.0.1
 | 
					 | 
				
			||||||
  rtp port-range 4002 16000
 | 
					 | 
				
			||||||
  rtp bind-ip 127.0.0.1
 | 
					 | 
				
			||||||
  rtp ip-probing
 | 
					 | 
				
			||||||
  rtp ip-dscp 46
 | 
					 | 
				
			||||||
  bind port 2427
 | 
					 | 
				
			||||||
  sdp audio payload number 98
 | 
					 | 
				
			||||||
  sdp audio payload name GSM
 | 
					 | 
				
			||||||
  number endpoints 512
 | 
					 | 
				
			||||||
  loop 0
 | 
					 | 
				
			||||||
  force-realloc 1
 | 
					 | 
				
			||||||
  rtcp-omit
 | 
					 | 
				
			||||||
  rtp-patch ssrc
 | 
					 | 
				
			||||||
  rtp-patch timestamp
 | 
					 | 
				
			||||||
  trunk 1
 | 
					 | 
				
			||||||
   rtp keep-alive once
 | 
					 | 
				
			||||||
   no rtp keep-alive
 | 
					 | 
				
			||||||
   line 0
 | 
					 | 
				
			||||||
@@ -1,18 +0,0 @@
 | 
				
			|||||||
!
 | 
					 | 
				
			||||||
! MGCP configuration example
 | 
					 | 
				
			||||||
!
 | 
					 | 
				
			||||||
mgcp
 | 
					 | 
				
			||||||
  bind ip 127.0.0.1
 | 
					 | 
				
			||||||
  rtp port-range 4002 16000
 | 
					 | 
				
			||||||
  rtp bind-ip 127.0.0.1
 | 
					 | 
				
			||||||
  rtp ip-probing
 | 
					 | 
				
			||||||
  rtp ip-dscp 46
 | 
					 | 
				
			||||||
  bind port 2427
 | 
					 | 
				
			||||||
  sdp audio payload number 98
 | 
					 | 
				
			||||||
  sdp audio payload name GSM
 | 
					 | 
				
			||||||
  number endpoints 512
 | 
					 | 
				
			||||||
  loop 0
 | 
					 | 
				
			||||||
  force-realloc 1
 | 
					 | 
				
			||||||
  rtcp-omit
 | 
					 | 
				
			||||||
  rtp-patch ssrc
 | 
					 | 
				
			||||||
  rtp-patch timestamp
 | 
					 | 
				
			||||||
							
								
								
									
										19
									
								
								doc/examples/osmo-msc/osmo-msc.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								doc/examples/osmo-msc/osmo-msc.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! OsmoMSC configuration saved from vty
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					network
 | 
				
			||||||
 | 
					 network country code 1
 | 
				
			||||||
 | 
					 mobile network code 1
 | 
				
			||||||
 | 
					 short name OsmoMSC
 | 
				
			||||||
 | 
					 long name OsmoMSC
 | 
				
			||||||
 | 
					 auth policy closed
 | 
				
			||||||
 | 
					 location updating reject cause 13
 | 
				
			||||||
 | 
					 encryption a5 0
 | 
				
			||||||
 | 
					 rrlp mode none
 | 
				
			||||||
 | 
					 mm info 1
 | 
				
			||||||
 | 
					msc
 | 
				
			||||||
 | 
					 mgcpgw remote-ip 10.23.24.1
 | 
				
			||||||
 | 
					 assign-tmsi
 | 
				
			||||||
							
								
								
									
										29
									
								
								doc/examples/osmo-sgsn/osmo-sgsn.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								doc/examples/osmo-sgsn/osmo-sgsn.cfg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					!
 | 
				
			||||||
 | 
					! Osmocom SGSN configuration
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					line vty
 | 
				
			||||||
 | 
					 no login
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					sgsn
 | 
				
			||||||
 | 
					 gtp local-ip 10.23.24.1
 | 
				
			||||||
 | 
					 ggsn 0 remote-ip 10.23.24.2
 | 
				
			||||||
 | 
					 ggsn 0 gtp-version 1
 | 
				
			||||||
 | 
					 auth-policy remote
 | 
				
			||||||
 | 
					 gsup remote-ip 127.0.0.1
 | 
				
			||||||
 | 
					 gsup remote-port 4222
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					ns
 | 
				
			||||||
 | 
					 timer tns-block 3
 | 
				
			||||||
 | 
					 timer tns-block-retries 3
 | 
				
			||||||
 | 
					 timer tns-reset 3
 | 
				
			||||||
 | 
					 timer tns-reset-retries 3
 | 
				
			||||||
 | 
					 timer tns-test 30
 | 
				
			||||||
 | 
					 timer tns-alive 3
 | 
				
			||||||
 | 
					 timer tns-alive-retries 10
 | 
				
			||||||
 | 
					 encapsulation udp local-ip 10.23.24.1
 | 
				
			||||||
 | 
					 encapsulation udp local-port 23000
 | 
				
			||||||
 | 
					 encapsulation framerelay-gre enabled 0
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					bssgp
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
							
								
								
									
										54
									
								
								doc/gsm-hopping.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								doc/gsm-hopping.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
				
			|||||||
 | 
					according to GSM 05.02:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					general parameters from CCCH:
 | 
				
			||||||
 | 
					* CA cell allocation of ARFCN's (System Information / BCCH)
 | 
				
			||||||
 | 
					* FN: TDMA frame number (t1,t2,t3') in SCH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					specific parameters from channel assignment:
 | 
				
			||||||
 | 
					* MA: mobile allocation, defines set of ARFCN's, up to 64
 | 
				
			||||||
 | 
					* MAIO: index
 | 
				
			||||||
 | 
					* HSN: hopping sequence generator number (0..64)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					hopping sequence generation (6.2.3):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uint8_t rntable[114] = {
 | 
				
			||||||
 | 
						 48,  98,  63,   1,  36,  95,  78, 102,  94,  73,
 | 
				
			||||||
 | 
						  0,  64,  25,  81,  76,  59, 124,  23, 104, 100,
 | 
				
			||||||
 | 
						101,  47, 118,  85,  18,  56,  96,  86,  54,   2,
 | 
				
			||||||
 | 
						 80,  34, 127,  13,   6,  89,  57, 103,  12,  74,
 | 
				
			||||||
 | 
						 55, 111,  75,  38, 109,  71, 112,  29,  11,  88,
 | 
				
			||||||
 | 
						 87,  19,   3,  68, 110,  26,  33,  31,   8,  45,
 | 
				
			||||||
 | 
						 82,  58,  40, 107,  32,   5, 106,  92,  62,  67,
 | 
				
			||||||
 | 
						 77, 108, 122,  37,  60,  66, 121,  42,  51, 126,
 | 
				
			||||||
 | 
						117, 114,   4,  90,  43,  52,  53, 113, 120,  72,
 | 
				
			||||||
 | 
						 16,  49,   7,  79, 119,  61,  22,  84,   9,  97,
 | 
				
			||||||
 | 
						125,  99,  17, 123
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* mai=0 represents lowest ARFCN in the MA */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uint8_t hopping_mai(uint8_t hsn, uint32_t fn, uint8_t maio,
 | 
				
			||||||
 | 
							     uint8_t t1, uint8_t t2, uint8_t t3_)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						uint8_t mai;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (hsn == 0) /* cyclic hopping */
 | 
				
			||||||
 | 
							mai = (fn + maio) % n;
 | 
				
			||||||
 | 
						else {
 | 
				
			||||||
 | 
							uint32_t m, m_, t_, s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							m = t2 + rntable[(hsn xor (t1 % 64)) + t3];
 | 
				
			||||||
 | 
							m_ = m % (2^NBIN);
 | 
				
			||||||
 | 
							t_ = t3 % (2^NBIN);
 | 
				
			||||||
 | 
							if (m_ < n then)
 | 
				
			||||||
 | 
								s = m_;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								s = (m_ + t_) % n;
 | 
				
			||||||
 | 
							mai = (s + maio) % n;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return mai;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										89
									
								
								doc/handover.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								doc/handover.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,89 @@
 | 
				
			|||||||
 | 
					Ideas about a handover algorithm
 | 
				
			||||||
 | 
					======================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This is mostly based on the results presented in Chapter 8 of "Performance
 | 
				
			||||||
 | 
					Enhancements in a Frequency Hopping GSM Network" by Thomas Toftegaard Nielsen
 | 
				
			||||||
 | 
					and Joeroen Wigard. 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=== Reasons for performing handover ===
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Section 2.1.1: Handover used in their CAPACITY simulation:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1) Interference Handover
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Average RXLEV is satisfactory high, but average RXQUAL too low indicates
 | 
				
			||||||
 | 
					interference to the channel.  Handover should be made.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2) Bad Quality
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Averaged RXQUAL is lower than a threshold
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					3) Low Level / Signal Strength
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Average RXLEV is lower than a threshold
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					4) Distance Handover
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MS is too far away from a cell (measured by TA)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					5) Power budget / Better Cell
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RX Level of neighbor cell is at least "HO Margin dB" dB better than the
 | 
				
			||||||
 | 
					current serving cell.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=== Ideal parameters for HO algorithm ===
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Chapter 8, Section 2.2, Table 24:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Window RXLEV averaging:		10 SACCH frames (no weighting)
 | 
				
			||||||
 | 
					Window RXQUAL averaging:	1 SACCH frame (no averaging)
 | 
				
			||||||
 | 
					Level Threashold:		1 of the last 1 AV-RXLEV values < -110dBm
 | 
				
			||||||
 | 
					Quality Threshold:		3 of the last 4 AV-RXQUAL values >= 5
 | 
				
			||||||
 | 
					Interference Threshold:		1 of the last AV-RXLEV > -85 dBm &
 | 
				
			||||||
 | 
									3 of the last 4 AV-RXQUAL values >= 5
 | 
				
			||||||
 | 
					Power Budget:			Level of neighbor cell > 3 dB better
 | 
				
			||||||
 | 
					Power Budget Interval:		Every 6 SACCH frames (6 seconds ?!?)
 | 
				
			||||||
 | 
					Distance Handover:		Disabled
 | 
				
			||||||
 | 
					Evaluation rule 1:		RXLEV of the candidate cell a tleast -104 dBm
 | 
				
			||||||
 | 
					Evaluation rule 2:		Level of candidate cell > 3dB better own cell
 | 
				
			||||||
 | 
					Timer Successful HO:		5 SACCH frames
 | 
				
			||||||
 | 
					Timer Unsuccessful HO:		1 SACCH frame
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In a non-frequency hopping case, RXQUAL threshold can be decreased to
 | 
				
			||||||
 | 
					RXLEV >= 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When frequency hopping is enabled, the following additional parameters
 | 
				
			||||||
 | 
					should be introduced:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* No intra-cell handover
 | 
				
			||||||
 | 
					* Use a HO Margin of 2dB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=== Handover Channel Reservation ===
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In loaded network, each cell should reserve some channels for handovers,
 | 
				
			||||||
 | 
					rather than using all of them for new call establishment.  This reduces the
 | 
				
			||||||
 | 
					need to drop calls due to failing handovers, at the expense of failing new call
 | 
				
			||||||
 | 
					attempts.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=== Dynamic HO Margin ===
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The handover margin (hysteresis) should depend on the RXQUAL. Optimal results
 | 
				
			||||||
 | 
					were achieved with the following settings:
 | 
				
			||||||
 | 
					* RXQUAL <= 4: 9 dB
 | 
				
			||||||
 | 
					* RXQUAL == 5: 6 dB
 | 
				
			||||||
 | 
					* RXQUAL >= 6: 1 dB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					== Actual Handover on a protocol level ==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					After the BSC has decided a handover shall be done, it has to
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# allocate a channel at the new BTS
 | 
				
			||||||
 | 
					# allocate a handover reference
 | 
				
			||||||
 | 
					# activate the channel on the BTS side using RSL CHANNEL ACTIVATION,
 | 
				
			||||||
 | 
					  indicating the HO reference
 | 
				
			||||||
 | 
					# BTS responds with CHAN ACT ACK, including GSM frame number
 | 
				
			||||||
 | 
					# BSC sends 04.08 HO CMD to MS using old BTS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										94
									
								
								doc/ipa-sccp.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								doc/ipa-sccp.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,94 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					IPA SCCP message flow in the BSC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					February, 2013		Holger Hans Peter Freyther
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CONTENTS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1. SCCP inside the IPA header
 | 
				
			||||||
 | 
					2. Supported SCCP message types
 | 
				
			||||||
 | 
					3. Receiving SCCP messages
 | 
				
			||||||
 | 
					4. Sending SCCP messages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1. SCCP inside the IPA header
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Many Soft-MSCs implement something that is called SCCP/lite. This means
 | 
				
			||||||
 | 
					that SCCP messages are transported inside a small multiplexing protocol
 | 
				
			||||||
 | 
					over TCP/IP. This is an alternative to a full SIGTRAN implementation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The multiplexing protocol is the same as used with the sysmoBTS and the
 | 
				
			||||||
 | 
					ip.access nanoBTS. It is a three byte header with two bytes for the length
 | 
				
			||||||
 | 
					in network byte order and one byte for the type. The type to be used for
 | 
				
			||||||
 | 
					SCCP is 0xFD.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct ipa_header {
 | 
				
			||||||
 | 
							uint16_t length_in_network_order;
 | 
				
			||||||
 | 
							uint8_t  type;
 | 
				
			||||||
 | 
						} __attribute__((packed));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2. Supported SCCP message types
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To implement GSM 08.08 only a subset of SCCP messages need to be implemented.
 | 
				
			||||||
 | 
					For transporting paging and reset messages SCCP UDT messages are used. For
 | 
				
			||||||
 | 
					the connections with a Mobile Station (MS) a SCCP connection is opened. This
 | 
				
			||||||
 | 
					means that the SCCP CR, SCCP CC, SCCP CREF, SCCP RLC, SCCP RLSD, SCCP DT1
 | 
				
			||||||
 | 
					and SCCP IT messages are supported.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					3. Receiving SCCP UDT messages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This is an illustration of the flow of messages. The IPA multiplexing protocol
 | 
				
			||||||
 | 
					is used for various protocols. This means there is a central place where the
 | 
				
			||||||
 | 
					multiplexing stream terminates. The stream is terminated in the osmo_bsc_msc.c
 | 
				
			||||||
 | 
					file and the ipaccess_a_fd_cb method. For SCCP messages the SCCP dispatching
 | 
				
			||||||
 | 
					sccp_system_incoming method is called. This function is implemented in the
 | 
				
			||||||
 | 
					libosmo-sccp library.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To receive UDT messages osmo_bsc_sccp.c:osmo_bsc_sccp_init is using the
 | 
				
			||||||
 | 
					sccp_set_read function to register a callback for UDT messages. The callback
 | 
				
			||||||
 | 
					is msc_sccp_read and it is calling bsc_handle_udt that is implemented in the
 | 
				
			||||||
 | 
					osmo_bsc_bssap.c. This function will handle the GSM 08.08 BSSAP messages.
 | 
				
			||||||
 | 
					Currently only the reset acknowledge and the paging messages are handled.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The BSC currently does not accept incoming SCCP messages and is only opening
 | 
				
			||||||
 | 
					SCCP connections to the MSC. When opening a connection the callbacks for state
 | 
				
			||||||
 | 
					changes (connection confirmed, released, release complete) are set and a routine
 | 
				
			||||||
 | 
					for handling incoming data. This registration is done in the osmo_bsc_sccp.c
 | 
				
			||||||
 | 
					file and the bsc_create_new_connection method. The name of the callback is
 | 
				
			||||||
 | 
					msc_outgoing_sccp_data and this will call bsc_handle_dt1 that is implemented
 | 
				
			||||||
 | 
					in the osmo_bsc_bssap.c file. This will forward the messages to the right
 | 
				
			||||||
 | 
					Mobile Station (MS).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					4. Sending SCCP messages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					There are three parts to sending that will be explained below. The first part
 | 
				
			||||||
 | 
					is to send an entire SCCP frame (which includes the GSM 08.08 data) to the
 | 
				
			||||||
 | 
					MSC. This is done by first registering the low level sending. sccp_system_init
 | 
				
			||||||
 | 
					is called with the function that is responsible for sending a message. The
 | 
				
			||||||
 | 
					msc_sccp_write_ipa will call the msc_queue_write function with the data and
 | 
				
			||||||
 | 
					the right MSC connection. Below the msc_queue_write the IPA header will be
 | 
				
			||||||
 | 
					prepended to the msg and then send to the MSC.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The BSC supports multiple different A-link connections, the decision to pick
 | 
				
			||||||
 | 
					the right MSC is done in this method. It is either done via the SCCP connection
 | 
				
			||||||
 | 
					or the ctx pointer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When the BSC is starting a BSS RESET message will be sent to the MSC. The reset
 | 
				
			||||||
 | 
					is created in osmo_bsc_msc.c:initialize_if_needed and sccp_write is called with
 | 
				
			||||||
 | 
					the GSM 08.08 data and the connection to use. The libosmo-sccp library will
 | 
				
			||||||
 | 
					embed it into a SCCP UDT message and call the msc_sccp_write_ipa method.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When a new SCCP connection is to be created the bsc_create_new_connection
 | 
				
			||||||
 | 
					in the osmo_bsc_sccp.c file. The sccp_connection_socket method will create
 | 
				
			||||||
 | 
					the context for a SCCP connection. The state and data callback will be used
 | 
				
			||||||
 | 
					to be notified about data and changes. Once the connection is configured the
 | 
				
			||||||
 | 
					bsc_open_connection will be called that will ask the libosmo-sccp library to
 | 
				
			||||||
 | 
					create a SCCP CR message using the sccp_connection_connect method. For active
 | 
				
			||||||
 | 
					connections the sccp_connection_write method will be called.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,23 +0,0 @@
 | 
				
			|||||||
EXTRA_DIST = osmomgw-usermanual.adoc \
 | 
					 | 
				
			||||||
    osmomgw-usermanual-docinfo.xml \
 | 
					 | 
				
			||||||
    osmomgw-vty-reference.xml \
 | 
					 | 
				
			||||||
    regen_doc.sh \
 | 
					 | 
				
			||||||
    chapters \
 | 
					 | 
				
			||||||
    vty
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if BUILD_MANUALS
 | 
					 | 
				
			||||||
  ASCIIDOC = osmomgw-usermanual.adoc
 | 
					 | 
				
			||||||
  ASCIIDOC_DEPS = $(srcdir)/chapters/*.adoc
 | 
					 | 
				
			||||||
  include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.asciidoc.inc
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  VTY_REFERENCE = osmomgw-vty-reference.xml
 | 
					 | 
				
			||||||
  include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.vty-reference.inc
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  BUILT_REFERENCE_XML = $(builddir)/vty/mgw_vty_reference.xml
 | 
					 | 
				
			||||||
  $(builddir)/vty/mgw_vty_reference.xml: $(top_builddir)/src/osmo-mgw/osmo-mgw
 | 
					 | 
				
			||||||
	mkdir -p $(builddir)/vty
 | 
					 | 
				
			||||||
	$(top_builddir)/src/osmo-mgw/osmo-mgw --vty-ref-xml > $@
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  OSMO_REPOSITORY = osmo-mgw
 | 
					 | 
				
			||||||
  include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.common.inc
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
@@ -1,129 +0,0 @@
 | 
				
			|||||||
== Configuring OsmoMGW
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
A basic configation of OsmoMGW mainly consists of specifying the IP address
 | 
					 | 
				
			||||||
and port on which to listen to MGCP commands, but changing the port range at
 | 
					 | 
				
			||||||
which the RTP streams terminate as well as limiting operation to a single call
 | 
					 | 
				
			||||||
agent can be done as well as changing the number of endpoints.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== Configuring MGCP
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
By default OsmoMGW listens for MGCP on port 2427 on any IP address. If a call
 | 
					 | 
				
			||||||
agent address is configured then OsmoMGW will only answer MGCP commands from
 | 
					 | 
				
			||||||
that IP port 2727, otherwise all sources are handled. A domain can be
 | 
					 | 
				
			||||||
specified
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: MGCP configuration
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# bind ip 127.0.0.1
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# bind port 2427
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# call-agent ip 127.0.0.1
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# domain mgw-bsc
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# local ip 127.0.0.1
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== Configuring the trunk
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The first trunk is considered a virtual trunk in OsmoMGW. All
 | 
					 | 
				
			||||||
endpoints of type "rtpbridge" are routed here. The virtual trunk is configured
 | 
					 | 
				
			||||||
in the config-mgcp context.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
All other trunks are configured in the config-mgcp-trunk context, but the
 | 
					 | 
				
			||||||
commands used are identical. Right now trunks are considered only for "ds/e1"
 | 
					 | 
				
			||||||
type endpoints.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: MGCP trunk configuration
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# number endpoints 63 <1>
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# rtp bind-ip 10.0.0.1 <2>
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# rtp port-range 12000-14000 <3>
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
<1> Maximum number of endpoints that can be allocated at once
 | 
					 | 
				
			||||||
<2> Use this IP when binding RTP endpoints
 | 
					 | 
				
			||||||
<3> Use ports in this range when binding RTP endpoints
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
There are some options to tweak how RTP forwarding behaves in OsmoMGW:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: MGCP trunk rtp options
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# rtp keep-alive 30 <1>
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# rtp-patch ssrc <2>
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# rtp-patch timestamp <3>
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
<1> Send dummy UDP packets periodically to RTP destination
 | 
					 | 
				
			||||||
<2> Hide SSRC changes
 | 
					 | 
				
			||||||
<3> Ensure RTP timestamp is aligned with frame duration
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NOTE: Changes to trunks that affect resource allocation, such as newly created
 | 
					 | 
				
			||||||
trunks or a change of the number of available endpoints, require a full restart
 | 
					 | 
				
			||||||
of osmo-mgw!
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== E1 trunk considerations
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
While the RTP bridge trunks are natively based on IP no special considerations
 | 
					 | 
				
			||||||
are required during setup. E1 trunks are mapped on a physical E1 line, which has
 | 
					 | 
				
			||||||
to be configured as shown below.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: E1 line setup
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
OsmoMGW(config-e1_input)# e1_line 0 driver dahdi <1>
 | 
					 | 
				
			||||||
OsmoMGW(config-e1_input)# e1_line 0 port 2 <2>
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
<1> Name of the libosmo-abis driver implementation ("dahdi")
 | 
					 | 
				
			||||||
<2> Port number of the physical E1 port to use (2)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
In osmo-mgw the e1_input node is used to configure the physical E1 line. The
 | 
					 | 
				
			||||||
line number will be used internally to identify the configured E1 line. The
 | 
					 | 
				
			||||||
port number is the physical E1 connector (sometimes called 'span') at the E1
 | 
					 | 
				
			||||||
hardware. Per trunk an individual E1 line will be needed. Beware that the E1
 | 
					 | 
				
			||||||
driver may also need configuration settings that are not discussed here.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: E1 trunk setup
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp)# trunk 0 <1>
 | 
					 | 
				
			||||||
OsmoMGW(config-mgcp-trunk)# line 0 <2>
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
<1> Creation of a trunk (0)
 | 
					 | 
				
			||||||
<2> Reference to the E1 line to use (0)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The E1 trunk is created along with a number, typically starting at 0, but if
 | 
					 | 
				
			||||||
required any number from 0-64 is allowed. The E1 trunk configuration concerning
 | 
					 | 
				
			||||||
the IP related aspects is nearly identical to the configuration of the virtual
 | 
					 | 
				
			||||||
trunk. However, it is important that the user assigns one of the E1 line numbers
 | 
					 | 
				
			||||||
that were configured under the e1_input node.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NOTE: The endpoint name that is used on MGCP level will include the trunk number,
 | 
					 | 
				
			||||||
not the E1 line number. For simplicity (and compatibility with OsmoBSC) it is
 | 
					 | 
				
			||||||
recommended to use equal numbers for trunk and E1 line. However, if required any
 | 
					 | 
				
			||||||
E1 line can be mapped flexible on any trunk as long as the mapping is bijective.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: A typical configuration with one E1 trunk
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
e1_input
 | 
					 | 
				
			||||||
 e1_line 0 driver dahdi
 | 
					 | 
				
			||||||
 e1_line 0 port 2
 | 
					 | 
				
			||||||
mgcp
 | 
					 | 
				
			||||||
 bind ip 127.0.0.1
 | 
					 | 
				
			||||||
 rtp net-range 6000 6011
 | 
					 | 
				
			||||||
 rtp net-bind-ip 192.168.100.130
 | 
					 | 
				
			||||||
 rtp ip-probing
 | 
					 | 
				
			||||||
 rtp ip-dscp 46
 | 
					 | 
				
			||||||
 no rtp keep-alive
 | 
					 | 
				
			||||||
 bind port 2428
 | 
					 | 
				
			||||||
 number endpoints 30
 | 
					 | 
				
			||||||
 loop 0
 | 
					 | 
				
			||||||
 force-realloc 1
 | 
					 | 
				
			||||||
 osmux off
 | 
					 | 
				
			||||||
 rtp-patch rfc5993hr
 | 
					 | 
				
			||||||
 trunk 0
 | 
					 | 
				
			||||||
  rtp keep-alive once
 | 
					 | 
				
			||||||
  no rtp keep-alive
 | 
					 | 
				
			||||||
  line 0
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NOTE: One E1 trunk always covers a whole E1 line. All subslots (I.640) will be mapped
 | 
					 | 
				
			||||||
to individual MGCP endpoints. As long as the endpoints remain unused the
 | 
					 | 
				
			||||||
underlying E1 timeslot is not used.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NOTE: The E1 trunk implementation also works with T1 lines, however since T1 has
 | 
					 | 
				
			||||||
24 instead of 31 usable timeslots only the endpoints that fall into that 1-24 timeslot
 | 
					 | 
				
			||||||
range will be useable.
 | 
					 | 
				
			||||||
@@ -1,4 +0,0 @@
 | 
				
			|||||||
[[counters]]
 | 
					 | 
				
			||||||
== Counters
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./counters_generated.adoc[]
 | 
					 | 
				
			||||||
@@ -1,83 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
// autogenerated by show asciidoc counters
 | 
					 | 
				
			||||||
These counters and their description based on OsmoMGW 1.5.0.64-189f (OsmoMGW).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== Rate Counters
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// generating tables for rate_ctr_group
 | 
					 | 
				
			||||||
// rate_ctr_group table aggregated statistics for all rtp connections
 | 
					 | 
				
			||||||
.all_rtp_conn - aggregated statistics for all rtp connections
 | 
					 | 
				
			||||||
[options="header"]
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
| Name | Reference | Description
 | 
					 | 
				
			||||||
| all_rtp:err_tstmp_in | <<all_rtp_conn_all_rtp:err_tstmp_in>> | Total inbound rtp-stream timestamp errors.
 | 
					 | 
				
			||||||
| all_rtp:err_tstmp_out | <<all_rtp_conn_all_rtp:err_tstmp_out>> | Total outbound rtp-stream timestamp errors.
 | 
					 | 
				
			||||||
| all_rtp:packets_rx | <<all_rtp_conn_all_rtp:packets_rx>> | Total inbound rtp packets.
 | 
					 | 
				
			||||||
| all_rtp:octets_rx | <<all_rtp_conn_all_rtp:octets_rx>> | Total inbound rtp octets.
 | 
					 | 
				
			||||||
| all_rtp:packets_tx | <<all_rtp_conn_all_rtp:packets_tx>> | Total outbound rtp packets.
 | 
					 | 
				
			||||||
| all_rtp:octets_tx | <<all_rtp_conn_all_rtp:octets_tx>> | Total outbound rtp octets.
 | 
					 | 
				
			||||||
| all_rtp:dropped | <<all_rtp_conn_all_rtp:dropped>> | Total dropped rtp packets.
 | 
					 | 
				
			||||||
| all_rtp:num_closed_conns | <<all_rtp_conn_all_rtp:num_closed_conns>> | Total number of rtp connections closed.
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
// rate_ctr_group table dlcx statistics
 | 
					 | 
				
			||||||
.dlcx - dlcx statistics
 | 
					 | 
				
			||||||
[options="header"]
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
| Name | Reference | Description
 | 
					 | 
				
			||||||
| dlcx:success | <<dlcx_dlcx:success>> | DLCX command processed successfully.
 | 
					 | 
				
			||||||
| dlcx:wildcard | <<dlcx_dlcx:wildcard>> | wildcard names in DLCX commands are unsupported.
 | 
					 | 
				
			||||||
| dlcx:no_conn | <<dlcx_dlcx:no_conn>> | endpoint specified in DLCX command has no active connections.
 | 
					 | 
				
			||||||
| dlcx:callid | <<dlcx_dlcx:callid>> | CallId specified in DLCX command mismatches endpoint's CallId .
 | 
					 | 
				
			||||||
| dlcx:connid | <<dlcx_dlcx:connid>> | connection ID specified in DLCX command does not exist on endpoint.
 | 
					 | 
				
			||||||
| dlcx:unhandled_param | <<dlcx_dlcx:unhandled_param>> | unhandled parameter in DLCX command.
 | 
					 | 
				
			||||||
| dlcx:rejected | <<dlcx_dlcx:rejected>> | connection deletion rejected by policy.
 | 
					 | 
				
			||||||
| dlcx:deferred | <<dlcx_dlcx:deferred>> | connection deletion deferred by policy.
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
// rate_ctr_group table mdcx statistics
 | 
					 | 
				
			||||||
.mdcx - mdcx statistics
 | 
					 | 
				
			||||||
[options="header"]
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
| Name | Reference | Description
 | 
					 | 
				
			||||||
| mdcx:success | <<mdcx_mdcx:success>> | MDCX command processed successfully.
 | 
					 | 
				
			||||||
| mdcx:wildcard | <<mdcx_mdcx:wildcard>> | wildcard endpoint names in MDCX commands are unsupported.
 | 
					 | 
				
			||||||
| mdcx:no_conn | <<mdcx_mdcx:no_conn>> | endpoint specified in MDCX command has no active connections.
 | 
					 | 
				
			||||||
| mdcx:callid | <<mdcx_mdcx:callid>> | invalid CallId specified in MDCX command.
 | 
					 | 
				
			||||||
| mdcx:connid | <<mdcx_mdcx:connid>> | invalid connection ID specified in MDCX command.
 | 
					 | 
				
			||||||
| crcx:unhandled_param | <<mdcx_crcx:unhandled_param>> | unhandled parameter in MDCX command.
 | 
					 | 
				
			||||||
| mdcx:no_connid | <<mdcx_mdcx:no_connid>> | no connection ID specified in MDCX command.
 | 
					 | 
				
			||||||
| mdcx:conn_not_found | <<mdcx_mdcx:conn_not_found>> | connection specified in MDCX command does not exist.
 | 
					 | 
				
			||||||
| mdcx:invalid_mode | <<mdcx_mdcx:invalid_mode>> | invalid connection mode in MDCX command.
 | 
					 | 
				
			||||||
| mdcx:conn_opt | <<mdcx_mdcx:conn_opt>> | connection options invalid.
 | 
					 | 
				
			||||||
| mdcx:no_remote_conn_desc | <<mdcx_mdcx:no_remote_conn_desc>> | no opposite end specified for connection.
 | 
					 | 
				
			||||||
| mdcx:start_rtp_failure | <<mdcx_mdcx:start_rtp_failure>> | failure to start RTP processing.
 | 
					 | 
				
			||||||
| mdcx:conn_rejected | <<mdcx_mdcx:conn_rejected>> | connection rejected by policy.
 | 
					 | 
				
			||||||
| mdcx:conn_deferred | <<mdcx_mdcx:conn_deferred>> | connection deferred by policy.
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
// rate_ctr_group table crxc statistics
 | 
					 | 
				
			||||||
.crcx - crxc statistics
 | 
					 | 
				
			||||||
[options="header"]
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
| Name | Reference | Description
 | 
					 | 
				
			||||||
| crcx:success | <<crcx_crcx:success>> | CRCX command processed successfully.
 | 
					 | 
				
			||||||
| crcx:bad_action | <<crcx_crcx:bad_action>> | bad action in CRCX command.
 | 
					 | 
				
			||||||
| crcx:unhandled_param | <<crcx_crcx:unhandled_param>> | unhandled parameter in CRCX command.
 | 
					 | 
				
			||||||
| crcx:missing_callid | <<crcx_crcx:missing_callid>> | missing CallId in CRCX command.
 | 
					 | 
				
			||||||
| crcx:invalid_mode | <<crcx_crcx:invalid_mode>> | invalid connection mode in CRCX command.
 | 
					 | 
				
			||||||
| crcx:limit_exceeded | <<crcx_crcx:limit_exceeded>> | limit of concurrent connections was reached.
 | 
					 | 
				
			||||||
| crcx:unkown_callid | <<crcx_crcx:unkown_callid>> | unknown CallId in CRCX command.
 | 
					 | 
				
			||||||
| crcx:alloc_conn_fail | <<crcx_crcx:alloc_conn_fail>> | connection allocation failure.
 | 
					 | 
				
			||||||
| crcx:no_remote_conn_desc | <<crcx_crcx:no_remote_conn_desc>> | no opposite end specified for connection.
 | 
					 | 
				
			||||||
| crcx:start_rtp_failure | <<crcx_crcx:start_rtp_failure>> | failure to start RTP processing.
 | 
					 | 
				
			||||||
| crcx:conn_rejected | <<crcx_crcx:conn_rejected>> | connection rejected by policy.
 | 
					 | 
				
			||||||
| crcx:no_osmux | <<crcx_crcx:no_osmux>> | no osmux offered by peer.
 | 
					 | 
				
			||||||
| crcx:conn_opt | <<crcx_crcx:conn_opt>> | connection options invalid.
 | 
					 | 
				
			||||||
| crcx:codec_nego | <<crcx_crcx:codec_nego>> | codec negotiation failure.
 | 
					 | 
				
			||||||
| crcx:bind_port | <<crcx_crcx:bind_port>> | port bind failure.
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
== Osmo Stat Items
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// generating tables for osmo_stat_items
 | 
					 | 
				
			||||||
== Osmo Counters
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// generating tables for osmo_counters
 | 
					 | 
				
			||||||
// there are no ungrouped osmo_counters
 | 
					 | 
				
			||||||
@@ -1,100 +0,0 @@
 | 
				
			|||||||
== MGCP Endpoints
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
MGCP organizes the switching resources in so called endpoints. Each endpoint is
 | 
					 | 
				
			||||||
referenced by its unique identifier. While RFC 3435 specifies a naming scheme, the
 | 
					 | 
				
			||||||
actual identifier naming is subject to the implementation and configuration.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== RTP proxy / RTP bridge endpoints
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OsmoMGW implements a freely configurable number of `rtpbridge` endpoints. Those
 | 
					 | 
				
			||||||
endpoints are able to host two connections at a time to model the functionality
 | 
					 | 
				
			||||||
of a tandem switch.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RTP bridge endpoint identifiers are referenced by the string `rtpbridge/`, a
 | 
					 | 
				
			||||||
hexadecimal number without leading zeros and a domain name (configurable).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
rtpbridge/<number>@<domain>
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: List of virtual endpoints
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
rtpbridge/1@mgw
 | 
					 | 
				
			||||||
rtpbridge/2@mgw
 | 
					 | 
				
			||||||
rtpbridge/3@mgw
 | 
					 | 
				
			||||||
rtpbridge/4@mgw
 | 
					 | 
				
			||||||
rtpbridge/5@mgw
 | 
					 | 
				
			||||||
rtpbridge/6@mgw
 | 
					 | 
				
			||||||
rtpbridge/7@mgw
 | 
					 | 
				
			||||||
rtpbridge/8@mgw
 | 
					 | 
				
			||||||
rtpbridge/9@mgw
 | 
					 | 
				
			||||||
rtpbridge/a@mgw
 | 
					 | 
				
			||||||
rtpbridge/b@mgw
 | 
					 | 
				
			||||||
rtpbridge/c@mgw
 | 
					 | 
				
			||||||
rtpbridge/d@mgw
 | 
					 | 
				
			||||||
rtpbridge/e@mgw
 | 
					 | 
				
			||||||
rtpbridge/f@mgw
 | 
					 | 
				
			||||||
rtpbridge/10@mgw
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== E1/T1 endpoints
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OsmoMGW supports E1 subslot multiplexing as specified by I.460. All possible
 | 
					 | 
				
			||||||
subslot combinations are mapped on individual endpoints. The endpoint names
 | 
					 | 
				
			||||||
are prefixed with `ds/e1-` followed by the trunk number and the E1 timeslot.
 | 
					 | 
				
			||||||
The subslot is defined by a bit rate and a bit offset.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
ds/e1-<trunk>/s-<timeslot>/su<bitrate>-<bitoffset>@<domain>
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: List of endpoints on E1 trunk 0 at E1 timeslot 2
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su64-0@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su32-0@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su32-4@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su16-0@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su16-2@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su16-4@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su16-6@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su8-0@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su8-1@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su8-2@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su8-3@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su8-4@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su8-5@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su8-6@mgw
 | 
					 | 
				
			||||||
ds/e1-0/s-2/su8-7@mgw
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
When creating connections on endpoints that reside in one E1 timeslot the call
 | 
					 | 
				
			||||||
agent must make sure that no overlapping endpoints are used. It is for example
 | 
					 | 
				
			||||||
not possible to use `ds/e1-0/s-2/su16-2@mgw` and `ds/e1-0/s-2/su8-3@mgw` at the
 | 
					 | 
				
			||||||
same time because they overlap.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Subslot overlapping
 | 
					 | 
				
			||||||
[options="header"]
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
| Bit offset  4+| Subslots
 | 
					 | 
				
			||||||
| 0 | 8k .2+| 16k .4+| 32k .8+| 64k
 | 
					 | 
				
			||||||
| 1 | 8k
 | 
					 | 
				
			||||||
| 2 | 8k .2+| 16k
 | 
					 | 
				
			||||||
| 3 | 8k
 | 
					 | 
				
			||||||
| 4 | 8k .2+| 16k .4+| 32k
 | 
					 | 
				
			||||||
| 5 | 8k
 | 
					 | 
				
			||||||
| 6 | 8k .2+| 16k
 | 
					 | 
				
			||||||
| 7 | 8k
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NOTE: The current implementation (December 2020) only implements TRAU frame
 | 
					 | 
				
			||||||
encoding/decoding for 16K and 8K subslots. Endpoints with other bitrates are
 | 
					 | 
				
			||||||
not yet useable.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NOTE: the VTY command "show mgcp" can be used to get a list of all available
 | 
					 | 
				
			||||||
endpoints (including identifiers)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== The `null` endpoint
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OsmoMGW offers a special `null@<domain>` endpoint which can be audited at all times.
 | 
					 | 
				
			||||||
This is useful for MGCP clients who wish to submit requests to OsmoMGW
 | 
					 | 
				
			||||||
periodically to find out whether it is still reachable and in a working state.
 | 
					 | 
				
			||||||
@@ -1,72 +0,0 @@
 | 
				
			|||||||
== MGCP Extensions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The MGCP protocol is extendable. The following non-standard extensions are
 | 
					 | 
				
			||||||
understood by OsmoMGW.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== `X-Osmo-IGN`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`X-Osmo-IGN` indicates to OsmoMGW that specific items of an endpoint should be
 | 
					 | 
				
			||||||
ignored, so that it is lenient on mismatching values that would normally
 | 
					 | 
				
			||||||
indicate collisions or configuration errors.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
==== `X-Osmo-IGN` Format
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The value part of `X-Osmo-IGN` must be one or more items separated by one or more
 | 
					 | 
				
			||||||
spaces. Each item consists of one or more non-whitespace characters.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: `X-Osmo-IGN` format with three ficticious items "X", "abc" and "123".
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
X-Osmo-IGN: X abc 123
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`X-Osmo-IGN` must be issued in the MGCP header section (typically as its last item),
 | 
					 | 
				
			||||||
before the SDP section starts.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
==== Supported `X-Osmo-IGN` Items
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Currently, the following `X-Osmo-IGN` items are supported:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* `C`: ignore CallID mismatches, i.e. differing "C" values between connections
 | 
					 | 
				
			||||||
  on the same endpoint.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Note:
 | 
					 | 
				
			||||||
`X-Osmo-IGN` does not support ignoring mismatches on the domain part of
 | 
					 | 
				
			||||||
an endpoint name, e.g. ignoring a mismatch on "example.com" in
 | 
					 | 
				
			||||||
`rtpbridge/123abc@example.com`. Instead, you may globally configure OsmoMGW
 | 
					 | 
				
			||||||
with `mgcp` / `domain *` to permit all domain parts.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
===== `X-Osmo-IGN: C`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
By default, OsmoMGW verifies that all CallIDs ("C" values) match for all
 | 
					 | 
				
			||||||
connections on any one given endpoint. To ignore CallID mismatches, pass a `C`
 | 
					 | 
				
			||||||
in the `X-Osmo-IGN` header, for the first or the second `CRCX` on an endpoint.
 | 
					 | 
				
			||||||
When the `X-Osmo-IGN: C` is sent for any one `CRCX` on an endpoint, CallID
 | 
					 | 
				
			||||||
mismatches will be ignored for that and all subsequent messages for that
 | 
					 | 
				
			||||||
endpoint. Hence this header only needs to be included once per endpoint, in any
 | 
					 | 
				
			||||||
`CRCX` message that precedes or coincides with a CallID mismatch.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This is particularly useful for a BSC that is connected to an A/SCCPlite MSC,
 | 
					 | 
				
			||||||
where the BSC and MSC each are expected to configure their respective own
 | 
					 | 
				
			||||||
connection on a shared endpoint. For A/SCCPlite, it is impossible for the BSC
 | 
					 | 
				
			||||||
to know the CallID that the MSC will use, so CallID mismatches are inevitable.
 | 
					 | 
				
			||||||
See also OsmoBSC, which will by default pass the `X-Osmo-IGN: C` header for
 | 
					 | 
				
			||||||
endpoints associated with an A/SCCPlite MSC.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example: `CRCX` message that instructs OsmoMGW to ignore CallID mismatches
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
CRCX 2 rtpbridge/123abc@mgw MGCP 1.0
 | 
					 | 
				
			||||||
M: recvonly
 | 
					 | 
				
			||||||
C: 2
 | 
					 | 
				
			||||||
L: p:20
 | 
					 | 
				
			||||||
X-Osmo-IGN: C
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
v=0
 | 
					 | 
				
			||||||
c=IN IP4 123.12.12.123
 | 
					 | 
				
			||||||
m=audio 5904 RTP/AVP 97
 | 
					 | 
				
			||||||
a=rtpmap:97 GSM-EFR/8000
 | 
					 | 
				
			||||||
a=ptime:40
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== `X-Osmux`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
See <<mgcp-extension-osmux>>
 | 
					 | 
				
			||||||
@@ -1,115 +0,0 @@
 | 
				
			|||||||
[[overview]]
 | 
					 | 
				
			||||||
== Overview
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This manual should help you getting started with OsmoMGW. It will cover
 | 
					 | 
				
			||||||
aspects of configuring and running the media gateway.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[intro_overview]]
 | 
					 | 
				
			||||||
=== About OsmoMGW
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OsmoMGW is the Osmocom implementation of a media gateway to handle user
 | 
					 | 
				
			||||||
plane (voice) traffic in cellular networks. It can connect and optionally
 | 
					 | 
				
			||||||
transcode RTP voice streams between different network elements such as BTSs
 | 
					 | 
				
			||||||
and external entities like SIP. It is typically co-located with both OsmoBSC
 | 
					 | 
				
			||||||
and OsmoMSC and controlled by them via MGCP, the Media Gateway Control
 | 
					 | 
				
			||||||
Protocol.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[fig-bsc]]
 | 
					 | 
				
			||||||
.OsmoMGW used with OsmoBSC
 | 
					 | 
				
			||||||
[graphviz]
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
digraph G {
 | 
					 | 
				
			||||||
    rankdir = LR;
 | 
					 | 
				
			||||||
    OsmoBTS -> OsmoBSC [label="Abis/IP"];
 | 
					 | 
				
			||||||
    OsmoBSC -> "core-network" [label="3GPP AoIP"];
 | 
					 | 
				
			||||||
    OsmoBSC -> OsmoMGW [label="MGCP"];
 | 
					 | 
				
			||||||
    OsmoBTS -> OsmoMGW [label="RTP",dir=both];
 | 
					 | 
				
			||||||
    OsmoMGW -> "core-network" [label="RTP",dir=both];
 | 
					 | 
				
			||||||
    {rank=same OsmoBSC OsmoMGW}
 | 
					 | 
				
			||||||
    OsmoMGW [color=red];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[fig-msc]]
 | 
					 | 
				
			||||||
.OsmoMGW used with OsmoMSC
 | 
					 | 
				
			||||||
[graphviz]
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
digraph G {
 | 
					 | 
				
			||||||
    rankdir = LR;
 | 
					 | 
				
			||||||
    "2G BSS" -> OsmoMSC [label="3GPP AoIP"];
 | 
					 | 
				
			||||||
    OsmoMSC -> OsmoMGW [label="MGCP"];
 | 
					 | 
				
			||||||
    "2G BSS" -> OsmoMGW [label="RTP",dir=both];
 | 
					 | 
				
			||||||
    OsmoMSC -> OsmoSIP [label="MNCC"];
 | 
					 | 
				
			||||||
    OsmoSIP -> PBX [label="SIP Trunk"];
 | 
					 | 
				
			||||||
    OsmoMGW -> PBX [label="RTP",dir=both];
 | 
					 | 
				
			||||||
    {rank=same OsmoMSC OsmoMGW}
 | 
					 | 
				
			||||||
    OsmoSIP [label="osmo-sip-connector"];
 | 
					 | 
				
			||||||
    OsmoMGW [color=red];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    hNodeB -> OsmoHNBGW [label="Iuh"];
 | 
					 | 
				
			||||||
    OsmoHNBGW -> OsmoMSC [label="IuCS"];
 | 
					 | 
				
			||||||
    hNodeB -> OsmoMGW [label="RTP",dir=both];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[fig-bsc-e1]]
 | 
					 | 
				
			||||||
.Integration of legacy E1 BTS in AoIP network
 | 
					 | 
				
			||||||
[graphviz]
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
digraph G {
 | 
					 | 
				
			||||||
    rankdir = LR;
 | 
					 | 
				
			||||||
    BTS -> OsmoBSC [label="Abis/E1"];
 | 
					 | 
				
			||||||
    OsmoBSC -> "core-network" [label="3GPP AoIP"];
 | 
					 | 
				
			||||||
    OsmoBSC -> OsmoMGW [label="MGCP"];
 | 
					 | 
				
			||||||
    BTS -> OsmoMGW [label="TRAU/E1",dir=both];
 | 
					 | 
				
			||||||
    OsmoMGW -> "core-network" [label="RTP",dir=both];
 | 
					 | 
				
			||||||
    {rank=same OsmoBSC OsmoMGW}
 | 
					 | 
				
			||||||
    OsmoMGW [color=red];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== Software Components
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OsmoMGW contains a variety of different software components, which we’ll
 | 
					 | 
				
			||||||
quickly describe in this section.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
==== MGCP Implementation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OsmoMGW brings its own MGCP implementation through which OsmoMGW is
 | 
					 | 
				
			||||||
controlled.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The commands implemented are CRCX, MDCX, DLCX and RSIP. The command AUEP is
 | 
					 | 
				
			||||||
implemented as a stub and will simply respond with OK.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
==== RTP implementation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Support for IuUP which is used in 3G cells is quite lacking at the moment.
 | 
					 | 
				
			||||||
3G<->3G and 2G<->2G calls should work, but 3G<->2G does not.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
==== Audio transcoder
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Transcoding is currently not supported in OsmoMGW.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== Limitations
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
At the moment (November 2020), OsmoMGW implements RTP proxy / RTP bridge
 | 
					 | 
				
			||||||
type endpoints and E1/T1 16k/8k sub-slots with TRAU frames for classic BTS
 | 
					 | 
				
			||||||
support. To the RTP proxy / RTP bridge endpoints two RTP connections can
 | 
					 | 
				
			||||||
be established, which then work as a tandem. E1/T1 endpoints support one
 | 
					 | 
				
			||||||
RTP connection at a time that is associated with a sub-slot on an E1 line.
 | 
					 | 
				
			||||||
We are planning to add further endpoint types for:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- classic E1/T1 timeslots (64kBps alaw/ulaw)
 | 
					 | 
				
			||||||
- announcement/playout end-points
 | 
					 | 
				
			||||||
- conference endpoints
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== Additional resources
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
You can find the OsmoMGW issue tracker and wiki online at
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- https://osmocom.org/projects/osmo-mgw
 | 
					 | 
				
			||||||
- https://osmocom.org/projects/osmo-mgw/wiki
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RFC 3435 for MGCP is located at
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- https://tools.ietf.org/html/rfc3435
 | 
					 | 
				
			||||||
@@ -1,42 +0,0 @@
 | 
				
			|||||||
==== Full example of QoS for osmo-mgw
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
In the below example we will show the full set of configuration required
 | 
					 | 
				
			||||||
for both DSCP and PCP differentiation of RTP traffic by osmo-mgw.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
What we want to achieve in this example is the following configuration:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.DSCP and PCP assignments for osmo-mgw Abis downlink traffic in this example
 | 
					 | 
				
			||||||
[options="header",width="30%",cols="2,1,1"]
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
|Traffic      |DSCP|PCP
 | 
					 | 
				
			||||||
|RTP    |  46|  6
 | 
					 | 
				
			||||||
|===
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
. configure the osmo-mgw program to set the DSCP value
 | 
					 | 
				
			||||||
. configure an egrees QoS map to map from priority to PCP
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example Step 1: add related VTY configuration to `osmo-mgw.cfg`
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
...
 | 
					 | 
				
			||||||
mgcp
 | 
					 | 
				
			||||||
 rtp ip-dscp 46
 | 
					 | 
				
			||||||
 rtp socket-priority 6
 | 
					 | 
				
			||||||
...
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.Example Step 2: egress QoS map to map from socket priority to PCP values
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
$ sudo ip link set dev eth0.9<1> type vlan egress-qos-map 0:0 5:5 6:6 7:7 <2>
 | 
					 | 
				
			||||||
----
 | 
					 | 
				
			||||||
<1> make sure to specify your specific VLAN interface name here instead of `eth0.9`.
 | 
					 | 
				
			||||||
<2> create a egress QoS map that maps the priority value 1:1 to the PCP. We also include the
 | 
					 | 
				
			||||||
    mapping 5:5 and 7:7 from the osmo-bsc example (see <<userman-osmobsc>>) here.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NOTE:: The settings of the `ip` command are volatile and only active until
 | 
					 | 
				
			||||||
the next reboot (or the network device or VLAN is removed).  Please refer to
 | 
					 | 
				
			||||||
the documentation of your specific Linux distribution in order to find out how
 | 
					 | 
				
			||||||
to make such settings persistent by means of an `ifup` hook whenever the interface
 | 
					 | 
				
			||||||
comes up.  For CentOS/RHEL 8 this can e.g. be achieved by means of an `/sbin/ifup-local
 | 
					 | 
				
			||||||
script` (when using `network-scripts` and not NetworkManager).  For Debian or Ubuntu,
 | 
					 | 
				
			||||||
this typically involves adding `up` lines to `/etc/network/interfaces` or a `/etc/network/if-up.d`
 | 
					 | 
				
			||||||
script.
 | 
					 | 
				
			||||||
@@ -1,25 +0,0 @@
 | 
				
			|||||||
== Running OsmoMGW
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The OsmoMGW executable (`osmo-mgw`) offers the following command-line
 | 
					 | 
				
			||||||
arguments:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== SYNOPSIS
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
*osmo-mgw* [-h|-V] [-D] [-c 'CONFIGFILE'] [-s]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=== OPTIONS
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
*-h, --help*::
 | 
					 | 
				
			||||||
	Print a short help message about the supported options
 | 
					 | 
				
			||||||
*-V, --version*::
 | 
					 | 
				
			||||||
	Print the compile-time version number of the program
 | 
					 | 
				
			||||||
*-D, --daemonize*::
 | 
					 | 
				
			||||||
	Fork the process as a daemon into background.
 | 
					 | 
				
			||||||
*-c, --config-file 'CONFIGFILE'*::
 | 
					 | 
				
			||||||
	Specify the file and path name of the configuration file to be
 | 
					 | 
				
			||||||
	used. If none is specified, use `osmo-mgw.cfg` in the current
 | 
					 | 
				
			||||||
	working directory.
 | 
					 | 
				
			||||||
*-s, --disable-color*::
 | 
					 | 
				
			||||||
	Disable colors for logging to stderr. This has mostly been
 | 
					 | 
				
			||||||
	deprecated by VTY based logging configuration, see <<logging>>
 | 
					 | 
				
			||||||
	for more information.
 | 
					 | 
				
			||||||
@@ -1,47 +0,0 @@
 | 
				
			|||||||
<revhistory>
 | 
					 | 
				
			||||||
  <revision>
 | 
					 | 
				
			||||||
    <revnumber>1</revnumber>
 | 
					 | 
				
			||||||
    <date>July 24th, 2018</date>
 | 
					 | 
				
			||||||
    <authorinitials>DW</authorinitials>
 | 
					 | 
				
			||||||
    <revremark>
 | 
					 | 
				
			||||||
      Initial version
 | 
					 | 
				
			||||||
    </revremark>
 | 
					 | 
				
			||||||
  </revision>
 | 
					 | 
				
			||||||
</revhistory>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<authorgroup>
 | 
					 | 
				
			||||||
  <author>
 | 
					 | 
				
			||||||
    <firstname>Daniel</firstname>
 | 
					 | 
				
			||||||
    <surname>Willmann</surname>
 | 
					 | 
				
			||||||
    <email>dwillmann@sysmocom.de</email>
 | 
					 | 
				
			||||||
    <authorinitials>DW</authorinitials>
 | 
					 | 
				
			||||||
    <affiliation>
 | 
					 | 
				
			||||||
      <shortaffil>sysmocom</shortaffil>
 | 
					 | 
				
			||||||
      <orgname>sysmocom - s.f.m.c. GmbH</orgname>
 | 
					 | 
				
			||||||
    </affiliation>
 | 
					 | 
				
			||||||
  </author>
 | 
					 | 
				
			||||||
</authorgroup>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<copyright>
 | 
					 | 
				
			||||||
  <year>2018</year>
 | 
					 | 
				
			||||||
  <holder>sysmocom - s.f.m.c. GmbH</holder>
 | 
					 | 
				
			||||||
</copyright>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<legalnotice>
 | 
					 | 
				
			||||||
  <para>
 | 
					 | 
				
			||||||
	Permission is granted to copy, distribute and/or modify this
 | 
					 | 
				
			||||||
	document under the terms of the GNU Free Documentation License,
 | 
					 | 
				
			||||||
	Version 1.3 or any later version published by the Free Software
 | 
					 | 
				
			||||||
	Foundation; with the Invariant Sections being just 'Foreword',
 | 
					 | 
				
			||||||
	'Acknowledgements' and 'Preface', with no Front-Cover Texts,
 | 
					 | 
				
			||||||
	and no Back-Cover Texts.  A copy of the license is included in
 | 
					 | 
				
			||||||
	the section entitled "GNU Free Documentation License".
 | 
					 | 
				
			||||||
  </para>
 | 
					 | 
				
			||||||
  <para>
 | 
					 | 
				
			||||||
	The Asciidoc source code of this manual can be found at
 | 
					 | 
				
			||||||
	<ulink url="http://git.osmocom.org/osmo-gsm-manuals/">
 | 
					 | 
				
			||||||
		http://git.osmocom.org/osmo-gsm-manuals/
 | 
					 | 
				
			||||||
	</ulink>
 | 
					 | 
				
			||||||
  </para>
 | 
					 | 
				
			||||||
</legalnotice>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,39 +0,0 @@
 | 
				
			|||||||
:gfdl-enabled:
 | 
					 | 
				
			||||||
:program-name: OsmoMGW
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OsmoMGW User Manual
 | 
					 | 
				
			||||||
====================
 | 
					 | 
				
			||||||
Daniel Willmann <dwillmann@sysmocom.de>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/preface.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::{srcdir}/chapters/overview.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::{srcdir}/chapters/running.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/vty.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/logging.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::{srcdir}/chapters/configuration.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::{srcdir}/chapters/mgcp_endpoints.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::{srcdir}/chapters/mgcp_extensions.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/osmux/osmux.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/qos-dscp-pcp.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//include::{srcdir}/chapters/counters.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/vty_cpu_sched.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/port_numbers.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/bibliography.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/glossary.adoc[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include::./common/chapters/gfdl.adoc[]
 | 
					 | 
				
			||||||
@@ -1,38 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<!--
 | 
					 | 
				
			||||||
  ex:ts=2:sw=42sts=2:et
 | 
					 | 
				
			||||||
  -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
 | 
					 | 
				
			||||||
-->
 | 
					 | 
				
			||||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML 5.0//EN"
 | 
					 | 
				
			||||||
"http://docbook.org/xml/5.0/dtd/docbook.dtd" [
 | 
					 | 
				
			||||||
<!ENTITY chapter-vty      SYSTEM      "./common/chapters/vty.xml" >
 | 
					 | 
				
			||||||
<!ENTITY sections-vty     SYSTEM      "generated/docbook_vty.xml"  >
 | 
					 | 
				
			||||||
]>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<book>
 | 
					 | 
				
			||||||
  <info>
 | 
					 | 
				
			||||||
    <revhistory>
 | 
					 | 
				
			||||||
        <revision>
 | 
					 | 
				
			||||||
            <revnumber>v1</revnumber>
 | 
					 | 
				
			||||||
            <date>12th December 2017</date>
 | 
					 | 
				
			||||||
            <authorinitials>pm</authorinitials>
 | 
					 | 
				
			||||||
            <revremark>Initial</revremark>
 | 
					 | 
				
			||||||
        </revision>
 | 
					 | 
				
			||||||
    </revhistory>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <title>OsmoMGW VTY Reference</title>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <copyright>
 | 
					 | 
				
			||||||
      <year>2017</year>
 | 
					 | 
				
			||||||
    </copyright>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <legalnotice>
 | 
					 | 
				
			||||||
      <para>This work is copyright by <orgname>sysmocom - s.f.m.c. GmbH</orgname>. All rights reserved.
 | 
					 | 
				
			||||||
      </para>
 | 
					 | 
				
			||||||
    </legalnotice>
 | 
					 | 
				
			||||||
  </info>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <!-- Main chapters-->
 | 
					 | 
				
			||||||
  &chapter-vty;
 | 
					 | 
				
			||||||
</book>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,17 +0,0 @@
 | 
				
			|||||||
#!/bin/sh -x
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [ -z "$DOCKER_PLAYGROUND" ]; then
 | 
					 | 
				
			||||||
	echo "You need to set DOCKER_PLAYGROUND"
 | 
					 | 
				
			||||||
	exit 1
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
SCRIPT=$(realpath "$0")
 | 
					 | 
				
			||||||
MANUAL_DIR=$(dirname "$SCRIPT")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
COMMIT=${COMMIT:-$(git log -1 --format=format:%H)}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cd "$DOCKER_PLAYGROUND/scripts" || exit 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OSMO_MGW_BRANCH=$COMMIT ./regen_doc.sh osmo-mgw 4243 \
 | 
					 | 
				
			||||||
	"$MANUAL_DIR/chapters/counters_generated.adoc" \
 | 
					 | 
				
			||||||
	"$MANUAL_DIR/vty/mgw_vty_reference.xml"
 | 
					 | 
				
			||||||
@@ -1,2 +0,0 @@
 | 
				
			|||||||
<vtydoc xmlns='urn:osmocom:xml:libosmocore:vty:doc:1.0'>
 | 
					 | 
				
			||||||
</vtydoc>
 | 
					 | 
				
			||||||
							
								
								
									
										22
									
								
								doc/oml-interface.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								doc/oml-interface.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					oml interface design notes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					problems:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* there is no way how to tag a command sent to the BTS, with the response
 | 
				
			||||||
 | 
					  having the same tag to identify the originator of the command
 | 
				
			||||||
 | 
					* therefore, we can have e.g. both the BSC and the OML interface send a
 | 
				
			||||||
 | 
					  SET ATTRIBUTE message, where the responses would end up at the wrong
 | 
				
			||||||
 | 
					  query.
 | 
				
			||||||
 | 
					* The BTS has 10s to ACK/NACK a command. We do not run any timers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					the only possible solutions i can imagine:
 | 
				
			||||||
 | 
					* have some kind of exclusive locking, where the OML interface gets blocked
 | 
				
			||||||
 | 
					  from the BSC and is exclusively assigned to the OML console until all commands
 | 
				
			||||||
 | 
					  of the OML console have terminated.  This can either be done explicitly
 | 
				
			||||||
 | 
					  dynamically or on demand
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* use the OML interface synchronously, i.e. always wait for the response from
 | 
				
			||||||
 | 
					  the BTS before
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* unilateral / unsolicited messages need to be broadcasted to both the BSC and
 | 
				
			||||||
 | 
					  the OML console
 | 
				
			||||||
							
								
								
									
										33
									
								
								doc/osmo-nitb-data_structures.dot
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								doc/osmo-nitb-data_structures.dot
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					digraph G {
 | 
				
			||||||
 | 
						net [label="gsm_network"]
 | 
				
			||||||
 | 
						bts [label="gsm_bts"]
 | 
				
			||||||
 | 
						trx [label="gsm_bts_trx"]
 | 
				
			||||||
 | 
						ts [label="gsm_bts_trx_ts"]
 | 
				
			||||||
 | 
						lchan [label="gsm_lchan"]
 | 
				
			||||||
 | 
						sub [label="gsm_subscriber"]
 | 
				
			||||||
 | 
						subcon [label="gsm_subscriber_conn"]
 | 
				
			||||||
 | 
						sccpcon [label="osmo_bsc_sccp_con"]
 | 
				
			||||||
 | 
						subgrp [label="gsm_subscriber_group"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						net -> bts
 | 
				
			||||||
 | 
						bts -> trx
 | 
				
			||||||
 | 
						trx -> ts
 | 
				
			||||||
 | 
						ts -> lchan
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						lchan -> ts
 | 
				
			||||||
 | 
						ts -> trx
 | 
				
			||||||
 | 
						trx -> bts
 | 
				
			||||||
 | 
						bts -> net
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						lchan -> subcon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						subcon -> sub
 | 
				
			||||||
 | 
						subcon -> sccpcon
 | 
				
			||||||
 | 
						subcon -> lchan
 | 
				
			||||||
 | 
						subcon -> lchan [label="ho_lchan"]
 | 
				
			||||||
 | 
						subcon -> bts
 | 
				
			||||||
 | 
						subcon -> lchan [label="secondary_lchan"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sub -> subgrp
 | 
				
			||||||
 | 
						subgrp -> net
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										48
									
								
								doc/paging.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								doc/paging.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					GSM Paging implementation in OpenBSC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					== Code structure ==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The code is implemented in the libbsc/paging.c file. The external
 | 
				
			||||||
 | 
					interface is documented/specified in the include/openbsc/paging.h
 | 
				
			||||||
 | 
					header file. The code is used by the NITB and BSC application.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					== Implementation ==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Paging can be initiated in two ways. The standard way is to page by
 | 
				
			||||||
 | 
					LAC. Each BTS has its own list/queue of outstanding paging operation.
 | 
				
			||||||
 | 
					When a subscriber is paged one "struct paging_request" per BTS will
 | 
				
			||||||
 | 
					be allocated and added to the tail of the list. The BTS is supposed
 | 
				
			||||||
 | 
					to be configured to not repeat the paging.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A paging_request will remain in the queue until a paging response or at
 | 
				
			||||||
 | 
					the expiry of the T3113. Every 500 milliseconds a RSL paging command is
 | 
				
			||||||
 | 
					send to the BTS. The 500 milliseconds is a throttling to not crash the
 | 
				
			||||||
 | 
					ip.access nanoBTS. Once one paging_request has been handled it will be
 | 
				
			||||||
 | 
					put at the end of the queue/list and the available slots for the BTS
 | 
				
			||||||
 | 
					will be decreased.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The available slots will be updated based on the paging load information
 | 
				
			||||||
 | 
					element of the CCCH Load indication. If no paging slots are considered
 | 
				
			||||||
 | 
					to be available and no load indication is sent a timer is started. The
 | 
				
			||||||
 | 
					current timeout is 500 milliseconds and at the expiry of the timer the
 | 
				
			||||||
 | 
					available slots will be set to 20.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OpenBSC has the " paging free <-1-1024>" configuration option. In case
 | 
				
			||||||
 | 
					there are less free channels than required no paging request will be
 | 
				
			||||||
 | 
					sent to the BTS. Instead it will be attempted to send the paging request
 | 
				
			||||||
 | 
					at the next timeout (500 milliseconds).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					== Limitation ==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The paging throughput could be higher but this has lead to crashes on the
 | 
				
			||||||
 | 
					ip.access nanoBTS in the past.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					== Configuration ==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=== ip.access nanoBTS ===
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The current CCCH Load indication threshold is 10% and the period is 1 second.
 | 
				
			||||||
 | 
					The code can be found inside the src/libbsc/bts_ipaccess_nanobts.c inside the
 | 
				
			||||||
 | 
					nanobts_attr_bts array.
 | 
				
			||||||
@@ -1,20 +1,6 @@
 | 
				
			|||||||
SUBDIRS = \
 | 
					 | 
				
			||||||
	osmocom \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nobase_include_HEADERS = \
 | 
					nobase_include_HEADERS = \
 | 
				
			||||||
	osmocom/mgcp_client/defs.h \
 | 
						osmocom/legacy_mgcp/mgcp.h \
 | 
				
			||||||
	osmocom/mgcp_client/mgcp_client.h \
 | 
						osmocom/legacy_mgcp/mgcp_internal.h \
 | 
				
			||||||
	osmocom/mgcp_client/mgcp_client_endpoint_fsm.h \
 | 
						osmocom/legacy_mgcp/mgcpgw_client.h \
 | 
				
			||||||
	osmocom/mgcp_client/mgcp_client_fsm.h \
 | 
						osmocom/legacy_mgcp/osmux.h \
 | 
				
			||||||
	osmocom/mgcp_client/mgcp_client_pool.h \
 | 
					 | 
				
			||||||
	osmocom/mgcp/mgcp.h \
 | 
					 | 
				
			||||||
	osmocom/mgcp/mgcp_common.h \
 | 
					 | 
				
			||||||
	osmocom/mgcp/osmux.h \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# This gets copied during make from osmocom/mgcp/mgcp_common.h. Therefore it is not included in the source tree and we
 | 
					 | 
				
			||||||
# don't need to distribute it (OS#4084).
 | 
					 | 
				
			||||||
nobase_nodist_include_HEADERS = \
 | 
					 | 
				
			||||||
	osmocom/mgcp_client/mgcp_common.h \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
						$(NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,3 @@
 | 
				
			|||||||
SUBDIRS = \
 | 
					SUBDIRS = \
 | 
				
			||||||
	mgcp_client \
 | 
						legacy_mgcp \
 | 
				
			||||||
	mgcp \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
						$(NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								include/osmocom/legacy_mgcp/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								include/osmocom/legacy_mgcp/Makefile.am
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					noinst_HEADERS = \
 | 
				
			||||||
 | 
						mgcp_transcode.h \
 | 
				
			||||||
 | 
						vty.h \
 | 
				
			||||||
 | 
						$(NULL)
 | 
				
			||||||
							
								
								
									
										299
									
								
								include/osmocom/legacy_mgcp/mgcp.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										299
									
								
								include/osmocom/legacy_mgcp/mgcp.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,299 @@
 | 
				
			|||||||
 | 
					/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
 | 
				
			||||||
 | 
					 * (C) 2009-2012 by On-Waves
 | 
				
			||||||
 | 
					 * All Rights Reserved
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
 | 
					 * it under the terms of the GNU Affero General Public License as published by
 | 
				
			||||||
 | 
					 * the Free Software Foundation; either version 3 of the License, or
 | 
				
			||||||
 | 
					 * (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program 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 Affero General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU Affero General Public License
 | 
				
			||||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENBSC_MGCP_H
 | 
				
			||||||
 | 
					#define OPENBSC_MGCP_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <osmocom/core/msgb.h>
 | 
				
			||||||
 | 
					#include <osmocom/core/write_queue.h>
 | 
				
			||||||
 | 
					#include <osmocom/core/timer.h>
 | 
				
			||||||
 | 
					#include <osmocom/core/logging.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <arpa/inet.h>
 | 
				
			||||||
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					#include <sys/socket.h>
 | 
				
			||||||
 | 
					#include <netinet/in.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RTP_PORT_DEFAULT 4000
 | 
				
			||||||
 | 
					#define RTP_PORT_NET_DEFAULT 16000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Calculate the RTP audio port for the given multiplex
 | 
				
			||||||
 | 
					 * and the direction. This allows a semi static endpoint
 | 
				
			||||||
 | 
					 * to port calculation removing the need for the BSC
 | 
				
			||||||
 | 
					 * and the MediaGateway to communicate.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Port usage explained:
 | 
				
			||||||
 | 
					 *       base + (multiplex * 2) + 0 == local port to wait for network packets
 | 
				
			||||||
 | 
					 *       base + (multiplex * 2) + 1 == local port for rtcp
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The above port will receive packets from the BTS that need
 | 
				
			||||||
 | 
					 * to be patched and forwarded to the network.
 | 
				
			||||||
 | 
					 * The above port will receive packets from the network that
 | 
				
			||||||
 | 
					 * need to be patched and forwarded to the BTS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * We assume to have a static BTS IP address so we can differentiate
 | 
				
			||||||
 | 
					 * network and BTS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static inline int rtp_calculate_port(int multiplex, int base)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return base + (multiplex * 2);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Handling of MGCP Endpoints and the MGCP Config
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct mgcp_endpoint;
 | 
				
			||||||
 | 
					struct mgcp_config;
 | 
				
			||||||
 | 
					struct mgcp_trunk_config;
 | 
				
			||||||
 | 
					struct mgcp_rtp_end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MGCP_ENDP_CRCX 1
 | 
				
			||||||
 | 
					#define MGCP_ENDP_DLCX 2
 | 
				
			||||||
 | 
					#define MGCP_ENDP_MDCX 3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * what to do with the msg?
 | 
				
			||||||
 | 
					 *	- continue as usual?
 | 
				
			||||||
 | 
					 *	- reject and send a failure code?
 | 
				
			||||||
 | 
					 *	- defer? do not send anything
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define MGCP_POLICY_CONT	4
 | 
				
			||||||
 | 
					#define MGCP_POLICY_REJECT	5
 | 
				
			||||||
 | 
					#define MGCP_POLICY_DEFER	6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef int (*mgcp_realloc)(struct mgcp_trunk_config *cfg, int endpoint);
 | 
				
			||||||
 | 
					typedef int (*mgcp_change)(struct mgcp_trunk_config *cfg, int endpoint, int state);
 | 
				
			||||||
 | 
					typedef int (*mgcp_policy)(struct mgcp_trunk_config *cfg, int endpoint, int state, const char *transactio_id);
 | 
				
			||||||
 | 
					typedef int (*mgcp_reset)(struct mgcp_trunk_config *cfg);
 | 
				
			||||||
 | 
					typedef int (*mgcp_rqnt)(struct mgcp_endpoint *endp, char tone);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Return:
 | 
				
			||||||
 | 
					 *   <  0 in case no audio was processed
 | 
				
			||||||
 | 
					 *   >= 0 in case audio was processed. The remaining payload
 | 
				
			||||||
 | 
					 *   length will be returned.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					typedef int (*mgcp_processing)(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
								       struct mgcp_rtp_end *dst_end,
 | 
				
			||||||
 | 
								       char *data, int *len, int buf_size);
 | 
				
			||||||
 | 
					typedef int (*mgcp_processing_setup)(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
									     struct mgcp_rtp_end *dst_end,
 | 
				
			||||||
 | 
									     struct mgcp_rtp_end *src_end);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef void (*mgcp_get_format)(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
									int *payload_type,
 | 
				
			||||||
 | 
									const char**subtype_name,
 | 
				
			||||||
 | 
									const char**fmtp_extra);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define PORT_ALLOC_STATIC	0
 | 
				
			||||||
 | 
					#define PORT_ALLOC_DYNAMIC	1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * This holds information on how to allocate ports
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct mgcp_port_range {
 | 
				
			||||||
 | 
						int mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* addr or NULL to fall-back to default */
 | 
				
			||||||
 | 
						char *bind_addr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* pre-allocated from a base? */
 | 
				
			||||||
 | 
						int base_port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* dynamically allocated */
 | 
				
			||||||
 | 
						int range_start;
 | 
				
			||||||
 | 
						int range_end;
 | 
				
			||||||
 | 
						int last_port;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MGCP_KEEPALIVE_ONCE (-1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_trunk_config {
 | 
				
			||||||
 | 
						struct llist_head entry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct mgcp_config *cfg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int trunk_nr;
 | 
				
			||||||
 | 
						int trunk_type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char *audio_fmtp_extra;
 | 
				
			||||||
 | 
						char *audio_name;
 | 
				
			||||||
 | 
						int audio_payload;
 | 
				
			||||||
 | 
						int audio_send_ptime;
 | 
				
			||||||
 | 
						int audio_send_name;
 | 
				
			||||||
 | 
						int audio_loop;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int no_audio_transcoding;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int omit_rtcp;
 | 
				
			||||||
 | 
						int keepalive_interval;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* RTP patching */
 | 
				
			||||||
 | 
						int force_constant_ssrc; /* 0: don't, 1: once */
 | 
				
			||||||
 | 
						int force_aligned_timing;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* spec handling */
 | 
				
			||||||
 | 
						int force_realloc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* timer */
 | 
				
			||||||
 | 
						struct osmo_timer_list keepalive_timer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						unsigned int number_endpoints;
 | 
				
			||||||
 | 
						struct mgcp_endpoint *endpoints;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum mgcp_role {
 | 
				
			||||||
 | 
						MGCP_BSC = 0,
 | 
				
			||||||
 | 
						MGCP_BSC_NAT,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum mgcp_connection_mode {
 | 
				
			||||||
 | 
						MGCP_CONN_NONE = 0,
 | 
				
			||||||
 | 
						MGCP_CONN_RECV_ONLY = 1,
 | 
				
			||||||
 | 
						MGCP_CONN_SEND_ONLY = 2,
 | 
				
			||||||
 | 
						MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY,
 | 
				
			||||||
 | 
						MGCP_CONN_LOOPBACK  = 4 | MGCP_CONN_RECV_SEND,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern const struct value_string mgcp_connection_mode_strs[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline const char *mgcp_cmode_name(enum mgcp_connection_mode mode)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return get_value_string(mgcp_connection_mode_strs, mode);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_config {
 | 
				
			||||||
 | 
						int source_port;
 | 
				
			||||||
 | 
						char *local_ip;
 | 
				
			||||||
 | 
						char *source_addr;
 | 
				
			||||||
 | 
						char *bts_ip;
 | 
				
			||||||
 | 
						char *call_agent_addr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct in_addr bts_in;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* transcoder handling */
 | 
				
			||||||
 | 
						char *transcoder_ip;
 | 
				
			||||||
 | 
						struct in_addr transcoder_in;
 | 
				
			||||||
 | 
						int transcoder_remote_base;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* RTP processing */
 | 
				
			||||||
 | 
						mgcp_processing rtp_processing_cb;
 | 
				
			||||||
 | 
						mgcp_processing_setup setup_rtp_processing_cb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						mgcp_get_format get_net_downlink_format_cb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct osmo_wqueue gw_fd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct mgcp_port_range bts_ports;
 | 
				
			||||||
 | 
						struct mgcp_port_range net_ports;
 | 
				
			||||||
 | 
						struct mgcp_port_range transcoder_ports;
 | 
				
			||||||
 | 
						int endp_dscp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int bts_force_ptime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						mgcp_change change_cb;
 | 
				
			||||||
 | 
						mgcp_policy policy_cb;
 | 
				
			||||||
 | 
						mgcp_reset reset_cb;
 | 
				
			||||||
 | 
						mgcp_realloc realloc_cb;
 | 
				
			||||||
 | 
						mgcp_rqnt rqnt_cb;
 | 
				
			||||||
 | 
						void *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t last_call_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* trunk handling */
 | 
				
			||||||
 | 
						struct mgcp_trunk_config trunk;
 | 
				
			||||||
 | 
						struct llist_head trunks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* only used for start with a static configuration */
 | 
				
			||||||
 | 
						int last_net_port;
 | 
				
			||||||
 | 
						int last_bts_port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						enum mgcp_role role;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* osmux translator: 0 means disabled, 1 means enabled */
 | 
				
			||||||
 | 
						int osmux;
 | 
				
			||||||
 | 
						/* addr to bind the server to */
 | 
				
			||||||
 | 
						char *osmux_addr;
 | 
				
			||||||
 | 
						/* The BSC-NAT may ask for enabling osmux on demand. This tells us if
 | 
				
			||||||
 | 
						 * the osmux socket is already initialized.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						int osmux_init;
 | 
				
			||||||
 | 
						/* osmux batch factor: from 1 to 4 maximum */
 | 
				
			||||||
 | 
						int osmux_batch;
 | 
				
			||||||
 | 
						/* osmux batch size (in bytes) */
 | 
				
			||||||
 | 
						int osmux_batch_size;
 | 
				
			||||||
 | 
						/* osmux port */
 | 
				
			||||||
 | 
						uint16_t osmux_port;
 | 
				
			||||||
 | 
						/* Pad circuit with dummy messages until we see the first voice
 | 
				
			||||||
 | 
						 * message.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						uint16_t osmux_dummy;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* config management */
 | 
				
			||||||
 | 
					struct mgcp_config *mgcp_config_alloc(void);
 | 
				
			||||||
 | 
					int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg,
 | 
				
			||||||
 | 
							      enum mgcp_role role);
 | 
				
			||||||
 | 
					int mgcp_vty_init(void);
 | 
				
			||||||
 | 
					int mgcp_endpoints_allocate(struct mgcp_trunk_config *cfg);
 | 
				
			||||||
 | 
					void mgcp_release_endp(struct mgcp_endpoint *endp);
 | 
				
			||||||
 | 
					void mgcp_initialize_endp(struct mgcp_endpoint *endp);
 | 
				
			||||||
 | 
					int mgcp_reset_transcoder(struct mgcp_config *cfg);
 | 
				
			||||||
 | 
					void mgcp_format_stats(struct mgcp_endpoint *endp, char *stats, size_t size);
 | 
				
			||||||
 | 
					int mgcp_parse_stats(struct msgb *msg, uint32_t *ps, uint32_t *os, uint32_t *pr, uint32_t *_or, int *loss, uint32_t *jitter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void mgcp_trunk_set_keepalive(struct mgcp_trunk_config *tcfg, int interval);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * format helper functions
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct msgb *mgcp_handle_message(struct mgcp_config *cfg, struct msgb *msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* adc helper */
 | 
				
			||||||
 | 
					static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (timeslot == 0) {
 | 
				
			||||||
 | 
							LOGP(DLMGCP, LOGL_ERROR, "Timeslot should not be 0\n");
 | 
				
			||||||
 | 
							timeslot = 255;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return timeslot + (32 * multiplex);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void mgcp_endpoint_to_timeslot(int endpoint, int *multiplex, int *timeslot)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						*multiplex = endpoint / 32;
 | 
				
			||||||
 | 
						*timeslot = endpoint % 32;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_send_reset_ep(struct mgcp_endpoint *endp, int endpoint);
 | 
				
			||||||
 | 
					int mgcp_send_reset_all(struct mgcp_config *cfg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_create_bind(const char *source_addr, struct osmo_fd *fd, int port);
 | 
				
			||||||
 | 
					int mgcp_send(struct mgcp_endpoint *endp, int dest, int is_rtp, struct sockaddr_in *addr, char *buf, int rc);
 | 
				
			||||||
 | 
					int mgcp_udp_send(int fd, struct in_addr *addr, int port, char *buf, int len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										337
									
								
								include/osmocom/legacy_mgcp/mgcp_internal.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										337
									
								
								include/osmocom/legacy_mgcp/mgcp_internal.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,337 @@
 | 
				
			|||||||
 | 
					/* MGCP Private Data */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
 | 
				
			||||||
 | 
					 * (C) 2009-2012 by On-Waves
 | 
				
			||||||
 | 
					 * All Rights Reserved
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
 | 
					 * it under the terms of the GNU Affero General Public License as published by
 | 
				
			||||||
 | 
					 * the Free Software Foundation; either version 3 of the License, or
 | 
				
			||||||
 | 
					 * (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program 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 Affero General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU Affero General Public License
 | 
				
			||||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <osmocom/core/select.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define CI_UNUSED 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum mgcp_trunk_type {
 | 
				
			||||||
 | 
						MGCP_TRUNK_VIRTUAL,
 | 
				
			||||||
 | 
						MGCP_TRUNK_E1,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_rtp_stream_state {
 | 
				
			||||||
 | 
						uint32_t ssrc;
 | 
				
			||||||
 | 
						uint16_t last_seq;
 | 
				
			||||||
 | 
						uint32_t last_timestamp;
 | 
				
			||||||
 | 
						uint32_t err_ts_counter;
 | 
				
			||||||
 | 
						int32_t last_tsdelta;
 | 
				
			||||||
 | 
						uint32_t last_arrival_time;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_rtp_state {
 | 
				
			||||||
 | 
						int initialized;
 | 
				
			||||||
 | 
						int patch_ssrc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t orig_ssrc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int seq_offset;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int32_t  timestamp_offset;
 | 
				
			||||||
 | 
						uint32_t packet_duration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct mgcp_rtp_stream_state in_stream;
 | 
				
			||||||
 | 
						struct mgcp_rtp_stream_state out_stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* jitter and packet loss calculation */
 | 
				
			||||||
 | 
						int stats_initialized;
 | 
				
			||||||
 | 
						uint16_t stats_base_seq;
 | 
				
			||||||
 | 
						uint16_t stats_max_seq;
 | 
				
			||||||
 | 
						uint32_t stats_ssrc;
 | 
				
			||||||
 | 
						uint32_t stats_jitter;
 | 
				
			||||||
 | 
						int32_t stats_transit;
 | 
				
			||||||
 | 
						int stats_cycles;
 | 
				
			||||||
 | 
						bool patched_first_rtp_payload;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_rtp_codec {
 | 
				
			||||||
 | 
						uint32_t rate;
 | 
				
			||||||
 | 
						int channels;
 | 
				
			||||||
 | 
						uint32_t frame_duration_num;
 | 
				
			||||||
 | 
						uint32_t frame_duration_den;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int payload_type;
 | 
				
			||||||
 | 
						char *audio_name;
 | 
				
			||||||
 | 
						char *subtype_name;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_rtp_end {
 | 
				
			||||||
 | 
						/* statistics */
 | 
				
			||||||
 | 
						unsigned int packets;
 | 
				
			||||||
 | 
						unsigned int octets;
 | 
				
			||||||
 | 
						unsigned int dropped_packets;
 | 
				
			||||||
 | 
						struct in_addr addr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* in network byte order */
 | 
				
			||||||
 | 
						int rtp_port, rtcp_port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* audio codec information */
 | 
				
			||||||
 | 
						struct mgcp_rtp_codec codec;
 | 
				
			||||||
 | 
						struct mgcp_rtp_codec alt_codec; /* TODO/XXX: make it generic */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* per endpoint data */
 | 
				
			||||||
 | 
						int  frames_per_packet;
 | 
				
			||||||
 | 
						uint32_t packet_duration_ms;
 | 
				
			||||||
 | 
						char *fmtp_extra;
 | 
				
			||||||
 | 
						int output_enabled;
 | 
				
			||||||
 | 
						int force_output_ptime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* RTP patching */
 | 
				
			||||||
 | 
						int force_constant_ssrc; /* -1: always, 0: don't, 1: once */
 | 
				
			||||||
 | 
						int force_aligned_timing;
 | 
				
			||||||
 | 
						void *rtp_process_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Each end has a socket...
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						struct osmo_fd rtp;
 | 
				
			||||||
 | 
						struct osmo_fd rtcp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int local_port;
 | 
				
			||||||
 | 
						int local_alloc;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum {
 | 
				
			||||||
 | 
						MGCP_TAP_BTS_IN,
 | 
				
			||||||
 | 
						MGCP_TAP_BTS_OUT,
 | 
				
			||||||
 | 
						MGCP_TAP_NET_IN,
 | 
				
			||||||
 | 
						MGCP_TAP_NET_OUT,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* last element */
 | 
				
			||||||
 | 
						MGCP_TAP_COUNT
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_rtp_tap {
 | 
				
			||||||
 | 
						int enabled;
 | 
				
			||||||
 | 
						struct sockaddr_in forward;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_lco {
 | 
				
			||||||
 | 
						char *string;
 | 
				
			||||||
 | 
						char *codec;
 | 
				
			||||||
 | 
						int pkt_period_min; /* time in ms */
 | 
				
			||||||
 | 
						int pkt_period_max; /* time in ms */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum mgcp_type {
 | 
				
			||||||
 | 
						MGCP_RTP_DEFAULT	= 0,
 | 
				
			||||||
 | 
						MGCP_RTP_TRANSCODED,
 | 
				
			||||||
 | 
						MGCP_OSMUX_BSC,
 | 
				
			||||||
 | 
						MGCP_OSMUX_BSC_NAT,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <osmocom/legacy_mgcp/osmux.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_endpoint {
 | 
				
			||||||
 | 
						int allocated;
 | 
				
			||||||
 | 
						uint32_t ci;
 | 
				
			||||||
 | 
						char *callid;
 | 
				
			||||||
 | 
						struct mgcp_lco local_options;
 | 
				
			||||||
 | 
						int conn_mode;
 | 
				
			||||||
 | 
						int orig_mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* backpointer */
 | 
				
			||||||
 | 
						struct mgcp_config *cfg;
 | 
				
			||||||
 | 
						struct mgcp_trunk_config *tcfg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* port status for bts/net */
 | 
				
			||||||
 | 
						struct mgcp_rtp_end bts_end;
 | 
				
			||||||
 | 
						struct mgcp_rtp_end net_end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * For transcoding we will send from the local_port
 | 
				
			||||||
 | 
						 * of trans_bts and it will arrive at trans_net from
 | 
				
			||||||
 | 
						 * where we will forward it to the network.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						struct mgcp_rtp_end trans_bts;
 | 
				
			||||||
 | 
						struct mgcp_rtp_end trans_net;
 | 
				
			||||||
 | 
						enum mgcp_type type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* sequence bits */
 | 
				
			||||||
 | 
						struct mgcp_rtp_state net_state;
 | 
				
			||||||
 | 
						struct mgcp_rtp_state bts_state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* fields for re-transmission */
 | 
				
			||||||
 | 
						char *last_trans;
 | 
				
			||||||
 | 
						char *last_response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* tap for the endpoint */
 | 
				
			||||||
 | 
						struct mgcp_rtp_tap taps[MGCP_TAP_COUNT];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct {
 | 
				
			||||||
 | 
							/* Osmux state: disabled, activating, active */
 | 
				
			||||||
 | 
							enum osmux_state state;
 | 
				
			||||||
 | 
							/* Allocated Osmux circuit ID for this endpoint */
 | 
				
			||||||
 | 
							int allocated_cid;
 | 
				
			||||||
 | 
							/* Used Osmux circuit ID for this endpoint */
 | 
				
			||||||
 | 
							uint8_t cid;
 | 
				
			||||||
 | 
							/* handle to batch messages */
 | 
				
			||||||
 | 
							struct osmux_in_handle *in;
 | 
				
			||||||
 | 
							/* handle to unbatch messages */
 | 
				
			||||||
 | 
							struct osmux_out_handle out;
 | 
				
			||||||
 | 
							/* statistics */
 | 
				
			||||||
 | 
							struct {
 | 
				
			||||||
 | 
								uint32_t chunks;
 | 
				
			||||||
 | 
								uint32_t octets;
 | 
				
			||||||
 | 
							} stats;
 | 
				
			||||||
 | 
						} osmux;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define for_each_line(line, save)			\
 | 
				
			||||||
 | 
						for (line = strline_r(NULL, &save); line;\
 | 
				
			||||||
 | 
						     line = strline_r(NULL, &save))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline char *strline_r(char *str, char **saveptr)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char *result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (str)
 | 
				
			||||||
 | 
							*saveptr = str;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						result = *saveptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (*saveptr != NULL) {
 | 
				
			||||||
 | 
							*saveptr = strpbrk(*saveptr, "\r\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (*saveptr != NULL) {
 | 
				
			||||||
 | 
								char *eos = *saveptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if ((*saveptr)[0] == '\r' && (*saveptr)[1] == '\n')
 | 
				
			||||||
 | 
									(*saveptr)++;
 | 
				
			||||||
 | 
								(*saveptr)++;
 | 
				
			||||||
 | 
								if ((*saveptr)[0] == '\0')
 | 
				
			||||||
 | 
									*saveptr = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								*eos = '\0';
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return result;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define ENDPOINT_NUMBER(endp) abs((int)(endp - endp->tcfg->endpoints))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Internal structure while parsing a request
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct mgcp_parse_data {
 | 
				
			||||||
 | 
						struct mgcp_config *cfg;
 | 
				
			||||||
 | 
						struct mgcp_endpoint *endp;
 | 
				
			||||||
 | 
						char *trans;
 | 
				
			||||||
 | 
						char *save;
 | 
				
			||||||
 | 
						int found;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_send_dummy(struct mgcp_endpoint *endp);
 | 
				
			||||||
 | 
					int mgcp_bind_bts_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
 | 
				
			||||||
 | 
					int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
 | 
				
			||||||
 | 
					int mgcp_bind_trans_bts_rtp_port(struct mgcp_endpoint *enp, int rtp_port);
 | 
				
			||||||
 | 
					int mgcp_bind_trans_net_rtp_port(struct mgcp_endpoint *enp, int rtp_port);
 | 
				
			||||||
 | 
					int mgcp_free_rtp_port(struct mgcp_rtp_end *end);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* For transcoding we need to manage an in and an output that are connected */
 | 
				
			||||||
 | 
					static inline int endp_back_channel(int endpoint)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return endpoint + 60;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_trunk_config *mgcp_trunk_alloc(struct mgcp_config *cfg, int index);
 | 
				
			||||||
 | 
					struct mgcp_trunk_config *mgcp_trunk_num(struct mgcp_config *cfg, int index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void mgcp_rtp_end_config(struct mgcp_endpoint *endp, int expect_ssrc_change,
 | 
				
			||||||
 | 
								 struct mgcp_rtp_end *rtp);
 | 
				
			||||||
 | 
					uint32_t mgcp_rtp_packet_duration(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
									  struct mgcp_rtp_end *rtp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void mgcp_state_calc_loss(struct mgcp_rtp_state *s, struct mgcp_rtp_end *,
 | 
				
			||||||
 | 
								uint32_t *expected, int *loss);
 | 
				
			||||||
 | 
					uint32_t mgcp_state_calc_jitter(struct mgcp_rtp_state *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* payload processing default functions */
 | 
				
			||||||
 | 
					int mgcp_rtp_processing_default(struct mgcp_endpoint *endp, struct mgcp_rtp_end *dst_end,
 | 
				
			||||||
 | 
									char *data, int *len, int buf_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_setup_rtp_processing_default(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
									      struct mgcp_rtp_end *dst_end,
 | 
				
			||||||
 | 
									      struct mgcp_rtp_end *src_end);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void mgcp_get_net_downlink_format_default(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
										  int *payload_type,
 | 
				
			||||||
 | 
										  const char**subtype_name,
 | 
				
			||||||
 | 
										  const char**fmtp_extra);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* internal RTP Annex A counting */
 | 
				
			||||||
 | 
					void mgcp_rtp_annex_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *state,
 | 
				
			||||||
 | 
								const uint16_t seq, const int32_t transit,
 | 
				
			||||||
 | 
								const uint32_t ssrc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_set_ip_tos(int fd, int tos);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum {
 | 
				
			||||||
 | 
						MGCP_DEST_NET = 0,
 | 
				
			||||||
 | 
						MGCP_DEST_BTS,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MGCP_DUMMY_LOAD 0x23
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * SDP related information
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					/* Assume audio frame length of 20ms */
 | 
				
			||||||
 | 
					#define DEFAULT_RTP_AUDIO_FRAME_DUR_NUM 20
 | 
				
			||||||
 | 
					#define DEFAULT_RTP_AUDIO_FRAME_DUR_DEN 1000
 | 
				
			||||||
 | 
					#define DEFAULT_RTP_AUDIO_PACKET_DURATION_MS 20
 | 
				
			||||||
 | 
					#define DEFAULT_RTP_AUDIO_DEFAULT_RATE  8000
 | 
				
			||||||
 | 
					#define DEFAULT_RTP_AUDIO_DEFAULT_CHANNELS 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define PTYPE_UNDEFINED (-1)
 | 
				
			||||||
 | 
					int mgcp_parse_sdp_data(struct mgcp_endpoint *endp, struct mgcp_rtp_end *rtp, struct mgcp_parse_data *p);
 | 
				
			||||||
 | 
					int mgcp_set_audio_info(void *ctx, struct mgcp_rtp_codec *codec,
 | 
				
			||||||
 | 
								int payload_type, const char *audio_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Internal network related
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static inline const char *mgcp_net_src_addr(struct mgcp_endpoint *endp)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (endp->cfg->net_ports.bind_addr)
 | 
				
			||||||
 | 
							return endp->cfg->net_ports.bind_addr;
 | 
				
			||||||
 | 
						return endp->cfg->source_addr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline const char *mgcp_bts_src_addr(struct mgcp_endpoint *endp)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (endp->cfg->bts_ports.bind_addr)
 | 
				
			||||||
 | 
							return endp->cfg->bts_ports.bind_addr;
 | 
				
			||||||
 | 
						return endp->cfg->source_addr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_msg_terminate_nul(struct msgb *msg);
 | 
				
			||||||
							
								
								
									
										90
									
								
								include/osmocom/legacy_mgcp/mgcp_transcode.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								include/osmocom/legacy_mgcp/mgcp_transcode.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,90 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * (C) 2014 by On-Waves
 | 
				
			||||||
 | 
					 * All Rights Reserved
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
 | 
					 * it under the terms of the GNU Affero General Public License as published by
 | 
				
			||||||
 | 
					 * the Free Software Foundation; either version 3 of the License, or
 | 
				
			||||||
 | 
					 * (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program 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 Affero General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU Affero General Public License
 | 
				
			||||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#ifndef OPENBSC_MGCP_TRANSCODE_H
 | 
				
			||||||
 | 
					#define OPENBSC_MGCP_TRANSCODE_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "bscconfig.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <gsm.h>
 | 
				
			||||||
 | 
					#ifdef HAVE_BCG729
 | 
				
			||||||
 | 
					#include <bcg729/decoder.h>
 | 
				
			||||||
 | 
					#include <bcg729/encoder.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum audio_format {
 | 
				
			||||||
 | 
						AF_INVALID,
 | 
				
			||||||
 | 
						AF_S16,
 | 
				
			||||||
 | 
						AF_L16,
 | 
				
			||||||
 | 
						AF_GSM,
 | 
				
			||||||
 | 
						AF_G729,
 | 
				
			||||||
 | 
						AF_PCMA,
 | 
				
			||||||
 | 
						AF_PCMU
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_process_rtp_state {
 | 
				
			||||||
 | 
						/* decoding */
 | 
				
			||||||
 | 
						enum audio_format src_fmt;
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							gsm gsm_handle;
 | 
				
			||||||
 | 
					#ifdef HAVE_BCG729
 | 
				
			||||||
 | 
							bcg729DecoderChannelContextStruct *g729_dec;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						} src;
 | 
				
			||||||
 | 
						size_t src_frame_size;
 | 
				
			||||||
 | 
						size_t src_samples_per_frame;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* processing */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* encoding */
 | 
				
			||||||
 | 
						enum audio_format dst_fmt;
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							gsm gsm_handle;
 | 
				
			||||||
 | 
					#ifdef HAVE_BCG729
 | 
				
			||||||
 | 
							bcg729EncoderChannelContextStruct *g729_enc;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						} dst;
 | 
				
			||||||
 | 
						size_t dst_frame_size;
 | 
				
			||||||
 | 
						size_t dst_samples_per_frame;
 | 
				
			||||||
 | 
						int dst_packet_duration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int is_running;
 | 
				
			||||||
 | 
						uint16_t next_seq;
 | 
				
			||||||
 | 
						uint32_t next_time;
 | 
				
			||||||
 | 
						int16_t samples[10*160];
 | 
				
			||||||
 | 
						size_t sample_cnt;
 | 
				
			||||||
 | 
						size_t sample_offs;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_transcoding_setup(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
								   struct mgcp_rtp_end *dst_end,
 | 
				
			||||||
 | 
								   struct mgcp_rtp_end *src_end);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void mgcp_transcoding_net_downlink_format(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
										  int *payload_type,
 | 
				
			||||||
 | 
										  const char**audio_name,
 | 
				
			||||||
 | 
										  const char**fmtp_extra);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_transcoding_process_rtp(struct mgcp_endpoint *endp,
 | 
				
			||||||
 | 
									 struct mgcp_rtp_end *dst_end,
 | 
				
			||||||
 | 
									 char *data, int *len, int buf_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcp_transcoding_get_frame_size(void *state_, int nsamples, int dst);
 | 
				
			||||||
 | 
					#endif /* OPENBSC_MGCP_TRANSCODE_H */
 | 
				
			||||||
							
								
								
									
										73
									
								
								include/osmocom/legacy_mgcp/mgcpgw_client.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								include/osmocom/legacy_mgcp/mgcpgw_client.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MGCPGW_CLIENT_LOCAL_ADDR_DEFAULT "0.0.0.0"
 | 
				
			||||||
 | 
					#define MGCPGW_CLIENT_LOCAL_PORT_DEFAULT 0
 | 
				
			||||||
 | 
					#define MGCPGW_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1"
 | 
				
			||||||
 | 
					#define MGCPGW_CLIENT_REMOTE_PORT_DEFAULT 2427
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct msgb;
 | 
				
			||||||
 | 
					struct vty;
 | 
				
			||||||
 | 
					struct mgcpgw_client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcpgw_client_conf {
 | 
				
			||||||
 | 
						const char *local_addr;
 | 
				
			||||||
 | 
						int local_port;
 | 
				
			||||||
 | 
						const char *remote_addr;
 | 
				
			||||||
 | 
						int remote_port;
 | 
				
			||||||
 | 
						uint16_t first_endpoint;
 | 
				
			||||||
 | 
						uint16_t last_endpoint;
 | 
				
			||||||
 | 
						uint16_t bts_base;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef unsigned int mgcp_trans_id_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_response_head {
 | 
				
			||||||
 | 
					       int response_code;
 | 
				
			||||||
 | 
					       mgcp_trans_id_t trans_id;
 | 
				
			||||||
 | 
					       const char *comment;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_response {
 | 
				
			||||||
 | 
						char *body;
 | 
				
			||||||
 | 
						struct mgcp_response_head head;
 | 
				
			||||||
 | 
						uint16_t audio_port;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf);
 | 
				
			||||||
 | 
					void mgcpgw_client_vty_init(void *talloc_ctx, int node, struct mgcpgw_client_conf *conf);
 | 
				
			||||||
 | 
					int mgcpgw_client_config_write(struct vty *vty, const char *indent);
 | 
				
			||||||
 | 
					struct mgcpgw_client_conf *mgcpgw_client_conf_actual(struct mgcpgw_client *mgcp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcpgw_client *mgcpgw_client_init(void *ctx,
 | 
				
			||||||
 | 
										 struct mgcpgw_client_conf *conf);
 | 
				
			||||||
 | 
					int mgcpgw_client_connect(struct mgcpgw_client *mgcp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp);
 | 
				
			||||||
 | 
					uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp);
 | 
				
			||||||
 | 
					uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcpgw_client_next_endpoint(struct mgcpgw_client *client);
 | 
				
			||||||
 | 
					void mgcpgw_client_release_endpoint(uint16_t id, struct mgcpgw_client *client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Invoked when an MGCP response is received or sending failed.  When the
 | 
				
			||||||
 | 
					 * response is passed as NULL, this indicates failure during transmission. */
 | 
				
			||||||
 | 
					typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void *priv);
 | 
				
			||||||
 | 
					int mgcp_response_parse_params(struct mgcp_response *r);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg,
 | 
				
			||||||
 | 
							     mgcp_response_cb_t response_cb, void *priv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum mgcp_connection_mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct msgb *mgcp_msg_crcx(struct mgcpgw_client *mgcp,
 | 
				
			||||||
 | 
								   uint16_t rtp_endpoint, unsigned int call_id,
 | 
				
			||||||
 | 
								   enum mgcp_connection_mode mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct msgb *mgcp_msg_mdcx(struct mgcpgw_client *mgcp,
 | 
				
			||||||
 | 
								   uint16_t rtp_endpoint, const char *rtp_conn_addr,
 | 
				
			||||||
 | 
								   uint16_t rtp_port, enum mgcp_connection_mode mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct msgb *mgcp_msg_dlcx(struct mgcpgw_client *mgcp, uint16_t rtp_endpoint,
 | 
				
			||||||
 | 
								   unsigned int call_id);
 | 
				
			||||||
							
								
								
									
										33
									
								
								include/osmocom/legacy_mgcp/mgcpgw_client_internal.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								include/osmocom/legacy_mgcp/mgcpgw_client_internal.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MSGB_CB_MGCP_TRANS_ID 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcpgw_client {
 | 
				
			||||||
 | 
						struct mgcpgw_client_conf actual;
 | 
				
			||||||
 | 
						uint32_t remote_addr;
 | 
				
			||||||
 | 
						struct osmo_wqueue wq;
 | 
				
			||||||
 | 
						mgcp_trans_id_t next_trans_id;
 | 
				
			||||||
 | 
						struct llist_head responses_pending;
 | 
				
			||||||
 | 
						struct llist_head inuse_endpoints;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_inuse_endpoint {
 | 
				
			||||||
 | 
						struct llist_head entry;
 | 
				
			||||||
 | 
						uint16_t id;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_response_pending {
 | 
				
			||||||
 | 
						struct llist_head entry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						mgcp_trans_id_t trans_id;
 | 
				
			||||||
 | 
						mgcp_response_cb_t response_cb;
 | 
				
			||||||
 | 
						void *priv;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mgcp_response_pending * mgcpgw_client_pending_add(
 | 
				
			||||||
 | 
										struct mgcpgw_client *mgcp,
 | 
				
			||||||
 | 
										mgcp_trans_id_t trans_id,
 | 
				
			||||||
 | 
										mgcp_response_cb_t response_cb,
 | 
				
			||||||
 | 
										void *priv);
 | 
				
			||||||
							
								
								
									
										42
									
								
								include/osmocom/legacy_mgcp/osmux.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								include/osmocom/legacy_mgcp/osmux.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					#ifndef _OPENBSC_OSMUX_H_
 | 
				
			||||||
 | 
					#define _OPENBSC_OSMUX_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <osmocom/netif/osmux.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define OSMUX_PORT	1984
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum {
 | 
				
			||||||
 | 
						OSMUX_ROLE_BSC = 0,
 | 
				
			||||||
 | 
						OSMUX_ROLE_BSC_NAT,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int osmux_init(int role, struct mgcp_config *cfg);
 | 
				
			||||||
 | 
					int osmux_enable_endpoint(struct mgcp_endpoint *endp, int role,
 | 
				
			||||||
 | 
								  struct in_addr *addr, uint16_t port);
 | 
				
			||||||
 | 
					void osmux_disable_endpoint(struct mgcp_endpoint *endp);
 | 
				
			||||||
 | 
					void osmux_allocate_cid(struct mgcp_endpoint *endp);
 | 
				
			||||||
 | 
					void osmux_release_cid(struct mgcp_endpoint *endp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int osmux_xfrm_to_rtp(struct mgcp_endpoint *endp, int type, char *buf, int rc);
 | 
				
			||||||
 | 
					int osmux_xfrm_to_osmux(int type, char *buf, int rc, struct mgcp_endpoint *endp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int osmux_send_dummy(struct mgcp_endpoint *endp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int osmux_get_cid(void);
 | 
				
			||||||
 | 
					void osmux_put_cid(uint8_t osmux_cid);
 | 
				
			||||||
 | 
					int osmux_used_cid(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum osmux_state {
 | 
				
			||||||
 | 
						OSMUX_STATE_DISABLED = 0,
 | 
				
			||||||
 | 
						OSMUX_STATE_NEGOTIATING,
 | 
				
			||||||
 | 
						OSMUX_STATE_ACTIVATING,
 | 
				
			||||||
 | 
						OSMUX_STATE_ENABLED,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum osmux_usage {
 | 
				
			||||||
 | 
						OSMUX_USAGE_OFF = 0,
 | 
				
			||||||
 | 
						OSMUX_USAGE_ON = 1,
 | 
				
			||||||
 | 
						OSMUX_USAGE_ONLY = 2,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										31
									
								
								include/osmocom/legacy_mgcp/vty.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								include/osmocom/legacy_mgcp/vty.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					#ifndef OPENBSC_VTY_H
 | 
				
			||||||
 | 
					#define OPENBSC_VTY_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <osmocom/vty/vty.h>
 | 
				
			||||||
 | 
					#include <osmocom/vty/buffer.h>
 | 
				
			||||||
 | 
					#include <osmocom/vty/command.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct gsm_network;
 | 
				
			||||||
 | 
					struct vty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct buffer *vty_argv_to_buffer(int argc, const char *argv[], int base);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct cmd_element cfg_description_cmd;
 | 
				
			||||||
 | 
					extern struct cmd_element cfg_no_description_cmd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum mgcp_vty_node {
 | 
				
			||||||
 | 
						MGCP_NODE,
 | 
				
			||||||
 | 
						TRUNK_NODE,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct log_info;
 | 
				
			||||||
 | 
					int bsc_vty_init(struct gsm_network *network);
 | 
				
			||||||
 | 
					int bsc_vty_init_extra(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void msc_vty_init(struct gsm_network *msc_network);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct gsm_network *gsmnet_from_vty(struct vty *vty);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
@@ -1,16 +0,0 @@
 | 
				
			|||||||
noinst_HEADERS = \
 | 
					 | 
				
			||||||
	vty.h \
 | 
					 | 
				
			||||||
	mgcp_msg.h \
 | 
					 | 
				
			||||||
	mgcp_conn.h \
 | 
					 | 
				
			||||||
	mgcp_stat.h \
 | 
					 | 
				
			||||||
	mgcp_endp.h \
 | 
					 | 
				
			||||||
	mgcp_sdp.h \
 | 
					 | 
				
			||||||
	mgcp_codec.h \
 | 
					 | 
				
			||||||
	mgcp_trunk.h \
 | 
					 | 
				
			||||||
	debug.h \
 | 
					 | 
				
			||||||
	mgcp_ratectr.h \
 | 
					 | 
				
			||||||
	mgcp_e1.h \
 | 
					 | 
				
			||||||
	mgcp_network.h \
 | 
					 | 
				
			||||||
	mgcp_protocol.h \
 | 
					 | 
				
			||||||
	mgcp_iuup.h \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
					 | 
				
			||||||
@@ -1,37 +0,0 @@
 | 
				
			|||||||
/* (C) 2017 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Author: Philipp Maier
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
#include <osmocom/core/linuxlist.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define DEBUG
 | 
					 | 
				
			||||||
#include <osmocom/core/logging.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Debug Areas of the code */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
	DRTP,
 | 
					 | 
				
			||||||
	DE1,
 | 
					 | 
				
			||||||
	DOSMUX,
 | 
					 | 
				
			||||||
	Debug_LastEntry,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern const struct log_info log_info;
 | 
					 | 
				
			||||||
@@ -1,213 +0,0 @@
 | 
				
			|||||||
/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
 | 
					 | 
				
			||||||
 * (C) 2009-2012 by On-Waves
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/core/msgb.h>
 | 
					 | 
				
			||||||
#include <osmocom/core/socket.h>
 | 
					 | 
				
			||||||
#include <osmocom/core/write_queue.h>
 | 
					 | 
				
			||||||
#include <osmocom/core/timer.h>
 | 
					 | 
				
			||||||
#include <osmocom/core/logging.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/mgcp/mgcp_common.h>
 | 
					 | 
				
			||||||
#include <osmocom/mgcp/osmux.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <arpa/inet.h>
 | 
					 | 
				
			||||||
#include <sys/types.h>
 | 
					 | 
				
			||||||
#include <sys/socket.h>
 | 
					 | 
				
			||||||
#include <netinet/in.h>
 | 
					 | 
				
			||||||
#include <pthread.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "mgcp_ratectr.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define RTP_PORT_DEFAULT_RANGE_START 16002
 | 
					 | 
				
			||||||
#define RTP_PORT_DEFAULT_RANGE_END RTP_PORT_DEFAULT_RANGE_START + 64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Handling of MGCP Endpoints and the MGCP Config
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct mgcp_endpoint;
 | 
					 | 
				
			||||||
struct mgcp_config;
 | 
					 | 
				
			||||||
struct mgcp_trunk;
 | 
					 | 
				
			||||||
struct mgcp_rtp_end;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define MGCP_ENDP_CRCX 1
 | 
					 | 
				
			||||||
#define MGCP_ENDP_DLCX 2
 | 
					 | 
				
			||||||
#define MGCP_ENDP_MDCX 3
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * what to do with the msg?
 | 
					 | 
				
			||||||
 *	- continue as usual?
 | 
					 | 
				
			||||||
 *	- reject and send a failure code?
 | 
					 | 
				
			||||||
 *	- defer? do not send anything
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define MGCP_POLICY_CONT	4
 | 
					 | 
				
			||||||
#define MGCP_POLICY_REJECT	5
 | 
					 | 
				
			||||||
#define MGCP_POLICY_DEFER	6
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef int (*mgcp_reset)(struct mgcp_trunk *cfg);
 | 
					 | 
				
			||||||
typedef int (*mgcp_rqnt)(struct mgcp_endpoint *endp, char tone);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Return:
 | 
					 | 
				
			||||||
 *   <  0 in case no audio was processed
 | 
					 | 
				
			||||||
 *   >= 0 in case audio was processed. The remaining payload
 | 
					 | 
				
			||||||
 *   length will be returned.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef int (*mgcp_processing)(struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
			       struct mgcp_rtp_end *dst_end,
 | 
					 | 
				
			||||||
			       char *data, int *len, int buf_size);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_conn_rtp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef int (*mgcp_processing_setup)(struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
				     struct mgcp_conn_rtp *conn_dst,
 | 
					 | 
				
			||||||
				     struct mgcp_conn_rtp *conn_src);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_rtp_codec;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef void (*mgcp_get_format)(struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
				const struct mgcp_rtp_codec **codec,
 | 
					 | 
				
			||||||
				const char **fmtp_extra,
 | 
					 | 
				
			||||||
				struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * This holds information on how to allocate ports
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct mgcp_port_range {
 | 
					 | 
				
			||||||
	pthread_mutex_t lock;
 | 
					 | 
				
			||||||
	/* addr or NULL to fall-back to default */
 | 
					 | 
				
			||||||
	char bind_addr_v4[INET6_ADDRSTRLEN];
 | 
					 | 
				
			||||||
	char bind_addr_v6[INET6_ADDRSTRLEN];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* dynamically allocated */
 | 
					 | 
				
			||||||
	int range_start;
 | 
					 | 
				
			||||||
	int range_end;
 | 
					 | 
				
			||||||
	int last_port;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* set to true to enable automatic probing
 | 
					 | 
				
			||||||
	 * of the local bind IP-Address, bind_addr
 | 
					 | 
				
			||||||
	 * (or its fall back) is used when automatic
 | 
					 | 
				
			||||||
	 * probing fails */
 | 
					 | 
				
			||||||
	bool bind_addr_probe;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* There are up to three modes in which the keep-alive dummy packet can be
 | 
					 | 
				
			||||||
 * sent. The behaviour is controlled via the keepalive_interval member of the
 | 
					 | 
				
			||||||
 * trunk config. If that member is set to 0 (MGCP_KEEPALIVE_NEVER) no dummy-
 | 
					 | 
				
			||||||
 * packet is sent at all and the timer that sends regular dummy packets
 | 
					 | 
				
			||||||
 * is no longer scheduled. If the keepalive_interval is set to -1, only
 | 
					 | 
				
			||||||
 * one dummy packet is sent when an CRCX or an MDCX is performed. No timer
 | 
					 | 
				
			||||||
 * is scheduled. For all vales greater 0, the timer is scheduled and the
 | 
					 | 
				
			||||||
 * value is used as interval. See also mgcp_keepalive_timer_cb(),
 | 
					 | 
				
			||||||
 * handle_modify_con(), and handle_create_con() */
 | 
					 | 
				
			||||||
#define MGCP_KEEPALIVE_ONCE (-1)
 | 
					 | 
				
			||||||
#define MGCP_KEEPALIVE_NEVER 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum mgcp_role {
 | 
					 | 
				
			||||||
	MGCP_BSC = 0,
 | 
					 | 
				
			||||||
	MGCP_BSC_NAT,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_config {
 | 
					 | 
				
			||||||
	int source_port;
 | 
					 | 
				
			||||||
	char local_ip[INET6_ADDRSTRLEN];
 | 
					 | 
				
			||||||
	char source_addr[INET6_ADDRSTRLEN];
 | 
					 | 
				
			||||||
	char call_agent_addr[INET6_ADDRSTRLEN];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* RTP processing */
 | 
					 | 
				
			||||||
	mgcp_processing rtp_processing_cb;
 | 
					 | 
				
			||||||
	mgcp_processing_setup setup_rtp_processing_cb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	mgcp_get_format get_net_downlink_format_cb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct osmo_wqueue gw_fd;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct mgcp_port_range net_ports;
 | 
					 | 
				
			||||||
	int endp_dscp;
 | 
					 | 
				
			||||||
	int endp_priority;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	int force_ptime;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	mgcp_reset reset_cb;
 | 
					 | 
				
			||||||
	mgcp_rqnt rqnt_cb;
 | 
					 | 
				
			||||||
	void *data;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* list holding the trunks */
 | 
					 | 
				
			||||||
	struct llist_head trunks;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	enum mgcp_role role;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct {
 | 
					 | 
				
			||||||
		/* Osmux usage policy: */
 | 
					 | 
				
			||||||
		enum osmux_usage usage;
 | 
					 | 
				
			||||||
		/* addr to bind the server to */
 | 
					 | 
				
			||||||
		char *local_addr_v4;
 | 
					 | 
				
			||||||
		char *local_addr_v6;
 | 
					 | 
				
			||||||
		/* osmux port */
 | 
					 | 
				
			||||||
		uint16_t local_port;
 | 
					 | 
				
			||||||
		/* The osmux socket is allocated on demand (1st time used).
 | 
					 | 
				
			||||||
		* This tells us if the osmux socket is already initialized.  */
 | 
					 | 
				
			||||||
		bool initialized;
 | 
					 | 
				
			||||||
		/* osmux batch factor: from 1 to 4 maximum */
 | 
					 | 
				
			||||||
		int batch_factor;
 | 
					 | 
				
			||||||
		/* osmux batch size (in bytes) */
 | 
					 | 
				
			||||||
		int batch_size;
 | 
					 | 
				
			||||||
		/* Pad circuit with dummy AMR frames if no payload to transmit is available */
 | 
					 | 
				
			||||||
		bool dummy_padding;
 | 
					 | 
				
			||||||
		/* Whether peer is behind NAT (Retrieve remote addr from 1st received Osmux packet) */
 | 
					 | 
				
			||||||
		bool peer_behind_nat;
 | 
					 | 
				
			||||||
	} osmux;
 | 
					 | 
				
			||||||
	/* domain name of the media gateway */
 | 
					 | 
				
			||||||
	char domain[255+1];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* time after which inactive connections (CIs) get closed */
 | 
					 | 
				
			||||||
	int conn_timeout;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* osmocom CTRL interface */
 | 
					 | 
				
			||||||
	struct ctrl_handle *ctrl;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* global rate counters to measure the MGWs overall performance and
 | 
					 | 
				
			||||||
	 * health */
 | 
					 | 
				
			||||||
	struct mgcp_ratectr_global ratectr;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* config management */
 | 
					 | 
				
			||||||
struct mgcp_config *mgcp_config_alloc(void);
 | 
					 | 
				
			||||||
int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg,
 | 
					 | 
				
			||||||
		      enum mgcp_role role);
 | 
					 | 
				
			||||||
int mgcp_vty_init(void);
 | 
					 | 
				
			||||||
void mgcp_trunk_set_keepalive(struct mgcp_trunk *trunk, int interval);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * format helper functions
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct msgb *mgcp_handle_message(struct mgcp_config *cfg, struct msgb *msg);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_send_reset_ep(struct mgcp_endpoint *endp);
 | 
					 | 
				
			||||||
int mgcp_send_reset_all(struct mgcp_config *cfg);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_create_bind(const char *source_addr, struct osmo_fd *fd, int port, uint8_t dscp,
 | 
					 | 
				
			||||||
		     uint8_t prio);
 | 
					 | 
				
			||||||
int mgcp_udp_send(int fd, const struct osmo_sockaddr *addr, const char *buf, int len);
 | 
					 | 
				
			||||||
@@ -1,21 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define DEFAULT_RTP_AUDIO_FRAME_DUR_NUM 20
 | 
					 | 
				
			||||||
#define DEFAULT_RTP_AUDIO_FRAME_DUR_DEN 1000
 | 
					 | 
				
			||||||
#define DEFAULT_RTP_AUDIO_PACKET_DURATION_MS 20
 | 
					 | 
				
			||||||
#define DEFAULT_RTP_AUDIO_DEFAULT_RATE  8000
 | 
					 | 
				
			||||||
#define DEFAULT_RTP_AUDIO_DEFAULT_CHANNELS 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define PTYPE_UNDEFINED (-1)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_conn_rtp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void mgcp_codec_summary(struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
void mgcp_codec_reset_all(struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
int mgcp_codec_add(struct mgcp_conn_rtp *conn, int payload_type, const char *audio_name, const struct mgcp_codec_param *param);
 | 
					 | 
				
			||||||
int mgcp_codec_decide(struct mgcp_conn_rtp *conn_src, struct mgcp_conn_rtp *conn_dst);
 | 
					 | 
				
			||||||
const struct mgcp_rtp_codec *mgcp_codec_pt_find_by_subtype_name(struct mgcp_conn_rtp *conn,
 | 
					 | 
				
			||||||
								const char *subtype_name, unsigned int match_nr);
 | 
					 | 
				
			||||||
bool mgcp_codec_amr_align_mode_is_indicated(const struct mgcp_rtp_codec *codec);
 | 
					 | 
				
			||||||
bool mgcp_codec_amr_is_octet_aligned(const struct mgcp_rtp_codec *codec);
 | 
					 | 
				
			||||||
struct mgcp_rtp_codec *mgcp_codec_from_pt(struct mgcp_conn_rtp *conn, int payload_type);
 | 
					 | 
				
			||||||
@@ -1,112 +0,0 @@
 | 
				
			|||||||
/* MGCP common implementations.
 | 
					 | 
				
			||||||
 * These are used in libosmo-mgcp as well as libosmo-mgcp-client.
 | 
					 | 
				
			||||||
 * To avoid interdependency, these are implemented in .h file only. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					 | 
				
			||||||
 * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
 | 
					 | 
				
			||||||
 * (C) 2009-2012 by On-Waves
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Two copies of this file are kept in osmocom/mgcp/ and osmocom/mgcp_client/.
 | 
					 | 
				
			||||||
 * Since both are by definition identical, use the old header exclusion ifdefs
 | 
					 | 
				
			||||||
 * instead of '#pragma once' to avoid including both of these files.
 | 
					 | 
				
			||||||
 * Though at the time of writing there are no such users, this allows including
 | 
					 | 
				
			||||||
 * both libosmo-mgcp and libosmo-mgcp-client headers in the same file. */
 | 
					 | 
				
			||||||
#ifndef OSMO_MGCP_COMMON_H
 | 
					 | 
				
			||||||
#define OSMO_MGCP_COMMON_H
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
#include <errno.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/core/msgb.h>
 | 
					 | 
				
			||||||
#include <osmocom/core/logging.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define for_each_non_empty_line(line, save)			\
 | 
					 | 
				
			||||||
	for (line = strtok_r(NULL, "\r\n", &save); line;	\
 | 
					 | 
				
			||||||
	     line = strtok_r(NULL, "\r\n", &save))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum mgcp_connection_mode {
 | 
					 | 
				
			||||||
	MGCP_CONN_NONE = 0,
 | 
					 | 
				
			||||||
	MGCP_CONN_RECV_ONLY = 1,
 | 
					 | 
				
			||||||
	MGCP_CONN_SEND_ONLY = 2,
 | 
					 | 
				
			||||||
	MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY,
 | 
					 | 
				
			||||||
	MGCP_CONN_LOOPBACK  = 4 | MGCP_CONN_RECV_SEND,
 | 
					 | 
				
			||||||
	MGCP_CONN_CONFECHO  = 8 | MGCP_CONN_RECV_SEND,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define MGCP_X_OSMO_IGN_HEADER "X-Osmo-IGN:"
 | 
					 | 
				
			||||||
#define MGCP_X_OSMO_OSMUX_HEADER "X-Osmux:"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Values should be bitwise-OR-able */
 | 
					 | 
				
			||||||
enum mgcp_x_osmo_ign {
 | 
					 | 
				
			||||||
	MGCP_X_OSMO_IGN_NONE = 0,
 | 
					 | 
				
			||||||
	MGCP_X_OSMO_IGN_CALLID = 1,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Codec parameters (communicated via SDP/fmtp) */
 | 
					 | 
				
			||||||
struct mgcp_codec_param {
 | 
					 | 
				
			||||||
	bool amr_octet_aligned_present;
 | 
					 | 
				
			||||||
	bool amr_octet_aligned;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Ensure that the msg->l2h is NUL terminated. */
 | 
					 | 
				
			||||||
static inline int mgcp_msg_terminate_nul(struct msgb *msg)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	unsigned char *tail = msg->l2h + msgb_l2len(msg); /* char after l2 data */
 | 
					 | 
				
			||||||
	if (tail[-1] == '\0')
 | 
					 | 
				
			||||||
		/* nothing to do */;
 | 
					 | 
				
			||||||
	else if (msgb_tailroom(msg) > 0)
 | 
					 | 
				
			||||||
		tail[0] = '\0';
 | 
					 | 
				
			||||||
	else if (tail[-1] == '\r' || tail[-1] == '\n')
 | 
					 | 
				
			||||||
		tail[-1] = '\0';
 | 
					 | 
				
			||||||
	else {
 | 
					 | 
				
			||||||
		LOGP(DLMGCP, LOGL_ERROR, "Cannot NUL terminate MGCP message: "
 | 
					 | 
				
			||||||
		     "Length: %d, Buffer size: %d\n",
 | 
					 | 
				
			||||||
		     msgb_l2len(msg), msg->data_len);
 | 
					 | 
				
			||||||
		return -ENOTSUP;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Maximum length of the comment field */
 | 
					 | 
				
			||||||
#define MGCP_COMMENT_MAXLEN 256
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Maximum allowed String length of Connection Identifiers as per spec
 | 
					 | 
				
			||||||
 * (see also RFC3435 2.1.3.2 Names of Connections), plus one for '\0'. */
 | 
					 | 
				
			||||||
#define MGCP_CONN_ID_MAXLEN 32+1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Deprecated: old name of MGCP_CONN_ID_MAXLEN. */
 | 
					 | 
				
			||||||
#define MGCP_CONN_ID_LENGTH MGCP_CONN_ID_MAXLEN
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* String length of Endpoint Identifiers.
 | 
					 | 
				
			||||||
/  (see also RFC3435 section 3.2.1.3) */
 | 
					 | 
				
			||||||
#define MGCP_ENDPOINT_MAXLEN (255*2+1+1)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* A prefix to denote the virtual trunk (RTP on both ends) */
 | 
					 | 
				
			||||||
#define MGCP_ENDPOINT_PREFIX_VIRTUAL_TRUNK "rtpbridge/"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* A prefix to denote the e1 trunk
 | 
					 | 
				
			||||||
 * (see also RFC3435 section E.2) */
 | 
					 | 
				
			||||||
#define MGCP_ENDPOINT_PREFIX_E1_TRUNK "ds/e1-"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Maximal number of payload types / codecs that can be negotiated via SDP at
 | 
					 | 
				
			||||||
 * at once. */
 | 
					 | 
				
			||||||
#define MGCP_MAX_CODECS 10
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
@@ -1,246 +0,0 @@
 | 
				
			|||||||
/* Message connection list handling */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Author: Philipp Maier
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/mgcp/mgcp.h>
 | 
					 | 
				
			||||||
#include <osmocom/mgcp/mgcp_network.h>
 | 
					 | 
				
			||||||
#include <osmocom/mgcp/osmux.h>
 | 
					 | 
				
			||||||
#include <osmocom/core/linuxlist.h>
 | 
					 | 
				
			||||||
#include <osmocom/core/rate_ctr.h>
 | 
					 | 
				
			||||||
#include <osmocom/gsm/iuup.h>
 | 
					 | 
				
			||||||
#include <inttypes.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define LOGPCONN(conn, cat, level, fmt, args...) \
 | 
					 | 
				
			||||||
LOGPENDP((conn)->endp, cat, level, "CI:%s " fmt, \
 | 
					 | 
				
			||||||
         (conn)->id, \
 | 
					 | 
				
			||||||
         ## args)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define LOG_CONN(conn, level, fmt, args...) \
 | 
					 | 
				
			||||||
	LOGP(DRTP, level, "(%s I:%s) " fmt, \
 | 
					 | 
				
			||||||
	     (conn)->endp ? (conn)->endp->name : "none", (conn)->id, ## args)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define LOG_CONN_RTP(conn_rtp, level, fmt, args...) \
 | 
					 | 
				
			||||||
	LOG_CONN((conn_rtp)->conn, level, fmt, ## args)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Specific rtp connection type (see struct mgcp_conn_rtp) */
 | 
					 | 
				
			||||||
enum mgcp_conn_rtp_type {
 | 
					 | 
				
			||||||
	MGCP_RTP_DEFAULT	= 0,
 | 
					 | 
				
			||||||
	MGCP_RTP_OSMUX,
 | 
					 | 
				
			||||||
	MGCP_RTP_IUUP,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! Connection type, specifies which member of the union "u" in mgcp_conn
 | 
					 | 
				
			||||||
 *  contains a useful connection description (currently only RTP) */
 | 
					 | 
				
			||||||
enum mgcp_conn_type {
 | 
					 | 
				
			||||||
	MGCP_CONN_TYPE_RTP,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* MGCP connection (RTP) */
 | 
					 | 
				
			||||||
struct mgcp_conn_rtp {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Backpointer to conn struct */
 | 
					 | 
				
			||||||
	struct mgcp_conn *conn;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Specific connection type */
 | 
					 | 
				
			||||||
	enum mgcp_conn_rtp_type type;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Port status */
 | 
					 | 
				
			||||||
	struct mgcp_rtp_end end;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Sequence bits */
 | 
					 | 
				
			||||||
	struct mgcp_rtp_state state;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* taps for the rtp connection; one per direction */
 | 
					 | 
				
			||||||
	struct mgcp_rtp_tap tap_in;
 | 
					 | 
				
			||||||
	struct mgcp_rtp_tap tap_out;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Osmux states (optional) */
 | 
					 | 
				
			||||||
	struct {
 | 
					 | 
				
			||||||
		/* Osmux state: disabled, activating, active */
 | 
					 | 
				
			||||||
		enum osmux_state state;
 | 
					 | 
				
			||||||
		/* Is local_cid holding valid data? is it allocated from pool? */
 | 
					 | 
				
			||||||
		bool local_cid_allocated;
 | 
					 | 
				
			||||||
		/* Allocated local Osmux circuit ID for this conn */
 | 
					 | 
				
			||||||
		uint8_t local_cid;
 | 
					 | 
				
			||||||
		/* Is remote_cid holding valid data? was it already received from client? */
 | 
					 | 
				
			||||||
		bool remote_cid_present;
 | 
					 | 
				
			||||||
		/* Received remote Osmux circuit ID for this conn */
 | 
					 | 
				
			||||||
		uint8_t remote_cid;
 | 
					 | 
				
			||||||
		/* handle to batch messages, shared (refcounted) among several conns */
 | 
					 | 
				
			||||||
		struct osmux_in_handle *in;
 | 
					 | 
				
			||||||
		/* handle to unbatch messages, one allocated and owned per conn */
 | 
					 | 
				
			||||||
		struct osmux_out_handle *out;
 | 
					 | 
				
			||||||
		/* statistics: */
 | 
					 | 
				
			||||||
		struct rate_ctr_group *ctrg;
 | 
					 | 
				
			||||||
	} osmux;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct {
 | 
					 | 
				
			||||||
		struct osmo_iuup_instance *iui;
 | 
					 | 
				
			||||||
		bool active_init; /* true: Send IuUP Init */
 | 
					 | 
				
			||||||
		int rfci_id_no_data; /* RFCI Id for RFCI NO_DATA (-1 if not available) */
 | 
					 | 
				
			||||||
		bool configured;
 | 
					 | 
				
			||||||
		struct osmo_iuup_rnl_prim *init_ind;
 | 
					 | 
				
			||||||
	} iuup;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct rate_ctr_group *ctrg;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! MGCP connection (untyped) */
 | 
					 | 
				
			||||||
struct mgcp_conn {
 | 
					 | 
				
			||||||
	/*! list head */
 | 
					 | 
				
			||||||
	struct llist_head entry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Backpointer to the endpoint where the conn belongs to */
 | 
					 | 
				
			||||||
	struct mgcp_endpoint *endp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! type of the connection (union) */
 | 
					 | 
				
			||||||
	enum mgcp_conn_type type;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! mode of the connection */
 | 
					 | 
				
			||||||
	enum mgcp_connection_mode mode;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! copy of the mode to restore the original setting (VTY) */
 | 
					 | 
				
			||||||
	enum mgcp_connection_mode mode_orig;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! connection id to identify the connection */
 | 
					 | 
				
			||||||
	char id[MGCP_CONN_ID_MAXLEN];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! human readable name (vty, logging) */
 | 
					 | 
				
			||||||
	char name[256];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! activity tracker (for cleaning up inactive connections) */
 | 
					 | 
				
			||||||
	struct osmo_timer_list watchdog;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! union with connection description */
 | 
					 | 
				
			||||||
	union {
 | 
					 | 
				
			||||||
		struct mgcp_conn_rtp rtp;
 | 
					 | 
				
			||||||
	} u;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! pointer to optional private data */
 | 
					 | 
				
			||||||
	void *priv;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* RTP connection related counters */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
	IN_STREAM_ERR_TSTMP_CTR,
 | 
					 | 
				
			||||||
	OUT_STREAM_ERR_TSTMP_CTR,
 | 
					 | 
				
			||||||
	RTP_PACKETS_RX_CTR,
 | 
					 | 
				
			||||||
	RTP_OCTETS_RX_CTR,
 | 
					 | 
				
			||||||
	RTP_PACKETS_TX_CTR,
 | 
					 | 
				
			||||||
	RTP_OCTETS_TX_CTR,
 | 
					 | 
				
			||||||
	RTP_DROPPED_PACKETS_CTR,
 | 
					 | 
				
			||||||
	RTP_NUM_CONNECTIONS,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* RTP per-connection statistics. Instances of the corresponding rate counter group
 | 
					 | 
				
			||||||
 * exist for the lifetime of an RTP connection.
 | 
					 | 
				
			||||||
 * Must be kept in sync with all_rtp_conn_rate_ctr_desc below */
 | 
					 | 
				
			||||||
static const struct rate_ctr_desc mgcp_conn_rate_ctr_desc[] = {
 | 
					 | 
				
			||||||
	[IN_STREAM_ERR_TSTMP_CTR] = {"stream_err_tstmp:in", "Inbound rtp-stream timestamp errors."},
 | 
					 | 
				
			||||||
	[OUT_STREAM_ERR_TSTMP_CTR] = {"stream_err_tstmp:out", "Outbound rtp-stream timestamp errors."},
 | 
					 | 
				
			||||||
	[RTP_PACKETS_RX_CTR] = {"rtp:packets_rx", "Inbound rtp packets."},
 | 
					 | 
				
			||||||
	[RTP_OCTETS_RX_CTR] = {"rtp:octets_rx", "Inbound rtp octets."},
 | 
					 | 
				
			||||||
	[RTP_PACKETS_TX_CTR] = {"rtp:packets_tx", "Outbound rtp packets."},
 | 
					 | 
				
			||||||
	[RTP_OCTETS_TX_CTR] = {"rtp:octets_tx", "Outbound rtp octets."},
 | 
					 | 
				
			||||||
	[RTP_DROPPED_PACKETS_CTR] = {"rtp:dropped", "Dropped rtp packets."}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Aggregated RTP connection stats. These are updated when an RTP connection is freed.
 | 
					 | 
				
			||||||
 * Must be kept in sync with mgcp_conn_rate_ctr_desc above */
 | 
					 | 
				
			||||||
static const struct rate_ctr_desc all_rtp_conn_rate_ctr_desc[] = {
 | 
					 | 
				
			||||||
	[IN_STREAM_ERR_TSTMP_CTR] = {"all_rtp:err_tstmp_in", "Total inbound rtp-stream timestamp errors."},
 | 
					 | 
				
			||||||
	[OUT_STREAM_ERR_TSTMP_CTR] = {"all_rtp:err_tstmp_out", "Total outbound rtp-stream timestamp errors."},
 | 
					 | 
				
			||||||
	[RTP_PACKETS_RX_CTR] = {"all_rtp:packets_rx", "Total inbound rtp packets."},
 | 
					 | 
				
			||||||
	[RTP_OCTETS_RX_CTR] = {"all_rtp:octets_rx", "Total inbound rtp octets."},
 | 
					 | 
				
			||||||
	[RTP_PACKETS_TX_CTR] = {"all_rtp:packets_tx", "Total outbound rtp packets."},
 | 
					 | 
				
			||||||
	[RTP_OCTETS_TX_CTR] = {"all_rtp:octets_tx", "Total outbound rtp octets."},
 | 
					 | 
				
			||||||
	[RTP_DROPPED_PACKETS_CTR] = {"all_rtp:dropped", "Total dropped rtp packets."},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* This last counter does not exist in per-connection stats, only here. */
 | 
					 | 
				
			||||||
	[RTP_NUM_CONNECTIONS] = {"all_rtp:num_closed_conns", "Total number of rtp connections closed."}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Osmux connection related counters */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
	OSMUX_CHUNKS_RX_CTR,
 | 
					 | 
				
			||||||
	OSMUX_OCTETS_RX_CTR,
 | 
					 | 
				
			||||||
	OSMUX_RTP_PACKETS_TX_CTR,
 | 
					 | 
				
			||||||
	OSMUX_RTP_PACKETS_TX_DROPPED_CTR,
 | 
					 | 
				
			||||||
	OSMUX_AMR_OCTETS_TX_CTR,
 | 
					 | 
				
			||||||
	/* Only available in global stats: */
 | 
					 | 
				
			||||||
	OSMUX_NUM_CONNECTIONS,
 | 
					 | 
				
			||||||
	OSMUX_PACKETS_RX_CTR,
 | 
					 | 
				
			||||||
	OSMUX_PACKETS_TX_CTR,
 | 
					 | 
				
			||||||
	OSMUX_DROPPED_PACKETS_CTR,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* RTP per-connection statistics. Instances of the corresponding rate counter group
 | 
					 | 
				
			||||||
 * exist for the lifetime of an RTP connection.
 | 
					 | 
				
			||||||
 * Must be kept in sync with all_rtp_conn_rate_ctr_desc below */
 | 
					 | 
				
			||||||
static const struct rate_ctr_desc mgcp_conn_osmux_rate_ctr_desc[] = {
 | 
					 | 
				
			||||||
	[OSMUX_CHUNKS_RX_CTR] = {"osmux:chunks_rx", "Inbound Osmux chunks."},
 | 
					 | 
				
			||||||
	[OSMUX_OCTETS_RX_CTR] = {"osmux:octets_rx", "Inbound Osmux octets."},
 | 
					 | 
				
			||||||
	[OSMUX_RTP_PACKETS_TX_CTR] = {"osmux:rtp_packets_tx", "Tx outbound RTP packets to encode as Osmux."},
 | 
					 | 
				
			||||||
	[OSMUX_RTP_PACKETS_TX_DROPPED_CTR] = {"osmux:rtp_packets_tx_dropped", "Dropped Tx outbound RTP packets to encode as Osmux."},
 | 
					 | 
				
			||||||
	[OSMUX_AMR_OCTETS_TX_CTR] = {"osmux:amr_octets_tx", "Tx outbound AMD payload octets."},
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Aggregated Osmux connection stats. These are updated when an Osmux connection is freed.
 | 
					 | 
				
			||||||
 * Must be kept in sync with mgcp_conn_osmux_rate_ctr_desc above */
 | 
					 | 
				
			||||||
static const struct rate_ctr_desc all_osmux_conn_rate_ctr_desc[] = {
 | 
					 | 
				
			||||||
	[OSMUX_CHUNKS_RX_CTR] = {"all_osmux:chunks_rx", "Inbound Osmux chunks."},
 | 
					 | 
				
			||||||
	[OSMUX_OCTETS_RX_CTR] = {"all_osmux:octets_rx", "Inbound Osmux octets."},
 | 
					 | 
				
			||||||
	[OSMUX_RTP_PACKETS_TX_CTR] = {"all_osmux:rtp_packets_tx", "Tx outbound RTP packets to encode as Osmux."},
 | 
					 | 
				
			||||||
	[OSMUX_RTP_PACKETS_TX_DROPPED_CTR] = {"all_osmux:rtp_packets_tx_dropped", "Dropped Tx outbound RTP packets to encode as Osmux."},
 | 
					 | 
				
			||||||
	[OSMUX_AMR_OCTETS_TX_CTR] = {"all_osmux:amr_octets_tx", "Tx outbound AMD payload octets."},
 | 
					 | 
				
			||||||
	/* These last counters below do not exist in per-connection stats, only here: */
 | 
					 | 
				
			||||||
	[OSMUX_NUM_CONNECTIONS] = {"all_osmux:num_closed_conns", "Total number of osmux connections closed."},
 | 
					 | 
				
			||||||
	[OSMUX_PACKETS_RX_CTR] = {"all_osmux:packets_rx", "Total inbound UDP/Osmux packets."},
 | 
					 | 
				
			||||||
	[OSMUX_PACKETS_TX_CTR] = {"all_osmux:packets_tx", "Total outbound UDP/Osmux packets."},
 | 
					 | 
				
			||||||
	[OSMUX_DROPPED_PACKETS_CTR] = {"all_osmux:dropped_packets", "Dropped outbound UDP/Osmux packets."}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Was conn configured to handle Osmux? */
 | 
					 | 
				
			||||||
static inline bool mgcp_conn_rtp_is_osmux(const struct mgcp_conn_rtp *conn) {
 | 
					 | 
				
			||||||
	return conn->type == MGCP_RTP_OSMUX;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Was conn configured to handle Osmux? */
 | 
					 | 
				
			||||||
static inline bool mgcp_conn_rtp_is_iuup(const struct mgcp_conn_rtp *conn)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return conn->type == MGCP_RTP_IUUP;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_conn *mgcp_conn_alloc(void *ctx, struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
				  enum mgcp_conn_type type, char *name);
 | 
					 | 
				
			||||||
struct mgcp_conn *mgcp_conn_get(struct mgcp_endpoint *endp, const char *id);
 | 
					 | 
				
			||||||
struct mgcp_conn_rtp *mgcp_conn_get_rtp(struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
					const char *id);
 | 
					 | 
				
			||||||
void mgcp_conn_free(struct mgcp_endpoint *endp, const char *id);
 | 
					 | 
				
			||||||
void mgcp_conn_free_oldest(struct mgcp_endpoint *endp);
 | 
					 | 
				
			||||||
void mgcp_conn_free_all(struct mgcp_endpoint *endp);
 | 
					 | 
				
			||||||
char *mgcp_conn_dump(struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
struct mgcp_conn *mgcp_find_dst_conn(struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
struct mgcp_conn *mgcp_conn_get_oldest(struct mgcp_endpoint *endp);
 | 
					 | 
				
			||||||
void mgcp_conn_watchdog_kick(struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
@@ -1,27 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* A 64k timeslot on an E1 line can be subdevied into the following
 | 
					 | 
				
			||||||
 * subslot combinations:
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * subslot:                                          offset:
 | 
					 | 
				
			||||||
 * [          ][          ][   16k    ][8k_subslot]  0
 | 
					 | 
				
			||||||
 * [          ][   32k    ][_subslot__][8k_subslot]  1
 | 
					 | 
				
			||||||
 * [          ][ subslot  ][   16k    ][8k_subslot]  2
 | 
					 | 
				
			||||||
 * [   64k    ][__________][_subslot__][8k_subslot]  3
 | 
					 | 
				
			||||||
 * [ timeslot ][          ][   16k    ][8k_subslot]  4
 | 
					 | 
				
			||||||
 * [          ][   32K    ][_subslot__][8k_subslot]  5
 | 
					 | 
				
			||||||
 * [          ][ subslot  ][   16k    ][8k_subslot]  6
 | 
					 | 
				
			||||||
 * [          ][          ][ subslot  ][8k_subslot]  7
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Since overlapping assignment of subslots is not possible there is a limited
 | 
					 | 
				
			||||||
 * set of subslot assignments possible. The e1_rates array lists the possible
 | 
					 | 
				
			||||||
 * assignments as depicted above. Also each subslot assignment comes along with
 | 
					 | 
				
			||||||
 * a bit offset in the E1 bitstream. The e1_offsets arrays lists the bit
 | 
					 | 
				
			||||||
 * offsets. */
 | 
					 | 
				
			||||||
static const uint8_t e1_rates[] = { 64, 32, 32, 16, 16, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8 };
 | 
					 | 
				
			||||||
static const uint8_t e1_offsets[] = { 0, 0, 4, 0, 2, 4, 6, 0, 1, 2, 3, 4, 5, 6, 7 };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_e1_endp_equip(struct mgcp_endpoint *endp, uint8_t ts, uint8_t ss, uint8_t offs);
 | 
					 | 
				
			||||||
void mgcp_e1_endp_update(struct mgcp_endpoint *endp);
 | 
					 | 
				
			||||||
void mgcp_e1_endp_release(struct mgcp_endpoint *endp, uint8_t ts);
 | 
					 | 
				
			||||||
int mgcp_e1_send_rtp(struct mgcp_endpoint *endp, struct mgcp_rtp_codec *codec, struct msgb *msg);
 | 
					 | 
				
			||||||
@@ -1,148 +0,0 @@
 | 
				
			|||||||
/* Endpoint types */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Author: Philipp Maier
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/core/msgb.h>
 | 
					 | 
				
			||||||
#include <osmocom/gsm/i460_mux.h>
 | 
					 | 
				
			||||||
#include <osmocom/mgcp/mgcp_protocol.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct sockaddr;
 | 
					 | 
				
			||||||
struct mgcp_conn;
 | 
					 | 
				
			||||||
struct mgcp_conn_rtp;
 | 
					 | 
				
			||||||
struct mgcp_endpoint;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Number of E1 subslots (different variants, not all useable at the same time) */
 | 
					 | 
				
			||||||
#define MGCP_ENDP_E1_SUBSLOTS 15
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define LOGPENDP(endp, cat, level, fmt, args...) \
 | 
					 | 
				
			||||||
LOGP(cat, level, "endpoint:%s " fmt, \
 | 
					 | 
				
			||||||
     endp ? endp->name : "none", \
 | 
					 | 
				
			||||||
     ## args)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum rtp_proto {
 | 
					 | 
				
			||||||
	MGCP_PROTO_RTP,
 | 
					 | 
				
			||||||
	MGCP_PROTO_RTCP,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct osmo_rtp_msg_ctx {
 | 
					 | 
				
			||||||
	enum rtp_proto proto;
 | 
					 | 
				
			||||||
	struct mgcp_conn_rtp *conn_src;
 | 
					 | 
				
			||||||
	struct osmo_sockaddr *from_addr;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define OSMO_RTP_MSG_CTX(MSGB) ((struct osmo_rtp_msg_ctx*)(MSGB)->cb)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
osmo_static_assert(sizeof(((struct msgb*)0)->cb) >= sizeof(struct osmo_rtp_msg_ctx), osmo_rtp_msg_ctx_fits_in_msgb_cb);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Callback type for RTP dispatcher functions (e.g mgcp_dispatch_rtp_bridge_cb, see below).
 | 
					 | 
				
			||||||
 * The OSMO_RTP_MSG_CTX() should be set appropriately on the msg. */
 | 
					 | 
				
			||||||
typedef int (*mgcp_dispatch_rtp_cb) (struct msgb *msg);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Callback type for endpoint specific cleanup actions. This function
 | 
					 | 
				
			||||||
 * is automatically executed when a connection is freed (see mgcp_conn_free()
 | 
					 | 
				
			||||||
 * in mgcp_conn.c). Depending on the type of the endpoint there may be endpoint
 | 
					 | 
				
			||||||
 * specific things to take care of once a connection has been removed. */
 | 
					 | 
				
			||||||
typedef void (*mgcp_cleanup_cp) (struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
				 struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! MGCP endpoint properties */
 | 
					 | 
				
			||||||
struct mgcp_endpoint_type {
 | 
					 | 
				
			||||||
	/*! maximum number of connections */
 | 
					 | 
				
			||||||
	int max_conns;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! callback that defines how to dispatch incoming RTP data */
 | 
					 | 
				
			||||||
	mgcp_dispatch_rtp_cb dispatch_rtp_cb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! callback that implements endpoint specific cleanup actions */
 | 
					 | 
				
			||||||
	mgcp_cleanup_cp cleanup_cb;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! MGCP endpoint typeset */
 | 
					 | 
				
			||||||
struct mgcp_endpoint_typeset {
 | 
					 | 
				
			||||||
	struct mgcp_endpoint_type rtp;
 | 
					 | 
				
			||||||
	struct mgcp_endpoint_type e1;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! static MGCP endpoint typeset (pre-initalized, read-only) */
 | 
					 | 
				
			||||||
extern const struct mgcp_endpoint_typeset ep_typeset;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! MGCP endpoint model */
 | 
					 | 
				
			||||||
struct mgcp_endpoint {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Unique endpoint name, used for addressing via MGCP */
 | 
					 | 
				
			||||||
	char *name;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Call identifier string (as supplied by the call agant) */
 | 
					 | 
				
			||||||
	char *callid;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Local connection options (see mgcp_internal.h) */
 | 
					 | 
				
			||||||
	struct mgcp_lco local_options;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! List of struct mgcp_conn, of the connections active on this endpoint */
 | 
					 | 
				
			||||||
	struct llist_head conns;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Backpointer to the trunk this endpoint belongs to */
 | 
					 | 
				
			||||||
	struct mgcp_trunk *trunk;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Endpoint properties (see above) */
 | 
					 | 
				
			||||||
	const struct mgcp_endpoint_type *type;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Last MGCP transmission (in case re-transmission is required) */
 | 
					 | 
				
			||||||
	char *last_trans;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Last MGCP response (in case re-transmission is required) */
 | 
					 | 
				
			||||||
	char *last_response;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! MGCP_X_OSMO_IGN_* flags from 'X-Osmo-IGN:' header */
 | 
					 | 
				
			||||||
	uint32_t x_osmo_ign;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* E1 specific */
 | 
					 | 
				
			||||||
	struct {
 | 
					 | 
				
			||||||
		struct osmo_i460_schan_desc scd;
 | 
					 | 
				
			||||||
		struct osmo_i460_subchan *schan;
 | 
					 | 
				
			||||||
		struct osmo_fsm_inst *trau_sync_fi;
 | 
					 | 
				
			||||||
		struct osmo_trau2rtp_state *trau_rtp_st;
 | 
					 | 
				
			||||||
		uint8_t last_amr_ft;
 | 
					 | 
				
			||||||
		struct mgcp_rtp_codec *last_codec;
 | 
					 | 
				
			||||||
	} e1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_endpoint *mgcp_endp_alloc(struct mgcp_trunk *trunk, unsigned int index);
 | 
					 | 
				
			||||||
int mgcp_endp_claim(struct mgcp_endpoint *endp, const char *callid);
 | 
					 | 
				
			||||||
void mgcp_endp_update(struct mgcp_endpoint *endp);
 | 
					 | 
				
			||||||
bool mgcp_endp_is_wildcarded(const char *epname);
 | 
					 | 
				
			||||||
bool mgcp_endp_is_null(const char *epname);
 | 
					 | 
				
			||||||
struct mgcp_endpoint *mgcp_endp_by_name_trunk(int *cause, const char *epname,
 | 
					 | 
				
			||||||
					      const struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
struct mgcp_endpoint *mgcp_endp_by_name(int *cause, const char *epname,
 | 
					 | 
				
			||||||
					struct mgcp_config *cfg);
 | 
					 | 
				
			||||||
bool mgcp_endp_avail(struct mgcp_endpoint *endp);
 | 
					 | 
				
			||||||
void mgcp_endp_add_conn(struct mgcp_endpoint *endp, struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
void mgcp_endp_remove_conn(struct mgcp_endpoint *endp, struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
void mgcp_endp_strip_name(char *epname_stripped, const char *epname,
 | 
					 | 
				
			||||||
			 const struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
struct mgcp_endpoint *mgcp_endp_find_specific(const char *epname,
 | 
					 | 
				
			||||||
			const struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
void mgcp_endp_release(struct mgcp_endpoint *endp);
 | 
					 | 
				
			||||||
@@ -1,33 +0,0 @@
 | 
				
			|||||||
/* IuUP connection functionalitites */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * (C) 2021 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Author: Pau Espin Pedrol
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/core/msgb.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_conn_rtp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_conn_iuup_init(struct mgcp_conn_rtp *conn_rtp);
 | 
					 | 
				
			||||||
void mgcp_conn_iuup_cleanup(struct mgcp_conn_rtp *conn_rtp);
 | 
					 | 
				
			||||||
int mgcp_conn_iuup_dispatch_rtp(struct msgb *msg);
 | 
					 | 
				
			||||||
int mgcp_conn_iuup_send_rtp(struct mgcp_conn_rtp *conn_src_rtp, struct mgcp_conn_rtp *conn_dest_rtp, struct msgb *msg);
 | 
					 | 
				
			||||||
int mgcp_conn_iuup_send_dummy(struct mgcp_conn_rtp *conn_rtp);
 | 
					 | 
				
			||||||
@@ -1,58 +0,0 @@
 | 
				
			|||||||
/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
 | 
					 | 
				
			||||||
/* Message parser/generator utilities */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
 | 
					 | 
				
			||||||
 * (C) 2009-2012 by On-Waves
 | 
					 | 
				
			||||||
 * (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <stdint.h>
 | 
					 | 
				
			||||||
#include <stdbool.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_conn;
 | 
					 | 
				
			||||||
struct mgcp_parse_data;
 | 
					 | 
				
			||||||
struct mgcp_endpoint;
 | 
					 | 
				
			||||||
struct mgcp_trunk;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void mgcp_disp_msg(unsigned char *message, unsigned int len, char *preamble);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_parse_conn_mode(const char *msg, struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
			 struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_parse_header(struct mgcp_parse_data *pdata, char *data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_parse_osmux_cid(const char *line);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool mgcp_check_param(const struct mgcp_endpoint *endp, struct mgcp_trunk *trunk, const char *line);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_verify_call_id(struct mgcp_endpoint *endp, const char *callid);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_verify_ci(struct mgcp_endpoint *endp, const char *conn_id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
char *mgcp_strline(char *str, char **saveptr);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define for_each_line(line, save)\
 | 
					 | 
				
			||||||
	for (line = mgcp_strline(NULL, &save); line;\
 | 
					 | 
				
			||||||
	     line = mgcp_strline(NULL, &save))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define for_each_non_empty_line(line, save)\
 | 
					 | 
				
			||||||
	for (line = strtok_r(NULL, "\r\n", &save); line;\
 | 
					 | 
				
			||||||
	     line = strtok_r(NULL, "\r\n", &save))
 | 
					 | 
				
			||||||
@@ -1,187 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <inttypes.h>
 | 
					 | 
				
			||||||
#include <stdbool.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/core/socket.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/mgcp/mgcp.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* The following constant defines an RTP dummy payload that is used for
 | 
					 | 
				
			||||||
 * "UDP Hole Punching" (NAT) */
 | 
					 | 
				
			||||||
#define MGCP_DUMMY_LOAD 0x23
 | 
					 | 
				
			||||||
static const char rtp_dummy_payload[] = { MGCP_DUMMY_LOAD };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Check if the data in a given message buffer matches the rtp dummy payload
 | 
					 | 
				
			||||||
 * defined above */
 | 
					 | 
				
			||||||
#define mgcp_is_rtp_dummy_payload(msg) \
 | 
					 | 
				
			||||||
	(msgb_length(msg) == sizeof(rtp_dummy_payload) && \
 | 
					 | 
				
			||||||
	memcmp(msgb_data(msg), rtp_dummy_payload, sizeof(rtp_dummy_payload)) == 0)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define RTP_BUF_SIZE	4096
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_rtp_stream_state {
 | 
					 | 
				
			||||||
	uint32_t ssrc;
 | 
					 | 
				
			||||||
	uint16_t last_seq;
 | 
					 | 
				
			||||||
	uint32_t last_timestamp;
 | 
					 | 
				
			||||||
	struct rate_ctr *err_ts_ctr;
 | 
					 | 
				
			||||||
	int32_t last_tsdelta;
 | 
					 | 
				
			||||||
	uint32_t last_arrival_time;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_rtp_state {
 | 
					 | 
				
			||||||
	/* has this state structure been initialized? */
 | 
					 | 
				
			||||||
	int initialized;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct {
 | 
					 | 
				
			||||||
		/* are we patching the SSRC value? */
 | 
					 | 
				
			||||||
		bool patch_ssrc;
 | 
					 | 
				
			||||||
		/* original SSRC (to which we shall patch any different SSRC) */
 | 
					 | 
				
			||||||
		uint32_t orig_ssrc;
 | 
					 | 
				
			||||||
		/* offset to apply on the sequence number */
 | 
					 | 
				
			||||||
		int seq_offset;
 | 
					 | 
				
			||||||
		/* offset to apply on the timestamp number */
 | 
					 | 
				
			||||||
		int32_t timestamp_offset;
 | 
					 | 
				
			||||||
	} patch;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* duration of a packet (FIXME: in which unit?) */
 | 
					 | 
				
			||||||
	uint32_t packet_duration;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Note: These states are not continuously updated, they serve as an
 | 
					 | 
				
			||||||
	 * information source to patch certain values in the RTP header. Do
 | 
					 | 
				
			||||||
	 * not use this state if constantly updated data about the RTP stream
 | 
					 | 
				
			||||||
	 * is needed. (see also mgcp_patch_and_count() */
 | 
					 | 
				
			||||||
	struct mgcp_rtp_stream_state in_stream;
 | 
					 | 
				
			||||||
	struct mgcp_rtp_stream_state out_stream;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* jitter and packet loss calculation */
 | 
					 | 
				
			||||||
	struct {
 | 
					 | 
				
			||||||
		int initialized;
 | 
					 | 
				
			||||||
		uint16_t base_seq;
 | 
					 | 
				
			||||||
		uint16_t max_seq;
 | 
					 | 
				
			||||||
		uint32_t ssrc;
 | 
					 | 
				
			||||||
		uint32_t jitter;
 | 
					 | 
				
			||||||
		int32_t transit;
 | 
					 | 
				
			||||||
		int cycles;
 | 
					 | 
				
			||||||
	} stats;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Alternative values for RTP tx, in case no sufficient header
 | 
					 | 
				
			||||||
	 * information is available so the header needs to be generated
 | 
					 | 
				
			||||||
	 * locally (when just forwarding packets, the header of incoming
 | 
					 | 
				
			||||||
	 * data is just re-used) */
 | 
					 | 
				
			||||||
	uint16_t alt_rtp_tx_sequence;
 | 
					 | 
				
			||||||
	uint32_t alt_rtp_tx_ssrc;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_rtp_codec {
 | 
					 | 
				
			||||||
	uint32_t rate;
 | 
					 | 
				
			||||||
	int channels;
 | 
					 | 
				
			||||||
	uint32_t frame_duration_num;
 | 
					 | 
				
			||||||
	uint32_t frame_duration_den;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	int payload_type;
 | 
					 | 
				
			||||||
	char audio_name[64];
 | 
					 | 
				
			||||||
	char subtype_name[64];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bool param_present;
 | 
					 | 
				
			||||||
	struct mgcp_codec_param param;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* 'mgcp_rtp_end': basically a wrapper around the RTP+RTCP ports */
 | 
					 | 
				
			||||||
struct mgcp_rtp_end {
 | 
					 | 
				
			||||||
	/* remote IP address of the RTP socket */
 | 
					 | 
				
			||||||
	struct osmo_sockaddr addr;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* in network byte order */
 | 
					 | 
				
			||||||
	int rtcp_port;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* currently selected audio codec */
 | 
					 | 
				
			||||||
	struct mgcp_rtp_codec *codec;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* array with assigned audio codecs to choose from (SDP) */
 | 
					 | 
				
			||||||
	struct mgcp_rtp_codec codecs[MGCP_MAX_CODECS];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* number of assigned audio codecs (SDP) */
 | 
					 | 
				
			||||||
	unsigned int codecs_assigned;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* per endpoint data */
 | 
					 | 
				
			||||||
	int  frames_per_packet;
 | 
					 | 
				
			||||||
	uint32_t packet_duration_ms;
 | 
					 | 
				
			||||||
	int maximum_packet_time; /* -1: not set */
 | 
					 | 
				
			||||||
	char *fmtp_extra;
 | 
					 | 
				
			||||||
	/* are we transmitting packets (true) or dropping (false) outbound packets */
 | 
					 | 
				
			||||||
	bool output_enabled;
 | 
					 | 
				
			||||||
	/* FIXME: This parameter can be set + printed, but is nowhere used! */
 | 
					 | 
				
			||||||
	int force_output_ptime;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* RTP patching */
 | 
					 | 
				
			||||||
	int force_constant_ssrc; /* -1: always, 0: don't, 1: once */
 | 
					 | 
				
			||||||
	/* should we perform align_rtp_timestamp_offset() (1) or not (0) */
 | 
					 | 
				
			||||||
	int force_aligned_timing;
 | 
					 | 
				
			||||||
	bool rfc5993_hr_convert;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Each end has a separate socket for RTP and RTCP */
 | 
					 | 
				
			||||||
	struct osmo_fd rtp;
 | 
					 | 
				
			||||||
	struct osmo_fd rtcp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* local UDP port number of the RTP socket; RTCP is +1 */
 | 
					 | 
				
			||||||
	int local_port;
 | 
					 | 
				
			||||||
	/* where the endpoint RTP connection binds to, set during CRCX and
 | 
					 | 
				
			||||||
	 * possibly updated during MDCX */
 | 
					 | 
				
			||||||
	char local_addr[INET6_ADDRSTRLEN];
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_rtp_tap {
 | 
					 | 
				
			||||||
	/* is this tap active (1) or not (0) */
 | 
					 | 
				
			||||||
	int enabled;
 | 
					 | 
				
			||||||
	/* IP/port to which we're forwarding the tapped data */
 | 
					 | 
				
			||||||
	struct osmo_sockaddr forward;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_conn;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_send(struct mgcp_endpoint *endp, int is_rtp, struct osmo_sockaddr *addr,
 | 
					 | 
				
			||||||
	      struct msgb *msg, struct mgcp_conn_rtp *conn_src,
 | 
					 | 
				
			||||||
	      struct mgcp_conn_rtp *conn_dst);
 | 
					 | 
				
			||||||
int mgcp_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
int mgcp_dispatch_rtp_bridge_cb(struct msgb *msg);
 | 
					 | 
				
			||||||
void mgcp_cleanup_rtp_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
int mgcp_dispatch_e1_bridge_cb(struct msgb *msg);
 | 
					 | 
				
			||||||
void mgcp_cleanup_e1_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port,
 | 
					 | 
				
			||||||
			   struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
void mgcp_free_rtp_port(struct mgcp_rtp_end *end);
 | 
					 | 
				
			||||||
void mgcp_patch_and_count(const struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
			  struct mgcp_rtp_state *state,
 | 
					 | 
				
			||||||
			  struct mgcp_rtp_end *rtp_end,
 | 
					 | 
				
			||||||
			  struct osmo_sockaddr *addr, struct msgb *msg);
 | 
					 | 
				
			||||||
int mgcp_get_local_addr(char *addr, struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* payload processing default functions */
 | 
					 | 
				
			||||||
int mgcp_rtp_processing_default(struct mgcp_endpoint *endp, struct mgcp_rtp_end *dst_end,
 | 
					 | 
				
			||||||
				char *data, int *len, int buf_size);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_setup_rtp_processing_default(struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
				      struct mgcp_conn_rtp *conn_dst,
 | 
					 | 
				
			||||||
				      struct mgcp_conn_rtp *conn_src);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void mgcp_get_net_downlink_format_default(struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
					  const struct mgcp_rtp_codec **codec,
 | 
					 | 
				
			||||||
					  const char **fmtp_extra,
 | 
					 | 
				
			||||||
					  struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* internal RTP Annex A counting */
 | 
					 | 
				
			||||||
void mgcp_rtp_annex_count(const struct mgcp_endpoint *endp, struct mgcp_rtp_state *state,
 | 
					 | 
				
			||||||
			const uint16_t seq, const int32_t transit,
 | 
					 | 
				
			||||||
			const uint32_t ssrc, const bool marker_bit);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void rtpconn_rate_ctr_add(struct mgcp_conn_rtp *conn_rtp, struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
				 int id, int inc);
 | 
					 | 
				
			||||||
void rtpconn_rate_ctr_inc(struct mgcp_conn_rtp *conn_rtp, struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
				 int id);
 | 
					 | 
				
			||||||
void forward_data_tap(int fd, struct mgcp_rtp_tap *tap, struct msgb *msg);
 | 
					 | 
				
			||||||
uint32_t mgcp_get_current_ts(unsigned codec_rate);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int amr_oa_bwe_convert(struct mgcp_endpoint *endp, struct msgb *msg, bool target_is_oa);
 | 
					 | 
				
			||||||
@@ -1,30 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Internal structure while parsing a request */
 | 
					 | 
				
			||||||
struct mgcp_parse_data {
 | 
					 | 
				
			||||||
	struct mgcp_config *cfg;
 | 
					 | 
				
			||||||
	char *epname;
 | 
					 | 
				
			||||||
	char *trans;
 | 
					 | 
				
			||||||
	char *save;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Local connection options */
 | 
					 | 
				
			||||||
struct mgcp_lco {
 | 
					 | 
				
			||||||
	char *string;
 | 
					 | 
				
			||||||
	char *codec;
 | 
					 | 
				
			||||||
	int pkt_period_min; /* time in ms */
 | 
					 | 
				
			||||||
	int pkt_period_max; /* time in ms */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
char *mgcp_debug_get_last_endpoint_name(void);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
char *get_lco_identifier(const char *options);
 | 
					 | 
				
			||||||
int check_local_cx_options(void *ctx, const char *options);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_rtp_end;
 | 
					 | 
				
			||||||
struct mgcp_endpoint;
 | 
					 | 
				
			||||||
void mgcp_rtp_end_config(struct mgcp_endpoint *endp, int expect_ssrc_change,
 | 
					 | 
				
			||||||
			 struct mgcp_rtp_end *rtp);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t mgcp_rtp_packet_duration(const struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
				  const struct mgcp_rtp_end *rtp);
 | 
					 | 
				
			||||||
@@ -1,109 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Global MCGP general rate counters */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
	MGCP_GENERAL_RX_MSGS_TOTAL,
 | 
					 | 
				
			||||||
	MGCP_GENERAL_RX_MSGS_RETRANSMITTED,
 | 
					 | 
				
			||||||
	MGCP_GENERAL_RX_MSGS_HANDLED,
 | 
					 | 
				
			||||||
	MGCP_GENERAL_RX_MSGS_UNHANDLED,
 | 
					 | 
				
			||||||
	MGCP_GENERAL_RX_FAIL_MSG_PARSE,
 | 
					 | 
				
			||||||
	MGCP_GENERAL_RX_FAIL_NO_ENDPOINT,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Trunk-global MCGP CRCX related rate counters */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
	MGCP_CRCX_SUCCESS,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_BAD_ACTION,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_UNHANDLED_PARAM,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_MISSING_CALLID,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_INVALID_MODE,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_LIMIT_EXCEEDED,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_UNKNOWN_CALLID,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_ALLOC_CONN,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_NO_REMOTE_CONN_DESC,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_START_RTP,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_NO_OSMUX,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_INVALID_CONN_OPTIONS,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_CODEC_NEGOTIATION,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_BIND_PORT,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_AVAIL,
 | 
					 | 
				
			||||||
	MGCP_CRCX_FAIL_CLAIM,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Trunk-global MCGP MDCX related rate counters */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
	MGCP_MDCX_SUCCESS,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_WILDCARD,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_NO_CONN,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_INVALID_CALLID,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_INVALID_CONNID,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_UNHANDLED_PARAM,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_NO_CONNID,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_CONN_NOT_FOUND,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_INVALID_MODE,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_INVALID_CONN_OPTIONS,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_NO_REMOTE_CONN_DESC,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_START_RTP,
 | 
					 | 
				
			||||||
	MGCP_MDCX_FAIL_AVAIL,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Trunk-global MCGP DLCX related rate counters */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
	MGCP_DLCX_SUCCESS,
 | 
					 | 
				
			||||||
	MGCP_DLCX_FAIL_NO_CONN,
 | 
					 | 
				
			||||||
	MGCP_DLCX_FAIL_INVALID_CALLID,
 | 
					 | 
				
			||||||
	MGCP_DLCX_FAIL_INVALID_CONNID,
 | 
					 | 
				
			||||||
	MGCP_DLCX_FAIL_UNHANDLED_PARAM,
 | 
					 | 
				
			||||||
	MGCP_DLCX_FAIL_AVAIL,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Trunk-global E1 related counters */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
        E1_I460_TRAU_RX_FAIL_CTR,
 | 
					 | 
				
			||||||
        E1_I460_TRAU_TX_FAIL_CTR,
 | 
					 | 
				
			||||||
        E1_I460_TRAU_MUX_EMPTY_CTR,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* NOTE: When adding counters, also the dump_ratectr_* routines in vty.c must be updated. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_ratectr_global {
 | 
					 | 
				
			||||||
	/* Rate counter group which contains stats for generic MGCP events. */
 | 
					 | 
				
			||||||
	struct rate_ctr_group *mgcp_general_ctr_group;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_ratectr_trunk {
 | 
					 | 
				
			||||||
	/* Rate counter group which contains stats for processed CRCX commands. */
 | 
					 | 
				
			||||||
	struct rate_ctr_group *mgcp_crcx_ctr_group;
 | 
					 | 
				
			||||||
	/* Rate counter group which contains stats for processed MDCX commands. */
 | 
					 | 
				
			||||||
	struct rate_ctr_group *mgcp_mdcx_ctr_group;
 | 
					 | 
				
			||||||
	/* Rate counter group which contains stats for processed DLCX commands. */
 | 
					 | 
				
			||||||
	struct rate_ctr_group *mgcp_dlcx_ctr_group;
 | 
					 | 
				
			||||||
	/* Rate counter group which aggregates stats of individual RTP connections. */
 | 
					 | 
				
			||||||
	struct rate_ctr_group *all_rtp_conn_stats;
 | 
					 | 
				
			||||||
	/* Rate counter group which aggregates stats of individual Osmux connections. */
 | 
					 | 
				
			||||||
	struct rate_ctr_group *all_osmux_conn_stats;
 | 
					 | 
				
			||||||
	/* Rate counter group which contains stats for E1 events (only valid for E1 trunks) */
 | 
					 | 
				
			||||||
	struct rate_ctr_group *e1_stats;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_config;
 | 
					 | 
				
			||||||
struct mgcp_trunk;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_ratectr_global_alloc(struct mgcp_config *cfg);
 | 
					 | 
				
			||||||
void mgcp_ratectr_global_free(struct mgcp_config *cfg);
 | 
					 | 
				
			||||||
int mgcp_ratectr_trunk_alloc(struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
void mgcp_ratectr_trunk_free(struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Trunk-global common stat items */
 | 
					 | 
				
			||||||
enum {
 | 
					 | 
				
			||||||
	TRUNK_STAT_ENDPOINTS_TOTAL,
 | 
					 | 
				
			||||||
	TRUNK_STAT_ENDPOINTS_USED,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_stat_trunk {
 | 
					 | 
				
			||||||
	/* Stat item group which contains general status values of the trunk. */
 | 
					 | 
				
			||||||
	struct osmo_stat_item_group *common;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_stat_trunk_alloc(struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
void mgcp_stat_trunk_free(struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
@@ -1,31 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * SDP generation and parsing
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * (C) 2009-2015 by Holger Hans Peter Freyther <zecke@selfish.org>
 | 
					 | 
				
			||||||
 * (C) 2009-2014 by On-Waves
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_parse_sdp_data(const struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
			struct mgcp_conn_rtp *conn,
 | 
					 | 
				
			||||||
			struct mgcp_parse_data *p);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_write_response_sdp(const struct mgcp_endpoint *endp,
 | 
					 | 
				
			||||||
			    const struct mgcp_conn_rtp *conn, struct msgb *sdp,
 | 
					 | 
				
			||||||
			    const char *addr);
 | 
					 | 
				
			||||||
@@ -1,35 +0,0 @@
 | 
				
			|||||||
/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
 | 
					 | 
				
			||||||
/* The statistics generator */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
 | 
					 | 
				
			||||||
 * (C) 2009-2012 by On-Waves
 | 
					 | 
				
			||||||
 * (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <inttypes.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void mgcp_format_stats(char *str, size_t str_len,  struct mgcp_conn *conn);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Exposed for test purposes only, do not use actively */
 | 
					 | 
				
			||||||
void calc_loss(struct mgcp_conn_rtp *conn, uint32_t *expected, int *loss);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Exposed for test purposes only, do not use actively */
 | 
					 | 
				
			||||||
uint32_t calc_jitter(struct mgcp_rtp_state *);
 | 
					 | 
				
			||||||
@@ -1,52 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * (C) 2021 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
 | 
					 | 
				
			||||||
 * All Rights Reserved
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Author: Eric Wild
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software; you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation; either version 3 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program 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 Affero General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU Affero General Public License
 | 
					 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <stdatomic.h>
 | 
					 | 
				
			||||||
#include <stdbool.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct spsc {
 | 
					 | 
				
			||||||
	atomic_uint readptr;
 | 
					 | 
				
			||||||
	atomic_uint writeptr;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	int efd_r, efd_w; /* eventfds used to block/notify readers/writers */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	int count;
 | 
					 | 
				
			||||||
	int size_per_buf;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	void *buf; /* buffer size count*size_per_buf */
 | 
					 | 
				
			||||||
	uintptr_t data[0]; /* count sized array of pointers to size_per_buf chunks in buf array*/
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct qchan {
 | 
					 | 
				
			||||||
	struct spsc *a;
 | 
					 | 
				
			||||||
	struct spsc *b;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool spsc_push(struct spsc *q, void *elem);
 | 
					 | 
				
			||||||
bool spsc_pop(struct spsc *q, void *elem);
 | 
					 | 
				
			||||||
ssize_t spsc_prep_pop(struct spsc *q);
 | 
					 | 
				
			||||||
int spsc_get_a_rdfd(struct qchan *q);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct qchan spsc_chan_init(void *talloc_ctx, unsigned int count, unsigned int size_per_buf);
 | 
					 | 
				
			||||||
struct qchan spsc_chan_init_ex(void *talloc_ctx, unsigned int count, unsigned int size_per_buf, bool blockr_a,
 | 
					 | 
				
			||||||
			       bool blockw_a, bool blockr_b, bool blockw_b);
 | 
					 | 
				
			||||||
void spsc_chan_close(struct qchan *q);
 | 
					 | 
				
			||||||
@@ -1,86 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/gsm/i460_mux.h>
 | 
					 | 
				
			||||||
#include <osmocom/abis/e1_input.h>
 | 
					 | 
				
			||||||
#include <osmocom/mgcp/mgcp_ratectr.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define LOGPTRUNK(trunk, cat, level, fmt, args...) \
 | 
					 | 
				
			||||||
LOGP(cat, level, "trunk:%u " fmt, \
 | 
					 | 
				
			||||||
     trunk ? trunk->trunk_nr : 0, \
 | 
					 | 
				
			||||||
     ## args)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum mgcp_trunk_type {
 | 
					 | 
				
			||||||
	MGCP_TRUNK_VIRTUAL,
 | 
					 | 
				
			||||||
	MGCP_TRUNK_E1,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern const struct value_string mgcp_trunk_type_strs[];
 | 
					 | 
				
			||||||
static inline const char *mgcp_trunk_type_strs_str(enum mgcp_trunk_type val)
 | 
					 | 
				
			||||||
{ return get_value_string(mgcp_trunk_type_strs, val); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_trunk {
 | 
					 | 
				
			||||||
	struct llist_head entry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct mgcp_config *cfg;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	unsigned int trunk_nr;
 | 
					 | 
				
			||||||
	enum mgcp_trunk_type trunk_type;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	char *audio_fmtp_extra;
 | 
					 | 
				
			||||||
	int audio_send_ptime;
 | 
					 | 
				
			||||||
	int audio_send_name;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	int omit_rtcp;
 | 
					 | 
				
			||||||
	int keepalive_interval;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* RTP patching */
 | 
					 | 
				
			||||||
	int force_constant_ssrc; /* 0: don't, 1: once */
 | 
					 | 
				
			||||||
	int force_aligned_timing;
 | 
					 | 
				
			||||||
	bool rfc5993_hr_convert;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* spec handling */
 | 
					 | 
				
			||||||
	int force_realloc;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* timer */
 | 
					 | 
				
			||||||
	struct osmo_timer_list keepalive_timer;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* When set, incoming RTP packets are not filtered
 | 
					 | 
				
			||||||
	 * when ports and ip-address do not match (debug) */
 | 
					 | 
				
			||||||
	int rtp_accept_all;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	unsigned int number_endpoints;
 | 
					 | 
				
			||||||
	struct mgcp_endpoint **endpoints;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* rate counters and stat items to measure the trunks overall performance and health */
 | 
					 | 
				
			||||||
	struct mgcp_ratectr_trunk ratectr;
 | 
					 | 
				
			||||||
	struct mgcp_stat_trunk stats;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	union {
 | 
					 | 
				
			||||||
		/* Virtual trunk specific */
 | 
					 | 
				
			||||||
		struct {
 | 
					 | 
				
			||||||
			unsigned int vty_number_endpoints;
 | 
					 | 
				
			||||||
		} v;
 | 
					 | 
				
			||||||
		/* E1 specific */
 | 
					 | 
				
			||||||
		struct {
 | 
					 | 
				
			||||||
			unsigned int vty_line_nr;
 | 
					 | 
				
			||||||
			uint8_t ts_usecount[NUM_E1_TS-1];
 | 
					 | 
				
			||||||
			struct osmo_i460_timeslot i460_ts[NUM_E1_TS-1];
 | 
					 | 
				
			||||||
			/* Note: on an E1 line TS 0 is devoted to framing and
 | 
					 | 
				
			||||||
			 * alignment and therefore only NUM_E1_TS-1 timeslots
 | 
					 | 
				
			||||||
			 * are available for traffic. */
 | 
					 | 
				
			||||||
		} e1;
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_trunk *mgcp_trunk_alloc(struct mgcp_config *cfg, enum mgcp_trunk_type ttype, unsigned int nr);
 | 
					 | 
				
			||||||
int mgcp_trunk_equip(struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
struct mgcp_trunk *mgcp_trunk_by_num(const struct mgcp_config *cfg, enum mgcp_trunk_type ttype, unsigned int nr);
 | 
					 | 
				
			||||||
struct mgcp_trunk *mgcp_trunk_by_name(const struct mgcp_config *cfg, const char *epname);
 | 
					 | 
				
			||||||
int e1_trunk_nr_from_epname(unsigned int *trunk_nr, const char *epname);
 | 
					 | 
				
			||||||
struct mgcp_trunk *mgcp_trunk_by_line_num(const struct mgcp_config *cfg, unsigned int num);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* The virtual trunk is always created on trunk id 0 for historical reasons,
 | 
					 | 
				
			||||||
 * use this define constant as ID when allocating a virtual trunk. Other
 | 
					 | 
				
			||||||
 * trunks may be assigned with arbritrary id numbers */
 | 
					 | 
				
			||||||
#define MGCP_VIRT_TRUNK_ID 0
 | 
					 | 
				
			||||||
@@ -1,41 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <stdint.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/core/socket.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/netif/osmux.h>
 | 
					 | 
				
			||||||
struct mgcp_conn_rtp;
 | 
					 | 
				
			||||||
struct mgcp_trunk;
 | 
					 | 
				
			||||||
struct mgcp_endpoint;
 | 
					 | 
				
			||||||
struct mgcp_conn_rtp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int osmux_init(struct mgcp_trunk *trunk);
 | 
					 | 
				
			||||||
int osmux_init_conn(struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
int conn_osmux_enable(struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
void conn_osmux_disable(struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
int conn_osmux_event_rx_crcx_mdcx(struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
int conn_osmux_send_rtp(struct mgcp_conn_rtp *conn, struct msgb *msg);
 | 
					 | 
				
			||||||
int osmux_send_dummy(struct mgcp_conn_rtp *conn);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void osmux_cid_pool_get(uint8_t osmux_cid);
 | 
					 | 
				
			||||||
int osmux_cid_pool_get_next(void);
 | 
					 | 
				
			||||||
void osmux_cid_pool_put(uint8_t osmux_cid);
 | 
					 | 
				
			||||||
bool osmux_cid_pool_allocated(uint8_t osmux_cid);
 | 
					 | 
				
			||||||
int osmux_cid_pool_count_used(void);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum osmux_state {
 | 
					 | 
				
			||||||
	OSMUX_STATE_DISABLED = 0, /* Osmux not being currently used by endp */
 | 
					 | 
				
			||||||
	OSMUX_STATE_ACTIVATING,   /* Osmux was accepted in MGCP CRCX ACK. It can now be enabled by \ref conn_osmux_enable. */
 | 
					 | 
				
			||||||
	OSMUX_STATE_ENABLED,	  /* Osmux was initialized by \ref conn_osmux_enable and can process frames */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern const struct value_string osmux_state_strs[];
 | 
					 | 
				
			||||||
static inline const char *osmux_state_str(enum osmux_state val)
 | 
					 | 
				
			||||||
{ return get_value_string(osmux_state_strs, val); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum osmux_usage {
 | 
					 | 
				
			||||||
	OSMUX_USAGE_OFF = 0,
 | 
					 | 
				
			||||||
	OSMUX_USAGE_ON = 1,
 | 
					 | 
				
			||||||
	OSMUX_USAGE_ONLY = 2,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
@@ -1,12 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/vty/command.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum mgcp_vty_node {
 | 
					 | 
				
			||||||
	MGCP_NODE = _LAST_OSMOVTY_NODE + 1,
 | 
					 | 
				
			||||||
	TRUNK_NODE,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum mgw_vty_cmd_attr {
 | 
					 | 
				
			||||||
	MGW_CMD_ATTR_NEWCONN = 0,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
@@ -1,14 +0,0 @@
 | 
				
			|||||||
BUILT_SOURCES = \
 | 
					 | 
				
			||||||
	mgcp_common.h \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
noinst_HEADERS = \
 | 
					 | 
				
			||||||
	mgcp_client_internal.h \
 | 
					 | 
				
			||||||
	mgcp_client_pool_internal.h \
 | 
					 | 
				
			||||||
	$(NULL)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
mgcp_common.h: $(top_srcdir)/include/osmocom/mgcp/mgcp_common.h
 | 
					 | 
				
			||||||
	echo -e "/*\n\n   DO NOT EDIT THIS FILE!\n   THIS IS OVERWRITTEN DURING BUILD\n   This is an automatic copy of <osmocom/mgcp/mgcp_common.h>\n\n */" > mgcp_common.h
 | 
					 | 
				
			||||||
	cat $(top_srcdir)/include/osmocom/mgcp/mgcp_common.h >> mgcp_common.h
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CLEANFILES = mgcp_common.h
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
#include <osmocom/core/defs.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if BUILDING_LIBOSMOMGCPCLIENT
 | 
					 | 
				
			||||||
# define OSMO_DEPRECATED_OUTSIDE_LIBOSMOMGCPCLIENT(text)
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
# define OSMO_DEPRECATED_OUTSIDE_LIBOSMOMGCPCLIENT(text) OSMO_DEPRECATED(text)
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
@@ -1,190 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <stdint.h>
 | 
					 | 
				
			||||||
#include <arpa/inet.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/mgcp_client/defs.h>
 | 
					 | 
				
			||||||
#include <osmocom/mgcp_client/mgcp_common.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* See also: RFC 3435, chapter 3.5 Transmission over UDP */
 | 
					 | 
				
			||||||
#define MGCP_CLIENT_LOCAL_ADDR_DEFAULT NULL /* INADDR(6)_ANY */
 | 
					 | 
				
			||||||
#define MGCP_CLIENT_LOCAL_PORT_DEFAULT 0
 | 
					 | 
				
			||||||
#define MGCP_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1"
 | 
					 | 
				
			||||||
#define MGCP_CLIENT_REMOTE_PORT_DEFAULT 2427
 | 
					 | 
				
			||||||
#define MGCP_CLIENT_KEEPALIVE_DEFAULT_ENDP "null"
 | 
					 | 
				
			||||||
#define MGCP_CLIENT_MGW_STR "Configure MGCP connection to Media Gateway\n"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct msgb;
 | 
					 | 
				
			||||||
struct vty;
 | 
					 | 
				
			||||||
struct mgcp_client;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_client_conf {
 | 
					 | 
				
			||||||
	const char *local_addr;
 | 
					 | 
				
			||||||
	int local_port;
 | 
					 | 
				
			||||||
	const char *remote_addr;
 | 
					 | 
				
			||||||
	int remote_port;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* By default, we are always addressing the MGW with e.g. 'rtpbridge/123@mgw'.
 | 
					 | 
				
			||||||
	 * If this is nonempty, the contained name will be used instead of 'mgw'. */
 | 
					 | 
				
			||||||
	char endpoint_domain_name[MGCP_ENDPOINT_MAXLEN];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* The user may configure certain endpoint names that are reset via DLCX
 | 
					 | 
				
			||||||
	 * on startup. Usually this will be one wildcarded endpoint e.g.
 | 
					 | 
				
			||||||
	 * 'rtpbridge/(wildcard)' or a number of specific E1 like e.g.
 | 
					 | 
				
			||||||
	 * 'ds/e1-0/s-3/su16-4' */
 | 
					 | 
				
			||||||
	struct llist_head reset_epnames;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* human readable name / description */
 | 
					 | 
				
			||||||
	char *description;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct {
 | 
					 | 
				
			||||||
		uint32_t timeout_sec;
 | 
					 | 
				
			||||||
		uint32_t req_interval_sec;
 | 
					 | 
				
			||||||
		char req_endpoint_name[MGCP_ENDPOINT_MAXLEN];
 | 
					 | 
				
			||||||
	} keepalive;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef unsigned int mgcp_trans_id_t;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! Enumeration of the codec types that mgcp_client is able to handle. */
 | 
					 | 
				
			||||||
enum mgcp_codecs {
 | 
					 | 
				
			||||||
	CODEC_PCMU_8000_1 = 0,
 | 
					 | 
				
			||||||
	CODEC_GSM_8000_1 = 3,
 | 
					 | 
				
			||||||
	CODEC_PCMA_8000_1 = 8,
 | 
					 | 
				
			||||||
	CODEC_G729_8000_1 = 18,
 | 
					 | 
				
			||||||
	CODEC_GSMEFR_8000_1 = 110,	/* 3GPP TS 48.103 table 5.4.2.2.1 */
 | 
					 | 
				
			||||||
	CODEC_GSMHR_8000_1 = 111,	/* 3GPP TS 48.103 table 5.4.2.2.1 */
 | 
					 | 
				
			||||||
	CODEC_AMR_8000_1 = 112,		/* 3GPP TS 48.103 table 5.4.2.2.1 */
 | 
					 | 
				
			||||||
	CODEC_AMRWB_16000_1 = 113,	/* 3GPP TS 48.103 table 5.4.2.2.1 */
 | 
					 | 
				
			||||||
	CODEC_IUFP = 96,
 | 
					 | 
				
			||||||
	CODEC_CLEARMODE = 120,		/* 3GPP TS 48.103 table 5.4.2.2.1 */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
/* Note: when new codec types are added, the corresponding value strings
 | 
					 | 
				
			||||||
 * in mgcp_client.c (codec_table) must be updated as well. Enumerations
 | 
					 | 
				
			||||||
 * in enum mgcp_codecs must correspond to a valid payload type. However,
 | 
					 | 
				
			||||||
 * this is an internal assumption that is made to avoid lookup tables.
 | 
					 | 
				
			||||||
 * The API-User should not rely on this coincidence! */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern const struct value_string osmo_mgcpc_codec_names[];
 | 
					 | 
				
			||||||
static inline const char *osmo_mgcpc_codec_name(enum mgcp_codecs val)
 | 
					 | 
				
			||||||
{ return get_value_string(osmo_mgcpc_codec_names, val); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! Structure to build a payload type map to allow the defiition custom payload
 | 
					 | 
				
			||||||
 *  types. */
 | 
					 | 
				
			||||||
struct ptmap {
 | 
					 | 
				
			||||||
	/*! codec for which a payload type number should be defined */
 | 
					 | 
				
			||||||
	enum mgcp_codecs codec;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! payload type number (96-127) */
 | 
					 | 
				
			||||||
	unsigned int pt;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_response_head {
 | 
					 | 
				
			||||||
	int response_code;
 | 
					 | 
				
			||||||
	mgcp_trans_id_t trans_id;
 | 
					 | 
				
			||||||
	char comment[MGCP_COMMENT_MAXLEN];
 | 
					 | 
				
			||||||
	char conn_id[MGCP_CONN_ID_MAXLEN];
 | 
					 | 
				
			||||||
	char endpoint[MGCP_ENDPOINT_MAXLEN];
 | 
					 | 
				
			||||||
	bool x_osmo_osmux_use;
 | 
					 | 
				
			||||||
	uint8_t x_osmo_osmux_cid;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_response {
 | 
					 | 
				
			||||||
	char *body;
 | 
					 | 
				
			||||||
	struct mgcp_response_head head;
 | 
					 | 
				
			||||||
	uint16_t audio_port;
 | 
					 | 
				
			||||||
	char audio_ip[INET6_ADDRSTRLEN];
 | 
					 | 
				
			||||||
	unsigned int ptime;
 | 
					 | 
				
			||||||
	enum mgcp_codecs codecs[MGCP_MAX_CODECS];
 | 
					 | 
				
			||||||
	unsigned int codecs_len;
 | 
					 | 
				
			||||||
	struct ptmap ptmap[MGCP_MAX_CODECS];
 | 
					 | 
				
			||||||
	unsigned int ptmap_len;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum mgcp_verb {
 | 
					 | 
				
			||||||
	MGCP_VERB_CRCX,
 | 
					 | 
				
			||||||
	MGCP_VERB_MDCX,
 | 
					 | 
				
			||||||
	MGCP_VERB_DLCX,
 | 
					 | 
				
			||||||
	MGCP_VERB_AUEP,
 | 
					 | 
				
			||||||
	MGCP_VERB_RSIP,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define MGCP_MSG_PRESENCE_ENDPOINT	0x0001
 | 
					 | 
				
			||||||
#define MGCP_MSG_PRESENCE_CALL_ID	0x0002
 | 
					 | 
				
			||||||
#define MGCP_MSG_PRESENCE_CONN_ID	0x0004
 | 
					 | 
				
			||||||
#define MGCP_MSG_PRESENCE_AUDIO_IP	0x0008
 | 
					 | 
				
			||||||
#define MGCP_MSG_PRESENCE_AUDIO_PORT	0x0010
 | 
					 | 
				
			||||||
#define MGCP_MSG_PRESENCE_CONN_MODE	0x0020
 | 
					 | 
				
			||||||
#define MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID 0x4000
 | 
					 | 
				
			||||||
#define MGCP_MSG_PRESENCE_X_OSMO_IGN	0x8000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_msg {
 | 
					 | 
				
			||||||
	enum mgcp_verb verb;
 | 
					 | 
				
			||||||
	/* See MGCP_MSG_PRESENCE_* constants */
 | 
					 | 
				
			||||||
	uint32_t presence;
 | 
					 | 
				
			||||||
	char endpoint[MGCP_ENDPOINT_MAXLEN];
 | 
					 | 
				
			||||||
	unsigned int call_id;
 | 
					 | 
				
			||||||
	char *conn_id;
 | 
					 | 
				
			||||||
	uint16_t audio_port;
 | 
					 | 
				
			||||||
	char *audio_ip;
 | 
					 | 
				
			||||||
	enum mgcp_connection_mode conn_mode;
 | 
					 | 
				
			||||||
	unsigned int ptime;
 | 
					 | 
				
			||||||
	enum mgcp_codecs codecs[MGCP_MAX_CODECS];
 | 
					 | 
				
			||||||
	unsigned int codecs_len;
 | 
					 | 
				
			||||||
	struct ptmap ptmap[MGCP_MAX_CODECS];
 | 
					 | 
				
			||||||
	unsigned int ptmap_len;
 | 
					 | 
				
			||||||
	uint32_t x_osmo_ign;
 | 
					 | 
				
			||||||
	bool x_osmo_osmux_use;
 | 
					 | 
				
			||||||
	int x_osmo_osmux_cid; /* -1 is wildcard */
 | 
					 | 
				
			||||||
	bool param_present;
 | 
					 | 
				
			||||||
	struct mgcp_codec_param param;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_client_conf *mgcp_client_conf_alloc(void *ctx);
 | 
					 | 
				
			||||||
void mgcp_client_conf_init(struct mgcp_client_conf *conf) OSMO_DEPRECATED_OUTSIDE_LIBOSMOMGCPCLIENT("use mgcp_client_conf_alloc() (or even better, switch to the mgcp_client_pool API!)");
 | 
					 | 
				
			||||||
void mgcp_client_vty_init(void *talloc_ctx, int node, struct mgcp_client_conf *conf);
 | 
					 | 
				
			||||||
int mgcp_client_config_write(struct vty *vty, const char *indent);
 | 
					 | 
				
			||||||
struct mgcp_client_conf *mgcp_client_conf_actual(struct mgcp_client *mgcp);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct mgcp_client *mgcp_client_init(void *ctx,
 | 
					 | 
				
			||||||
				     struct mgcp_client_conf *conf);
 | 
					 | 
				
			||||||
int mgcp_client_connect(struct mgcp_client *mgcp);
 | 
					 | 
				
			||||||
int mgcp_client_connect2(struct mgcp_client *mgcp, unsigned int retry_n_ports) OSMO_DEPRECATED("Use mgcp_client_connect() instead");
 | 
					 | 
				
			||||||
void mgcp_client_disconnect(struct mgcp_client *mgcp);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const char *mgcp_client_remote_addr_str(struct mgcp_client *mgcp);
 | 
					 | 
				
			||||||
uint16_t mgcp_client_remote_port(struct mgcp_client *mgcp);
 | 
					 | 
				
			||||||
uint32_t mgcp_client_remote_addr_n(struct mgcp_client *mgcp) OSMO_DEPRECATED("deprecated, returns 0");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const char *mgcp_client_endpoint_domain(const struct mgcp_client *mgcp);
 | 
					 | 
				
			||||||
const char *mgcp_client_rtpbridge_wildcard(const struct mgcp_client *mgcp);
 | 
					 | 
				
			||||||
const char *mgcp_client_e1_epname(void *ctx, const struct mgcp_client *mgcp, uint8_t trunk_id, uint8_t ts,
 | 
					 | 
				
			||||||
				  uint8_t rate, uint8_t offset);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Invoked when an MGCP response is received or sending failed.  When the
 | 
					 | 
				
			||||||
 * response is passed as NULL, this indicates failure during transmission. */
 | 
					 | 
				
			||||||
typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void *priv);
 | 
					 | 
				
			||||||
int mgcp_response_parse_params(struct mgcp_response *r);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int mgcp_client_tx(struct mgcp_client *mgcp, struct msgb *msg,
 | 
					 | 
				
			||||||
		   mgcp_response_cb_t response_cb, void *priv);
 | 
					 | 
				
			||||||
int mgcp_client_cancel(struct mgcp_client *mgcp, mgcp_trans_id_t trans_id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum mgcp_connection_mode;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct msgb *mgcp_msg_gen(struct mgcp_client *mgcp, struct mgcp_msg *mgcp_msg);
 | 
					 | 
				
			||||||
mgcp_trans_id_t mgcp_msg_trans_id(struct msgb *msg);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern const struct value_string mgcp_client_connection_mode_strs[];
 | 
					 | 
				
			||||||
static inline const char *mgcp_client_cmode_name(enum mgcp_connection_mode mode)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return get_value_string(mgcp_client_connection_mode_strs, mode);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum mgcp_codecs map_str_to_codec(const char *str);
 | 
					 | 
				
			||||||
unsigned int map_codec_to_pt(const struct ptmap *ptmap, unsigned int ptmap_len,
 | 
					 | 
				
			||||||
			     enum mgcp_codecs codec);
 | 
					 | 
				
			||||||
enum mgcp_codecs map_pt_to_codec(struct ptmap *ptmap, unsigned int ptmap_len,
 | 
					 | 
				
			||||||
				 unsigned int pt);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const char *mgcp_client_name(const struct mgcp_client *mgcp);
 | 
					 | 
				
			||||||
@@ -1,55 +0,0 @@
 | 
				
			|||||||
/* FSM to manage multiple connections of an MGW endpoint */
 | 
					 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/mgcp_client/mgcp_client_fsm.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define LOG_MGCPC_EP(ep, level, fmt, args...) do { \
 | 
					 | 
				
			||||||
	LOGPFSML(ep->fi, level, "%s " fmt, \
 | 
					 | 
				
			||||||
		 osmo_mgcpc_ep_name(ep), ## args); \
 | 
					 | 
				
			||||||
	} while(0)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct osmo_mgcpc_ep;
 | 
					 | 
				
			||||||
struct osmo_mgcpc_ep_ci;
 | 
					 | 
				
			||||||
struct osmo_tdef;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct osmo_mgcpc_ep *osmo_mgcpc_ep_alloc(struct osmo_fsm_inst *parent, uint32_t parent_term_event,
 | 
					 | 
				
			||||||
					  struct mgcp_client *mgcp_client,
 | 
					 | 
				
			||||||
					  const struct osmo_tdef *T_defs,
 | 
					 | 
				
			||||||
					  const char *fsm_id,
 | 
					 | 
				
			||||||
					  const char *endpoint_str_fmt, ...);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct osmo_mgcpc_ep_ci *osmo_mgcpc_ep_ci_add(struct osmo_mgcpc_ep *ep, const char *label_fmt, ...);
 | 
					 | 
				
			||||||
const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_rtp_info(const struct osmo_mgcpc_ep_ci *ci);
 | 
					 | 
				
			||||||
bool osmo_mgcpc_ep_ci_get_crcx_info_to_sockaddr(const struct osmo_mgcpc_ep_ci *ci, struct sockaddr_storage *dest);
 | 
					 | 
				
			||||||
bool osmo_mgcpc_ep_ci_get_crcx_info_to_osmux_cid(const struct osmo_mgcpc_ep_ci *ci, uint8_t* cid);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_remote_rtp_info(const struct osmo_mgcpc_ep_ci *ci);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void osmo_mgcpc_ep_ci_request(struct osmo_mgcpc_ep_ci *ci,
 | 
					 | 
				
			||||||
			      enum mgcp_verb verb, const struct mgcp_conn_peer *verb_info,
 | 
					 | 
				
			||||||
			      struct osmo_fsm_inst *notify,
 | 
					 | 
				
			||||||
			      uint32_t event_success, uint32_t event_failure,
 | 
					 | 
				
			||||||
			      void *notify_data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void osmo_mgcpc_ep_cancel_notify(struct osmo_mgcpc_ep *ep, struct osmo_fsm_inst *notify);
 | 
					 | 
				
			||||||
struct osmo_mgcpc_ep *osmo_mgcpc_ep_ci_ep(struct osmo_mgcpc_ep_ci *ci);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! Dispatch a DLCX for the given connection.
 | 
					 | 
				
			||||||
 * \param ci  Connection identifier as obtained from osmo_mgcpc_ep_ci_add().
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static inline void osmo_mgcpc_ep_ci_dlcx(struct osmo_mgcpc_ep_ci *ci)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	osmo_mgcpc_ep_ci_request(ci, MGCP_VERB_DLCX, NULL, NULL, 0, 0, NULL);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void osmo_mgcpc_ep_clear(struct osmo_mgcpc_ep *ep);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const char *osmo_mgcpc_ep_name(const struct osmo_mgcpc_ep *ep);
 | 
					 | 
				
			||||||
const char *osmo_mgcpc_ep_local_name(const struct osmo_mgcpc_ep *ep);
 | 
					 | 
				
			||||||
const char *osmo_mgcpc_ep_ci_name(const struct osmo_mgcpc_ep_ci *ci);
 | 
					 | 
				
			||||||
const char *osmo_mgcpc_ep_ci_id(const struct osmo_mgcpc_ep_ci *ci);
 | 
					 | 
				
			||||||
struct mgcp_client *osmo_mgcpc_ep_client(const struct osmo_mgcpc_ep *ep);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern const struct value_string osmo_mgcp_verb_names[];
 | 
					 | 
				
			||||||
static inline const char *osmo_mgcp_verb_name(enum mgcp_verb val)
 | 
					 | 
				
			||||||
{ return get_value_string(osmo_mgcp_verb_names, val); }
 | 
					 | 
				
			||||||
@@ -1,74 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <osmocom/mgcp_client/mgcp_common.h>
 | 
					 | 
				
			||||||
#include <osmocom/mgcp_client/mgcp_client.h>
 | 
					 | 
				
			||||||
#include <osmocom/gsm/protocol/gsm_04_08.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*! This struct organizes the connection infromation one connection side
 | 
					 | 
				
			||||||
 *  (either remote or local). It is used to pass parameters (local) to the FSM
 | 
					 | 
				
			||||||
 *  and get responses (remote) from the FSM as pointer attached to the FSM
 | 
					 | 
				
			||||||
 *  event.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  When modifiying a connection, the endpoint and call_id members may be left
 | 
					 | 
				
			||||||
 *  unpopulated. The call_id field is ignored in this case. If an endpoint
 | 
					 | 
				
			||||||
 *  identifier is supplied it is checked against the internal state to make
 | 
					 | 
				
			||||||
 *  sure it is correct. */
 | 
					 | 
				
			||||||
struct mgcp_conn_peer {
 | 
					 | 
				
			||||||
	/*! RTP connection IP-Address (optional, string e.g. "127.0.0.1") */
 | 
					 | 
				
			||||||
	char addr[INET6_ADDRSTRLEN];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! RTP connection IP-Port (optional)  */
 | 
					 | 
				
			||||||
	uint16_t port;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! RTP endpoint */
 | 
					 | 
				
			||||||
	char endpoint[MGCP_ENDPOINT_MAXLEN];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! CALL ID (unique per connection) */
 | 
					 | 
				
			||||||
	unsigned int call_id;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! RTP packetization interval (optional) */
 | 
					 | 
				
			||||||
	unsigned int ptime;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! RTP codec list (optional) */
 | 
					 | 
				
			||||||
	enum mgcp_codecs codecs[MGCP_MAX_CODECS];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! Number of codecs in RTP codec list (optional) */
 | 
					 | 
				
			||||||
	unsigned int codecs_len;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! RTP payload type map (optional, only needed when payload types are
 | 
					 | 
				
			||||||
	 * used that differ from what IANA/3GPP defines) */
 | 
					 | 
				
			||||||
	struct ptmap ptmap[MGCP_MAX_CODECS];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! RTP payload type map length (optional, only needed when payload
 | 
					 | 
				
			||||||
	 * types are used that differ from what IANA/3GPP defines) */
 | 
					 | 
				
			||||||
	unsigned int ptmap_len;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! If nonzero, send 'X-Osmo-IGN:' header. This is useful e.g. for SCCPlite MSCs where the MSC is
 | 
					 | 
				
			||||||
	 * known to issue incoherent or unknown CallIDs / to issue CRCX commands with a different domain
 | 
					 | 
				
			||||||
	 * name than the BSC. An OsmoMGW will then ignore these and not fail on mismatches. */
 | 
					 | 
				
			||||||
	uint32_t x_osmo_ign;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! send 'X-Osmux: %d' header (or "*" as wildcard). */
 | 
					 | 
				
			||||||
	bool x_osmo_osmux_use;
 | 
					 | 
				
			||||||
	/*! -1 means send wildcard. */
 | 
					 | 
				
			||||||
	int x_osmo_osmux_cid;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! If left MGCP_CONN_NONE, use MGCP_CONN_RECV_ONLY or MGCP_CONN_RECV_SEND, depending on whether an audio RTP
 | 
					 | 
				
			||||||
	 * address is set. If != MGCP_CONN_NONE, force this conn mode. */
 | 
					 | 
				
			||||||
	enum mgcp_connection_mode conn_mode;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*! If the codec requires additional format parameters (fmtp), those cann be set here, see also
 | 
					 | 
				
			||||||
	 * mgcp_common.h */
 | 
					 | 
				
			||||||
	bool param_present;
 | 
					 | 
				
			||||||
	struct mgcp_codec_param param;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct osmo_fsm_inst *mgcp_conn_create(struct mgcp_client *mgcp, struct osmo_fsm_inst *parent_fi, uint32_t parent_term_evt,
 | 
					 | 
				
			||||||
				       uint32_t parent_evt, struct mgcp_conn_peer *conn_peer);
 | 
					 | 
				
			||||||
int mgcp_conn_modify(struct osmo_fsm_inst *fi, uint32_t parent_evt, struct mgcp_conn_peer *conn_peer);
 | 
					 | 
				
			||||||
void mgcp_conn_delete(struct osmo_fsm_inst *fi);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const char *mgcp_conn_get_ci(struct osmo_fsm_inst *fi);
 | 
					 | 
				
			||||||
struct mgcp_client *mgcp_conn_get_client(struct osmo_fsm_inst *fi);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const char *osmo_mgcpc_conn_peer_name(const struct mgcp_conn_peer *info);
 | 
					 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user