From 1a634a1492f31647ce714c50cfae38c9d61f9d57 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 22 Apr 2014 14:33:37 +0200 Subject: [PATCH] identity: Remove use the "contact" and userString from SIPIdentity The code allows (and that looks like a good thing) to have a different from and username in the authorization. The userString was not really right as it was missing the URL part (sip/sips) and the splitting was broken as well. --- callagent/SIPIdentity.st | 24 +----------------------- callagent/session/SIPCall.st | 11 +++-------- callagent/tests/SIPIdentityTest.st | 29 ----------------------------- package.xml | 2 -- 4 files changed, 4 insertions(+), 62 deletions(-) delete mode 100644 callagent/tests/SIPIdentityTest.st diff --git a/callagent/SIPIdentity.st b/callagent/SIPIdentity.st index 5cb7ddc..da600f4 100644 --- a/callagent/SIPIdentity.st +++ b/callagent/SIPIdentity.st @@ -17,25 +17,12 @@ " Object subclass: SIPIdentity [ - | contact hostname username password proxyUsername proxyPassword | + | hostname username password proxyUsername proxyPassword | - SIPIdentity class >> fromUserString: aString [ - | split | - split := aString subStrings: '@'. - ^self new - username: split first; - hostname: split second; - yourself - ] - - contact: aContact [ - contact := aContact - ] - username: aUsername [ username := aUsername ] @@ -75,13 +62,4 @@ Object subclass: SIPIdentity [ proxyPassword [ ^proxyPassword ifNil: [password] ] - - userString [ - ^contact ifNil: [ - (WriteStream on: String new) - nextPutAll: username; - nextPut: $@; - nextPutAll: hostname; - contents] - ] ] diff --git a/callagent/session/SIPCall.st b/callagent/session/SIPCall.st index c0ea48d..27c74f6 100644 --- a/callagent/session/SIPCall.st +++ b/callagent/session/SIPCall.st @@ -51,19 +51,14 @@ will simply ignore everything but the first dialog.'> ] ] - SIPCall class >> fromIdenity: anIdentity host: aHost port: aPort to: aTo on: aUseragent [ + SIPCall class >> fromIdenity: aUser identity: anIdentity host: aHost port: aPort to: aTo on: aUseragent [ ^ self - on: ((SIPDialog fromUser: anIdentity userString host: aHost port: aPort) + on: ((SIPDialog fromUser: aUser host: aHost port: aPort) to: aTo; identity: anIdentity; yourself) useragent: aUseragent ] SIPCall class >> fromUser: aUser host: aHost port: aPort to: aTo on: aUseragent [ - | identity | - - identity := aUseragent mainIdentity copy - contact: aUser; - yourself. - ^self fromIdenity: identity host: aHost port: aPort to: aTo on: aUseragent + ^self fromIdenity: aUser identity: aUseragent mainIdentity host: aHost port: aPort to: aTo on: aUseragent ] state [ diff --git a/callagent/tests/SIPIdentityTest.st b/callagent/tests/SIPIdentityTest.st deleted file mode 100644 index fedc6ce..0000000 --- a/callagent/tests/SIPIdentityTest.st +++ /dev/null @@ -1,29 +0,0 @@ -" - (C) 2014 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 . -" - -TestCase subclass: SIPIdentityTest [ - - - - testFromUserString [ - | res | - res := SIPIdentity fromUserString: '1234@10.23.24.1'. - self assert: res username equals: '1234'. - self assert: res hostname equals: '10.23.24.1'. - ] -] diff --git a/package.xml b/package.xml index 3e55e49..69fd77b 100644 --- a/package.xml +++ b/package.xml @@ -68,7 +68,6 @@ Osmo.SIPCallAgentTest Osmo.SIPDigestTest Osmo.SIPRegisterTransactionTest - Osmo.SIPIdentityTest grammar/SIPGrammarTest.st callagent/tests/SIPParserTest.st callagent/tests/Tests.st @@ -76,6 +75,5 @@ callagent/tests/SIPDigestTest.st callagent/tests/SIPTransportMock.st callagent/tests/SIPRegisterTransactionTest.st - callagent/tests/SIPIdentityTest.st