summaryrefslogtreecommitdiffstats
path: root/callagent/tests/SIPCallAgentTest.st
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-10 19:22:33 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-10 19:49:05 +0200
commit1e43d02ed39d926714ee68b213bfbe234f395d1e (patch)
tree4e7d39becefb6faef386399f0e3c6a7dc63c916a /callagent/tests/SIPCallAgentTest.st
parentdf79f4c46949379f263db8d10392059428af7bbd (diff)
transaction: ACK the 401 Unauthorized message before we change
So this code acks the 401 Unauthorized message. It is possible that this message is lost on the way we will not be able to respond to the 401 again. The right thing would be to "fork" off the transaction to deal with re-transmissions.
Diffstat (limited to 'callagent/tests/SIPCallAgentTest.st')
-rw-r--r--callagent/tests/SIPCallAgentTest.st22
1 files changed, 17 insertions, 5 deletions
diff --git a/callagent/tests/SIPCallAgentTest.st b/callagent/tests/SIPCallAgentTest.st
index d8c3441..c1d151a 100644
--- a/callagent/tests/SIPCallAgentTest.st
+++ b/callagent/tests/SIPCallAgentTest.st
@@ -194,8 +194,12 @@ TestCase subclass: SIPCallAgentTest [
transport inject: (self authorizationRequired: branch callId: callId tag: fromTag tag).
"Verify that a second message has been sent and it contains an auth result"
- self assert: sent size equals: 2.
+ self assert: sent size equals: 3.
msg := SIPParser parse: sent second data.
+ self assert: msg class verb equals: 'ACK'.
+
+ msg := SIPParser parse: sent third data.
+ self assert: msg class verb equals: 'INVITE'.
secondBranch := (msg parameter: 'Via' ifAbsent: [nil]) branch.
self deny: branch = secondBranch.
self assert: (msg parameter: 'CSeq' ifAbsent: [-1]) number equals: 2.
@@ -233,8 +237,12 @@ TestCase subclass: SIPCallAgentTest [
transport inject: (self authorizationRequired: branch callId: callId tag: fromTag tag).
"Verify that a second message has been sent and it contains an auth result"
- self assert: sent size equals: 2.
+ self assert: sent size equals: 3.
msg := SIPParser parse: sent second data.
+ self assert: msg class verb equals: 'ACK'.
+
+ msg := SIPParser parse: sent third data.
+ self assert: msg class verb equals: 'INVITE'.
branch := (msg parameter: 'Via' ifAbsent: [nil]) branch.
self assert: (msg parameter: 'CSeq' ifAbsent: [-1]) number equals: 2.
self assert: call state equals: SIPCall stateInvite.
@@ -272,8 +280,12 @@ TestCase subclass: SIPCallAgentTest [
transport inject: (self proxyAuthRequired: branch callId: callId tag: fromTag tag cseq: 1).
"Verify that a second message has been sent and it contains an auth result"
- self assert: sent size equals: 2.
+ self assert: sent size equals: 3.
msg := SIPParser parse: sent second data.
+ self assert: msg class verb equals: 'ACK'.
+
+ msg := SIPParser parse: sent third data.
+ self assert: msg class verb equals: 'INVITE'.
secondBranch := (msg parameter: 'Via' ifAbsent: [nil]) branch.
self deny: branch = secondBranch.
self assert: (msg parameter: 'CSeq' ifAbsent: [-1]) number equals: 2.
@@ -296,8 +308,8 @@ TestCase subclass: SIPCallAgentTest [
"Inject a 200 and check the ACK"
transport inject: (self ok: secondBranch callId: callId tag: fromTag tag cseq: 2).
- self assert: sent size equals: 3.
- msg := SIPParser parse: sent third data.
+ self assert: sent size equals: 4.
+ msg := SIPParser parse: (sent at: 4) data.
self assert: (msg parameter: 'CSeq' ifAbsent: [-1]) number equals: 2.
self assert: call state equals: SIPCall stateSession.
auth := msg parameter: 'Proxy-Authorization' ifAbsent: [nil].