csd 0.1.18 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/bin/ai +22 -1
  5. data/bin/ttai +47 -0
  6. data/csd.gemspec +15 -6
  7. data/lib/csd.rb +75 -16
  8. data/lib/csd/application/decklink/base.rb +2 -2
  9. data/lib/csd/application/default.rb +2 -3
  10. data/lib/csd/application/default/base.rb +5 -2
  11. data/lib/csd/application/i2conf.rb +28 -0
  12. data/lib/csd/application/i2conf/about.yml +8 -0
  13. data/lib/csd/application/i2conf/base.rb +215 -0
  14. data/lib/csd/application/i2conf/config_example.rb +22 -0
  15. data/lib/csd/application/i2conf/options/common.rb +11 -0
  16. data/lib/csd/application/i2conf/options/common_defaults.rb +4 -0
  17. data/lib/csd/application/i2conf/options/install.rb +10 -0
  18. data/lib/csd/application/i2conf/options/install_defaults.rb +4 -0
  19. data/lib/csd/application/minisip.rb +8 -12
  20. data/lib/csd/application/minisip/about.yml +12 -4
  21. data/lib/csd/application/minisip/base.rb +40 -1
  22. data/lib/csd/application/minisip/component.rb +2 -0
  23. data/lib/csd/application/minisip/component/core.rb +13 -6
  24. data/lib/csd/application/minisip/component/gnome.rb +1 -0
  25. data/lib/csd/application/minisip/component/network.rb +95 -0
  26. data/lib/csd/application/minisip/component/plugins.rb +1 -1
  27. data/lib/csd/application/minisip/options/{compile.rb → install.rb} +4 -0
  28. data/lib/csd/application/minisip/options/{compile_defaults.rb → install_defaults.rb} +2 -1
  29. data/lib/csd/application/minisip/phonebook_example.rb +41 -12
  30. data/lib/csd/application/minisip/unix.rb +24 -17
  31. data/lib/csd/application/minisip/unix/linux/debian.rb +13 -5
  32. data/lib/csd/application/minisip/unix/linux/debian/ubuntu10.rb +3 -2
  33. data/lib/csd/applications.rb +1 -1
  34. data/lib/csd/commands.rb +23 -5
  35. data/lib/csd/extensions/gem/platform.rb +12 -0
  36. data/lib/csd/options_parser.rb +31 -11
  37. data/test/application/test_minisip.rb +63 -6
  38. data/test/functional/test_options.rb +82 -3
  39. metadata +19 -8
@@ -0,0 +1,22 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ module CSD
4
+ module Application
5
+ module I2conf
6
+
7
+ CONFIG_EXAMPLE = %{
8
+ <interface>eth0</interface>
9
+ <use_udp>true</use_udp>
10
+ <use_tcp>false</use_tcp>
11
+ <sip_identity>
12
+ <uri>mcu@carenet-se.se</uri>
13
+ <local_port>5060</local_port>
14
+ <register>true</register>
15
+ <username>mcu</username>
16
+ <password>YOURPASSWORD</password>
17
+ <realm>carenet-se.se</realm>
18
+ </sip_identity>}
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ opts.headline 'WORKING DIRECTORY OPTIONS'.green.bold
4
+
5
+ opts.on("--no-temp", "Use a subdirectory in the current directory as working directory and not /tmp.") do |value|
6
+ self.temp = value
7
+ end
8
+
9
+ opts.on("--work-dir [PATH]", "Defines and/or creates the working directory. This will override the --no-temp option.") do |value|
10
+ self.work_dir = value
11
+ end
@@ -0,0 +1,4 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ self.temp = true
4
+ self.work_dir = nil
@@ -0,0 +1,10 @@
1
+ # -*- encoding: UTF-8 -*-
2
+ # This file gets eval'ed by the global options parser in lib/csd/options_parser
3
+
4
+ opts.on("--no-apt-get","Don't run any apt-get commands") do |value|
5
+ self.apt_get = value
6
+ end
7
+
8
+ opts.on("--no-minisip","Don't install the MiniSIP libraries (needed by i2conf)") do |value|
9
+ self.minisip = value
10
+ end
@@ -0,0 +1,4 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ self.apt_get = true
4
+ self.minisip = true
@@ -54,19 +54,15 @@ module CSD
54
54
  # 32 bit
