callagent: Change the command to set the SDP file as such.
This commit is contained in:
parent
a0dbcd42e2
commit
e84e9ce915
|
@ -61,14 +61,14 @@ Object subclass: MGCPCommand [
|
|||
^ params ifNil: [params := OrderedCollection new]
|
||||
]
|
||||
|
||||
sdpAdd: line [
|
||||
sdp: aRecord [
|
||||
<category: 'private'>
|
||||
self sdp add: line.
|
||||
sdp := aRecord.
|
||||
]
|
||||
|
||||
sdp [
|
||||
<category: 'private'>
|
||||
^ sdp ifNil: [sdp := OrderedCollection new]
|
||||
^ sdp
|
||||
]
|
||||
|
||||
asDatagram [
|
||||
|
@ -92,13 +92,8 @@ Object subclass: MGCPCommand [
|
|||
"write optional SDP"
|
||||
sdp ifNotNil: [
|
||||
out
|
||||
cr; nl.
|
||||
|
||||
sdp do: [:each |
|
||||
out
|
||||
nextPutAll: each;
|
||||
cr; nl.
|
||||
].
|
||||
cr; nl;
|
||||
nextPutAll: sdp.
|
||||
].
|
||||
|
||||
^ out contents
|
||||
|
|
|
@ -34,8 +34,35 @@ TestCase subclass: MGCPCommandTest [
|
|||
^ self trunk endpointAt: 20.
|
||||
]
|
||||
|
||||
exampleSDP [
|
||||
<category: 'private'>
|
||||
^ (WriteStream on: String new)
|
||||
nextPutAll: 'v=0'; cr; nl;
|
||||
nextPutAll: 'o=- 258696477 0 IN IP4 172.16.1.107'; cr; nl;
|
||||
nextPutAll: 'c=IN IP4 172.16.1.107'; cr; nl;
|
||||
nextPutAll: 't=0 0'; cr; nl;
|
||||
nextPutAll: 'm=audio 6666 RTP/AVP 127'; cr; nl;
|
||||
nextPutAll: 'a=rtpmap:127 GSM-EFR/8000/1'; cr; nl;
|
||||
nextPutAll: 'a=ptime:20'; cr; nl;
|
||||
nextPutAll: 'a=recvonly'; cr; nl;
|
||||
nextPutAll: 'm=image 4402 udptl t38'; cr; nl;
|
||||
nextPutAll: 'a=T38FaxVersion:0'; cr; nl;
|
||||
nextPutAll: 'a=T38MaxBitRate:14400'; cr; nl;
|
||||
contents
|
||||
]
|
||||
|
||||
exampleMDCX [
|
||||
^ (WriteStream on: String new)
|
||||
nextPutAll: 'MDCX 808080 14@mgw MGCP 1.0'; cr; nl;
|
||||
nextPutAll: 'C: 4a84ad5d25f'; cr; nl;
|
||||
nextPutAll: 'L: p:20, a:GSM-EFR, nt:IN'; cr; nl;
|
||||
nextPutAll: 'M: recvonly'; cr; nl;
|
||||
cr; nl;
|
||||
nextPutAll: self exampleSDP;
|
||||
contents
|
||||
]
|
||||
|
||||
exampleCRCX [
|
||||
| crnl |
|
||||
^ (WriteStream on: String new)
|
||||
nextPutAll: 'CRCX 808080 14@mgw MGCP 1.0'; cr; nl;
|
||||
nextPutAll: 'C: 4a84ad5d25f'; cr; nl;
|
||||
|
@ -80,6 +107,22 @@ TestCase subclass: MGCPCommandTest [
|
|||
self assert: (trunk endpointAt: 31) timeslot = 31.
|
||||
]
|
||||
|
||||
testMDCXWithSDP [
|
||||
| mdcx trans |
|
||||
|
||||
trans := MGCPTransaction on: self endpoint of: self callagent.
|
||||
trans transactionId: '808080'.
|
||||
mdcx := (MGCPMDCXCommand createMDCX: self endpoint callId: '4a84ad5d25f')
|
||||
parameterAdd: 'L: p:20, a:GSM-EFR, nt:IN';
|
||||
parameterAdd: 'M: recvonly';
|
||||
sdp: self exampleSDP;
|
||||
yourself.
|
||||
trans command: mdcx.
|
||||
|
||||
mdcx asDatagram printNl.
|
||||
self assert: mdcx asDatagram = self exampleMDCX.
|
||||
]
|
||||
|
||||
tearDown [
|
||||
self callagent stop.
|
||||
]
|
||||
|
|
Reference in New Issue