summaryrefslogtreecommitdiff
path: root/config/routes.rb
blob: 83ac5c4de1333fd312e294cf68c1ea7f96c0271e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
Gemeinschaft42c::Application.routes.draw do

  resources :restore_jobs

  resources :groups do
    resources :group_memberships
    resources :group_permissions
  end

  resources :sim_card_providers do
    resources :sim_cards, :except => [:edit, :update]
  end

  resources :intruders

  resources :backup_jobs, :except => [:edit, :update]

  scope :constraints => lambda{|req|%w(127.0.0.1).include? req.remote_addr} do
    get "trigger/voicemail"
    get "trigger/fax"
  end

  resources :call_routes do
    collection { 
      post :sort 
      get :show_variables
    }
    resources :route_elements do
      collection { post :sort }
    end
  end

  resources :gateways do
    resources :gateway_settings
    resources :gateway_parameters
  end

  resources :gs_parameters, :only => [:show, :index, :update, :edit]

  resources :automatic_call_distributors

  resources :gs_cluster_sync_log_entries

  resources :gs_nodes do
    member do
      get 'sync'
    end
  end

  resources :gui_functions

  namespace :api do 
    resources :rows 
  end

  resources :phone_numbers, :only => [:sort] do
    collection { post :sort }
  end

  resources :acd_agents, :only => [] do
    resources :phone_numbers
  end

  resources :automatic_call_distributors, :only => [] do
    resources :acd_agents
    resources :phone_numbers
  end

  resources :hunt_group_members, :only => [] do
    resources :phone_numbers
  end

  resources :hunt_groups, :only => [] do
    resources :hunt_group_members
    resources :phone_numbers
  end

  if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
    resources :whitelists, :only => [] do
      resources :phone_numbers
    end
  end

  resources :access_authorizations, :only => [] do
    resources :phone_numbers
  end

  resources :fax_documents

  resources :fax_accounts, :only => [] do
    resources :fax_documents
    resources :phone_numbers
  end

  resources :gemeinschaft_setups, :only => [:new, :create]

  resources :phone_number_ranges, :only => [] do
    resources :phone_numbers
  end
  
  resources :conferences, :only => [] do
    resources :conference_invitees
    resources :phone_numbers
  end
  
  resources :phone_numbers, :only => [] do
    resources :call_forwards
    resources :ringtones
  end
  
  resources :addresses
  
  resources :sip_domains
  
  resources :manufacturers do
    resources :phone_models
  end
  
  # Log-in / log-out / sign-up:
  get "log_in"  => "sessions#new"     , :as => "log_in"  
  get "log_out" => "sessions#destroy" , :as => "log_out"  
  get "sign_up" => "users#new"        , :as => "sign_up"  
  get "login"   => "sessions#new"     , :as => "log_in"  
  get "logout"  => "sessions#destroy" , :as => "log_out"  
  get "signup"  => "users#new"        , :as => "sign_up"  
  
  # Provisioning:
  # Snom
  get "config_snom/:phone/:sip_account/idle_screen"        => "config_snom#idle_screen"
  get "config_snom/:phone/:sip_account/log_in"             => "config_snom#log_in"
  get "config_snom/:phone/:sip_account/phone_book"         => "config_snom#phone_book"
  get "config_snom/:phone/:sip_account/call_history"       => "config_snom#call_history"
  get "config_snom/:phone/:sip_account/call_history_:type" => "config_snom#call_history"
  get "config_snom/:phone/:sip_account/call_forwarding"    => "config_snom#call_forwarding"
  get "config_snom/exit"                                   => "config_snom#exit"
  get "config_snom/:phone/exit"                            => "config_snom#exit"
  get "config_snom/:phone/:sip_account/exit"               => "config_snom#exit"
  get "config_snom/:phone/:sip_account/hunt_group"         => "config_snom#hunt_group"
  get "config_snom/:phone/state_settings"                  => "config_snom#state_settings"
  get "config_snom/:phone/log_out"                         => "config_snom#log_out"
  get "config_snom/:phone/:sip_account/log_out"            => "config_snom#log_out"
  get "config_snom/:phone/log_in"                          => "config_snom#log_in"
  get "config_snom/:phone/:sip_account/log_in"             => "config_snom#log_in"
  get "config_snom/:phone/:sip_account/acd"                => "config_snom#acd"

  # Siemens
  get "config_siemens/:phone/call_history"                 => "config_siemens#call_history"
  get "config_siemens/:phone/:sip_account/call_history"    => "config_siemens#call_history"
  get "config_siemens/:phone/:sip_account/call_forwarding" => "config_siemens#call_forwarding"
  get "config_siemens/:phone/hunt_group"                   => "config_siemens#hunt_group"
  get "config_siemens/:phone/:sip_account/hunt_group"      => "config_siemens#hunt_group"
  get "config_siemens/:phone/menu"                         => "config_siemens#menu"
  get "config_siemens/:phone/:sip_account/menu"            => "config_siemens#menu"

  #Polycom
  get "config_polycom/:phone/:sip_account/phone_book"         => "config_polycom#phone_book"
  get "config_polycom/:phone/:sip_account/call_history"       => "config_polycom#call_history"
  get "config_polycom/:phone/:sip_account/idle_screen"        => "config_polycom#idle_screen"
 
  # Unified path for Snom phones.
  # Enter e.g. "http://192.168.1.105:3000/settings"
  # as the Setting URL (Advanced -> Update).
  match 'snom-:provisioning_key' => 'config_snom#show',
    :via => [:get],
    :format => 'xml'
  match 'settings-:mac_address' => 'config_snom#show',
    :constraints => { :mac_address => /000413[0-9A-F]{6}/i },
    :via => [:get],
    :format => 'xml'
  match "/DeploymentService/LoginService" => 'config_siemens#index',
    :via => [:post],
    :format => 'xml'
  match ':mac_address.cfg' => 'config_polycom#config_files',
    :constraints => { :mac_address => /0004f2[0-9A-F]{6}/i },
    :via => [:get],
    :format => 'xml'
  match 'settings-:mac_address.cfg' => 'config_polycom#settings',
    :constraints => { :mac_address => /0004f2[0-9A-F]{6}/i },
    :via => [:get],
    :format => 'xml'
  match ':mac_address-directory' => 'config_polycom#settings_directory',
    :constraints => { :mac_address => /0004f2[0-9A-F]{6}/i },
    :via => [:get],
    :format => 'xml'
    
  # Snom default path.
  # e.g. "/snom360-000413000000.htm"
  # Enter e.g. "http://192.168.1.105:3000"
  # as the Setting URL (Advanced -> Update).
  match 'snom:model-:mac_address' => 'config_snom#show',
    :constraints => { :mac_address => /000413[0-9A-F]{6}/i, :model => /[0-9]{3}/ },
    :via => [:get],
    :format => 'xml'
  
  resources :sessions
  
  get "page/index"
  get "page/help"
  
  root :to => "page#index"
  
  resources :users do
    # Display all phone books that the current user owns:
    resources :phone_books
    resources :user_groups, :only => [ :index, :show ]
    resources :sip_accounts
    resources :phones
    resources :conferences
    resources :fax_accounts
    resources :system_messages, :except => [ :edit, :update, :destroy ]
    resources :parking_stalls
  end
  
  resources :user_groups do
    # Display all phone books that the group of the current user owns:
    resources :phone_books
    resources :sip_accounts
    resources :fax_accounts
    resources :user_group_memberships
  end
  
  resources :tenants do
    # Display all phone books that the tenant of the current user owns:
    resources :phone_books
    resources :users do
      get "destroy_avatar"
    end
    resources :user_groups
    resources :sip_accounts
    resources :phones
    resources :conferences
    resources :phone_number_ranges
    resources :callthroughs
    if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
      resources :whitelists
    end
    resources :hunt_groups
    resources :automatic_call_distributors
    resources :parking_stalls
  end

  resources :callthroughs, :only => [] do
    resources :access_authorizations
    resources :phone_numbers
    if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
      resources :whitelists
    end
  end

  resources :softkeys, :only => [ :sort ] do
    collection { post :sort }
  end

  resources :sip_accounts, :only => [] do
    resources :phones_sip_accounts
    resources :phone_numbers
    resources :softkeys
    resources :call_forwards
    resources :ringtones
    resources :calls
    resources :call_histories do
      collection do
        delete 'destroy_multiple'
      end
      member do
        put 'call'
      end
    end
    resources :voicemail_messages do
      collection do
        delete 'destroy_multiple'
      end
      member do
        put 'call'
        put 'mark_read'
        put 'mark_unread'
      end
    end
    resources :voicemail_settings
  end

  resources :phones, :only => [] do
    resources :phone_sip_accounts
  end
  
  # Display all phone book entries that the current user can access:
  resources :phone_book_entries, :only => [ :index, :show ] do
    resources :phone_numbers do
      member do
        put 'call'
      end
    end
  end
  
  # Display all phone books that the current user can access:
  resources :phone_books, :only => [ :index, :show ] do
    resources :phone_book_entries
  end
  
  # Search
  post "search" => "phone_book_entries#index", :as => 'search'
  
  # http://0.0.0.0:3000/phone_books/3?name=Wintermeyer
  
  
  # The priority is based upon order of creation:
  # first created -> highest priority.
  
  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action
  
  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)
  
  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products
  
  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end
  
  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end
  
  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end
  
  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
  
  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => 'welcome#index'
  
  # See how all your routes lay out with "rake routes"
  
  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id(.:format)))'
end