253
253
Macro()</para></warning>
255
255
<option name="n">
256
<argument name="delete">
257
<para>With <replaceable>delete</replaceable> either not specified or set to <literal>0</literal>,
258
the recorded introduction will not be deleted if the caller hangs up while the remote party has not
260
<para>With <replaceable>delete</replaceable> set to <literal>1</literal>, the introduction will
261
always be deleted.</para>
256
263
<para>This option is a modifier for the call screening/privacy mode. (See the
257
264
<literal>p</literal> and <literal>P</literal> options.) It specifies
258
265
that no introductions are to be saved in the <directory>priv-callerintros</directory>
530
538
AST_APP_OPTION_ARG('L', OPT_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),
531
539
AST_APP_OPTION_ARG('m', OPT_MUSICBACK, OPT_ARG_MUSICBACK),
532
540
AST_APP_OPTION_ARG('M', OPT_CALLEE_MACRO, OPT_ARG_CALLEE_MACRO),
533
AST_APP_OPTION('n', OPT_SCREEN_NOINTRO),
541
AST_APP_OPTION_ARG('n', OPT_SCREEN_NOINTRO, OPT_ARG_SCREEN_NOINTRO),
534
542
AST_APP_OPTION('N', OPT_SCREEN_NOCLID),
535
543
AST_APP_OPTION('o', OPT_ORIGINAL_CLID),
536
544
AST_APP_OPTION_ARG('O', OPT_OPERMODE, OPT_ARG_OPERMODE),
550
558
#define CAN_EARLY_BRIDGE(flags,chan,peer) (!ast_test_flag64(flags, OPT_CALLEE_HANGUP | \
551
559
OPT_CALLER_HANGUP | OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | \
552
OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | OPT_CALLER_PARK) && \
560
OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | \
561
OPT_CALLER_PARK | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB) && \
553
562
!chan->audiohooks && !peer->audiohooks)
753
762
char *new_cid_num, *new_cid_name;
754
763
struct ast_channel *src;
756
ast_rtp_make_compatible(c, in, single);
765
if (CAN_EARLY_BRIDGE(peerflags, c, in)) {
766
ast_rtp_make_compatible(c, in, single);
757
768
if (ast_test_flag64(o, OPT_FORCECLID)) {
758
769
new_cid_num = ast_strdup(S_OR(in->macroexten, in->exten));
759
770
new_cid_name = NULL; /* XXX no name ? */
962
973
if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
963
974
ast_channel_early_bridge(in, c);
964
975
if (!ast_test_flag64(outgoing, OPT_RINGBACK))
965
ast_indicate(in, AST_CONTROL_PROGRESS);
976
if (single || (!single && !pa->sentringing)) {
977
ast_indicate(in, AST_CONTROL_PROGRESS);
967
980
case AST_CONTROL_VIDUPDATE:
968
981
ast_verb(3, "%s requested a video update, passing it to %s\n", c->name, in->name);
1582
if (ast_test_flag64(&opts, OPT_SCREEN_NOINTRO) && !ast_strlen_zero(opt_args[OPT_ARG_SCREEN_NOINTRO])) {
1583
delprivintro = atoi(opt_args[OPT_ARG_SCREEN_NOINTRO]);
1585
if (delprivintro < 0 || delprivintro > 1) {
1586
ast_log(LOG_WARNING, "Unknown argument %d specified to n option, ignoring\n", delprivintro);
1568
1591
if (ast_test_flag64(&opts, OPT_OPERMODE)) {
1569
1592
opermode = ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]) ? 1 : atoi(opt_args[OPT_ARG_OPERMODE]);
1570
1593
ast_verb(3, "Setting operator services mode to %d.\n", opermode);
1619
1642
outbound_group = ast_strdupa(outbound_group);
1621
1644
ast_channel_unlock(chan);
1622
ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
1645
ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB);
1624
1647
/* loop through the list of dial destinations */
1625
1648
rest = args.peers;
1729
1753
pbx_builtin_setvar_helper(tc, "DIALEDPEERNUMBER", numsubst);
1731
1755
/* Setup outgoing SDP to match incoming one */
1732
ast_rtp_make_compatible(tc, chan, !outgoing && !rest);
1756
if (CAN_EARLY_BRIDGE(peerflags, chan, tc)) {
1757
ast_rtp_make_compatible(tc, chan, !outgoing && !rest);
1734
1760
/* Inherit specially named variables from parent channel */
1735
1761
ast_channel_inherit_variables(chan, tc);
1915
/* Start autoservice on the other chan */
1916
res = ast_autoservice_start(chan);
1917
/* Now Stream the File */
1919
res = ast_streamfile(peer, opt_args[OPT_ARG_ANNOUNCE], peer->language);
1921
digit = ast_waitstream(peer, AST_DIGIT_ANY);
1923
/* Ok, done. stop autoservice */
1924
res = ast_autoservice_stop(chan);
1925
if (digit > 0 && !res)
1926
res = ast_senddigit(chan, digit, 0);
1941
struct ast_channel *chans[2];
1942
struct ast_channel *active_chan;
1947
/* we need to stream the announcment while monitoring the caller for a hangup */
1949
/* stream the file */
1950
res = ast_streamfile(peer, opt_args[OPT_ARG_ANNOUNCE], peer->language);
1953
ast_log(LOG_ERROR, "error streaming file '%s' to callee\n", opt_args[OPT_ARG_ANNOUNCE]);
1956
ast_set_flag(peer, AST_FLAG_END_DTMF_ONLY);
1957
while (peer->stream) {
1960
ms = ast_sched_wait(peer->sched);
1962
if (ms < 0 && !peer->timingfunc) {
1963
ast_stopstream(peer);
1969
active_chan = ast_waitfor_n(chans, 2, &ms);
1971
struct ast_frame *fr = ast_read(active_chan);
1977
switch(fr->frametype) {
1978
case AST_FRAME_DTMF_END:
1979
digit = fr->subclass;
1980
if (active_chan == peer && strchr(AST_DIGIT_ANY, res)) {
1981
ast_stopstream(peer);
1982
res = ast_senddigit(chan, digit, 0);
1985
case AST_FRAME_CONTROL:
1986
switch (fr->subclass) {
1987
case AST_CONTROL_HANGUP:
1997
/* Ignore all others */
2002
ast_sched_runq(peer->sched);
2004
ast_clear_flag(peer, AST_FLAG_END_DTMF_ONLY);
1932
2007
if (chan && peer && ast_test_flag64(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) {
2223
2298
sentringing = 0;
2224
2299
ast_indicate(chan, -1);
2302
if (delprivintro && ast_fileexists(pa.privintro, NULL, NULL) > 0) {
2303
ast_filedelete(pa.privintro, NULL);
2304
if (ast_fileexists(pa.privintro, NULL, NULL) > 0) {
2305
ast_log(LOG_NOTICE, "privacy: ast_filedelete didn't do its job on %s\n", pa.privintro);
2307
ast_verb(3, "Successfully deleted %s intro file\n", pa.privintro);
2226
2311
ast_channel_early_bridge(chan, NULL);
2227
2312
hanguptree(outgoing, NULL, 0); /* In this case, there's no answer anywhere */
2228
2313
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);