228
228
provided timeout) before going to the destination provided in the <literal>g</literal>
229
229
or <literal>h</literal> option. Default is 1.</para>
230
230
</option>
231
+ <option name="p">
232
+ <para>Match immediately on audible ringback tone, instead of or in addition to
233
+ a particular frequency.</para>
234
+ </option>
231
235
<option name="r">
232
236
<para>Apply to received frames only. Default is both directions.</para>
233
237
</option>
@@ -297,6 +301,7 @@ enum td_opts {
297
301
OPT_SIT = (1 << 9 ),
298
302
OPT_BUSY = (1 << 10 ),
299
303
OPT_DIALTONE = (1 << 11 ),
304
+ OPT_RINGING = (1 << 12 ),
300
305
};
301
306
302
307
enum {
@@ -316,6 +321,7 @@ AST_APP_OPTIONS(td_opts, {
316
321
AST_APP_OPTION_ARG ('g' , OPT_GOTO_RX , OPT_ARG_GOTO_RX ),
317
322
AST_APP_OPTION_ARG ('h' , OPT_GOTO_TX , OPT_ARG_GOTO_TX ),
318
323
AST_APP_OPTION_ARG ('n' , OPT_HITS_REQ , OPT_ARG_HITS_REQ ),
324
+ AST_APP_OPTION ('p' , OPT_RINGING ),
319
325
AST_APP_OPTION ('s' , OPT_SQUELCH ),
320
326
AST_APP_OPTION ('t' , OPT_TX ),
321
327
AST_APP_OPTION ('r' , OPT_RX ),
@@ -403,18 +409,31 @@ static int detect_callback(struct ast_audiohook *audiohook, struct ast_channel *
403
409
if (tstate > 0 ) {
404
410
ast_debug (3 , "tcount: %d, tstate: %d\n" , tcount , tstate );
405
411
switch (tstate ) {
412
+ case DSP_TONE_STATE_RINGING :
413
+ if (di -> signalfeatures & DSP_PROGRESS_RINGING ) {
414
+ ast_debug (1 , "Detected ringing on %s in %s direction\n" , ast_channel_name (chan ),
415
+ direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write" );
416
+ match = 1 ;
417
+ }
418
+ break ;
406
419
case DSP_TONE_STATE_DIALTONE :
407
420
if (di -> signalfeatures & DSP_FEATURE_WAITDIALTONE ) {
421
+ ast_debug (1 , "Detected dial tone on %s in %s direction\n" , ast_channel_name (chan ),
422
+ direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write" );
408
423
match = 1 ;
409
424
}
410
425
break ;
411
426
case DSP_TONE_STATE_BUSY :
412
427
if (di -> signalfeatures & DSP_PROGRESS_BUSY ) {
428
+ ast_debug (1 , "Detected busy tone on %s in %s direction\n" , ast_channel_name (chan ),
429
+ direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write" );
413
430
match = 1 ;
414
431
}
415
432
break ;
416
433
case DSP_TONE_STATE_SPECIAL3 :
417
434
if (di -> signalfeatures & DSP_PROGRESS_CONGESTION ) {
435
+ ast_debug (1 , "Detected SIT on %s in %s direction\n" , ast_channel_name (chan ),
436
+ direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write" );
418
437
match = 1 ;
419
438
}
420
439
break ;
@@ -427,7 +446,8 @@ static int detect_callback(struct ast_audiohook *audiohook, struct ast_channel *
427
446
} else if (di -> gototx ) {
428
447
ast_async_parseable_goto (chan , di -> gototx );
429
448
} else {
430
- ast_debug (3 , "Detected call progress signal, but don't know where to go\n" );
449
+ ast_debug (3 , "Detected call progress signal in %s direction, but don't know where to go\n" ,
450
+ direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write" );
431
451
}
432
452
}
433
453
}
@@ -583,6 +603,9 @@ static int parse_signal_features(struct ast_flags *flags)
583
603
if (ast_test_flag (flags , OPT_DIALTONE )) {
584
604
features |= DSP_FEATURE_WAITDIALTONE ;
585
605
}
606
+ if (ast_test_flag (flags , OPT_RINGING )) {
607
+ features |= DSP_PROGRESS_RINGING ;
608
+ }
586
609
587
610
return features ;
588
611
}
0 commit comments