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

callagent: Move the respond with to the callagent class

This commit is contained in:
Holger Hans Peter Freyther 2012-08-06 00:34:14 +02:00
parent 5b870389f0
commit 5b1b3f891d
2 changed files with 21 additions and 19 deletions

View File

@ -125,23 +125,6 @@ a proper session.'>
% {self class. self callId. aRequest class verb} area: #sip.
]
replyWith: aCode phrase: aPhrase on: aRequest [
| resp via cseq |
via := aRequest parameter: 'Via' ifAbsent: [^ self].
cseq := aRequest parameter: 'CSeq' ifAbsent: [^ self].
resp := (SIPResponse code: aCode with: aPhrase)
addParameter: 'Via' value: (ua generateVia: via branch);
addParameter: 'From' value: dialog generateTo;
addParameter: 'To' value: dialog generateFrom;
addParameter: 'Call-ID' value: dialog callId;
addParameter: 'CSeq' value: '%1 BYE' % {cseq number};
addParameter: 'Allow' value: 'ACK,BYE';
yourself.
ua injectDefaults: resp.
ua queueData: resp asDatagram dialog: dialog.
]
]
SIPSessionBase subclass: SIPCall [
@ -354,7 +337,7 @@ will simply ignore everything but the first dialog.'>
(self moveToState: self class stateRemoteHangup) ifTrue: [
self logNotice: 'SIPCall(%1) session remotely terminated.'
% {self callId} area: #sip.
self replyWith: 200 phrase: 'OK' on: aRequest.
ua respondWith: 200 phrase: 'OK' on: aRequest dialog: dialog.
self unregisterDialog.
self sessionEnd.
].

View File

@ -1,5 +1,5 @@
"
(C) 2011 by Holger Hans Peter Freyther
(C) 2011-2012 by Holger Hans Peter Freyther
All Rights Reserved
This program is free software: you can redistribute it and/or modify
@ -334,4 +334,23 @@ SIPUserAgentBase subclass: SIPUserAgent [
e logException: 'Parsing error %1' % {e tag} area: #sip.
]
]
respondWith: aCode phrase: aPhrase on: aRequest dialog: dialog [
| resp via cseq |
<category: 'Sending'>
via := aRequest parameter: 'Via' ifAbsent: [^ self].
cseq := aRequest parameter: 'CSeq' ifAbsent: [^ self].
resp := (SIPResponse code: aCode with: aPhrase)
addParameter: 'Via' value: (self generateVia: via branch);
addParameter: 'From' value: dialog generateTo;
addParameter: 'To' value: dialog generateFrom;
addParameter: 'Call-ID' value: dialog callId;
addParameter: 'CSeq' value: '%1 %2' % {cseq number. cseq method};
addParameter: 'Allow' value: 'ACK,BYE';
yourself.
self injectDefaults: resp.
self queueData: resp asDatagram dialog: dialog.
]
]