2011-03-15 12:43:00 +00:00
|
|
|
"
|
|
|
|
(C) 2010-2011 by Holger Hans Peter Freyther
|
|
|
|
All Rights Reserved
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"
|
|
|
|
|
|
|
|
Object subclass: MGCPCommand [
|
|
|
|
| verb transaction endp params sdp|
|
2011-06-10 10:05:01 +00:00
|
|
|
<comment: 'I am a command send to a MGCP gateway. I know my timeout
|
|
|
|
and such. Each MGCPGateWay can have a MGCPCommand subclass to specify
|
|
|
|
certain things. E.g. the endpoint numbering is different'>
|
|
|
|
<category: 'MGCP-callagent'>
|
2011-03-15 12:43:00 +00:00
|
|
|
|
|
|
|
MGCPCommand class >> createCRCX: anEndpoint callId: aCallId transId: aTransId [
|
|
|
|
<category: 'factory'>
|
|
|
|
"I create a CRCX command for the given endpoint."
|
|
|
|
|
|
|
|
^ (self new)
|
|
|
|
initialize;
|
|
|
|
verb: 'CRCX';
|
|
|
|
transactionId: aTransId;
|
|
|
|
endpoint: (self endpointNumberToName: anEndpoint);
|
|
|
|
parameterAdd: 'M: recvonly';
|
|
|
|
parameterAdd: 'C: ', aCallId;
|
|
|
|
yourself
|
|
|
|
]
|
|
|
|
|
|
|
|
MGCPCommand class >> endpointNumberToName: aNumber [
|
|
|
|
| hex |
|
|
|
|
<category: 'format'>
|
|
|
|
<comment: 'The IPA MGW assumes endpoint numbers in hex, lowercase'>
|
|
|
|
|
|
|
|
hex := ((aNumber radix: 16) copyFrom: 4) asLowercase.
|
|
|
|
^ hex, '@mgw'
|
|
|
|
]
|
|
|
|
|
|
|
|
initialize [
|
|
|
|
sdp := OrderedCollection new.
|
|
|
|
params := OrderedCollection new.
|
|
|
|
]
|
|
|
|
|
|
|
|
verb: aVerb [
|
|
|
|
<category: 'private'>
|
|
|
|
verb := aVerb.
|
|
|
|
]
|
|
|
|
|
|
|
|
endpoint: anEndpoint [
|
|
|
|
<category: 'private'>
|
|
|
|
endp := anEndpoint.
|
|
|
|
]
|
|
|
|
|
|
|
|
transactionId: anId [
|
|
|
|
<category: 'private'>
|
|
|
|
transaction := anId.
|
|
|
|
]
|
|
|
|
|
|
|
|
asDatagram [
|
|
|
|
| end msg |
|
|
|
|
<category: 'networking'>
|
|
|
|
|
|
|
|
end := Character lf asString, Character nl asString.
|
|
|
|
msg := verb, ' ', endp, ' MGCP 1.0', end
|
|
|
|
|
|
|
|
]
|
|
|
|
]
|