res_pjsip: add option to enable ContactStatus event when contact is updated
[asterisk/asterisk.git] / res / res_pjsip / config_global.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2013, Digium, Inc.
5  *
6  * Mark Michelson <mmichelson@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18
19 #include "asterisk.h"
20
21 #include <pjsip.h>
22 #include <pjlib.h>
23
24 #include "asterisk/res_pjsip.h"
25 #include "include/res_pjsip_private.h"
26 #include "asterisk/sorcery.h"
27 #include "asterisk/taskprocessor.h"
28 #include "asterisk/ast_version.h"
29 #include "asterisk/res_pjsip_cli.h"
30
31 #define DEFAULT_MAX_FORWARDS 70
32 #define DEFAULT_KEEPALIVE_INTERVAL 90
33 #define DEFAULT_USERAGENT_PREFIX "Asterisk PBX"
34 #define DEFAULT_OUTBOUND_ENDPOINT "default_outbound_endpoint"
35 #define DEFAULT_DEBUG "no"
36 #define DEFAULT_ENDPOINT_IDENTIFIER_ORDER "ip,username,anonymous"
37 #define DEFAULT_MAX_INITIAL_QUALIFY_TIME 0
38 #define DEFAULT_FROM_USER "asterisk"
39 #define DEFAULT_REALM "asterisk"
40 #define DEFAULT_REGCONTEXT ""
41 #define DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL 30
42 #define DEFAULT_DISABLE_MULTI_DOMAIN 0
43 #define DEFAULT_VOICEMAIL_EXTENSION ""
44 #define DEFAULT_UNIDENTIFIED_REQUEST_COUNT 5
45 #define DEFAULT_UNIDENTIFIED_REQUEST_PERIOD 5
46 #define DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL 30
47 #define DEFAULT_MWI_TPS_QUEUE_HIGH AST_TASKPROCESSOR_HIGH_WATER_LEVEL
48 #define DEFAULT_MWI_TPS_QUEUE_LOW -1
49 #define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED 0
50 #define DEFAULT_IGNORE_URI_USER_OPTIONS 0
51 #define DEFAULT_USE_CALLERID_CONTACT 0
52 #define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION 0
53
54 /*!
55  * \brief Cached global config object
56  *
57  * \details
58  * Cached so we don't have to keep asking sorcery for the config.
59  * We could ask for it hundreds of times a second if not more.
60  */
61 static AO2_GLOBAL_OBJ_STATIC(global_cfg);
62
63 static char default_useragent[256];
64
65 struct global_config {
66         SORCERY_OBJECT(details);
67         AST_DECLARE_STRING_FIELDS(
68                 AST_STRING_FIELD(useragent);
69                 AST_STRING_FIELD(regcontext);
70                 AST_STRING_FIELD(default_outbound_endpoint);
71                 /*! Debug logging yes|no|host */
72                 AST_STRING_FIELD(debug);
73                 /*! Order by which endpoint identifiers are checked (comma separated list) */
74                 AST_STRING_FIELD(endpoint_identifier_order);
75                 /*! User name to place in From header if there is no better option */
76                 AST_STRING_FIELD(default_from_user);
77                 /*! Default voicemail extension */
78                 AST_STRING_FIELD(default_voicemail_extension);
79                 /*! Realm to use in challenges before an endpoint is identified */
80                 AST_STRING_FIELD(default_realm);
81         );
82         /*! Value to put in Max-Forwards header */
83         unsigned int max_forwards;
84         /*! The interval at which to send keep alive messages to active connection-oriented transports */
85         unsigned int keep_alive_interval;
86         /*! The maximum time for all contacts to be qualified at startup */
87         unsigned int max_initial_qualify_time;
88         /*! The interval at which to check for expired contacts */
89         unsigned int contact_expiration_check_interval;
90         /*! Nonzero to disable multi domain support */
91         unsigned int disable_multi_domain;
92         /*! The maximum number of unidentified requests per source IP address before a security event is logged */
93         unsigned int unidentified_request_count;
94         /*! The period during which unidentified requests are accumulated */
95         unsigned int unidentified_request_period;
96         /*! Interval at which expired unidentifed requests will be pruned */
97         unsigned int unidentified_request_prune_interval;
98         struct {
99                 /*! Taskprocessor high water alert trigger level */
100                 unsigned int tps_queue_high;
101                 /*! Taskprocessor low water clear alert level. */
102                 int tps_queue_low;
103                 /*! Nonzero to disable sending unsolicited mwi to all endpoints on startup */
104                 unsigned int disable_initial_unsolicited;
105         } mwi;
106         /*! Nonzero if URI user field options are ignored. */
107         unsigned int ignore_uri_user_options;
108         /*! Nonzero if CALLERID(num) is to be used as the default contact username instead of default_from_user */
109         unsigned int use_callerid_contact;
110         /*! Nonzero if need to send AMI ContactStatus event when a contact is updated */
111         unsigned int send_contact_status_on_update_registration;
112 };
113
114 static void global_destructor(void *obj)
115 {
116         struct global_config *cfg = obj;
117
118         ast_string_field_free_memory(cfg);
119 }
120
121 static void *global_alloc(const char *name)
122 {
123         struct global_config *cfg;
124
125         cfg = ast_sorcery_generic_alloc(sizeof(*cfg), global_destructor);
126         if (!cfg || ast_string_field_init(cfg, 100)) {
127                 ao2_cleanup(cfg);
128                 return NULL;
129         }
130
131         return cfg;
132 }
133
134 static int global_apply(const struct ast_sorcery *sorcery, void *obj)
135 {
136         struct global_config *cfg = obj;
137         char max_forwards[10];
138
139         if (ast_strlen_zero(cfg->debug)) {
140                 ast_log(LOG_ERROR,
141                         "Global option 'debug' can't be empty.  Set it to a valid value or remove the entry to accept 'no' as the default\n");
142                 return -1;
143         }
144
145         if (ast_strlen_zero(cfg->default_from_user)) {
146                 ast_log(LOG_ERROR,
147                         "Global option 'default_from_user' can't be empty.  Set it to a valid value or remove the entry to accept 'asterisk' as the default\n");
148                 return -1;
149         }
150
151         snprintf(max_forwards, sizeof(max_forwards), "%u", cfg->max_forwards);
152
153         ast_sip_add_global_request_header("Max-Forwards", max_forwards, 1);
154         ast_sip_add_global_request_header("User-Agent", cfg->useragent, 1);
155         ast_sip_add_global_response_header("Server", cfg->useragent, 1);
156
157         ao2_t_global_obj_replace_unref(global_cfg, cfg, "Applying global settings");
158         return 0;
159 }
160
161 static struct global_config *get_global_cfg(void)
162 {
163         return ao2_global_obj_ref(global_cfg);
164 }
165
166 char *ast_sip_global_default_outbound_endpoint(void)
167 {
168         char *str;
169         struct global_config *cfg;
170
171         cfg = get_global_cfg();
172         if (!cfg) {
173                 return ast_strdup(DEFAULT_OUTBOUND_ENDPOINT);
174         }
175
176         str = ast_strdup(cfg->default_outbound_endpoint);
177         ao2_ref(cfg, -1);
178         return str;
179 }
180
181 char *ast_sip_get_debug(void)
182 {
183         char *res;
184         struct global_config *cfg;
185
186         cfg = get_global_cfg();
187         if (!cfg) {
188                 return ast_strdup(DEFAULT_DEBUG);
189         }
190
191         res = ast_strdup(cfg->debug);
192         ao2_ref(cfg, -1);
193         return res;
194 }
195
196 char *ast_sip_get_regcontext(void)
197 {
198         char *res;
199         struct global_config *cfg;
200
201         cfg = get_global_cfg();
202         if (!cfg) {
203                 return ast_strdup(DEFAULT_REGCONTEXT);
204         }
205
206         res = ast_strdup(cfg->regcontext);
207         ao2_ref(cfg, -1);
208
209         return res;
210 }
211
212 char *ast_sip_get_default_voicemail_extension(void)
213 {
214         char *res;
215         struct global_config *cfg;
216
217         cfg = get_global_cfg();
218         if (!cfg) {
219                 return ast_strdup(DEFAULT_VOICEMAIL_EXTENSION);
220         }
221
222         res = ast_strdup(cfg->default_voicemail_extension);
223         ao2_ref(cfg, -1);
224
225         return res;
226 }
227
228 char *ast_sip_get_endpoint_identifier_order(void)
229 {
230         char *res;
231         struct global_config *cfg;
232
233         cfg = get_global_cfg();
234         if (!cfg) {
235                 return ast_strdup(DEFAULT_ENDPOINT_IDENTIFIER_ORDER);
236         }
237
238         res = ast_strdup(cfg->endpoint_identifier_order);
239         ao2_ref(cfg, -1);
240         return res;
241 }
242
243 unsigned int ast_sip_get_keep_alive_interval(void)
244 {
245         unsigned int interval;
246         struct global_config *cfg;
247
248         cfg = get_global_cfg();
249         if (!cfg) {
250                 return DEFAULT_KEEPALIVE_INTERVAL;
251         }
252
253         interval = cfg->keep_alive_interval;
254         ao2_ref(cfg, -1);
255         return interval;
256 }
257
258 unsigned int ast_sip_get_contact_expiration_check_interval(void)
259 {
260         unsigned int interval;
261         struct global_config *cfg;
262
263         cfg = get_global_cfg();
264         if (!cfg) {
265                 return DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL;
266         }
267
268         interval = cfg->contact_expiration_check_interval;
269         ao2_ref(cfg, -1);
270         return interval;
271 }
272
273 unsigned int ast_sip_get_disable_multi_domain(void)
274 {
275         unsigned int disable_multi_domain;
276         struct global_config *cfg;
277
278         cfg = get_global_cfg();
279         if (!cfg) {
280                 return DEFAULT_DISABLE_MULTI_DOMAIN;
281         }
282
283         disable_multi_domain = cfg->disable_multi_domain;
284         ao2_ref(cfg, -1);
285         return disable_multi_domain;
286 }
287
288 unsigned int ast_sip_get_max_initial_qualify_time(void)
289 {
290         unsigned int time;
291         struct global_config *cfg;
292
293         cfg = get_global_cfg();
294         if (!cfg) {
295                 return DEFAULT_MAX_INITIAL_QUALIFY_TIME;
296         }
297
298         time = cfg->max_initial_qualify_time;
299         ao2_ref(cfg, -1);
300         return time;
301 }
302
303 void ast_sip_get_unidentified_request_thresholds(unsigned int *count, unsigned int *period,
304         unsigned int *prune_interval)
305 {
306         struct global_config *cfg;
307
308         cfg = get_global_cfg();
309         if (!cfg) {
310                 *count = DEFAULT_UNIDENTIFIED_REQUEST_COUNT;
311                 *period = DEFAULT_UNIDENTIFIED_REQUEST_PERIOD;
312                 *prune_interval = DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL;
313                 return;
314         }
315
316         *count = cfg->unidentified_request_count;
317         *period = cfg->unidentified_request_period;
318         *prune_interval = cfg->unidentified_request_prune_interval;
319
320         ao2_ref(cfg, -1);
321         return;
322 }
323
324 void ast_sip_get_default_realm(char *realm, size_t size)
325 {
326         struct global_config *cfg;
327
328         cfg = get_global_cfg();
329         if (!cfg) {
330                 ast_copy_string(realm, DEFAULT_REALM, size);
331         } else {
332                 ast_copy_string(realm, cfg->default_realm, size);
333                 ao2_ref(cfg, -1);
334         }
335 }
336
337 void ast_sip_get_default_from_user(char *from_user, size_t size)
338 {
339         struct global_config *cfg;
340
341         cfg = get_global_cfg();
342         if (!cfg) {
343                 ast_copy_string(from_user, DEFAULT_FROM_USER, size);
344         } else {
345                 ast_copy_string(from_user, cfg->default_from_user, size);
346                 ao2_ref(cfg, -1);
347         }
348 }
349
350
351 unsigned int ast_sip_get_mwi_tps_queue_high(void)
352 {
353         unsigned int tps_queue_high;
354         struct global_config *cfg;
355
356         cfg = get_global_cfg();
357         if (!cfg) {
358                 return DEFAULT_MWI_TPS_QUEUE_HIGH;
359         }
360
361         tps_queue_high = cfg->mwi.tps_queue_high;
362         ao2_ref(cfg, -1);
363         return tps_queue_high;
364 }
365
366 int ast_sip_get_mwi_tps_queue_low(void)
367 {
368         int tps_queue_low;
369         struct global_config *cfg;
370
371         cfg = get_global_cfg();
372         if (!cfg) {
373                 return DEFAULT_MWI_TPS_QUEUE_LOW;
374         }
375
376         tps_queue_low = cfg->mwi.tps_queue_low;
377         ao2_ref(cfg, -1);
378         return tps_queue_low;
379 }
380
381 unsigned int ast_sip_get_mwi_disable_initial_unsolicited(void)
382 {
383         unsigned int disable_initial_unsolicited;
384         struct global_config *cfg;
385
386         cfg = get_global_cfg();
387         if (!cfg) {
388                 return DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED;
389         }
390
391         disable_initial_unsolicited = cfg->mwi.disable_initial_unsolicited;
392         ao2_ref(cfg, -1);
393         return disable_initial_unsolicited;
394 }
395
396 unsigned int ast_sip_get_ignore_uri_user_options(void)
397 {
398         unsigned int ignore_uri_user_options;
399         struct global_config *cfg;
400
401         cfg = get_global_cfg();
402         if (!cfg) {
403                 return DEFAULT_IGNORE_URI_USER_OPTIONS;
404         }
405
406         ignore_uri_user_options = cfg->ignore_uri_user_options;
407         ao2_ref(cfg, -1);
408         return ignore_uri_user_options;
409 }
410
411 unsigned int ast_sip_get_use_callerid_contact(void)
412 {
413         unsigned int use_callerid_contact;
414         struct global_config *cfg;
415
416         cfg = get_global_cfg();
417         if (!cfg) {
418                 return DEFAULT_USE_CALLERID_CONTACT;
419         }
420
421         use_callerid_contact = cfg->use_callerid_contact;
422         ao2_ref(cfg, -1);
423         return use_callerid_contact;
424 }
425
426 unsigned int ast_sip_get_send_contact_status_on_update_registration(void)
427 {
428         unsigned int send_contact_status_on_update_registration;
429         struct global_config *cfg;
430
431         cfg = get_global_cfg();
432         if (!cfg) {
433                 return DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION;
434         }
435
436         send_contact_status_on_update_registration = cfg->send_contact_status_on_update_registration;
437         ao2_ref(cfg, -1);
438         return send_contact_status_on_update_registration;
439 }
440
441 /*!
442  * \internal
443  * \brief Observer to set default global object if none exist.
444  *
445  * \param name Module name owning the sorcery instance.
446  * \param sorcery Instance being observed.
447  * \param object_type Name of object being observed.
448  * \param reloaded Non-zero if the object is being reloaded.
449  *
450  * \return Nothing
451  */
452 static void global_loaded_observer(const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded)
453 {
454         struct ao2_container *globals;
455         struct global_config *cfg;
456
457         if (strcmp(object_type, "global")) {
458                 /* Not interested */
459                 return;
460         }
461
462         globals = ast_sorcery_retrieve_by_fields(sorcery, "global",
463                 AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
464         if (globals) {
465                 int count;
466
467                 count = ao2_container_count(globals);
468                 ao2_ref(globals, -1);
469
470                 if (1 < count) {
471                         ast_log(LOG_ERROR,
472                                 "At most one pjsip.conf type=global object can be defined.  You have %d defined.\n",
473                                 count);
474                         return;
475                 }
476                 if (count) {
477                         return;
478                 }
479         }
480
481         ast_debug(1, "No pjsip.conf type=global object exists so applying defaults.\n");
482         cfg = ast_sorcery_alloc(sorcery, "global", NULL);
483         if (!cfg) {
484                 return;
485         }
486         global_apply(sorcery, cfg);
487         ao2_ref(cfg, -1);
488 }
489
490 static const struct ast_sorcery_instance_observer observer_callbacks_global = {
491         .object_type_loaded = global_loaded_observer,
492 };
493
494 int sip_cli_print_global(struct ast_sip_cli_context *context)
495 {
496         struct global_config *cfg = get_global_cfg();
497
498         if (!cfg) {
499                 cfg = ast_sorcery_alloc(ast_sip_get_sorcery(), "global", NULL);
500                 if (!cfg) {
501                         return -1;
502                 }
503         }
504
505         ast_str_append(&context->output_buffer, 0, "\nGlobal Settings:\n\n");
506         ast_sip_cli_print_sorcery_objectset(cfg, context, 0);
507
508         ao2_ref(cfg, -1);
509         return 0;
510 }
511
512 int ast_sip_destroy_sorcery_global(void)
513 {
514         struct ast_sorcery *sorcery = ast_sip_get_sorcery();
515
516         ast_sorcery_instance_observer_remove(sorcery, &observer_callbacks_global);
517
518         ao2_t_global_obj_release(global_cfg, "Module is unloading");
519
520         return 0;
521 }
522
523 int ast_sip_initialize_sorcery_global(void)
524 {
525         struct ast_sorcery *sorcery = ast_sip_get_sorcery();
526
527         snprintf(default_useragent, sizeof(default_useragent), "%s %s",
528                 DEFAULT_USERAGENT_PREFIX, ast_get_version());
529
530         ast_sorcery_apply_default(sorcery, "global", "config", "pjsip.conf,criteria=type=global,single_object=yes,explicit_name=global");
531
532         if (ast_sorcery_object_register(sorcery, "global", global_alloc, NULL, global_apply)) {
533                 return -1;
534         }
535
536         ast_sorcery_object_field_register(sorcery, "global", "type", "", OPT_NOOP_T, 0, 0);
537         ast_sorcery_object_field_register(sorcery, "global", "max_forwards",
538                 __stringify(DEFAULT_MAX_FORWARDS),
539                 OPT_UINT_T, 0, FLDSET(struct global_config, max_forwards));
540         ast_sorcery_object_field_register(sorcery, "global", "user_agent", default_useragent,
541                 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, useragent));
542         ast_sorcery_object_field_register(sorcery, "global", "default_outbound_endpoint",
543                 DEFAULT_OUTBOUND_ENDPOINT,
544                 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_outbound_endpoint));
545         ast_sorcery_object_field_register(sorcery, "global", "debug", DEFAULT_DEBUG,
546                 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, debug));
547         ast_sorcery_object_field_register(sorcery, "global", "endpoint_identifier_order",
548                 DEFAULT_ENDPOINT_IDENTIFIER_ORDER,
549                 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, endpoint_identifier_order));
550         ast_sorcery_object_field_register(sorcery, "global", "keep_alive_interval",
551                 __stringify(DEFAULT_KEEPALIVE_INTERVAL),
552                 OPT_UINT_T, 0, FLDSET(struct global_config, keep_alive_interval));
553         ast_sorcery_object_field_register(sorcery, "global", "max_initial_qualify_time",
554                 __stringify(DEFAULT_MAX_INITIAL_QUALIFY_TIME),
555                 OPT_UINT_T, 0, FLDSET(struct global_config, max_initial_qualify_time));
556         ast_sorcery_object_field_register(sorcery, "global", "default_from_user", DEFAULT_FROM_USER,
557                 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_from_user));
558         ast_sorcery_object_field_register(sorcery, "global", "default_voicemail_extension",
559                 DEFAULT_VOICEMAIL_EXTENSION, OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config,
560                 default_voicemail_extension));
561         ast_sorcery_object_field_register(sorcery, "global", "regcontext", DEFAULT_REGCONTEXT,
562                 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, regcontext));
563         ast_sorcery_object_field_register(sorcery, "global", "contact_expiration_check_interval",
564                 __stringify(DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL),
565                 OPT_UINT_T, 0, FLDSET(struct global_config, contact_expiration_check_interval));
566         ast_sorcery_object_field_register(sorcery, "global", "disable_multi_domain",
567                 DEFAULT_DISABLE_MULTI_DOMAIN ? "yes" : "no",
568                 OPT_BOOL_T, 1, FLDSET(struct global_config, disable_multi_domain));
569         ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_count",
570                 __stringify(DEFAULT_UNIDENTIFIED_REQUEST_COUNT),
571                 OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_count));
572         ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_period",
573                 __stringify(DEFAULT_UNIDENTIFIED_REQUEST_PERIOD),
574                 OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_period));
575         ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_prune_interval",
576                 __stringify(DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL),
577                 OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_prune_interval));
578         ast_sorcery_object_field_register(sorcery, "global", "default_realm", DEFAULT_REALM,
579                 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_realm));
580         ast_sorcery_object_field_register(sorcery, "global", "mwi_tps_queue_high",
581                 __stringify(DEFAULT_MWI_TPS_QUEUE_HIGH),
582                 OPT_UINT_T, 0, FLDSET(struct global_config, mwi.tps_queue_high));
583         ast_sorcery_object_field_register(sorcery, "global", "mwi_tps_queue_low",
584                 __stringify(DEFAULT_MWI_TPS_QUEUE_LOW),
585                 OPT_INT_T, 0, FLDSET(struct global_config, mwi.tps_queue_low));
586         ast_sorcery_object_field_register(sorcery, "global", "mwi_disable_initial_unsolicited",
587                 DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED ? "yes" : "no",
588                 OPT_BOOL_T, 1, FLDSET(struct global_config, mwi.disable_initial_unsolicited));
589         ast_sorcery_object_field_register(sorcery, "global", "ignore_uri_user_options",
590                 DEFAULT_IGNORE_URI_USER_OPTIONS ? "yes" : "no",
591                 OPT_BOOL_T, 1, FLDSET(struct global_config, ignore_uri_user_options));
592         ast_sorcery_object_field_register(sorcery, "global", "use_callerid_contact",
593                 DEFAULT_USE_CALLERID_CONTACT ? "yes" : "no",
594                 OPT_YESNO_T, 1, FLDSET(struct global_config, use_callerid_contact));
595         ast_sorcery_object_field_register(sorcery, "global", "send_contact_status_on_update_registration",
596                 DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION ? "yes" : "no",
597                 OPT_YESNO_T, 1, FLDSET(struct global_config, send_contact_status_on_update_registration));
598
599         if (ast_sorcery_instance_observer_add(sorcery, &observer_callbacks_global)) {
600                 return -1;
601         }
602
603         return 0;
604 }