Index: apps/app_dial.c =================================================================== --- apps/app_dial.c (revision 139770) +++ apps/app_dial.c (working copy) @@ -188,6 +188,8 @@ " family/key is not specified.\n" " r - Indicate ringing to the calling party. Pass no audio to the calling\n" " party until the called channel has answered.\n" +" R - Like the 'r' option, but if early media is received, it will replace\n" +" the ringing sound.\n" " S(x) - Hang up the call after 'x' seconds *after* the called party has\n" " answered the call.\n" " t - Allow the called party to transfer the calling party by sending the\n" @@ -272,6 +274,7 @@ #define OPT_CANCEL_ELSEWHERE ((uint64_t)1 << 33) #define OPT_PEER_H ((uint64_t)1 << 34) #define OPT_CALLEE_GO_ON ((uint64_t)1 << 35) +#define OPT_RING_WITH_EARLY_MEDIA ((uint64_t)1 << 36) enum { OPT_ARG_ANNOUNCE = 0, @@ -317,6 +320,7 @@ AST_APP_OPTION('p', OPT_SCREENING), AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY), AST_APP_OPTION('r', OPT_RINGBACK), + AST_APP_OPTION('R', OPT_RING_WITH_EARLY_MEDIA), AST_APP_OPTION_ARG('S', OPT_DURATION_STOP, OPT_ARG_DURATION_STOP), AST_APP_OPTION('t', OPT_CALLEE_TRANSFER), AST_APP_OPTION('T', OPT_CALLER_TRANSFER), @@ -577,7 +581,7 @@ int orig = *to; struct ast_channel *peer = NULL; /* single is set if only one destination is enabled */ - int single = outgoing && !outgoing->next && !ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK); + int single = outgoing && !outgoing->next && !ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK | OPT_RING_WITH_EARLY_MEDIA); #ifdef HAVE_EPOLL struct chanlist *epollo; #endif @@ -1015,7 +1019,7 @@ ast_string_field_set(chan, musicclass, opt_args[OPT_ARG_MUSICBACK]); ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK], NULL); ast_string_field_set(chan, musicclass, original_moh); - } else if (ast_test_flag64(opts, OPT_RINGBACK)) { + } else if (ast_test_flag64(opts, OPT_RINGBACK) || ast_test_flag64(opts, OPT_RING_WITH_EARLY_MEDIA)) { ast_indicate(chan, AST_CONTROL_RINGING); pa->sentringing++; } @@ -1069,7 +1073,7 @@ if (ast_test_flag64(opts, OPT_MUSICBACK)) { ast_moh_stop(chan); - } else if (ast_test_flag64(opts, OPT_RINGBACK)) { + } else if (ast_test_flag64(opts, OPT_RINGBACK) || ast_test_flag64(opts, OPT_RING_WITH_EARLY_MEDIA)) { ast_indicate(chan, -1); pa->sentringing = 0; } @@ -1407,7 +1411,8 @@ OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | OPT_CALLER_PARK | OPT_CALLEE_MIXMONITOR | OPT_CALLER_MIXMONITOR | - OPT_RINGBACK | OPT_MUSICBACK | OPT_FORCECLID); + OPT_RINGBACK | OPT_MUSICBACK | OPT_FORCECLID | + OPT_RING_WITH_EARLY_MEDIA); ast_set2_flag64(tmp, args.url, DIAL_NOFORWARDHTML); } ast_copy_string(numsubst, number, sizeof(numsubst)); @@ -1612,7 +1617,7 @@ ast_moh_start(chan, NULL, NULL); } ast_indicate(chan, AST_CONTROL_PROGRESS); - } else if (ast_test_flag64(outgoing, OPT_RINGBACK)) { + } else if (ast_test_flag64(outgoing, OPT_RINGBACK) || ast_test_flag64(outgoing, OPT_RING_WITH_EARLY_MEDIA)) { ast_indicate(chan, AST_CONTROL_RINGING); sentringing++; }