smalltalk
/
osmo-st-sip
Archived
1
0
Fork 0

callagent: Test the parser a bit more

This commit is contained in:
Holger Hans Peter Freyther 2011-06-13 19:56:35 +02:00
parent df11de6c31
commit 3c3e759093
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,50 @@
"
(C) 2011 by Holger Hans Peter Freyther
All Rights Reserved
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"
PackageLoader fileInPackage: 'PetitParserTests'.
PP.PPCompositeParserTest subclass: SIPParserTest [
<comment: 'I excercise the SIPParser a bit'>
parserClass [
<category: 'accessing'>
^ 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: <sip:1000@on-waves.com>;tag=MzQ4NTQ0MTg2NzIyNDEwNjkyNjY_', crlf,
'To: <sip:9198@172.16.1.72>;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" <sip:9198@172.16.1.72>;party=calling;privacy=off;screen=no', crlf, crlf.
res := self parse: data.
self assert: res asDatagram = data.
]
]

View File

@ -16,6 +16,8 @@
<test>
<sunit>Osmo.SIPGrammarTest</sunit>
<sunit>Osmo.SIPParserTest</sunit>
<filein>grammar/SIPGrammarTest.st</filein>
<filein>callagent/SIPParserTest.st</filein>
</test>
</package>