misc: Use String>>#expandMacrosWith.. for the random helpers
These generate random strings so it is difficult to unit test. But the invocation worked: st> Osmo.SIPRandomHelper generateTag 'MzU0MjIxMTQ1OTIzODI1ODc3NjU_' st> Osmo.SIPRandomHelper generateCallId 'MTk3MTU3OTAxOA__@xiaoyu' st> Osmo.SIPUserAgent generateBranch 'z9hG4bKMzU0MjIwNDM2Myw0MjIxNg__'
This commit is contained in:
parent
06285b7135
commit
2e1967c49b
|
@ -169,7 +169,8 @@ Object subclass: SIPUserAgentBase [
|
|||
|
||||
SIPUserAgentBase class >> generateBranch [
|
||||
| data |
|
||||
data := '%1,%2' % {DateTime now asUTC asSeconds. Random between: 0 and: 99999}.
|
||||
data := '<1p>,<2p>' expandMacrosWithArguments:
|
||||
{DateTime now asUTC asSeconds. Random between: 0 and: 99999}.
|
||||
^ self branchStart, (SIPBase64 encode: data).
|
||||
]
|
||||
|
||||
|
|
|
@ -65,12 +65,12 @@ Object subclass: SIPRandomHelper [
|
|||
|
||||
SIPRandomHelper class >> generateTag [
|
||||
<category: 'random'>
|
||||
^ SIPBase64 encode: '%1%2' % {
|
||||
DateTime now asSeconds. SIPURandom nextInt}
|
||||
^ SIPBase64 encode: ('<1p><2p' expandMacrosWithArguments:
|
||||
{DateTime now asSeconds. SIPURandom nextInt})
|
||||
]
|
||||
|
||||
SIPRandomHelper class >> generateCallId [
|
||||
^ '%1@%2' % {
|
||||
^ '<1s>@<2s>' expandMacrosWithArguments: {
|
||||
SIPBase64 encode: SIPURandom nextInt asString.
|
||||
Sockets.SocketAddress localHostName.}
|
||||
]
|
||||
|
|
Reference in New Issue