diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-06-24 19:24:03 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-06-24 20:08:23 +0200 |
commit | 557986c4f2ee48a4542debc3d24e20a3e83157ab (patch) | |
tree | 79a4c6e093caf55ad0fc21ec89e73aeeb3f9ead4 | |
parent | 9c5b73d4c6130d3780b40e0f2043fb3553345a09 (diff) |
callagent: Fix the parsing of responses without SDP part
-rw-r--r-- | callagent/MGCPResponse.st | 5 | ||||
-rw-r--r-- | callagent/Tests.st | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/callagent/MGCPResponse.st b/callagent/MGCPResponse.st index babcff6..4ecbf24 100644 --- a/callagent/MGCPResponse.st +++ b/callagent/MGCPResponse.st @@ -59,6 +59,11 @@ Object subclass: MGCPResponse [ | str | <category: 'creation'> + aDict isNil ifTrue: [ + sdp := nil. + ^ self + ]. + str := WriteStream on: (String new). aDict second do: [:each | str diff --git a/callagent/Tests.st b/callagent/Tests.st index 3990aed..a021e47 100644 --- a/callagent/Tests.st +++ b/callagent/Tests.st @@ -295,4 +295,13 @@ PP.PPCompositeParserTest subclass: MGCPParserTest [ self assert: res sdp = sdp. self assert: (res parameterAt: 'I' ifAbsent: []) = '233434'. ] + + testFailureResp [ + | nl res | + nl := Character cr asString, Character nl asString. + res := self parse: '400 32323 OK', nl. + + self deny: res isSuccess. + self assert: res sdp isNil. + ] ] |