[asterisk-commits] mnicholson: testsuite/asterisk/trunk r472 - in /asterisk/trunk/tests/cdr/app_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 9 11:08:30 CDT 2010


Author: mnicholson
Date: Fri Jul  9 11:08:25 2010
New Revision: 472

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=472
Log:
Add a cdr test for the G flag option in app_dial

(related to issue #17592)

Added:
    asterisk/trunk/tests/cdr/app_dial_G_flag/
    asterisk/trunk/tests/cdr/app_dial_G_flag/configs/
    asterisk/trunk/tests/cdr/app_dial_G_flag/configs/extensions.conf   (with props)
    asterisk/trunk/tests/cdr/app_dial_G_flag/configs/sip.conf   (with props)
    asterisk/trunk/tests/cdr/app_dial_G_flag/run-test   (with props)
    asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/
    asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml   (with props)
    asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/data.csv   (with props)
    asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml   (with props)
    asterisk/trunk/tests/cdr/app_dial_G_flag/test.lua   (with props)

Added: asterisk/trunk/tests/cdr/app_dial_G_flag/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/app_dial_G_flag/configs/extensions.conf?view=auto&rev=472
==============================================================================
--- asterisk/trunk/tests/cdr/app_dial_G_flag/configs/extensions.conf (added)
+++ asterisk/trunk/tests/cdr/app_dial_G_flag/configs/extensions.conf Fri Jul  9 11:08:25 2010
@@ -1,0 +1,9 @@
+[default]
+
+exten => s,1,Noop
+exten => s,n,Dial(sip/127.0.0.2,,G(hangup^1))
+
+exten => hangup,1,Noop
+exten => hangup,n,Answer
+exten => hangup,n,Hangup
+

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/configs/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/configs/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/configs/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/cdr/app_dial_G_flag/configs/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/app_dial_G_flag/configs/sip.conf?view=auto&rev=472
==============================================================================
--- asterisk/trunk/tests/cdr/app_dial_G_flag/configs/sip.conf (added)
+++ asterisk/trunk/tests/cdr/app_dial_G_flag/configs/sip.conf Fri Jul  9 11:08:25 2010
@@ -1,0 +1,4 @@
+[general]
+udpbindaddr = 127.0.0.1:5060
+bindaddr = 127.0.0.1
+

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/configs/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/configs/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/configs/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/cdr/app_dial_G_flag/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/app_dial_G_flag/run-test?view=auto&rev=472
==============================================================================
--- asterisk/trunk/tests/cdr/app_dial_G_flag/run-test (added)
+++ asterisk/trunk/tests/cdr/app_dial_G_flag/run-test Fri Jul  9 11:08:25 2010
@@ -1,0 +1,3 @@
+#!/bin/bash -e
+. lib/sh/lua.sh
+asttest -a / -s `dirname $0` $@

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml?view=auto&rev=472
==============================================================================
--- asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml (added)
+++ asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml Fri Jul  9 11:08:25 2010
@@ -1,0 +1,77 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="send a call then wait for a hangup">
+	<Global variables="file,user"/>
+	<nop>
+		<action>
+			<lookup assign_to="line" file="[$file]" key="[$user]"/>
+		</action>
+	</nop>
+	<Reference variables="file,user"/>
+
+	<send retrans="500">
+		<![CDATA[
+
+		INVITE sip:[field1 line="[$line]"]@[remote_ip]:[remote_port] SIP/2.0
+		Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+		From: [field0 line="[$line]"] <sip:[field0 line="[$line]"]@[local_ip]:[local_port]>;tag=[call_number]
+		To: [field1 line="[$line]"] <sip:[field1 line="[$line]"]@[remote_ip]:[remote_port]>
+		Call-ID: [call_id]
+		CSeq: 1 INVITE
+		Contact: sip:[field0 line="[$line]"]@[local_ip]:[local_port]
+		Max-Forwards: 70
+		Content-Type: application/sdp
+		Content-Length: [len]
+
+		v=0
+		o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+		s=-
+		c=IN IP[media_ip_type] [media_ip]
+		t=0 0
+		m=audio [media_port] RTP/AVP 0
+		a=rtpmap:0 PCMU/8000
+
+		]]>
+	</send>
+
+	<recv response="100" optional="true"/>
+	<recv response="180" optional="true"/>
+	<recv response="183" optional="true"/>
+
+	<recv response="200" rtd="true" rrs="true"/>
+	
+	<send>
+		<![CDATA[
+
+		ACK sip:[field1 line="[$line]"]@[remote_ip]:[remote_port] SIP/2.0
+		Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+		From: [field0 line="[$line]"] <sip:[field0 line="[$line]"]@[local_ip]:[local_port]>;tag=[call_number]
+		To: [field1 line="[$line]"] <sip:[field1 line="[$line]"]@[remote_ip]:[remote_port]>
+		Call-ID: [call_id]
+		CSeq: 1 ACK
+		Contact: sip:[field0 line="[$line]"]@[local_ip]:[local_port]
+		Max-Forwards: 70
+		Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv request="BYE" optional="false" timeout="10000"/>
+
+	<send>
+		<![CDATA[
+
+		SIP/2.0 200 OK
+		[last_Via:]
+		[last_From:]
+		[last_To:];tag=[call_number]
+		[last_Call-ID:]
+		[last_CSeq:]
+		Contact: sip:[field0 line="[$line]"]@[local_ip]:[local_port]
+		Content-Length: 0
+
+		]]>
+	</send>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/data.csv
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/data.csv?view=auto&rev=472
==============================================================================
--- asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/data.csv (added)
+++ asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/data.csv Fri Jul  9 11:08:25 2010
@@ -1,0 +1,4 @@
+USER
+# from/contact;to
+test1;s
+test2;s

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/data.csv
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/data.csv
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/data.csv
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml?view=auto&rev=472
==============================================================================
--- asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml (added)
+++ asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml Fri Jul  9 11:08:25 2010
@@ -1,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="wait for a call followed by a hangup">
+
+	<Global variables="file,user"/>
+	<nop>
+		<action>
+			<lookup assign_to="line" file="[$file]" key="[$user]"/>
+		</action>
+	</nop>
+	<Reference variables="file,user"/>
+
+	<recv request="INVITE" crlf="true" timeout="5000"/>
+
+	<send>
+		<![CDATA[
+
+		SIP/2.0 180 Ringing
+		[last_Via:]
+		[last_From:]
+		[last_To:];tag=[call_number]
+		[last_Call-ID:]
+		[last_CSeq:]
+		Contact: sip:[field0 line="[$line]"]@[local_ip]:[local_port]
+		Content-Length: 0
+
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+
+		SIP/2.0 200 OK
+		[last_Via:]
+		[last_From:]
+		[last_To:];tag=[call_number]
+		[last_Call-ID:]
+		[last_CSeq:]
+		Contact: sip:[field0 line="[$line]"]@[local_ip]:[local_port]
+		Content-Length: 0
+
+		]]>
+	</send>
+	
+	<recv request="ACK" optional="false"/>
+	<recv request="BYE" optional="false" timeout="10000"/>
+
+	<send>
+		<![CDATA[
+
+		SIP/2.0 200 OK
+		[last_Via:]
+		[last_From:]
+		[last_To:];tag=[call_number]
+		[last_Call-ID:]
+		[last_CSeq:]
+		Contact: sip:[field0 line="[$line]"]@[local_ip]:[local_port]
+		Content-Length: 0
+
+		]]>
+	</send>
+
+
+</scenario>
+

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/cdr/app_dial_G_flag/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/app_dial_G_flag/test.lua?view=auto&rev=472
==============================================================================
--- asterisk/trunk/tests/cdr/app_dial_G_flag/test.lua (added)
+++ asterisk/trunk/tests/cdr/app_dial_G_flag/test.lua Fri Jul  9 11:08:25 2010
@@ -1,0 +1,52 @@
+require "cdr"
+
+function sipp_exec(scenario, name, host, port)
+	host = host or "127.0.0.1" 
+	port = port or "5060"
+	local inf = "data.csv"
+	local p = proc.exec_io("sipp",
+	"127.0.0.1",
+	"-m", "1",
+	"-sf", scenario,
+	"-inf", "sipp/" .. inf,
+	"-infindex", inf, "0",
+	"-i", host,
+	"-p", port,
+	"-timeout", "30",
+	"-timeout_error",
+	"-set", "user", name,
+	"-set", "file", inf
+	)
+
+	posix.sleep(1)
+	return p
+end
+
+function sipp_check_error(p, scenario)
+	local res, err = proc.perror(p:wait())
+
+	if not res then error(err) end
+	if res ~= 0 then 
+		error("error while executing " .. scenario .. " sipp scenario (sipp exited with status " .. res .. ")\n" .. p.stderr:read("*a"))
+	end
+	
+	return res, err
+end
+
+-- start asterisk
+print("starting asterisk")
+a = ast.new()
+a:load_config("configs/extensions.conf")
+a:load_config("configs/sip.conf")
+a:generate_manager_conf()
+a:spawn()
+	
+s1 = check("error starting sipp", sipp_exec("sipp/wait-for-call.xml", "test1", "127.0.0.2"))
+s2 = check("error starting sipp", sipp_exec("sipp/call.xml", "test2", "127.0.0.3"))
+
+sipp_check_error(s1, "wait-for-call.xml")
+sipp_check_error(s2, "call.xml")
+
+c = check("error loding cdr", cdr.new(a))
+fail_if(c:len() ~= 2, "expected 2 cdr records, found " .. c:len())
+

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/test.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/test.lua
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/cdr/app_dial_G_flag/test.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list