diff --git a/callagent/SIPIdentity.st b/callagent/SIPIdentity.st index 43d4f0b..8e2d432 100644 --- a/callagent/SIPIdentity.st +++ b/callagent/SIPIdentity.st @@ -48,10 +48,10 @@ Object subclass: SIPIdentity [ ] proxyUsername [ - ^proxyUsername + ^proxyUsername ifNil: [username] ] proxyPassword [ - ^proxyPassword + ^proxyPassword ifNil: [password] ] ] diff --git a/callagent/session/SIPSessionBase.st b/callagent/session/SIPSessionBase.st index bc4a15d..2cadbad 100644 --- a/callagent/session/SIPSessionBase.st +++ b/callagent/session/SIPSessionBase.st @@ -17,7 +17,7 @@ " Object subclass: SIPSessionBase [ - | rem ua initial_dialog dialog next_cseq | + | rem ua identity initial_dialog dialog next_cseq | ^ self new useragent: aUseragent; + identity: aUseragent mainIdentity; initialDialog: aDialog; yourself ] @@ -37,7 +38,7 @@ a proper session.'> initial_dialog := aDialog. initial_dialog contact: ('sip:<1s>@<2p>:<3p>' - expandMacrosWith: ua username with: ua transport address with: ua transport port). + expandMacrosWith: identity username with: ua transport address with: ua transport port). ] useragent: aUseragent [ @@ -45,6 +46,11 @@ a proper session.'> ua := aUseragent ] + identity: anIdentity [ + + identity := anIdentity + ] + callId [ ^ initial_dialog callId diff --git a/callagent/transactions/SIPTransaction.st b/callagent/transactions/SIPTransaction.st index 82f8034..1906805 100644 --- a/callagent/transactions/SIPTransaction.st +++ b/callagent/transactions/SIPTransaction.st @@ -18,7 +18,7 @@ Object subclass: SIPTransaction [ | sem useragent initial_dialog state timeout success failure notification - cseq branch retransmit_time fail_time removal + cseq branch retransmit_time fail_time removal identity authorization last_was_auth proxy_authorization last_was_proxy_auth | @@ -36,6 +36,7 @@ Object subclass: SIPTransaction [ ^ self new initialize; + identity: aUA mainIdentity; userAgent: aUA; initialDialog: aDialog; setupTransaction: aCseq; @@ -73,6 +74,11 @@ Object subclass: SIPTransaction [ useragent := aUA ] + identity: anIdentity [ + + identity := anIdentity + ] + state [ ^ state ifNil: [^ self class stateInitial] @@ -180,13 +186,13 @@ Object subclass: SIPTransaction [ ifFalse: [^self wrongAuth: aResp dialog: aDialog]. authorization := SIPAuthorization new - username: useragent username; + username: identity username; realm: (auth at: 'realm'); nonce: (auth at: 'nonce'); uri: initial_dialog destinationAddress; yourself. authorization - calculateResponse: useragent password + calculateResponse: identity password operation: self class operationName. "Increase CSeq and generate a new branch" @@ -221,7 +227,7 @@ Object subclass: SIPTransaction [ ifFalse: [^self wrongAuth: aResp dialog: aDialog]. proxy_authorization := SIPProxyAuthorization new - username: useragent proxyUsername; + username: identity proxyUsername; realm: (auth at: 'realm'); nonce: (auth at: 'nonce'); qop: (auth at: 'qop'); @@ -363,7 +369,7 @@ Object subclass: SIPTransaction [ proxy_authorization ifNotNil: [ proxy_authorization incrementClientNonce. proxy_authorization - calculateResponse: useragent proxyPassword + calculateResponse: identity proxyPassword operation: self class operationName. aRequest addParameter: 'Proxy-Authorization' value: proxy_authorization]. ] diff --git a/callagent/useragent/SIPUserAgent.st b/callagent/useragent/SIPUserAgent.st index 0a78336..65268e8 100644 --- a/callagent/useragent/SIPUserAgent.st +++ b/callagent/useragent/SIPUserAgent.st @@ -184,27 +184,12 @@ SIPUserAgentBase subclass: SIPUserAgent [ mainIdentity username: aUser. ] - username [ - - ^mainIdentity username - ] - password: aPass [ mainIdentity password: aPass ] - password [ - - ^mainIdentity password + mainIdentity [ + ^mainIdentity ] - - proxyUsername [ - ^mainIdentity proxyUsername ifNil: [mainIdentity username] - ] - - proxyPassword [ - ^mainIdentity proxyPassword ifNil: [mainIdentity password] - ] - ]