ring_api.cpp 20.1 KB
Newer Older
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
/*
 *  Copyright (C) 2014 Savoir-Faire Linux Inc.
 *  Author: Philippe Proulx <philippe.proulx@savoirfairelinux.com>
 *
 *  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.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
 *
 *  Additional permission under GNU GPL version 3 section 7:
 *
 *  If you modify this program, or any covered work, by linking or
 *  combining it with the OpenSSL project's OpenSSL library (or a
 *  modified version of that library), containing parts covered by the
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
 *  grants you additional permission to convey the resulting work.
 *  Corresponding Source for a non-source form of such a combination
 *  shall include the source code for the parts of OpenSSL used as well
 *  as that of the covered work.
 */
#include <string>
#include <vector>
#include <map>
#include <cstdlib>

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "manager.h"
#include "managerimpl.h"
#include "logger.h"
42
#include "dring.h"
43 44 45 46
#include "client/callmanager.h"
#include "client/configurationmanager.h"
#include "client/presencemanager.h"

Adrien Béraud's avatar
Adrien Béraud committed
47
#ifdef RING_VIDEO
48
#include "client/videomanager.h"
Adrien Béraud's avatar
Adrien Béraud committed
49
#endif // RING_VIDEO
50

Guillaume Roguez's avatar
Guillaume Roguez committed
51
static ring::CallManager* getCallManager()
52
{
Guillaume Roguez's avatar
Guillaume Roguez committed
53
    return ring::Manager::instance().getClient()->getCallManager();
54
}
55

Guillaume Roguez's avatar
Guillaume Roguez committed
56
static ring::ConfigurationManager* getConfigurationManager()
57
{
Guillaume Roguez's avatar
Guillaume Roguez committed
58
    return ring::Manager::instance().getClient()->getConfigurationManager();
59
}
60

Guillaume Roguez's avatar
Guillaume Roguez committed
61
static ring::PresenceManager* getPresenceManager()
62
{
Guillaume Roguez's avatar
Guillaume Roguez committed
63
    return ring::Manager::instance().getClient()->getPresenceManager();
64
}
65

Adrien Béraud's avatar
Adrien Béraud committed
66
#ifdef RING_VIDEO
Guillaume Roguez's avatar
Guillaume Roguez committed
67
static ring::VideoManager* getVideoManager()
68
{
Guillaume Roguez's avatar
Guillaume Roguez committed
69
    return ring::Manager::instance().getClient()->getVideoManager();
70
}
Adrien Béraud's avatar
Adrien Béraud committed
71
#endif // RING_VIDEO
72

Tristan Matthews's avatar
Tristan Matthews committed
73
const char *
Adrien Béraud's avatar
Adrien Béraud committed
74
ring_version()
Tristan Matthews's avatar
Tristan Matthews committed
75 76 77 78
{
    return PACKAGE_VERSION;
}

Adrien Béraud's avatar
Adrien Béraud committed
79
int ring_init(ring_ev_handlers* ev_handlers, enum ring_init_flag flags)
80
{
81 82
    // User handlers of library events
    // FIXME: static evil
Adrien Béraud's avatar
Adrien Béraud committed
83
    static ring_ev_handlers evHandlers_;
84 85

    // Copy user event handlers
86
    evHandlers_ = *ev_handlers;
87 88

    // Handle flags
Adrien Béraud's avatar
Adrien Béraud committed
89 90
    setDebugMode(flags & RING_FLAG_DEBUG);
    setConsoleLog(flags & RING_FLAG_CONSOLE_LOG);
91 92 93

    // Create manager
    try {
94
        // FIXME: static evil
Guillaume Roguez's avatar
Guillaume Roguez committed
95
        static ring::ManagerImpl *manager;
96 97
        // ensure that we haven't been in this function before
        assert(!manager);
Guillaume Roguez's avatar
Guillaume Roguez committed
98
        manager = &(ring::Manager::instance());
99
    } catch (...) {
Adrien Béraud's avatar
Adrien Béraud committed
100
        return -RING_ERR_MANAGER_INIT;
101 102 103
    }

    // Register user event handlers
104 105 106
    getCallManager()->registerEvHandlers(&evHandlers_.call_ev_handlers);
    getConfigurationManager()->registerEvHandlers(&evHandlers_.config_ev_handlers);
    getPresenceManager()->registerEvHandlers(&evHandlers_.pres_ev_handlers);
107

Adrien Béraud's avatar
Adrien Béraud committed
108
#ifdef RING_VIDEO
109
    getVideoManager()->registerEvHandlers(&evHandlers_.video_ev_handlers);
Adrien Béraud's avatar
Adrien Béraud committed
110
#endif // RING_VIDEO
111 112 113

    // Initialize manager now
    try {
Guillaume Roguez's avatar
Guillaume Roguez committed
114
        ring::Manager::instance().init("");
115
    } catch (...) {
Adrien Béraud's avatar
Adrien Béraud committed
116
        return -RING_ERR_MANAGER_INIT;
117 118 119 120 121
    }

    return 0;
}

