[asterisk-commits] mmichelson: testsuite/asterisk/trunk r3283 - in /asterisk/trunk/tests/channel...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 26 11:38:30 CDT 2012


Author: mmichelson
Date: Tue Jun 26 11:38:26 2012
New Revision: 3283

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3283
Log:
Stiffen a bouncy non-Digium presence subscription test.

This greatly simplifies the non-Digium presence test. Now, instead
of calling a second SIP peer in order to change device state, we just
use a custom device state. The subscriber now only expects one device
state NOTIFY instead of two. This reduction in SIP traffic and complexity
should make the test not bounce any more.


Removed:
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml
Modified:
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/extensions.conf
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/sip.conf
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/subscribe.xml
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml

Modified: asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/extensions.conf?view=diff&rev=3283&r1=3282&r2=3283
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/extensions.conf Tue Jun 26 11:38:26 2012
@@ -1,6 +1,6 @@
 [default]
 
-exten => bob,hint,SIP/bob,CustomPresence:bob
+exten => bob,hint,Custom:bob,CustomPresence:bob
 exten => bob,1,Noop
 
 exten => away,1,Answer
@@ -8,8 +8,6 @@
 same => n,UserEvent(Presence)
 same => n,Hangup
 
-exten => available,1,Answer
-same => n,Set(PRESENCE_STATE(CustomPresence:bob)=available)
+exten => callbob,1,Answer
+same => n,Set(DEVICE_STATE(Custom:bob)=INUSE)
 same => n,Hangup
-
-exten => callbob,1,Dial(SIP/bob)

Modified: asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/sip.conf?view=diff&rev=3283&r1=3282&r2=3283
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/sip.conf (original)
+++ asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/sip.conf Tue Jun 26 11:38:26 2012
@@ -7,9 +7,3 @@
 host=127.0.0.1
 port=5061
 allowsubscribe=yes
-
-[bob]
-type=peer
-host=127.0.0.1
-port=5062
-callcounter=yes

Modified: asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test?view=diff&rev=3283&r1=3282&r2=3283
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test Tue Jun 26 11:38:26 2012
@@ -26,17 +26,11 @@
     '-s' : 'bob',
 }
 
-BOB_SCENARIO = {
-    'scenario' : 'bob.xml',
-    '-p' : '5062',
-}
-
 class NominalStateChange(TestCase):
     def __init__(self):
         TestCase.__init__(self)
         self.create_asterisk()
         self.sipTest = SIPpScenario(TEST_DIR, SIPP_SUBSCRIBE)
-        self.bobTest = SIPpScenario(TEST_DIR, BOB_SCENARIO)
         self.sippPassed = False
         self.notifyPassed = True
 
@@ -44,32 +38,25 @@
         self.sippPassed = True
         reactor.stop()
 
-    def sippComplete(self, result):
-        # The first sipp scenario completed. Now to hang up bob's channel
-        self.ami[0].hangup("SIP/bob-00000000").addCallback(self.testComplete)
-
     def originateComplete(self, ami, event):
         # We successfully set presence, now let's change device state
         # so the SIPp test can conclude
         if event.get("userevent") != "Presence":
             return
 
-        df = ami.originate(channel = "Local/callbob at default", application
-                = "Echo")
-        df.addErrback(self.handleOriginateFailure)
+        ami.originate(channel = "Local/callbob at default", application
+                = "Echo").addErrback(self.handleOriginateFailure)
 
     def runSippTest(self):
-        self.bobTest.run(self)
-        df = self.sipTest.run(self)
-        df.addCallback(self.sippComplete)
+        self.sipTest.run(self).addCallback(self.testComplete)
 
-        df = self.ami[0].originate(channel = "Local/away at default", application = "Echo")
-        df.addErrback(self.handleOriginateFailure)
+        self.ami[0].originate(channel = "Local/away at default", application =
+                "Echo").addErrback(self.handleOriginateFailure)
 
     def inspectPresence(self, ami, event):
         # For this test, we expect none of these events.
         # If we get any, we fail.
-        if event.get("state") != "DIGIUM_PRESENCE_SENT":
+        if event.get("state") == "DIGIUM_PRESENCE_SENT":
             return
 
         logger.error("Unexpected Digium Presence NOTIFY received")

Modified: asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/subscribe.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/subscribe.xml?view=diff&rev=3283&r1=3282&r2=3283
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/subscribe.xml (original)
+++ asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/subscribe.xml Tue Jun 26 11:38:26 2012
@@ -88,24 +88,6 @@
     ]]>
   </send>
 
-  <!-- NOTIFY indicating answered state -->
-  <recv request="NOTIFY" crlf="true" />
-
-  <send>
-    <![CDATA[
-
-      SIP/2.0 200 OK
-      [last_Via:]
-      [last_From:]
-      [last_To:]
-      [last_Call-ID:]
-      [last_CSeq:]
-      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
-      Content-Length: 0
-
-    ]]>
-  </send>
-
   <send retrans="500">
     <![CDATA[
 

Modified: asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml?view=diff&rev=3283&r1=3282&r2=3283
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml Tue Jun 26 11:38:26 2012
@@ -1,7 +1,9 @@
 testinfo:
     summary: 'Test Reception of Digium custom presence'
     description: |
-        'Subscribe to presence and get notified of presence changes'
+        'Subscribe to presence and device state from a device without
+        a "Digium" User-agent header. Ensure that Presence updates are not
+        sent but that the device state updates are sent.'
 
 properties:
     minversion: '11.0.0'




More information about the asterisk-commits mailing list