diff --git a/callagent/SIPParserTest.st b/callagent/SIPParserTest.st index b23ce5c..7e6adaf 100644 --- a/callagent/SIPParserTest.st +++ b/callagent/SIPParserTest.st @@ -26,26 +26,30 @@ PP.PPCompositeParserTest subclass: SIPParserTest [ ^ SIPParser ] - testResponse [ - | data crlf res | - crlf := Character cr asString, Character nl asString. - data := 'SIP/2.0 480 Temporarily Unavailable', crlf, - 'Via: SIP/2.0/UDP 172.16.254.34;branch=z9hG4bKMzQ4NTQzNDgxNCwyNDE1Nw__', crlf, - 'From: ;tag=MzQ4NTQ0MTg2NzIyNDEwNjkyNjY_', crlf, - 'To: ;tag=42eBv22Fj314N', crlf, - 'Call-ID: MzY3NzE3ODgyNw__@xiaoyu', crlf, - 'CSeq: 1 INVITE', crlf, - 'User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-dff41af 2011-04-20 14-11-24 +0200', crlf, - 'Accept: application/sdp', crlf, - 'Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE', crlf, - 'Supported: timer, precondition, path, replaces', crlf, - 'Allow-Events: talk, hold, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer', crlf, - 'Reason: Q.850;cause=96;text="MANDATORY_IE_MISSING"', crlf, - 'Content-Length: 0', crlf, - 'Remote-Party-ID: "9198" ;party=calling;privacy=off;screen=no', crlf, crlf. + testResponseData [ + ^ (WriteStream on: (String new)) + nextPutAll: 'SIP/2.0 480 Temporarily Unavailable'; cr; nl; + nextPutAll: 'Via: SIP/2.0/UDP 172.16.254.34;branch=z9hG4bKMzQ4NTQzNDgxNCwyNDE1Nw__'; cr; nl; + nextPutAll: 'From: ;tag=MzQ4NTQ0MTg2NzIyNDEwNjkyNjY_'; cr; nl; + nextPutAll: 'To: ;tag=42eBv22Fj314N;abc=def;kbc;ajk'; cr; nl; + nextPutAll: 'Call-ID: MzY3NzE3ODgyNw__@xiaoyu'; cr; nl; + nextPutAll: 'CSeq: 1 INVITE'; cr; nl; + nextPutAll: 'User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-dff41af 2011-04-20 14-11-24 +0200'; cr; nl; + nextPutAll: 'Accept: application/sdp'; cr; nl; + nextPutAll: 'Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE'; cr; nl; + nextPutAll: 'Supported: timer, precondition, path, replaces'; cr; nl; + nextPutAll: 'Allow-Events: talk, hold, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer'; cr; nl; + nextPutAll: 'Reason: Q.850;cause=96;text="MANDATORY_IE_MISSING"'; cr; nl; + nextPutAll: 'Content-Length: 0'; cr; nl; + nextPutAll: 'Remote-Party-ID: "9198" ;party=calling;privacy=off;screen=no'; cr; nl; cr;nl; + contents. + ] - res := self parse: data. - self assert: res asDatagram = data. + testResponse [ + | data res | + + res := self parse: self testResponseData. + self assert: res asDatagram = self testResponseData. self assert: (res parameter: 'Via') branch = 'z9hG4bKMzQ4NTQzNDgxNCwyNDE1Nw__'. self assert: (res parameter: 'CSeq') number = 1. self assert: (res parameter: 'CSeq') method = 'INVITE'.