Adrien Béraud's avatar
Adrien Béraud committed
122
void ring_fini(void)
123 124
{
    // Finish manager
Guillaume Roguez's avatar
Guillaume Roguez committed
125
    ring::Manager::instance().finish();
126 127
}

Adrien Béraud's avatar
Adrien Béraud committed
128
void ring_poll_events()
129
{
Guillaume Roguez's avatar
Guillaume Roguez committed
130
    ring::Manager::instance().pollEvents();
131 132
}

Adrien Béraud's avatar
Adrien Béraud committed
133
bool ring_call_place(const std::string& account_id, const std::string& call_id, const std::string& to)
134
{
135
    return getCallManager()->placeCall(account_id, call_id, to);
136 137
}

Adrien Béraud's avatar
Adrien Béraud committed
138
bool ring_call_refuse(const std::string& call_id)
139
{
140
    return getCallManager()->refuse(call_id);
141 142
}

Adrien Béraud's avatar
Adrien Béraud committed
143
bool ring_call_accept(const std::string& call_id)
144
{
145
    return getCallManager()->accept(call_id);
146 147
}

Adrien Béraud's avatar
Adrien Béraud committed
148
bool ring_call_hang_up(const std::string& call_id)
149
{
150
    return getCallManager()->hangUp(call_id);
151 152
}

Adrien Béraud's avatar
Adrien Béraud committed
153
bool ring_call_hold(const std::string& call_id)
154
{
155
    return getCallManager()->hold(call_id);
156 157
}

Adrien Béraud's avatar
Adrien Béraud committed
158
bool ring_call_unhold(const std::string& call_id)
159
{
160
    return getCallManager()->unhold(call_id);
161 162
}

Adrien Béraud's avatar
Adrien Béraud committed
163
bool ring_call_transfer(const std::string& call_id, const std::string& to)
164
{
165
    return getCallManager()->transfer(call_id, to);
166 167
}

Adrien Béraud's avatar
Adrien Béraud committed
168
bool ring_call_attended_transfer(const std::string& transfer_id, const std::string& target_id)
169
{
170
    return getCallManager()->attendedTransfer(transfer_id, target_id);
171 172
}

Adrien Béraud's avatar
Adrien Béraud committed
173
std::map<std::string, std::string> ring_call_get_call_details(const std::string& call_id)
174
{
175
    return getCallManager()->getCallDetails(call_id);
176 177
}

Adrien Béraud's avatar
Adrien Béraud committed
178
std::vector<std::string> ring_call_get_call_list(void)
179
{
180
    return getCallManager()->getCallList();
181 182
}

Adrien Béraud's avatar
Adrien Béraud committed
183
void ring_call_remove_conference(const std::string& conf_id)
184
{
185
    getCallManager()->removeConference(conf_id);
186 187
}