55
55
  UI.debug "#{self}.instance supports Linux (32 bit)"
56
56
  UI.debug "#{self}.instance analyzes the Linux kernel release #{Gem::Platform.local.kernel_release.to_s.enquote}"
57
- case Gem::Platform.local.kernel_release
58
-
59
- when '2.6.32-21-generic', '2.6.32-22-generic'
60
- # Ubuntu 10.04
61
- UI.debug "#{self}.instance supports Ubuntu 10.04"
62
- Ubuntu10.new
63
-
64
- else
65
- # Any other Linux (currently only Debian is supported)
66
- UI.debug "#{self}.instance supports Debian"
67
- Debian.new
57
+ if Gem::Platform.local.ubuntu_10?
58
+ # Ubuntu 10.04
59
+ UI.debug "#{self}.instance supports Ubuntu 10.04"
60
+ Ubuntu10.new
61
+ else
62
+ # Any other Linux (currently only Debian is supported)
63
+ UI.debug "#{self}.instance supports Debian"
64
+ Debian.new
68
65
  end
69
-
70
66
  else
71
67
  # 64 bit
72
68
  UI.debug "#{self}.instance found the architecture to be other than 'x86', but 64 bit is not supported"
@@ -1,14 +1,22 @@
1
+ # -*- encoding: UTF-8 -*-
1
2
  human: MiniSIP
2
3
  description: An open-source SIP client for high-definition video conferencing.
3
4
  actions:
4
5
  public:
5
6
  #- show: Shows further information about MiniSIP
6
7
  #- download: Downloads MiniSIP components (e.g. source code, configurations, docs,...)
7
- - compile: Downloads and compiles MiniSIP from scratch
8
- #- package: Downloads, compiles and packages MiniSIP from scratch
8
+ - install: Downloads and compiles MiniSIP from scratch
9
9
  #- install: Installs an application
10
- #- check: Checks whether the environment dependencies for the application are satisfied
11
10
  developer:
11
+ - check: Checks whether the environment dependencies for MiniSIP are satisfied
12
+ - package: Downloads, compiles and packages MiniSIP from scratch
12
13
  #- publish: Submits a compiled package to the CSD package repository
13
14
  scopes:
14
- --- {}
15
+ install:
16
+ - core: Install only the Core component of MiniSIP
17
+ - ffmpeg: Install only the FFmpeg component of MiniSIP
18
+ - gnome: Install only the GNOME component of MiniSIP
19
+ - hdviper: Install only the HDVIPER component of MiniSIP
20
+ - network: Install only the Network component of MiniSIP
21
+ - plugins: Install only the Plugins component of MiniSIP
22
+ - x264: Install only the x264 component of MiniSIP
@@ -15,6 +15,13 @@ module CSD
15
15
  super
16
16
  define_relative_paths
17
17
  end
18
+
19
+ # Running the install task.
20
+ # Currently this corresponds to the compile task.
21
+ #
22
+ def install
23
+ compile
24
+ end
18
25
 
19
26
  # Running the compile task.
20
27
  #
@@ -27,6 +34,31 @@ module CSD
27
34
  def package
28
35
  UI.error 'Currently not supported for this platform. Sorry.'
29
36
  end
37
+
38
+ # Running the check task.
39
+ #
40
+ def check
41
+ UI.error 'Currently not supported for this platform. Sorry.'
42
+ end
43
+
44
+ # Determines which components of MiniSIP should be processed, because the scope parameter might be set
45
+ # by the user, requesting for only a particular component.
46
+ #
47
+ def components
48
+ Options.scope ? [Options.scope] : Options.scopes_names
49
+ end
50
+
51
+ # Determine whether all components should be processed or not.
52
+ #
53
+ def all_components?
54
+ components == Options.scopes_names
55
+ end
56
+
57
+ # Determines whether a particular component should be processed.
58
+ #
59
+ def component?(name)
60
+ components.include? name
61
+ end
30
62
 
31
63
  # This methods prints general information about this application module.
32
64
  #
