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

callagent: Manually parse the 'tag' from a to...

This should be done through the grammar instead.
This commit is contained in:
Holger Hans Peter Freyther 2011-06-14 01:48:14 +02:00
parent 88e451670c
commit 8330ad52d6
2 changed files with 26 additions and 0 deletions

View File

@ -63,6 +63,7 @@ Object subclass: SIPDialog [
toTag: aTag [
<category: 'accessing'>
to_tag := aTag
]
callId [
@ -100,4 +101,26 @@ Object subclass: SIPDialog [
destPort [
^ dest_port
]
updateFromRequest: aReq [
to_tag ifNil: [
| to pos tag|
to := aReq parameter: 'To' ifAbsent: [^false].
pos := to indexOf: ';tag=' matchCase: true startingAt: 1.
pos ifNil: [^self].
tag := WriteStream on: (String new).
(pos last + 1) to: to size do: [:pos |
(to at: pos) = $; ifTrue: [
to_tag := tag contents.
^ self
].
tag nextPut: (to at: pos).
].
to_tag := tag contents.
]
]
]

View File

@ -110,6 +110,9 @@ Object subclass: SIPTransaction [
<category: 'dispatch'>
('Found response %1 %2' % {aReq code. aReq phrase}) printNl.
dialog updateFromRequest: aReq.
code := aReq code asInteger.
code < 200 ifTrue: [
^ self respNotification: aReq