diff options
Diffstat (limited to 'pharo-porting/changes_for_pharo.st')
-rw-r--r-- | pharo-porting/changes_for_pharo.st | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pharo-porting/changes_for_pharo.st b/pharo-porting/changes_for_pharo.st index e36fa58..9de32d1 100644 --- a/pharo-porting/changes_for_pharo.st +++ b/pharo-porting/changes_for_pharo.st @@ -9,6 +9,11 @@ SIPURandom class extend [ <category: 'random'> ^(RAND rand: 4) asInteger ] + + nextFourBytes [ + <category: 'random'> + ^RAND rand: 4 + ] ] SIPUserAgentBase class extend [ @@ -17,6 +22,32 @@ SIPUserAgentBase class extend [ "For pharo just use the random we have" ^(RAND rand: 4) asInteger abs ] + + generateBranch [ + | data | + data := '<1p>,<2p>' expandMacrosWithArguments: + {DateTime now asUTC asSeconds. + (RAND rand: 2) asInteger}. + ^ self branchStart, (SIPBase64 encode: data). + ] +] + +SIPUserAgentBase extend [ + generateVia: aBranch [ + <category: 'ids'> + "For Pharo assume that transport address is a string" + ^ (WriteStream on: String new) + nextPutAll: 'SIP/2.0/'; + nextPutAll: transport type; + nextPutAll: ' '; + nextPutAll: transport address; + nextPutAll: ':'; + nextPutAll: transport port asString; + nextPutAll: ';branch='; + nextPutAll: aBranch; + nextPutAll: ';rport'; + contents. + ] ] SIPQuotedStringParser extend [ |