Adrien Béraud's avatar
Adrien Béraud committed
188
bool ring_call_join_participant(const std::string& sel_call_id, const std::string& drag_call_id)
189
{
190
    return getCallManager()->joinParticipant(sel_call_id, drag_call_id);
191 192
}

Adrien Béraud's avatar
Adrien Béraud committed
193
void ring_call_create_conf_from_participant_list(const std::vector<std::string>& participants)
194
{
195
    getCallManager()->createConfFromParticipantList(participants);
196 197
}

Adrien Béraud's avatar
Adrien Béraud committed
198
bool ring_call_is_conference_participant(const std::string& call_id)
199
{
200
    return getCallManager()->isConferenceParticipant(call_id);
201 202
}

Adrien Béraud's avatar
Adrien Béraud committed
203
bool ring_call_add_participant(const std::string& call_id, const std::string& conf_id)
204
{
205
    return getCallManager()->addParticipant(call_id, conf_id);
206 207
}

Adrien Béraud's avatar
Adrien Béraud committed
208
bool ring_call_add_main_participant(const std::string& conf_id)
209
{
210
    return getCallManager()->addMainParticipant(conf_id);
211 212
}

Adrien Béraud's avatar
Adrien Béraud committed
213
bool ring_call_detach_participant(const std::string& call_id)
214
{
215
    return getCallManager()->detachParticipant(call_id);
216 217
}

Adrien Béraud's avatar
Adrien Béraud committed
218
bool ring_call_join_conference(const std::string& sel_conf_id, const std::string& drag_conf_id)
219
{
220
    return getCallManager()->joinConference(sel_conf_id, drag_conf_id);
221 222
}

Adrien Béraud's avatar
Adrien Béraud committed
223
bool ring_call_hang_up_conference(const std::string& conf_id)
224
{
225
    return getCallManager()->hangUpConference(conf_id);
226 227
}

Adrien Béraud's avatar
Adrien Béraud committed
228
bool ring_call_hold_conference(const std::string& conf_id)
229
{
230
    return getCallManager()->holdConference(conf_id);
231 232
}

Adrien Béraud's avatar
Adrien Béraud committed
233
bool ring_call_unhold_conference(const std::string& conf_id)
234
{
235
    return getCallManager()->unholdConference(conf_id);
236 237
}

Adrien Béraud's avatar
Adrien Béraud committed
238
std::vector<std::string> ring_call_get_conference_list(void)
239
{
240
    return getCallManager()->getConferenceList();
241 242
}

Adrien Béraud's avatar
Adrien Béraud committed
243
std::vector<std::string> ring_call_get_participant_list(const std::string& conf_id)
244
{
245
    return getCallManager()->getParticipantList(conf_id);
246 247
}

Adrien Béraud's avatar
Adrien Béraud committed
248
std::vector<std::string> ring_call_get_display_names(const std::string& conf_id)
249
{
250
    return getCallManager()->getDisplayNames(conf_id);
251 252
}

Adrien Béraud's avatar
Adrien Béraud committed
253
std::string ring_call_get_conference_id(const std::string& call_id)
254
{
255
    return getCallManager()->getConferenceId(call_id);
256 257
}

Adrien Béraud's avatar
Adrien Béraud committed
258
std::map<std::string, std::string> ring_call_get_conference_details(const std::string& call_id)
259
{
260
    return getCallManager()->getConferenceDetails(call_id);
261 262
}

Adrien Béraud's avatar
Adrien Béraud committed
263
bool ring_call_play_recorded_file(const std::string& path)
264
{
265
    return getCallManager()->startRecordedFilePlayback(path);
266 267
}

Adrien Béraud's avatar
Adrien Béraud committed
268
void ring_call_stop_recorded_file(const std::string& path)
269
{
270
    getCallManager()->stopRecordedFilePlayback(path);
271 272
}

Adrien Béraud's avatar
Adrien Béraud committed
273
bool ring_call_toggle_recording(const std::string& call_id)
274
{
275
    return getCallManager()->toggleRecording(call_id);
276 277
}

