diff --git a/callagent/MGCPEndpoint.st b/callagent/MGCPEndpoint.st index c373e3b..d28615a 100644 --- a/callagent/MGCPEndpoint.st +++ b/callagent/MGCPEndpoint.st @@ -39,6 +39,11 @@ Object subclass: MGCPEndpoint [ ^ trunk endpointName: nr. ] + endpointNumber [ + + ^ nr + ] + multiplex [ ^ trunk multiplexFor: nr. diff --git a/callagent/Tests.st b/callagent/Tests.st index 975ce14..918ec45 100644 --- a/callagent/Tests.st +++ b/callagent/Tests.st @@ -115,8 +115,10 @@ TestCase subclass: MGCPCommandTest [ | trunk | trunk := MGCPDSTrunk createWithDest: '0.0.0.0' trunkNr: 3. + self assert: (self trunk endpointAt: 1) endpointNumber equals: 1. self assert: (self trunk endpointAt: 1) multiplex = 0. self assert: (self trunk endpointAt: 1) timeslot = 1. + self assert: (self trunk endpointAt: 31) endpointNumber equals: 31. self assert: (self trunk endpointAt: 31) multiplex = 0. self assert: (self trunk endpointAt: 31) timeslot = 31. @@ -282,6 +284,7 @@ TestCase subclass: MGCPEndpointAllocTest [ "Initial..." self assert: endp isUnused. + self assert: endp endpointNumber equals: 1. "Reserve..." endp reserve. @@ -332,6 +335,7 @@ TestCase subclass: MGCPEndpointAllocTest [ self assert: (trunk allocateEndpointIfFailure: [true]). "now free some endpoints" + self assert: (trunk endpointAt: 20) endpointNumber equals: 20. (trunk endpointAt: 20) free. (trunk endpointAt: 5) free. endp := (trunk allocateEndpointIfFailure: []).