From 115842f0e808a11b0610a4a38b403a130fa35873 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 14 Jun 2011 18:23:33 +0200 Subject: [PATCH] callagent: Make it possible to run on a different port --- callagent/SIPCallAgent.st | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/callagent/SIPCallAgent.st b/callagent/SIPCallAgent.st index 01519bd..ff9c3b4 100644 --- a/callagent/SIPCallAgent.st +++ b/callagent/SIPCallAgent.st @@ -67,6 +67,11 @@ Object subclass: SIPTransport [ ^ self subclassResponsibility ] + port [ + + ^ self subclassResponsibility + ] + type [ ^ self class type @@ -83,21 +88,30 @@ SIPTransport subclass: SIPUdpTransport [ ^ 'UDP' ] - SIPUdpTransport class >> startOn: anAddress [ + SIPUdpTransport class >> startOn: anAddress port: aPort [ ^ (self new) - initialize: anAddress; + initialize: anAddress port: aPort; yourself ] + SIPUdpTransport class >> startOn: anAddress [ + ^ self startOn: anAddress port: 5060. + ] + address [ ^ socket address ] - initialize: anAddress [ - socket := Sockets.DatagramSocket local: anAddress port: 5060. + port [ + + ^ socket port + ] + + initialize: anAddress port: aPort [ + socket := Sockets.DatagramSocket local: anAddress port: aPort. socket bufferSize: 2048; addToBeFinalized. @@ -161,8 +175,8 @@ Object subclass: SIPUserAgentBase [ generateVia: aBranch [ - ^ 'SIP/2.0/%1 %2;branch=%3' % - {transport type. transport address. aBranch} + ^ 'SIP/2.0/%1 %2:%3;branch=%4' % + {transport type. transport address. transport port. aBranch} ] generateCSeq [