Adrien Béraud's avatar
Adrien Béraud committed
278
void ring_call_set_recording(const std::string& call_id)
279
{
280
    getCallManager()->setRecording(call_id);
281 282
}

Adrien Béraud's avatar
Adrien Béraud committed
283
void ring_call_record_playback_seek(double pos)
284
{
285
    getCallManager()->recordPlaybackSeek(pos);
286 287
}

Adrien Béraud's avatar
Adrien Béraud committed
288
bool ring_call_is_recording(const std::string& call_id)
289
{
290
    return getCallManager()->getIsRecording(call_id);
291 292
}

Adrien Béraud's avatar
Adrien Béraud committed
293
std::string ring_call_get_current_audio_codec_name(const std::string& call_id)
294
{
295
    return getCallManager()->getCurrentAudioCodecName(call_id);
296 297
}

Adrien Béraud's avatar
Adrien Béraud committed
298
void ring_call_play_dtmf(const std::string& key)
299
{
300
    getCallManager()->playDTMF(key);
301 302
}

Adrien Béraud's avatar
Adrien Béraud committed
303
void ring_call_start_tone(int start, int type)
304
{
305
    getCallManager()->startTone(start, type);
306 307
}

Adrien Béraud's avatar
Adrien Béraud committed
308
void ring_call_set_sas_verified(const std::string& call_id)
309
{
310
    getCallManager()->setSASVerified(call_id);
311 312
}

Adrien Béraud's avatar
Adrien Béraud committed
313
void ring_call_reset_sas_verified(const std::string& call_id)
314
{
315
    getCallManager()->resetSASVerified(call_id);
316 317
}

Adrien Béraud's avatar
Adrien Béraud committed
318
void ring_call_set_confirm_go_clear(const std::string& call_id)
319
{
320
    getCallManager()->setConfirmGoClear(call_id);
321 322
}

Adrien Béraud's avatar
Adrien Béraud committed
323
void ring_call_request_go_clear(const std::string& call_id)
324
{
325
    getCallManager()->requestGoClear(call_id);
326 327
}

Adrien Béraud's avatar
Adrien Béraud committed
328
void ring_call_accept_enrollment(const std::string& call_id, bool accepted)
329
{
330
    getCallManager()->acceptEnrollment(call_id, accepted);
331 332
}

Adrien Béraud's avatar
Adrien Béraud committed
333
void ring_call_send_text_message(const std::string& call_id, const std::string& message)
334
{
335
    getCallManager()->sendTextMessage(call_id, message);
336 337
}

Adrien Béraud's avatar
Adrien Béraud committed
338
std::map<std::string, std::string> ring_config_get_account_details(const std::string& account_id)
339
{
340
    return getConfigurationManager()->getAccountDetails(account_id);
341 342
}

Adrien Béraud's avatar
Adrien Béraud committed
343
std::map<std::string, std::string> ring_config_get_volatile_account_details(const std::string& account_id)
344 345 346 347
{
    return getConfigurationManager()->getVolatileAccountDetails(account_id);
}

Adrien Béraud's avatar
Adrien Béraud committed
348
void ring_config_set_account_details(const std::string& account_id, const std::map<std::string, std::string>& details)
349
{
350
    getConfigurationManager()->setAccountDetails(account_id, details);
351 352
}

Adrien Béraud's avatar
Adrien Béraud committed
353
std::map<std::string, std::string> ring_config_get_account_template(void)
354
{
355
    return getConfigurationManager()->getAccountTemplate();
356 357
}

Adrien Béraud's avatar
Adrien Béraud committed
358
std::string ring_config_add_account(const std::map<std::string, std::string>& details)
359
{
360
    return getConfigurationManager()->addAccount(details);
361 362
}

Adrien Béraud's avatar
Adrien Béraud committed
363
void ring_config_remove_account(const std::string& account_id)
364
{
365
    getConfigurationManager()->removeAccount(account_id);
366 367
}

Adrien Béraud's avatar
Adrien Béraud committed
368
std::vector<std::string> ring_config_get_account_list(void)
369
{
370
    return getConfigurationManager()->getAccountList();
371 372
}

