[asterisk-dev] [Code Review] 3693: A test of the Authenticate application to ensure that it fails properly.

Tyler Austin Cambron reviewboard at asterisk.org
Wed Jul 2 09:50:31 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3693/
-----------------------------------------------------------

(Updated July 2, 2014, 9:50 a.m.)


Review request for Asterisk Developers.


Changes
-------

Corrected the title for the 'Bugs' section.
Added a hangup after Authenticate in the dialplan.
Corrected min-version.
Corrected app requirements.


Bugs: Asterisk-23953
    https://issues.asterisk.org/jira/browse/Asterisk-23953


Repository: testsuite


Description
-------

This test uses the dialplan to enter the Authenticate application, which has been given a hard coded password, and sends the wrong dtmf password three times. The Authenticate application should respond twice with the sound file "auth-incorrect", and then after a third incorrect try, play "vm-goodbye" and end the session. This test checks, using a header match, to ensure that "auth-incorrect" is played twice, followed by "vm-goodbye". To make the test give off an event for the playing of "vm-goodbye", the line of code that was in charge of raising the event in app.c had to be moved to file.c. I will post the diff in this description for clarification. The AppTest module also had to be modified to allow for an action to be executed each time that the event is matched instead of just executing once, regardless of the number of times the header match was told to match the event.

app.c and file.c diff file:
Index: app.c
===================================================================
--- app.c	(revision 415357)
+++ app.c	(working copy)
@@ -256,7 +256,6 @@
 
 	filename = ast_strdupa(prompt);
 	while ((front = strsep(&filename, "&"))) {
-		ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", front, ast_channel_name(c));
 		if (!ast_strlen_zero(front)) {
 			res = ast_streamfile(c, front, ast_channel_language(c));
 			if (res)
Index: file.c
===================================================================
--- file.c	(revision 415357)
+++ file.c	(working copy)
@@ -1105,6 +1105,7 @@
 		return -1;
 	if (vfs && ast_applystream(chan, vfs))
 		return -1;
+	ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", filename, ast_channel_name(chan));
 	res = ast_playstream(fs);
 	if (!res && vfs)
 		res = ast_playstream(vfs);
@@ -1611,7 +1612,6 @@
 {
 	int res = 0;
 	if (!ast_strlen_zero(file)) {
-		ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", file, ast_channel_name(chan));
 		res = ast_streamfile(chan, file, ast_channel_language(chan));
 		if (!res) {
 			res = ast_waitstream(chan, digits);


Diffs (updated)
-----

  /asterisk/trunk/tests/apps/tests.yaml 5202 
  /asterisk/trunk/tests/apps/authenticate/tests.yaml PRE-CREATION 
  /asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml PRE-CREATION 
  /asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf PRE-CREATION 
  /asterisk/trunk/lib/python/asterisk/apptest.py 5202 

Diff: https://reviewboard.asterisk.org/r/3693/diff/


Testing
-------

The test passes, and the logs show a call is made, the incorrect DTMF password is sent three times, the correct sound files are played as according to the header matches, and the session terminates upon hearing "vm-goodbye".


Thanks,

Tyler Austin Cambron

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140702/e8f01f8e/attachment-0001.html>


More information about the asterisk-dev mailing list