@@ -50,6 +82,7 @@ module CSD
50
82
  # Defines all paths ever needed for the MiniSIP module based on the working directory.
51
83
  #
52
84
  def define_relative_paths
85
+ UI.debug "#{self.class}#define_relative_paths defines relative MiniSIP paths now"
53
86
  if Options.this_user
54
87
  Path.build = Pathname.new(File.join(Path.work, 'build'))
55
88
  else
@@ -68,7 +101,7 @@ module CSD
68
101
  Path.build_share_aclocal = Pathname.new(File.join(Path.build_share, 'aclocal'))
69
102
  Path.giomm_header = Pathname.new(File.join('/', 'usr', 'include', 'giomm-2.4', 'giomm.h'))
70
103
  Path.giomm_header_backup = Pathname.new(File.join('/', 'usr', 'include', 'giomm-2.4', 'giomm.h.ai-backup'))
71
- Path.repository = Pathname.new(File.join(Path.work, 'repository'))
104
+ Path.repository = Pathname.new(File.join(Path.work, 'minisip'))
72
105
  Path.repository_libminisip_rules = Pathname.new(File.join(Path.repository, 'libminisip', 'debian', 'rules'))
73
106
  Path.repository_libminisip_rules_backup = Pathname.new(File.join(Path.repository, 'libminisip', 'debian', 'rules.ai-backup'))
74
107
  Path.repository_grabber = Pathname.new(File.join(Path.repository, 'libminisip', 'source', 'subsystem_media', 'video', 'grabber'))
@@ -95,6 +128,12 @@ module CSD
95
128
  Path.minisip_gnome_pixmap = Pathname.new(File.join('/', 'usr', 'share', 'pixmaps', 'minisip_gnome.png'))
96
129
  Path.minisip_desktop_entry = Pathname.new(File.join('/', 'usr', 'share', 'applications', 'minisip.desktop'))
97
130
  Path.phonebook = Pathname.new(File.join(ENV['HOME'], '.minisip.addr'))
131
+ Path.realtek_firmware = Pathname.new(File.join(Path.work, 'realtek'))
132
+ Path.intel_firmware = Pathname.new(File.join(Path.work, 'intel'))
133
+ Path.intel_firmware_src = Pathname.new(File.join(Path.intel_firmware, 'src'))
134
+ Path.sysctl_conf = Pathname.new(File.join('/', 'etc', 'sysctl.conf'))
135
+ Path.sysctl_conf_backup = Pathname.new(File.join('/', 'etc', 'sysctl.conf.ai-backup'))
136
+ Path.new_sysctl_conf = Pathname.new(File.join(Path.work, 'sysctl.conf'))
98
137
  end
99
138
 
100
139
  end
@@ -5,4 +5,6 @@ require 'csd/application/minisip/component/gnome'
5
5
  require 'csd/application/minisip/component/hdviper'
6
6
  require 'csd/application/minisip/component/plugins'
7
7
  require 'csd/application/minisip/component/x264'
8
+ require 'csd/application/minisip/component/network'
9
+
8
10
 
@@ -41,7 +41,7 @@ module CSD
41
41
  def remove_ffmpeg
42
42
  ffmpeg_available = Cmd.run('ffmpeg -h', :internal => true, :die_on_failure => false).success?
43
43
  return if Options.ffmpeg_first or !Options.configure or !libraries.include?('libminisip') or !ffmpeg_available
44
- UI.debug "MILESTONE: removing_ffmpeg"
44
+ UI.debug "MILESTONE_removing_ffmpeg"
45
45
  if Gem::Platform.local.debian?
46
46
  # Note that FFmpeg must have been installed via apt-get or via the AI in order for this to work,
47
47
  # because manual compilations of FFmpeg cannot be removed automatically
@@ -50,7 +50,7 @@ module CSD
50
50
  Cmd.run "sudo apt-get remove ffmpeg --yes", :announce_pwd => false
51
51
  else
52
52
  # On other linux distributions we don't know how to remove ffmpeg
53
- UI.debug "MILESTONE: cannot_remove_ffmpeg"
53
+ UI.debug "MILESTONE_cannot_remove_ffmpeg"
54
54
  raise Error::Minisip::Core::FFmpegInstalled, "Please remove ffmpeg from your system first, or run the #{CSD.executable} with --no-configure" unless Options.testmode