Adrien Béraud's avatar
Adrien Béraud committed
373
void ring_config_send_register(const std::string& account_id, bool enable)
374
{
375
    getConfigurationManager()->sendRegister(account_id, enable);
376 377
}

Adrien Béraud's avatar
Adrien Béraud committed
378
void ring_config_register_all_accounts(void)
379
{
380
    getConfigurationManager()->registerAllAccounts();
381 382
}

Adrien Béraud's avatar
Adrien Béraud committed
383
std::map<std::string, std::string> ring_config_get_tls_default_settings(void)
384
{
385
    return getConfigurationManager()->getTlsSettingsDefault();
386 387
}

Adrien Béraud's avatar
Adrien Béraud committed
388
std::vector<int> ring_config_get_audio_codec_list(void)
389
{
390
    return getConfigurationManager()->getAudioCodecList();
391 392
}

Adrien Béraud's avatar
Adrien Béraud committed
393
std::vector<std::string> ring_config_get_supported_tls_method(void)
394
{
395
    return getConfigurationManager()->getSupportedTlsMethod();
396 397
}

398 399 400 401 402
std::vector<std::string> ring_config_get_supported_ciphers(const std::string& account_id)
{
    return getConfigurationManager()->getSupportedCiphers(account_id);
}

Adrien Béraud's avatar
Adrien Béraud committed
403
std::vector<std::string> ring_config_get_audio_codec_details(int payload)
404
{
405
    return getConfigurationManager()->getAudioCodecDetails(payload);
406 407
}

Adrien Béraud's avatar
Adrien Béraud committed
408
std::vector<int> ring_config_get_active_audio_codec_list(const std::string& account_id)
409
{
410
    return getConfigurationManager()->getActiveAudioCodecList(account_id);
411 412
}

Adrien Béraud's avatar
Adrien Béraud committed
413
void ring_config_set_active_audio_codec_list(const std::vector<std::string>& list, const std::string& account_id)
414
{
415
    getConfigurationManager()->setActiveAudioCodecList(list, account_id);
416 417
}

Adrien Béraud's avatar
Adrien Béraud committed
418
std::vector<std::string> ring_config_get_audio_plugin_list(void)
419
{
420
    return getConfigurationManager()->getAudioPluginList();
421 422
}

Adrien Béraud's avatar
Adrien Béraud committed
423
void ring_config_set_audio_plugin(const std::string& audio_plugin)
424
{
425
    getConfigurationManager()->setAudioPlugin(audio_plugin);
426 427
}

Adrien Béraud's avatar
Adrien Béraud committed
428
std::vector<std::string> ring_config_get_audio_output_device_list()
429
{
430
    return getConfigurationManager()->getAudioOutputDeviceList();
431 432
}

Adrien Béraud's avatar
Adrien Béraud committed
433
void ring_config_set_audio_output_device(int index)
434
{
435
    getConfigurationManager()->setAudioOutputDevice(index);
436 437
}

Adrien Béraud's avatar
Adrien Béraud committed
438
void ring_config_set_audio_input_device(int index)
439
{
440
    getConfigurationManager()->setAudioInputDevice(index);
441 442
}

Adrien Béraud's avatar
Adrien Béraud committed
443
void ring_config_set_audio_ringtone_device(int index)
444
{
445
    getConfigurationManager()->setAudioRingtoneDevice(index);
446 447
}

Adrien Béraud's avatar
Adrien Béraud committed
448
std::vector<std::string> ring_config_get_audio_input_device_list(void)
449
{
450
    return getConfigurationManager()->getAudioInputDeviceList();
451 452
}

Adrien Béraud's avatar
Adrien Béraud committed
453
std::vector<std::string> ring_config_get_current_audio_devices_index(void)
454
{
455
    return getConfigurationManager()->getCurrentAudioDevicesIndex();
456 457
}

