callagent: Add the bye transaction...
This commit is contained in:
parent
2c8cb82c6f
commit
4d6b967b21
|
@ -19,7 +19,7 @@
|
|||
PackageLoader fileInPackage: 'Sockets'.
|
||||
|
||||
Object subclass: SIPTransaction [
|
||||
| useragent dialog state timeout success failure notification cseq branch terminated |
|
||||
| useragent dialog state timeout success failure notification cseq branch terminated t1|
|
||||
|
||||
SIPTransaction class >> stateInitial [ ^ 0 ]
|
||||
SIPTransaction class >> stateTrying [ ^ 1 ]
|
||||
|
@ -129,7 +129,7 @@ Object subclass: SIPTransaction [
|
|||
]
|
||||
|
||||
SIPTransaction subclass: SIPInviteTransaction [
|
||||
| sdp t1 ack_branch |
|
||||
| sdp ack_branch |
|
||||
<category: 'RFC3161 17.2.1'>
|
||||
|
||||
"200ms to get TRYING or OK"
|
||||
|
@ -201,3 +201,43 @@ SIPTransaction subclass: SIPInviteTransaction [
|
|||
^ super respFailure: aReq.
|
||||
]
|
||||
]
|
||||
|
||||
SIPTransaction subclass: SIPByeTransaction [
|
||||
<category: 'a bye...'>
|
||||
|
||||
SIPByeTransaction class >> createWith: aDialog on: aUA [
|
||||
^ self new
|
||||
userAgent: aUA;
|
||||
dialog: aDialog;
|
||||
setupTransaction;
|
||||
yourself.
|
||||
]
|
||||
|
||||
start [
|
||||
| bye |
|
||||
|
||||
self state = self class stateInitial ifFalse: [
|
||||
^ self error: 'Can not restart.'
|
||||
].
|
||||
|
||||
"Enter the state, remember the timeout"
|
||||
state := self class stateTrying.
|
||||
t1 := DateTime now.
|
||||
|
||||
bye := self createBye.
|
||||
self queueData: bye asDatagram.
|
||||
]
|
||||
|
||||
createBye [
|
||||
| bye |
|
||||
<category: 'invite'>
|
||||
|
||||
bye := (SIPByeRequest from: dialog)
|
||||
addParameter: 'Via' value: (useragent generateVia: branch);
|
||||
addParameter: 'CSeq' value: '%1 %2' % {cseq. 'BYE'};
|
||||
addParameter: 'Call-ID' value: dialog callId;
|
||||
yourself.
|
||||
useragent injectDefaults: bye.
|
||||
^ bye
|
||||
]
|
||||
]
|
||||
|
|
Reference in New Issue