Review Board 1.7.16


Allow app_dial to play 'indication tone while ringing' like 'option m' which will provide music on hold while ringing

Review Request #448 - Created Dec. 15, 2009 and submitted

Alec Davis
trunk
14504
Reviewers
asterisk-dev
Asterisk
This senario is based on an ETSI ISDN installation, but I'm sure applies to others.

option 'r' sends a Ringing Indication to the network, which informs the network we can deliver the call, but ultimately we may not be able to, and need to issue Congestion.
option 'm' sends a Progress Indication, which allows us to indicate Congestion and then let the call go, the network providor can then try the next provider.

The current ugly solution, is to record a music file, of Ringing, and play it, something like.
  exten => 80,1,Dial(DAHDI/2,30,m(myring))
  exten => 80,n,Congestion()

This patch provides an optional argument for option 'r' as in 'r(vodaring)'

Now a tidy and customizable way to play out any tones from the indications.conf file like.
  exten => 80,1,Dial(DAHDI/2,30,r(vodaring))
  exten => 80,n,Congestion()
100% test results with examples below.

exten => 80,1,Dial(DAHDI/2,,r(vodaring))
exten => 80,1,Dial(DAHDI/2,,r)
exten => 80,1,Dial(DAHDI/2,,m)
exten => 80,1,Dial(DAHDI/2,,)

Changes between revision 1 and 3

1 2 3
1 2 3

  1. trunk/apps/app_dial.c: Loading...
trunk/apps/app_dial.c
Diff Revision 1 Diff Revision 3
[20] 1587 lines
[+20] [+] static int dial_handle_playtones(struct ast_channel *chan, const char *data)
1588
	struct ast_tone_zone_sound *ts = NULL;
1588
	struct ast_tone_zone_sound *ts = NULL;
1589
	int res;
1589
	int res;
1590
	const char *str = data;
1590
	const char *str = data;
1591

    
   
1591

   
1592
	if (ast_strlen_zero(str)) {
1592
	if (ast_strlen_zero(str)) {
1593
		ast_log(LOG_NOTICE,"Nothing to play\n");
1593
		ast_debug(1,"Nothing to play\n");
1594
		return -1;
1594
		return -1;
1595
	}
1595
	}
1596

    
   
1596

   
1597
	ts = ast_get_indication_tone(chan->zone, str);
1597
	ts = ast_get_indication_tone(chan->zone, str);
1598

    
   
1598

   
1599
	if (ts && ts->data[0]) {
1599
	if (ts && ts->data[0]) {
1600
		res = ast_playtones_start(chan, 0, ts->data, 0);
1600
		res = ast_playtones_start(chan, 0, ts->data, 0);
1601
		ts = ast_tone_zone_sound_unref(ts);

   
1602
	} else {
1601
	} else {
1603
		res = -1;
1602
		res = -1;
1604
	}
1603
	}
1605

    
   
1604

   

    
   
1605
	if (ts) {

    
   
1606
		ts = ast_tone_zone_sound_unref(ts);

    
   
1607
	}

    
   
1608

   
1606
	if (res) {
1609
	if (res) {
1607
		ast_log(LOG_NOTICE, "Unable to start playtone \'%s\'\n", str);
1610
		ast_log(LOG_WARNING, "Unable to start playtone \'%s\'\n", str);
1608
	}
1611
	}
1609

    
   
1612

   
1610
	return res;
1613
	return res;
1611
}
1614
}
1612

    
   
1615

   
[+20] [20] 70 lines
[+20] [+] static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast_flags64 *peerflags, int *continue_exec)
1683
			ast_log(LOG_WARNING, "Unknown argument %d specified to n option, ignoring\n", delprivintro);
1686
			ast_log(LOG_WARNING, "Unknown argument %d specified to n option, ignoring\n", delprivintro);
1684
			delprivintro = 0;
1687
			delprivintro = 0;
1685
		}
1688
		}
1686
	}
1689
	}
1687

    
   
1690

   

    
   
1691
	if (!ast_test_flag64(&opts, OPT_RINGBACK)) {

    
   
1692
		opt_args[OPT_ARG_RINGBACK] = NULL;

    
   
1693
	}

    
   
1694

   
1688
	if (ast_test_flag64(&opts, OPT_OPERMODE)) {
1695
	if (ast_test_flag64(&opts, OPT_OPERMODE)) {
1689
		opermode = ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]) ? 1 : atoi(opt_args[OPT_ARG_OPERMODE]);
1696
		opermode = ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]) ? 1 : atoi(opt_args[OPT_ARG_OPERMODE]);
1690
		ast_verb(3, "Setting operator services mode to %d.\n", opermode);
1697
		ast_verb(3, "Setting operator services mode to %d.\n", opermode);
1691
	}
1698
	}
1692

    
   
1699

   
[+20] [20] 946 lines
  1. trunk/apps/app_dial.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.