Adrien Béraud's avatar
Adrien Béraud committed
458
int ring_config_get_audio_input_device_index(const std::string& name)
459
{
460
    return getConfigurationManager()->getAudioInputDeviceIndex(name);
461 462
}

Adrien Béraud's avatar
Adrien Béraud committed
463
int ring_config_get_audio_output_device_index(const std::string& name)
464
{
465
    return getConfigurationManager()->getAudioOutputDeviceIndex(name);
466 467
}

Adrien Béraud's avatar
Adrien Béraud committed
468
std::string ring_config_get_current_audio_output_plugin(void)
469
{
470
    return getConfigurationManager()->getCurrentAudioOutputPlugin();
471 472
}

Adrien Béraud's avatar
Adrien Béraud committed
473
bool ring_config_get_noise_suppress_state(void)
474
{
475
    return getConfigurationManager()->getNoiseSuppressState();
476 477
}

Adrien Béraud's avatar
Adrien Béraud committed
478
void ring_config_set_noise_suppress_state(bool state)
479
{
480
    getConfigurationManager()->setNoiseSuppressState(state);
481 482
}

Adrien Béraud's avatar
Adrien Béraud committed
483
bool ring_config_is_agc_enabled(void)
484
{
485
    return getConfigurationManager()->isAgcEnabled();
486 487
}

Adrien Béraud's avatar
Adrien Béraud committed
488
void ring_config_enable_agc(bool enabled)
489
{
490
    getConfigurationManager()->setAgcState(enabled);
491 492
}

Adrien Béraud's avatar
Adrien Béraud committed
493
void ring_config_mute_dtmf(bool mute)
494
{
495
    getConfigurationManager()->muteDtmf(mute);
496 497
}

Adrien Béraud's avatar
Adrien Béraud committed
498
bool ring_config_is_dtmf_muted(void)
499
{
500
    return getConfigurationManager()->isDtmfMuted();
501 502
}

Adrien Béraud's avatar
Adrien Béraud committed
503
bool ring_config_is_capture_muted(void)
504
{
505
    return getConfigurationManager()->isCaptureMuted();
506 507
}

Adrien Béraud's avatar
Adrien Béraud committed
508
void ring_config_mute_capture(bool mute)
509
{
510
    getConfigurationManager()->muteCapture(mute);
511 512
}

Adrien Béraud's avatar
Adrien Béraud committed
513
bool ring_config_is_playback_muted(void)
514
{
515
    return getConfigurationManager()->isPlaybackMuted();
516 517
}

Adrien Béraud's avatar
Adrien Béraud committed
518
void ring_config_mute_playback(int mute)
519
{
520
    getConfigurationManager()->mutePlayback(mute);
521 522
}

Adrien Béraud's avatar
Adrien Béraud committed
523
std::map<std::string, std::string> ring_config_get_ringtone_list(void)
524
{
525
    return getConfigurationManager()->getRingtoneList();
526 527
}

Adrien Béraud's avatar
Adrien Béraud committed
528
std::string ring_config_get_audio_manager(void)
529
{
530
    return getConfigurationManager()->getAudioManager();
531 532
}

Adrien Béraud's avatar
Adrien Béraud committed
533
bool ring_config_set_audio_manager(const std::string& api)
534
{
535
    return getConfigurationManager()->setAudioManager(api);
536 537
}

Adrien Béraud's avatar
Adrien Béraud committed
538
std::vector<std::string> ring_config_get_supported_audio_managers(void)
539 540 541 542 543 544 545 546 547 548 549 550 551 552
{
    return {
#if HAVE_ALSA
        ALSA_API_STR,
#endif
#if HAVE_PULSE
        PULSEAUDIO_API_STR,
#endif
#if HAVE_JACK
        JACK_API_STR,
#endif
    };
}

Adrien Béraud's avatar
Adrien Béraud committed
553
int ring_config_is_iax2_enabled(void)
554
{
555
    return getConfigurationManager()->isIax2Enabled();
556 557
}

