Skip to content

Commit 5a47f2e

Browse files
authored
app_callerid: Allow time zone to be specified.
Now that ast_callerid_callwaiting_full_tz_generate is available (via patch), we can specify time zones for the Caller ID spill, so add an argument that allows overriding the system time zone. This finally allows for essentially full feature parity with FOB: https://github.com/InterLinked1/orange-box This argument is being added before options, so this syntax is not backwards-compatible with existing usage.
1 parent 9cb4d63 commit 5a47f2e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

apps/app_callerid.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
<para>Redirecting reason, e.g. REDIRECTING(reason).</para>
7474
<para>Default is none (not sent).</para>
7575
</parameter>
76+
<parameter name="timezone">
77+
<para>TZ-format timezone to use for date/time.</para>
78+
<para>Default is the system time zone.</para>
79+
</parameter>
7680
<parameter name="options">
7781
<optionlist>
7882
<option name="c">
@@ -230,6 +234,7 @@ static int cwcid_exec(struct ast_channel *chan, const char *data)
230234
char *clidnum, *clidname;
231235
int presentation = -1, redirecting = -1, qualifier = 0;
232236
int dahdi = 0; /* whether to try to use native DAHDI */
237+
const char *tz;
233238
#ifdef HAVE_DAHDI
234239
struct dahdi_pvt *pvt = NULL;
235240
#endif
@@ -239,6 +244,7 @@ static int cwcid_exec(struct ast_channel *chan, const char *data)
239244
AST_APP_ARG(name);
240245
AST_APP_ARG(presentation);
241246
AST_APP_ARG(redirecting);
247+
AST_APP_ARG(timezone);
242248
AST_APP_ARG(options);
243249
);
244250

@@ -264,6 +270,7 @@ static int cwcid_exec(struct ast_channel *chan, const char *data)
264270
}
265271
}
266272

273+
tz = args.timezone;
267274
clidnum = ast_strlen_zero(args.number) ? ast_channel_caller(chan)->id.number.str : args.number;
268275
if (strlen(clidnum) > 15) {
269276
ast_log(LOG_WARNING, "Caller ID number '%s' is greater than 15 characters and will be truncated\n", clidnum);
@@ -424,14 +431,15 @@ static int cwcid_exec(struct ast_channel *chan, const char *data)
424431
/* similar to my_send_callerid in chan_dahdi.c: */
425432
pvt->callwaitcas = 0;
426433
pvt->cidcwexpire = 0;
427-
pvt->cidlen = ast_callerid_callwaiting_full_generate(pvt->cidspill,
434+
pvt->cidlen = ast_callerid_callwaiting_full_tz_generate(pvt->cidspill,
428435
cnam,
429436
clid,
430437
NULL,
431438
redirecting,
432439
presentation,
433440
qualifier,
434-
AST_LAW(pvt));
441+
AST_LAW(pvt),
442+
tz);
435443
pvt->cidlen += READ_SIZE * 4;
436444
pvt->cidpos = 0;
437445
pvt->cid_suppress_expire = 0;
@@ -457,15 +465,15 @@ static int cwcid_exec(struct ast_channel *chan, const char *data)
457465
ast_log(LOG_WARNING, "Failed to malloc cidspill\n");
458466
return -1;
459467
}
460-
cidlen = ast_callerid_callwaiting_full_generate(cidspill,
468+
cidlen = ast_callerid_callwaiting_full_tz_generate(cidspill,
461469
cnam,
462470
clid,
463471
NULL,
464472
redirecting,
465473
presentation,
466474
qualifier,
467-
ast_format_ulaw);
468-
475+
ast_format_ulaw,
476+
tz);
469477
if (cwcid_careful_send(chan, cidspill, cidlen, NULL)) {
470478
ast_log(LOG_WARNING, "Failed to write cidspill\n");
471479
res = -1;

0 commit comments

Comments
 (0)