-
Notifications
You must be signed in to change notification settings - Fork 0
/
feature-fixed-realtime.patch
1656 lines (1524 loc) · 69.2 KB
/
feature-fixed-realtime.patch
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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/funcs/func_curl.c b/funcs/func_curl.c
index c51d273..04eb2d7 100644
--- a/funcs/func_curl.c
+++ b/funcs/func_curl.c
@@ -753,6 +753,9 @@ static int acf_curl_helper(struct ast_channel *chan, struct curl_args *args)
if (curl_easy_perform(*curl) != 0) {
ast_log(LOG_WARNING, "%s ('%s')\n", curl_errbuf, args->url);
+
+ /* Any connection trouble cause request is not successful */
+ ret = -1;
}
/* Reset buffer to NULL so curl doesn't try to write to it when the
diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index 44ba4e4..1281957 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -108,7 +108,9 @@ struct ast_variable {
typedef struct ast_config *config_load_func(const char *database, const char *table, const char *configfile, struct ast_config *config, struct ast_flags flags, const char *suggested_include_file, const char *who_asked);
typedef struct ast_variable *realtime_var_get(const char *database, const char *table, const struct ast_variable *fields);
+typedef struct ast_variable *realtime_var_get2(const char *database, const char *table, const struct ast_variable *fields, int * const errflag);
typedef struct ast_config *realtime_multi_get(const char *database, const char *table, const struct ast_variable *fields);
+typedef struct ast_config *realtime_multi_get2(const char *database, const char *table, const struct ast_variable *fields, int * const errflag);
typedef int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, const struct ast_variable *fields);
typedef int realtime_update2(const char *database, const char *table, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields);
typedef int realtime_store(const char *database, const char *table, const struct ast_variable *fields);
@@ -131,7 +133,9 @@ struct ast_config_engine {
char *name;
config_load_func *load_func;
realtime_var_get *realtime_func;
+ realtime_var_get2 *realtime_func2;
realtime_multi_get *realtime_multi_func;
+ realtime_multi_get2 *realtime_multi_func2;
realtime_update *update_func;
realtime_update2 *update2_func;
realtime_store *store_func;
@@ -441,6 +445,7 @@ int ast_category_exist(const struct ast_config *config, const char *category_nam
*
* \param family which family/config to lookup
* \param fields which fields to lookup
+ * \param errflag place for backend error status if any
*
* \details
* This will use builtin configuration backends to look up a particular
@@ -458,8 +463,10 @@ int ast_category_exist(const struct ast_config *config, const char *category_nam
* You should use the constant SENTINEL to terminate arguments, in
* order to preserve cross-platform compatibility.
*/
+struct ast_variable *ast_load_realtime_fields2(const char *family, const struct ast_variable *fields, int * const errflag);
struct ast_variable *ast_load_realtime_fields(const char *family, const struct ast_variable *fields);
struct ast_variable *ast_load_realtime(const char *family, ...) attribute_sentinel;
+struct ast_variable *ast_load_realtime_all_fields2(const char *family, const struct ast_variable *fields, int * const errflag);
struct ast_variable *ast_load_realtime_all_fields(const char *family, const struct ast_variable *fields);
struct ast_variable *ast_load_realtime_all(const char *family, ...) attribute_sentinel;
@@ -525,6 +532,25 @@ int ast_unload_realtime(const char *family);
*/
int ast_realtime_require_field(const char *family, ...) attribute_sentinel;
+/*!
+ * \brief Retrieve realtime configuration
+ *
+ * \param family which family/config to lookup
+ * \param fields list of fields
+ * \param errflag optional place for error code from realtime backend
+ *
+ * \details
+ * This will use builtin configuration backends to look up a particular
+ * entity in realtime and return a variable list of its parameters. Unlike
+ * the ast_load_realtime, this function can return more than one entry and
+ * is thus stored inside a traditional ast_config structure rather than
+ * just returning a linked list of variables.
+ *
+ * \return An ast_config with one or more results
+ * \retval NULL Error or no results returned
+ */
+struct ast_config *ast_load_realtime_multientry_fields2(const char *family, const struct ast_variable *fields, int * const errflag);
+
/*!
* \brief Retrieve realtime configuration
*
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 593b186..4d4cc52 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -1425,14 +1425,14 @@ int pbx_builtin_raise_exception(struct ast_channel *chan, const char *data);
/*! @name Substitution routines, using static string buffers
* @{ */
-void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count);
-void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count);
-void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used);
+int pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count);
+int pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count);
+int pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used);
/*!
* \brief Substitutes variables, similar to pbx_substitute_variables_helper_full, but allows passing the context, extension, and priority in.
*/
-void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used, const char *context, const char *exten, int pri);
+int pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used, const char *context, const char *exten, int pri);
/*! @} */
/*! @name Substitution routines, using dynamic string buffers
@@ -1453,7 +1453,7 @@ const char *ast_str_retrieve_variable(struct ast_str **buf, ssize_t maxlen, stru
* \param chan Channel variables from which to extract values, and channel to pass to any dialplan functions.
* \param templ Variable template to expand.
*/
-void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ);
+int ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ);
/*!
* \param buf Result will be placed in this buffer.
@@ -1461,7 +1461,7 @@ void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct a
* \param headp If no channel is specified, a channel list from which to extract variable values
* \param templ Variable template to expand.
*/
-void ast_str_substitute_variables_varshead(struct ast_str **buf, ssize_t maxlen, struct varshead *headp, const char *templ);
+int ast_str_substitute_variables_varshead(struct ast_str **buf, ssize_t maxlen, struct varshead *headp, const char *templ);
/*!
* \param buf Result will be placed in this buffer.
@@ -1470,8 +1470,9 @@ void ast_str_substitute_variables_varshead(struct ast_str **buf, ssize_t maxlen,
* \param headp If no channel is specified, a channel list from which to extract variable values
* \param templ Variable template to expand.
* \param used Number of bytes read from the template. (May be NULL)
+ * \retval 0 if no errors, else some error occurred
*/
-void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, struct ast_channel *c, struct varshead *headp, const char *templ, size_t *used);
+int ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, struct ast_channel *c, struct varshead *headp, const char *templ, size_t *used);
/*!
* \brief Perform variable/function/expression substitution on an ast_str
@@ -1489,8 +1490,9 @@ void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, str
* If this parameter is set to 1 and both a channel and headp
* are specified, the channel will be searched for variables
* first and any not found will be searched for in headp.
+ * \retval 0 if no errors, else some error occurred
*/
-void ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
+int ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
struct ast_channel *c, struct varshead *headp, const char *templ,
size_t *used, int use_both);
diff --git a/include/asterisk/res_prometheus.h b/include/asterisk/res_prometheus.h
index 2c64437..5823d14 100644
--- a/include/asterisk/res_prometheus.h
+++ b/include/asterisk/res_prometheus.h
@@ -32,6 +32,7 @@
#include "asterisk/lock.h"
#include "asterisk/linkedlists.h"
#include "asterisk/stringfields.h"
+#include "asterisk/optional_api.h"
/*!
* \brief How many labels a single metric can have
@@ -231,6 +232,14 @@ struct prometheus_metric {
* callback function. Otherwise, leave it \c NULL.
*/
void (* get_metric_value)(struct prometheus_metric *metric);
+ /*!
+ * \brief Callback function called before metric being destroyed by res_prometheus module
+ *
+ * \retval 0 metric can be fully destroyed by res_prometheus module
+ * \retval -1 metric well be destroyed by producer module
+ *
+ */
+ int (* on_destroy)(struct prometheus_metric *metric);
/*!
* \brief A list of children metrics
*
@@ -286,6 +295,7 @@ struct prometheus_metric {
.help = (h), \
.children = AST_LIST_HEAD_NOLOCK_INIT_VALUE, \
.get_metric_value = (cb), \
+ .on_destroy = NULL, \
}
/*!
@@ -323,8 +333,11 @@ struct prometheus_metric {
* \c children list first.
*
* \param metric The metric to destroy
+ * \retval 0 if no errors, else some error occurred
*/
-void prometheus_metric_free(struct prometheus_metric *metric);
+AST_OPTIONAL_API(int, prometheus_metric_free,
+ (struct prometheus_metric *metric),
+ { return AST_OPTIONAL_API_UNAVAILABLE; });
/*!
* \brief Create a malloc'd counter metric
@@ -420,7 +433,9 @@ struct prometheus_callback {
* \retval 0 success
* \retval -1 error
*/
-int prometheus_metric_register(struct prometheus_metric *metric);
+AST_OPTIONAL_API(int, prometheus_metric_register,
+ (struct prometheus_metric *metric),
+ { return AST_OPTIONAL_API_UNAVAILABLE; });
/*!
* \brief Remove a registered metric
@@ -432,7 +447,9 @@ int prometheus_metric_register(struct prometheus_metric *metric);
* \retval 0 The metric was found, unregistered, and disposed of
* \retval -1 The metric was not found
*/
-int prometheus_metric_unregister(struct prometheus_metric *metric);
+AST_OPTIONAL_API(int, prometheus_metric_unregister,
+ (struct prometheus_metric *metric),
+ { return AST_OPTIONAL_API_UNAVAILABLE; });
/*!
* The current number of registered metrics
diff --git a/include/asterisk/sorcery.h b/include/asterisk/sorcery.h
index 8f7e2b2..afd56ee 100644
--- a/include/asterisk/sorcery.h
+++ b/include/asterisk/sorcery.h
@@ -292,27 +292,48 @@ struct ast_sorcery_wizard {
/*! \brief Callback for creating an object */
int (*create)(const struct ast_sorcery *sorcery, void *data, void *object);
- /*! \brief Callback for retrieving an object using an id */
+ /*! \brief Callback for retrieving an object using an id, return backend error if any */
+ void *(*retrieve_id2)(const struct ast_sorcery *sorcery, void *data, const char *type, const char *id, int * const errflag);
+
+ /*! \brief Callback for retrieving an object using an id */
void *(*retrieve_id)(const struct ast_sorcery *sorcery, void *data, const char *type, const char *id);
- /*! \brief Callback for retrieving multiple objects using a regex on their id */
- void (*retrieve_regex)(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const char *regex);
+ /*! \brief Callback for retrieving multiple objects using a regex on their id, return backend error if any */
+ void (*retrieve_regex2)(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const char *regex, int * const errflag);
+
+ /*! \brief Callback for retrieving multiple objects using a regex on their id */
+ void (*retrieve_regex)(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const char *regex);
- /*! \brief Optional callback for retrieving multiple objects by matching their id with a prefix */
- void (*retrieve_prefix)(const struct ast_sorcery *sorcery,
+ /*! \brief Optional callback for retrieving multiple objects by matching their id with a prefix, return backend error if any */
+ void (*retrieve_prefix2)(const struct ast_sorcery *sorcery,
void *data,
const char *type,
struct ao2_container *objects,
const char *prefix,
- const size_t prefix_len);
+ const size_t prefix_len,
+ int * const errflag);
+
+ /*! \brief Optional callback for retrieving multiple objects by matching their id with a prefix */
+ void (*retrieve_prefix)(const struct ast_sorcery *sorcery,
+ void *data,
+ const char *type,
+ struct ao2_container *objects,
+ const char *prefix,
+ const size_t prefix_len);
- /*! \brief Optional callback for retrieving an object using fields */
- void *(*retrieve_fields)(const struct ast_sorcery *sorcery, void *data, const char *type, const struct ast_variable *fields);
+ /*! \brief Optional callback for retrieving an object using fields, return backend error if any */
+ void *(*retrieve_fields2)(const struct ast_sorcery *sorcery, void *data, const char *type, const struct ast_variable *fields, int * const errflag);
- /*! \brief Optional callback for retrieving multiple objects using some optional field criteria */
- void (*retrieve_multiple)(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const struct ast_variable *fields);
+ /*! \brief Optional callback for retrieving an object using fields */
+ void *(*retrieve_fields)(const struct ast_sorcery *sorcery, void *data, const char *type, const struct ast_variable *fields);
- /*! \brief Callback for updating an object */
+ /*! \brief Optional callback for retrieving multiple objects using some optional field criteria, return backend error if any */
+ void (*retrieve_multiple2)(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const struct ast_variable *fields, int * const errflag);
+
+ /*! \brief Optional callback for retrieving multiple objects using some optional field criteria */
+ void (*retrieve_multiple)(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const struct ast_variable *fields);
+
+ /*! \brief Callback for updating an object */
int (*update)(const struct ast_sorcery *sorcery, void *data, void *object);
/*! \brief Callback for deleting an object */
@@ -1367,6 +1388,19 @@ void ast_sorcery_observer_remove(const struct ast_sorcery *sorcery, const char *
*/
int ast_sorcery_create(const struct ast_sorcery *sorcery, void *object);
+/*!
+ * \brief Retrieve an object using its unique identifier
+ *
+ * \param sorcery Pointer to a sorcery structure
+ * \param type Type of object to retrieve
+ * \param id Unique object identifier
+ * \param errflag Place for receive backend error if any
+ *
+ * \retval non-NULL if found
+ * \retval NULL if not found
+ */
+void *ast_sorcery_retrieve_by_id2(const struct ast_sorcery *sorcery, const char *type, const char *id, int * const errflag);
+
/*!
* \brief Retrieve an object using its unique identifier
*
@@ -1379,6 +1413,50 @@ int ast_sorcery_create(const struct ast_sorcery *sorcery, void *object);
*/
void *ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id);
+/*!
+ * \brief Retrieve an object or multiple objects using specific fields
+ * \since 13.9.0
+ *
+ * \param sorcery Pointer to a sorcery structure
+ * \param type Type of object to retrieve
+ * \param flags Flags to control behavior
+ * \param fields Optional object fields and values to match against
+ * \param errflag Optional placeholder for backend error status if any
+ *
+ * \retval non-NULL if found
+ * \retval NULL if not found
+ *
+ * \note If the AST_RETRIEVE_FLAG_MULTIPLE flag is specified the returned value will be an
+ * ao2_container that must be unreferenced after use.
+ *
+ * \note If the AST_RETRIEVE_FLAG_ALL flag is used you may omit fields to retrieve all objects
+ * of the given type.
+ *
+ * \note The fields parameter can contain realtime-style expressions in variable->name.
+ * All operators defined for ast_strings_match can be used except for regex as
+ * there's no common support for regex in the realtime backends at this time.
+ * If multiple variables are in the fields list, all must match for an object to
+ * be returned. See ast_strings_match for more information.
+ *
+ * Example:
+ *
+ * The following code can be significantly faster when a realtime backend is in use
+ * because the expression "qualify_frequency > 0" is passed to the database to limit
+ * the number of rows returned.
+ *
+ * struct ast_variable *var = ast_variable_new("qualify_frequency >", "0", "");
+ * struct ao2_container *aors;
+ *
+ * if (!var) {
+ * return;
+ * }
+ *
+ * aors = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(),
+ * "aor", AST_RETRIEVE_FLAG_MULTIPLE, var);
+ *
+ */
+void *ast_sorcery_retrieve_by_fields2(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields, int * const errflag);
+
/*!
* \brief Retrieve an object or multiple objects using specific fields
* \since 13.9.0
@@ -1422,6 +1500,21 @@ void *ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *
*/
void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields);
+/*!
+ * \brief Retrieve multiple objects using a regular expression on their id
+ *
+ * \param sorcery Pointer to a sorcery structure
+ * \param type Type of object to retrieve
+ * \param regex Regular expression
+ * \param errflag Optional parameter for receive error status from backend
+ *
+ * \retval non-NULL if error occurs
+ * \retval NULL success
+ *
+ * \note The provided regex is treated as extended case sensitive.
+ */
+struct ao2_container *ast_sorcery_retrieve_by_regex2(const struct ast_sorcery *sorcery, const char *type, const char *regex, int * const errflag);
+
/*!
* \brief Retrieve multiple objects using a regular expression on their id
*
@@ -1436,6 +1529,23 @@ void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const ch
*/
struct ao2_container *ast_sorcery_retrieve_by_regex(const struct ast_sorcery *sorcery, const char *type, const char *regex);
+/*!
+ * \brief Retrieve multiple objects whose id begins with the specified prefix
+ * \since 13.19.0
+ *
+ * \param sorcery Pointer to a sorcery structure
+ * \param type Type of object to retrieve
+ * \param prefix Object id prefix
+ * \param prefix_len The length of prefix in bytes
+ * \param errflag Optional placeholder to receive error from backend if any
+ *
+ * \retval non-NULL if error occurs
+ * \retval NULL success
+ *
+ * \note The prefix is matched in a case sensitive manner.
+ */
+struct ao2_container *ast_sorcery_retrieve_by_prefix2(const struct ast_sorcery *sorcery, const char *type, const char *prefix, const size_t prefix_len, int * const errflag);
+
/*!
* \brief Retrieve multiple objects whose id begins with the specified prefix
* \since 13.19.0
diff --git a/main/config.c b/main/config.c
index 1074407..13865ed 100644
--- a/main/config.c
+++ b/main/config.c
@@ -3344,7 +3344,7 @@ static int realtime_arguments_to_fields2(va_list ap, int skip, struct ast_variab
return 0;
}
-struct ast_variable *ast_load_realtime_all_fields(const char *family, const struct ast_variable *fields)
+struct ast_variable *ast_load_realtime_all_fields2(const char *family, const struct ast_variable *fields, int * const errflag)
{
struct ast_config_engine *eng;
char db[256];
@@ -3352,11 +3352,22 @@ struct ast_variable *ast_load_realtime_all_fields(const char *family, const stru
struct ast_variable *res=NULL;
int i;
+ if (errflag) {
+ *errflag = 0;
+ }
+
for (i = 1; ; i++) {
if ((eng = find_engine(family, i, db, sizeof(db), table, sizeof(table)))) {
- if (eng->realtime_func && (res = eng->realtime_func(db, table, fields))) {
- return res;
- }
+ if (eng->realtime_func2) {
+ if ((res = eng->realtime_func2(db, table, fields, errflag))) {
+ return res;
+ }
+ } else if (eng->realtime_func) {
+ if ((res = eng->realtime_func(db, table, fields))) {
+ return res;
+ }
+
+ }
} else {
return NULL;
}
@@ -3365,6 +3376,11 @@ struct ast_variable *ast_load_realtime_all_fields(const char *family, const stru
return res;
}
+struct ast_variable *ast_load_realtime_all_fields(const char *family, const struct ast_variable *fields)
+{
+ return ast_load_realtime_all_fields2(family, fields, NULL);
+}
+
struct ast_variable *ast_load_realtime_all(const char *family, ...)
{
RAII_VAR(struct ast_variable *, fields, NULL, ast_variables_destroy);
@@ -3382,13 +3398,13 @@ struct ast_variable *ast_load_realtime_all(const char *family, ...)
return res;
}
-struct ast_variable *ast_load_realtime_fields(const char *family, const struct ast_variable *fields)
+struct ast_variable *ast_load_realtime_fields2(const char *family, const struct ast_variable *fields, int * const errflag)
{
struct ast_variable *res;
struct ast_variable *cur;
struct ast_variable **prev;
- res = ast_load_realtime_all_fields(family, fields);
+ res = ast_load_realtime_all_fields2(family, fields, errflag);
/* Filter the list. */
prev = &res;
@@ -3417,6 +3433,11 @@ struct ast_variable *ast_load_realtime_fields(const char *family, const struct a
return res;
}
+struct ast_variable *ast_load_realtime_fields(const char *family, const struct ast_variable *fields)
+{
+ return ast_load_realtime_fields2(family, fields, NULL);
+}
+
struct ast_variable *ast_load_realtime(const char *family, ...)
{
RAII_VAR(struct ast_variable *, fields, NULL, ast_variables_destroy);
@@ -3507,7 +3528,7 @@ int ast_unload_realtime(const char *family)
return res;
}
-struct ast_config *ast_load_realtime_multientry_fields(const char *family, const struct ast_variable *fields)
+struct ast_config *ast_load_realtime_multientry_fields2(const char *family, const struct ast_variable *fields, int * const errflag)
{
struct ast_config_engine *eng;
char db[256];
@@ -3515,8 +3536,23 @@ struct ast_config *ast_load_realtime_multientry_fields(const char *family, const
struct ast_config *res = NULL;
int i;
+ if (errflag) {
+ *errflag = 0;
+ }
+
for (i = 1; ; i++) {
if ((eng = find_engine(family, i, db, sizeof(db), table, sizeof(table)))) {
+ if (eng->realtime_multi_func2) {
+ if ((res = eng->realtime_multi_func2(db, table, fields, errflag))) {
+ break;
+ }
+ } else if (eng->realtime_multi_func) {
+ if ((res = eng->realtime_multi_func(db, table, fields))) {
+ break;
+ }
+
+ }
+
if (eng->realtime_multi_func && (res = eng->realtime_multi_func(db, table, fields))) {
/* If we were returned an empty cfg, destroy it and return NULL */
if (!res->root) {
@@ -3530,9 +3566,20 @@ struct ast_config *ast_load_realtime_multientry_fields(const char *family, const
}
}
+ if (res && !res->root) {
+ ast_config_destroy(res);
+ res = NULL;
+ }
+
return res;
}
+struct ast_config *ast_load_realtime_multientry_fields(const char *family, const struct ast_variable *fields)
+{
+ return ast_load_realtime_multientry_fields2(family, fields, NULL);
+}
+
+
struct ast_config *ast_load_realtime_multientry(const char *family, ...)
{
RAII_VAR(struct ast_variable *, fields, NULL, ast_variables_destroy);
diff --git a/main/pbx_variables.c b/main/pbx_variables.c
index b05a9d1..52ac539 100644
--- a/main/pbx_variables.c
+++ b/main/pbx_variables.c
@@ -397,7 +397,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru
return ret;
}
-void ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
+int ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
struct ast_channel *c, struct varshead *headp, const char *templ,
size_t *used, int use_both)
{
@@ -406,6 +406,7 @@ void ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
struct ast_str *substr1 = ast_str_create(16);
struct ast_str *substr2 = NULL;
struct ast_str *substr3 = ast_str_create(16);
+ int error = 0;
ast_str_reset(*buf);
@@ -415,7 +416,7 @@ void ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
}
ast_free(substr1);
ast_free(substr3);
- return;
+ return -1;
}
whereweare = templ;
@@ -517,7 +518,7 @@ void ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
continue;
}
}
- ast_str_substitute_variables_full2(&substr2, 0, c, headp,
+ error |= ast_str_substitute_variables_full2(&substr2, 0, c, headp,
ast_str_buffer(substr1), NULL, use_both);
finalvars = ast_str_buffer(substr2);
} else {
@@ -570,7 +571,9 @@ void ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
}
res = (result ? 0 : -1);
}
- if (!res) {
+ if (res) {
+ error |= res;
+ } else {
ast_str_substring(substr3, offset, offset2);
ast_str_append(buf, maxlen, "%s", ast_str_buffer(substr3));
}
@@ -620,7 +623,7 @@ void ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
continue;
}
}
- ast_str_substitute_variables_full2(&substr2, 0, c, headp,
+ error |= ast_str_substitute_variables_full2(&substr2, 0, c, headp,
ast_str_buffer(substr1), NULL, use_both);
finalvars = ast_str_buffer(substr2);
} else {
@@ -639,36 +642,39 @@ void ast_str_substitute_variables_full2(struct ast_str **buf, ssize_t maxlen,
ast_free(substr1);
ast_free(substr2);
ast_free(substr3);
+
+ return error;
}
-void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen,
+int ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen,
struct ast_channel *chan, struct varshead *headp, const char *templ, size_t *used)
{
- ast_str_substitute_variables_full2(buf, maxlen, chan, headp, templ, used, 0);
+ return ast_str_substitute_variables_full2(buf, maxlen, chan, headp, templ, used, 0);
}
-void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
+int ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
{
- ast_str_substitute_variables_full(buf, maxlen, chan, NULL, templ, NULL);
+ return ast_str_substitute_variables_full(buf, maxlen, chan, NULL, templ, NULL);
}
-void ast_str_substitute_variables_varshead(struct ast_str **buf, ssize_t maxlen, struct varshead *headp, const char *templ)
+int ast_str_substitute_variables_varshead(struct ast_str **buf, ssize_t maxlen, struct varshead *headp, const char *templ)
{
- ast_str_substitute_variables_full(buf, maxlen, NULL, headp, templ, NULL);
+ return ast_str_substitute_variables_full(buf, maxlen, NULL, headp, templ, NULL);
}
-void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int count, size_t *used)
+int pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int count, size_t *used)
{
- pbx_substitute_variables_helper_full_location(c, headp, cp1, cp2, count, used, NULL, NULL, 0);
+ return pbx_substitute_variables_helper_full_location(c, headp, cp1, cp2, count, used, NULL, NULL, 0);
}
-void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int count, size_t *used, const char *context, const char *exten, int pri)
+int pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int count, size_t *used, const char *context, const char *exten, int pri)
{
/* Substitutes variables into cp2, based on string cp1, cp2 NO LONGER NEEDS TO BE ZEROED OUT!!!! */
const char *whereweare;
const char *orig_cp2 = cp2;
char ltmp[VAR_BUF_SIZE];
char var[VAR_BUF_SIZE];
+ int error = 0;
*cp2 = 0; /* just in case nothing ends up there */
whereweare = cp1;
@@ -767,7 +773,7 @@ void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct
/* Substitute if necessary */
if (needsub) {
- pbx_substitute_variables_helper_full_location(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL, context, exten, pri);
+ error |= pbx_substitute_variables_helper_full_location(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL, context, exten, pri);
vars = ltmp;
} else {
vars = var;
@@ -776,17 +782,23 @@ void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct
parse_variable_name(vars, &offset, &offset2, &isfunction);
if (isfunction) {
/* Evaluate function */
- if (c || !headp)
- cp4 = ast_func_read(c, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace;
- else {
+ if (c || !headp) {
+ int funcerr;
+
+ error |= (funcerr = ast_func_read(c, vars, workspace, VAR_BUF_SIZE));
+
+ cp4 = funcerr ? NULL : workspace;
+ } else {
struct varshead old;
struct ast_channel *bogus;
bogus = ast_dummy_channel_alloc();
if (bogus) {
+ int funcerr;
old = *ast_channel_varshead(bogus);
*ast_channel_varshead(bogus) = *headp;
- cp4 = ast_func_read(bogus, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace;
+ error |= (funcerr = ast_func_read(bogus, vars, workspace, VAR_BUF_SIZE));
+ cp4 = funcerr ? NULL : workspace;
/* Don't deallocate the varshead that was passed in */
*ast_channel_varshead(bogus) = old;
ast_channel_unref(bogus);
@@ -863,7 +875,7 @@ void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct
/* Substitute if necessary */
if (needsub) {
- pbx_substitute_variables_helper_full_location(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL, context, exten, pri);
+ error |= pbx_substitute_variables_helper_full_location(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL, context, exten, pri);
vars = ltmp;
} else {
vars = var;
@@ -881,16 +893,18 @@ void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct
if (used) {
*used = cp2 - orig_cp2;
}
+
+ return error;
}
-void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
+int pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
{
- pbx_substitute_variables_helper_full(c, (c) ? ast_channel_varshead(c) : NULL, cp1, cp2, count, NULL);
+ return pbx_substitute_variables_helper_full(c, (c) ? ast_channel_varshead(c) : NULL, cp1, cp2, count, NULL);
}
-void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count)
+int pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count)
{
- pbx_substitute_variables_helper_full(NULL, headp, cp1, cp2, count, NULL);
+ return pbx_substitute_variables_helper_full(NULL, headp, cp1, cp2, count, NULL);
}
/*! \brief CLI support for listing global variables in a parseable way */
diff --git a/main/sorcery.c b/main/sorcery.c
index 7f0ed2d..677b7b3 100644
--- a/main/sorcery.c
+++ b/main/sorcery.c
@@ -1850,13 +1850,17 @@ static int sorcery_cache_create(void *obj, void *arg, int flags)
return 0;
}
-void *ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
+void *ast_sorcery_retrieve_by_id2(const struct ast_sorcery *sorcery, const char *type, const char *id, int * const errflag)
{
struct ast_sorcery_object_type *object_type;
void *object = NULL;
int i;
unsigned int cached = 0;
+ if (errflag) {
+ *errflag = 0;
+ }
+
if (ast_strlen_zero(id)) {
return NULL;
}
@@ -1871,7 +1875,19 @@ void *ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *
struct ast_sorcery_object_wizard *wizard =
AST_VECTOR_GET(&object_type->wizards, i);
- if (wizard->wizard->callbacks.retrieve_id &&
+ if (wizard->wizard->callbacks.retrieve_id2) {
+ int placeholder;
+ int * const error = errflag ? errflag : &placeholder;
+
+ if (!(object = wizard->wizard->callbacks.retrieve_id2(sorcery, wizard->data, object_type->name, id, error))) {
+ if (!*error) {
+ /* No backend errors cause item not found by this backend */
+ continue;
+ }
+
+ /* Backend error cause immidiatly stop entity searching at other backends because infrastructure may be unstable. Is it right solution? */
+ }
+ } else if (wizard->wizard->callbacks.retrieve_id &&
!(object = wizard->wizard->callbacks.retrieve_id(sorcery, wizard->data, object_type->name, id))) {
continue;
}
@@ -1894,13 +1910,22 @@ void *ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *
return object;
}
-void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields)
+void *ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
+{
+ return ast_sorcery_retrieve_by_id2(sorcery, type, id, NULL);
+}
+
+void *ast_sorcery_retrieve_by_fields2(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields, int * const errflag)
{
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
void *object = NULL;
int i;
unsigned int cached = 0;
+ if (errflag) {
+ *errflag = 0;
+ }
+
if (!object_type) {
return NULL;
}
@@ -1917,18 +1942,26 @@ void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const ch
for (i = 0; i < AST_VECTOR_SIZE(&object_type->wizards); i++) {
struct ast_sorcery_object_wizard *wizard =
AST_VECTOR_GET(&object_type->wizards, i);
+ int placeholder;
+ int * const error = errflag ? errflag : &placeholder;
+
+ *error = 0;
if ((flags & AST_RETRIEVE_FLAG_MULTIPLE)) {
- if (wizard->wizard->callbacks.retrieve_multiple) {
+ if (wizard->wizard->callbacks.retrieve_multiple2) {
+ wizard->wizard->callbacks.retrieve_multiple2(sorcery, wizard->data, object_type->name, object, fields, error);
+ } else if (wizard->wizard->callbacks.retrieve_multiple) {
wizard->wizard->callbacks.retrieve_multiple(sorcery, wizard->data, object_type->name, object, fields);
}
} else if (fields && wizard->wizard->callbacks.retrieve_fields) {
- if (wizard->wizard->callbacks.retrieve_fields) {
+ if (wizard->wizard->callbacks.retrieve_fields2) {
+ object = wizard->wizard->callbacks.retrieve_fields2(sorcery, wizard->data, object_type->name, fields, error);
+ } else if (wizard->wizard->callbacks.retrieve_fields) {
object = wizard->wizard->callbacks.retrieve_fields(sorcery, wizard->data, object_type->name, fields);
}
}
- if (((flags & AST_RETRIEVE_FLAG_MULTIPLE) && (!ao2_container_count(object) || !wizard->caching)) || !object) {
+ if ((((flags & AST_RETRIEVE_FLAG_MULTIPLE) && (!ao2_container_count(object) || !wizard->caching)) || !object) && !*error) {
continue;
}
@@ -1946,12 +1979,21 @@ void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const ch
return object;
}
-struct ao2_container *ast_sorcery_retrieve_by_regex(const struct ast_sorcery *sorcery, const char *type, const char *regex)
+void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields)
+{
+ return ast_sorcery_retrieve_by_fields2(sorcery, type, flags, fields, NULL);
+}
+
+struct ao2_container *ast_sorcery_retrieve_by_regex2(const struct ast_sorcery *sorcery, const char *type, const char *regex, int * const errflag)
{
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
struct ao2_container *objects;
int i;
+ if (errflag) {
+ *errflag = 0;
+ }
+
if (!object_type) {
return NULL;
}
@@ -1966,27 +2008,43 @@ struct ao2_container *ast_sorcery_retrieve_by_regex(const struct ast_sorcery *so
struct ast_sorcery_object_wizard *wizard =
AST_VECTOR_GET(&object_type->wizards, i);
- if (!wizard->wizard->callbacks.retrieve_regex) {
- continue;
- }
+ if (wizard->wizard->callbacks.retrieve_regex2) {
+ int placeholder;
+ int * const error = errflag ? errflag : &placeholder;
- wizard->wizard->callbacks.retrieve_regex(sorcery, wizard->data, object_type->name, objects, regex);
+ wizard->wizard->callbacks.retrieve_regex2(sorcery, wizard->data, object_type->name, objects, regex, error);
- if (wizard->caching && ao2_container_count(objects)) {
- break;
- }
+ if (*error || (wizard->caching && ao2_container_count(objects))) {
+ break;
+ }
+ } else if (wizard->wizard->callbacks.retrieve_regex) {
+ wizard->wizard->callbacks.retrieve_regex(sorcery, wizard->data, object_type->name, objects, regex);
+
+ if (wizard->caching && ao2_container_count(objects)) {
+ break;
+ }
+ }
}
AST_VECTOR_RW_UNLOCK(&object_type->wizards);
return objects;
}
-struct ao2_container *ast_sorcery_retrieve_by_prefix(const struct ast_sorcery *sorcery, const char *type, const char *prefix, const size_t prefix_len)
+struct ao2_container *ast_sorcery_retrieve_by_regex(const struct ast_sorcery *sorcery, const char *type, const char *regex)
+{
+ return ast_sorcery_retrieve_by_regex2(sorcery, type, regex, NULL);
+}
+
+struct ao2_container *ast_sorcery_retrieve_by_prefix2(const struct ast_sorcery *sorcery, const char *type, const char *prefix, const size_t prefix_len, int * const errflag)
{
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
struct ao2_container *objects;
int i;
+ if (errflag) {
+ *errflag = 0;
+ }
+
if (!object_type) {
return NULL;
}
@@ -2001,14 +2059,21 @@ struct ao2_container *ast_sorcery_retrieve_by_prefix(const struct ast_sorcery *s
struct ast_sorcery_object_wizard *wizard =
AST_VECTOR_GET(&object_type->wizards, i);
- if (!wizard->wizard->callbacks.retrieve_prefix) {
- continue;
- }
+ if (wizard->wizard->callbacks.retrieve_prefix2) {
+ int placeholder;
+ int * const error = errflag ? errflag : &placeholder;
- wizard->wizard->callbacks.retrieve_prefix(sorcery, wizard->data, object_type->name, objects, prefix, prefix_len);
+ wizard->wizard->callbacks.retrieve_prefix2(sorcery, wizard->data, object_type->name, objects, prefix, prefix_len, error);
- if (wizard->caching && ao2_container_count(objects)) {
- break;
+ if (*error || (wizard->caching && ao2_container_count(objects))) {
+ break;
+ }
+ } else if (wizard->wizard->callbacks.retrieve_prefix) {
+ wizard->wizard->callbacks.retrieve_prefix(sorcery, wizard->data, object_type->name, objects, prefix, prefix_len);
+
+ if (wizard->caching && ao2_container_count(objects)) {
+ break;
+ }
}
}
AST_VECTOR_RW_UNLOCK(&object_type->wizards);
@@ -2016,6 +2081,11 @@ struct ao2_container *ast_sorcery_retrieve_by_prefix(const struct ast_sorcery *s
return objects;
}
+struct ao2_container *ast_sorcery_retrieve_by_prefix(const struct ast_sorcery *sorcery, const char *type, const char *prefix, const size_t prefix_len)
+{
+ return ast_sorcery_retrieve_by_prefix2(sorcery, type, prefix, prefix_len, NULL);
+}
+
/*! \brief Internal function which returns if the wizard has created the object */
static int sorcery_wizard_create(const struct ast_sorcery_object_wizard *object_wizard, const struct sorcery_details *details)
{
diff --git a/res/res_config_curl.c b/res/res_config_curl.c
index a124958..e3bc3d0 100644
--- a/res/res_config_curl.c
+++ b/res/res_config_curl.c
@@ -58,7 +58,7 @@ AST_THREADSTORAGE(result_buf);
* \retval var on success
* \retval NULL on failure
*/
-static struct ast_variable *realtime_curl(const char *url, const char *unused, const struct ast_variable *fields)
+static struct ast_variable *realtime_curl2(const char *url, const char *unused, const struct ast_variable *fields, int * const errflag)
{
struct ast_str *query, *buffer;
char buf1[256], buf2[256];
@@ -67,17 +67,34 @@ static struct ast_variable *realtime_curl(const char *url, const char *unused, c
unsigned int start = 1;
struct ast_variable *var = NULL, *prev = NULL;
+ if (errflag) {
+ *errflag = 0;
+ }
+
if (!ast_custom_function_find("CURL")) {
ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n");
+
+ if (errflag) {
+ *errflag = -1;
+ }
+
return NULL;
}
if (!(query = ast_str_thread_get(&query_buf, 16))) {
- return NULL;
+ if (errflag) {
+ *errflag = -1;
+ }
+
+ return NULL;
}
if (!(buffer = ast_str_thread_get(&result_buf, 16))) {
- return NULL;
+ if (errflag) {
+ *errflag = -1;
+ }
+
+ return NULL;
}
ast_str_set(&query, 0, "${CURL(%s/single,", url);
@@ -90,7 +107,11 @@ static struct ast_variable *realtime_curl(const char *url, const char *unused, c
}
ast_str_append(&query, 0, ")}");
- ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query));
+ if (ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query))) {
+ if (errflag) {
+ *errflag = -1;
+ }
+ }
/* Remove any trailing newline characters */
if ((stringp = strchr(ast_str_buffer(buffer), '\r')) || (stringp = strchr(ast_str_buffer(buffer), '\n'))) {
@@ -120,6 +141,11 @@ static struct ast_variable *realtime_curl(const char *url, const char *unused, c
return var;
}
+static struct ast_variable *realtime_curl(const char *url, const char *unused, const struct ast_variable *fields)
+{
+ return realtime_curl2(url, unused, fields, NULL);
+}
+
/*!
* \brief Execute an Select query and return ast_config list
* \param url
@@ -592,6 +618,7 @@ static struct ast_config *config_curl(const char *url, const char *unused, const
static struct ast_config_engine curl_engine = {
.name = "curl",
.load_func = config_curl,
+ .realtime_func2 = realtime_curl2,