Adrien Béraud's avatar
Adrien Béraud committed
558
std::string ring_config_get_record_path(void)
559
{
560
    return getConfigurationManager()->getRecordPath();
561 562
}

Adrien Béraud's avatar
Adrien Béraud committed
563
void ring_config_set_record_path(const std::string& path)
564
{
565
    getConfigurationManager()->setRecordPath(path);
566 567
}

Adrien Béraud's avatar
Adrien Béraud committed
568
bool ring_config_is_always_recording(void)
569
{
570
    return getConfigurationManager()->getIsAlwaysRecording();
571 572
}

Adrien Béraud's avatar
Adrien Béraud committed
573
void ring_config_set_always_recording(bool rec)
574
{
575
    getConfigurationManager()->setIsAlwaysRecording(rec);
576 577
}

Adrien Béraud's avatar
Adrien Béraud committed
578
void ring_config_set_history_limit(int days)
579
{
580
    getConfigurationManager()->setHistoryLimit(days);
581 582
}

Adrien Béraud's avatar
Adrien Béraud committed
583
int ring_config_get_history_limit(void)
584
{
585
    return getConfigurationManager()->getHistoryLimit();
586 587
}

Adrien Béraud's avatar
Adrien Béraud committed
588
void ring_config_clear_history(void)
589
{
590
    getConfigurationManager()->clearHistory();
591 592
}

Adrien Béraud's avatar
Adrien Béraud committed
593
void ring_config_set_accounts_order(const std::string& order)
594
{
595
    getConfigurationManager()->setAccountsOrder(order);
596 597
}

Adrien Béraud's avatar
Adrien Béraud committed
598
std::map<std::string, std::string> ring_config_get_hook_settings(void)
599
{
600
    return getConfigurationManager()->getHookSettings();
601 602
}

Adrien Béraud's avatar
Adrien Béraud committed
603
void ring_config_set_hook_settings(const std::map<std::string, std::string>& settings)
604
{
605
    getConfigurationManager()->setHookSettings(settings);
606 607
}

Adrien Béraud's avatar
Adrien Béraud committed
608
std::vector<std::map<std::string, std::string>> ring_config_get_history(void)
609
{
610
    return getConfigurationManager()->getHistory();
611 612
}

Adrien Béraud's avatar
Adrien Béraud committed
613
std::map<std::string, std::string> ring_config_get_tls_settings()
614
{
615
    return getConfigurationManager()->getTlsSettings();
616 617
}

Adrien Béraud's avatar
Adrien Béraud committed
618
void ring_config_set_tls_settings(const std::map< std::string, std::string >& settings)
619
{
620
    getConfigurationManager()->setTlsSettings(settings);
621 622
}

Adrien Béraud's avatar
Adrien Béraud committed
623
std::map<std::string, std::string> ring_config_get_ip2ip_details(void)
624
{
625
    return getConfigurationManager()->getIp2IpDetails();
626 627
}

Adrien Béraud's avatar
Adrien Béraud committed
628
std::vector<std::map<std::string, std::string>> ring_config_get_credentials(const std::string& account_id)
629
{
630
    return getConfigurationManager()->getCredentials(account_id);
631 632
}

Adrien Béraud's avatar
Adrien Béraud committed
633
void ring_config_set_credentials(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details)
634
{
635
    getConfigurationManager()->setCredentials(account_id, details);
636 637
}

Adrien Béraud's avatar
Adrien Béraud committed
638
std::string ring_config_get_addr_from_interface_name(const std::string& interface)
639
{
640
    return getConfigurationManager()->getAddrFromInterfaceName(interface);
641 642
}

Adrien Béraud's avatar
Adrien Béraud committed
643
std::vector<std::string> ring_config_get_all_ip_interface(void)
644
{
645
    return getConfigurationManager()->getAllIpInterface();
646 647
}

Adrien Béraud's avatar
Adrien Béraud committed
648
std::vector<std::string> ring_config_get_all_ip_interface_by_name(void)
649
{
650
    return getConfigurationManager()->getAllIpInterfaceByName();
651 652
}