The MediaStream resource owns the creation and management of a media connection between the remote media endpoint and the PowerMedia WMS. This resource defines the following:
Audio and video codecs used
IP Address and ports of both the remote and local endpoints
Various media related properties associated with the media connection
<mediastream
identifier="<identifier>" appid="<appid>"
href="http://server/dialogicwebservice/mediacontrol/mediastreams/<identifier>"
clientipaddress="<clientip>" serveripaddress="<serverip>">
<audio codec="<codec>" clientport="<port>" serverport="<port>"
payload=”<payload>” fmtp=”<fmtp>”
enable2833=”<boolean>” frames per packet="<frames per packet>"
jitter depth="<jitter depth>" payload2833="<payload2833>" type="<type>"/>
<video codec="<codec>" clientport="<port>" serverport="<port>"
payload=”<payload>” fmtp=”<fmtp>” frames per packet="<frames per packet>"
jitter depth="<jitter depth>" type="<type>"/>
</mediastream>
Name |
Description |
Type |
Input / Output |
Optional / Mandatory |
identifier |
Unique identifier assigned to the specific instance of the resource. This identifier is used by the web service client when performing actions on the resource. |
String |
Output |
N/A |
appid |
Unique application id included in the original HTTP POST creation process that is utilized by the web service such that clients only have access to resources that they created. |
String |
Output |
N/A |
href |
An HTTP reference to the specific resource. |
String |
Output |
N/A |
clientipaddress |
IP Address of the remote media endpoint. |
IP Address |
Input / Output |
Mandatory |
serveripaddress |
IP Address of the PowerMedia WMS. |
IP Address |
Output |
N/A |
audio codec |
Audio codec being utilized for this particular MediaStream. Values: ulaw, alaw, g711, g723, g726, g729, amr |
String |
Input / Output |
Mandatory |
audio clientport |
The port on which the remote endpoint will be receiving audio. |
String
|
Input / Output |
Mandatory |
audio serverport |
The port on which the PowerMedia WMS will be receiving audio. |
String
|
Output |
N/A |
audio payload |
RTP payload type associated with audio codec. See RFC 3550. |
String |
Input / Output |
Optional |
audio fmtp |
Miscellaneous “fmtp” parameters for audio codec. |
String |
Input / Output |
Optional |
audio enable2833 |
Enable RFC 2833 digit detection. Values: True or False Default: False |
String
|
Input / Output |
Optional |
audio payload2833 |
RTP payload ID of generated 2833 events. Values: 96 to 127 Default: 101 |
String |
Input / Output |
Optional |
audio type |
Determines the direction of the RTP stream. Values: sendonly, sendrecv, recvonly Default: sendrecv |
String |
Input / Output |
Optional |
audio jitter depth |
Jitter buffer size (frames). Default: 2 |
String |
Input / Output |
Optional |
audio frame per packet |
Frames sent per packet. Default: 2 |
String |
Input / Output |
Optional |
video codec |
Video codec being utilized for this particular MediaStream. Values: h263, h264, h263-1998, h263-2000 |
String |
Input / Output |
Mandatory |
video clientport |
The port on which the remote endpoint will be receiving video. |
String |
Input / Output |
Mandatory |
video serverport |
The port on which the PowerMedia WMS will be receiving video. |
String |
Output |
N/A |
video payload |
Payload number associated with video codec. |
String |
Input / Output |
Optional |
video fmtp |
Miscellaneous “fmtp” parameters for video codec. |
String |
Input / Output |
Optional |
video type |
Determines the direction of the RTP stream. Values: sendonly, sendrecv, recvonly Default: sendrecv |
String |
Input / Output |
Optional |
video jitter depth |
Jitter buffer size (frames). Default: 2 |
String |
Input / Output |
Optional |
video frame per packet |
Frames sent per packet. Default: 2 |
String |
Input / Output |
Optional |
The following diagram illustrates the MediaStream creation process.

The following diagram illustrates the MediaStream deletion process.

public boolean CreateMediaStream(String callId, String clientIPAddress,
int clientAudioPort, int clientVideoPort,
String audioCodec, String audioPayload,String audioFmtp, String enable2833,
String videoCodec, String videoPayload, String videoFmtp)
{
logger.info("MediaSession::CreateMediaStream - Entered.");
boolean result = false;
String WMSAudioCodec = "";
if (audioCodec.contentEquals("pcmu")) {
WMSAudioCodec = "ulaw";
}
String requestBody = "<mediastream " +
"clientipaddress=\"" + clientIPAddress + "\" " +
"serveripaddress=\"" + MainSipServlet.WMSHost + "\">\r\n" +
"\t<audio codec=\"" + WMSAudioCodec + "\" clientport=\"" +
clientAudioPort + "\" " +
"payload=\"" + audioPayload + "\" " +
"fmtp=\"" + audioFmtp + "\" " +
"enable2833=\"" + enable2833 + "\"/>\r\n";
if (videoCodec.length() > 0) {
requestBody = requestBody +
"\t<video codec=\"" + videoCodec + "\" clientport=\"" +
clientVideoPort + "\" " +
"payload=\"" + videoPayload + "\" " +
"fmtp=\"" + videoFmtp + "\" " +
"/>\r\n";
}
requestBody = requestBody + "</mediastream>";
//Create a HttpURLConnection with the correct server
//Send request and retrieve response
HttpURLConnection connection = utils.SendHTTPRequest("http://" +
MainSipServlet.WMSHost +
":81/DialogicWebService/mediacontrol/mediastreams",
"POST",
requestBody);
if (connection != null) {
xmlDoc = utils.GetHTTPXMLResponse(connection);
}
//Retrieve response codes
int responseCode = 0;
try {
responseCode = connection.getResponseCode();
} catch (IOException ex) {
Logger.getLogger(MediaSession.class.getName()).log(Level.SEVERE,null,ex);
logger.info("MediaSession::CreateMediaStream - Exited.");
return result;
}
String responseMessage = "";
try {
responseMessage = connection.getResponseMessage();
} catch (IOException ex) {
Logger.getLogger(MediaSession.class.getName()).log(Level.SEVERE,null,ex);
logger.info("MediaSession::CreateMediaStream - Exited.");
return result;
}
String responseLocation = connection.getHeaderField("location");
//close the connection
connection.disconnect();
//log results
logger.info("MediaSession::CreateMediaStream - Http response code ="
+ responseCode);
logger.info("MediaSession::CreateMediaStream - Http response message ="
+ responseMessage);
logger.info("MediaSession::CreateMediaStream - Http response location ="
+ responseLocation);
if (responseCode == 201) {
this.callId = callId;
mediaStreamRef = responseLocation;
identifier = ParseIdentifier();
collector.Create(identifier, Collector.IdentifierType.MEDIASTREAM);
result = true;
}
logger.info("MediaSession::CreateMediaStream - Exited.");
return result;
}