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

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.
This commit is contained in:
Holger Hans Peter Freyther 2014-04-22 14:33:37 +02:00
parent e89ddfa07a
commit 1a634a1492
4 changed files with 4 additions and 62 deletions

View File

@ -17,25 +17,12 @@
"
Object subclass: SIPIdentity [
| contact hostname username password proxyUsername proxyPassword |
| hostname username password proxyUsername proxyPassword |
<category: 'OsmoSIP-authorization'>
<comment: 'I represent a local identity that initiated a session
or similar'>
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]
]
]

View File

@ -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 |
<category: 'creation'>
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 [

View File

@ -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 <http://www.gnu.org/licenses/>.
"
TestCase subclass: SIPIdentityTest [
<category: 'OsmoSIP-Tests'>
<comment: 'I do test some basics of the SIPIdentity class'>
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'.
]
]

View File

@ -68,7 +68,6 @@
<sunit>Osmo.SIPCallAgentTest</sunit>
<sunit>Osmo.SIPDigestTest</sunit>
<sunit>Osmo.SIPRegisterTransactionTest</sunit>
<sunit>Osmo.SIPIdentityTest</sunit>
<filein>grammar/SIPGrammarTest.st</filein>
<filein>callagent/tests/SIPParserTest.st</filein>
<filein>callagent/tests/Tests.st</filein>
@ -76,6 +75,5 @@
<filein>callagent/tests/SIPDigestTest.st</filein>
<filein>callagent/tests/SIPTransportMock.st</filein>
<filein>callagent/tests/SIPRegisterTransactionTest.st</filein>
<filein>callagent/tests/SIPIdentityTest.st</filein>
</test>
</package>