55
55
  end
56
56
  end
@@ -143,10 +143,11 @@ module CSD
143
143
  #
144
144
  def compile_libraries
145
145
  create_build_dir
146
+ UI.debug "MILESTONE_processing_libraries"
146
147
  libraries.each do |library|
147
148
  directory = Pathname.new(File.join(Path.repository, library))
148
149
  if Cmd.cd(directory, :internal => true).success? or Options.reveal
149
- UI.debug "MILESTONE: processing_#{library}"
150
+ UI.debug "MILESTONE_processing_#{library}"
150
151
  UI.info "Processing MiniSIP -> #{library}".green.bold
151
152
  bootstrap
152
153
  configure library
@@ -192,14 +193,20 @@ module CSD
192
193
  def configure!(name='')
193
194
  individual_options = case name
194
195
  when 'libminisip'
195
- %Q{--enable-debug --enable-video --enable-opengl --disable-mil --enable-decklink --disable-sdl #{libminisip_cpp_flags} #{libminisip_ld_flags}}
196
+ %Q{--enable-video --enable-opengl --disable-mil --enable-decklink --disable-sdl #{libminisip_cpp_flags} #{libminisip_ld_flags}}
196
197
  when 'minisip'
197
- %Q{--enable-debug --enable-video --enable-opengl --enable-textui}
198
+ %Q{--enable-video --enable-opengl --enable-textui}
198
199
  else
199
200
  ''
200
201
  end
202
+ # The --enable-debug option should only be there if specifically requested
203
+ debug_options = (Options.enable_debug and (name == 'libminisip' or name == 'minisip')) ? '--enable-debug' : ''
204
+ # These options are used by all libraries
201
205
  common_options = Options.this_user ? %Q{--prefix="#{Path.build}" PKG_CONFIG_PATH="#{Path.build_lib_pkg_config}" ACLOCAL_FLAGS="#{Path.build_share_aclocal}" LD_LIBRARY_PATH="#{Path.build_lib}"} : ''
202
- Cmd.run ['./configure', common_options, individual_options].join(' ')
206
+ # I2conf needs to compile MiniSIP without any options
207
+ individual_options = '' if Options.blank_minisip_configuration
208
+ # Putting it all together
209
+ Cmd.run ['./configure', common_options, debug_options, individual_options].join(' ')
203
210
  end
204
211
 
205
212
  def make
@@ -50,6 +50,7 @@ Categories=Application;Internet;Network;Chat;AudioVideo}
50
50
  # If this step would not be done, the MiniSIP menu item would disappear after restarting Ubuntu.
51
51
  #
52
52
  def update_gnome_menu_cache
53
+ return unless Gem::Platform.local.ubuntu_10?
53
54
  Cmd.run %{sudo sh -c "/usr/share/gnome-menus/update-gnome-menus-cache /usr/share/applications/ > /usr/share/applications/desktop.${LANG}.cache"}, :announce_pwd => false
54
55
  end
55
56
 
@@ -0,0 +1,95 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ module CSD
4
+ module Application
5
+ module Minisip
6
+ module Component
7
+ module Network
8
+ class << self
9
+
10
+ OPTIMUM_BUFFERS = {
11
+ 'net.core.rmem_max' => '131071',
12
+ 'net.core.wmem_max' => '131071',
13
+ 'net.core.rmem_default' => '114688',
14
+ 'net.core.wmem_default' => '114688',
15
+ 'net.ipv4.udp_mem' => '81120 108160 162240',
16
+ 'net.ipv4.udp_rmem_min' => '4096',
17
+ 'net.ipv4.udp_wmem_min' => '4096'
18
+ }
19
+
20
+ def compile
21
+ UI.debug "#{self}.compile was called"
22
+ fix_udp_buffer
23
+ permanent_udp_buffer
24
+ lsmod = Cmd.run 'lsmod', :die_on_failure => false, :internal => true
25
+ lspci = Cmd.run 'lspci -v | grep Ethernet', :die_on_failure => false, :internal => true
26
+ UI.debug "#{self}.compile had this lsmod output: #{lsmod.output}"
27
+ UI.debug "#{self}.compile had this lspci output: #{lspci.output}"
28
+ update_realtek if (lsmod.success? and lsmod.output !~ /r8168/ and lspci.output =~ /RTL8111\/8168B/) or Options.reveal
29
+ update_intel if (lspci.success? and lspci.output =~ /82572EI/) or Options.reveal
30
+ end
31
+
32
+ def fix_udp_buffer
33
+ return unless Gem::Platform.local.debian? or Options.reveal
34
+ UI.info 'Fixing UDP buffer size'.green.bold
35
+ OPTIMUM_BUFFERS.each do |key, value|
36
+ Cmd.run %{sudo sysctl -w #{key}="#{value}"}, :announce_pwd => false
37
+ end
38
+ end
39
+
40
+ def permanent_udp_buffer
41
+ if Path.sysctl_conf_backup.file? and !Options.reveal
42
+ UI.warn "The UDP buffer modifications seems to be permanent already. Delete #{Path.sysctl_conf_backup.enquote} to enforce it."
43
+ else
44
+ UI.info 'Making the UDP buffer modifications permanent'.green.bold
45
+ content = Path.sysctl_conf.file? ? File.read(Path.sysctl_conf) : ''
46
+ Cmd.copy Path.sysctl_conf, Path.new_sysctl_conf
47
+ UI.info "Adding modifications to #{Path.new_sysctl_conf}".cyan
48
+ modifications = ['', '# Changes made by the AI'] + OPTIMUM_BUFFERS.map { |key, value| %{#{key} = #{value}} }
49
+ Cmd.touch_and_replace_content Path.new_sysctl_conf, modifications.join("\n"), :internal => true
50
+ # We cannot use Cmd.copy here, because Cmd.copy has no superuser privileges.
51
+ # And since we are for sure on Ubuntu, these commands will work.
52
+ Cmd.run "sudo cp #{Path.sysctl_conf} #{Path.sysctl_conf_backup}", :announce_pwd => false
53
+ Cmd.run "sudo cp #{Path.new_sysctl_conf} #{Path.sysctl_conf}", :announce_pwd => false
54
+ end
55
+ end
56
+
57
+ def update_realtek
58
+ checkout_realtek
59
+ compile_realtek
60
+ end
61
+
62
+ def update_intel
63
+ checkout_intel
64
+ compile_intel
65
+ end
66
+
67
+ def checkout_realtek
68
+ Cmd.git_clone 'Realtek firmware', 'git://github.com/csd/realtek.git', Path.realtek_firmware
69
+ end
70
+
71
+ def checkout_intel
72
+ Cmd.git_clone 'Intel firmware', 'git://github.com/csd/intel.git', Path.intel_firmware
73
+ end
74
+
75
+ def compile_realtek
76
+ UI.info 'Compiling Realtek firmware'.green.bold
77
+ Cmd.cd Path.realtek_firmware, :internal => true
78
+ Cmd.run 'sudo ./autorun.sh'
79
+ end
80
+
81
+ def compile_intel
82
+ UI.info 'Compiling Intel firmware'.green.bold
83
+ Cmd.cd Path.intel_firmware_src, :internal => true
84
+ Cmd.run 'sudo make install'
85
+ end
86
+
87
+ def introduction
88
+ end
89
+
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -27,7 +27,7 @@ module CSD
27
27
  # Copies the plugins from the repository to the final destination.
28
28
  #
29
29
  def copy
30
- if Path.plugins_destination.directory?
30
+ if Path.plugins_destination.directory? or Options.reveal
31
31
  UI.info "Installing optional MiniSIP plugins".green.bold
32
32
  UI.info "Copying from `#{Path.plugins_destination}´ to `#{Path.plugins}´".yellow
33
33
  Dir[File.join(Path.plugins, '{md,mg,mvideo}*.{a,la,so}')].each do |plugin|
@@ -42,3 +42,7 @@ end
42
42
  opts.on("--only libmutil,libmsip,etc.", Array, "Process only these libraries") do |list|
43
43
  self.only = list
44
44
  end
45
+
46
+ opts.on("--enable-debug","Enable MiniSIP-internal debugging") do |value|
47
+ self.enable_debug = value
48
+ end
@@ -7,4 +7,5 @@ self.bootstrap = true
7
7
  self.configure = true
8
8
  self.make = true
9
9
  self.make_install = true
10
- self.only = nil
10
+ self.only = nil
11
+ self.enable_debug = false
@@ -18,7 +18,7 @@ module CSD
18
18
  Client 1
19
19
  </desc>
20
20
  <uri>
21
- sip:client1@carenet-se.se
21
+ client1@carenet-se.se
22
22
  </uri>
23
23
  </pop>
24
24
  <pop>
@@ -26,7 +26,7 @@ module CSD
26
26
  Client2
27
27
  </desc>
28
28
  <uri>
29
- sip:client2@carenet-se.se
29
+ client2@carenet-se.se
30
30
  </uri>
31
31
  </pop>
32
32
  <pop>
@@ -34,7 +34,7 @@ module CSD
34
34
  Client3
35
35
  </desc>
36
36
  <uri>
37
- sip:client3@carenet-se.se
37
+ client3@carenet-se.se
38
38
  </uri>
39
39
  </pop>
40
40
  <pop>
@@ -42,7 +42,7 @@ module CSD
42
42
  Client4
43
43
  </desc>
44
44
  <uri>
45
- sip:client4@carenet-se.se
45
+ client4@carenet-se.se
46
46
  </uri>
47
47
  </pop>
48
48
  <pop>
@@ -50,7 +50,7 @@ module CSD
50
50
  Client5
51
51
  </desc>
52
52
  <uri>
53
- sip:client5@carenet-se.se
53
+ client5@carenet-se.se
54
54
  </uri>
55
55
  </pop>
56
56
  <pop>
@@ -58,28 +58,57 @@ module CSD
58
58
  Client6
59
59
  </desc>
60
60
  <uri>
61
- sip:client6@carenet-se.se
61
+ client6@carenet-se.se
62
62
  </uri>
63
63
  </pop>
64
64
  </contact>
65
65
  <contact>
66
66
  <name>
67
- Carenet-SE
67
+ Virtual Rooms
68
68
  </name>
69
69
  <pop>
70
70
  <desc>
71
- Multiparty Conference Room
71
+ Carenet-SE MCU
72
+ </desc>
73
+ <uri>
74
+ mcu@carenet-se.se
75
+ </uri>
76
+ </pop>
77
+ <pop>
78
+ <desc>
79
+ CESNET MCU
80
+ </desc>
81
+ <uri>
82
+ 950087999@cesnet.cz
83
+ </uri>
84
+ </pop>
85
+ <pop>
86
+ <desc>
87
+ TTA MCU
72
88
  </desc>
73
89
  <uri>
74
- sip:mcu@carenet-se.se
90
+ ttamcu@carenet-se.se
75
91
  </uri>
76
92
  </pop>
93
+ </contact>
94
+ <contact>
95
+ <name>
96
+ Carenet-SE
97
+ </name>
77
98
  <pop>
78
99
  <desc>
79
100
  Carenet Support Hotline
80
101
  </desc>
81
102
  <uri>
82
- sip:uri@carenet-se.se
103
+ support@carenet-se.se
104
+ </uri>
105
+ </pop>
106
+ <pop>
107
+ <desc>
108
+ SIP test account
109
+ </desc>
110
+ <uri>
111
+ test@carenet-se.se
83
112
  </uri>
84
113
  </pop>
85
114
  </contact>
@@ -92,7 +121,7 @@ module CSD
92
121
  Tandberg Client1
93
122
  </desc>
94
123
  <uri>
95
- sip:tandberg1@carenet-se.se
124
+ tandberg1@carenet-se.se
96
125
  </uri>
97
126
  </pop>
98
127
  <pop>
@@ -100,7 +129,7 @@ module CSD
100
129
  Tandberg Client2
101
130
  </desc>
102
131
  <uri>
103
- sip:tandberg2@carenet-se.se
132
+ tandberg2@carenet-se.se
104
133
  </uri>
105
134
  </pop>
106
135
  </contact>