<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/en/2160/3/7/_/styles/combined.css?spaceKey=TOP&forWysiwyg=true" type="text/css">
</head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
<h2><a href="https://wiki.asterisk.org/wiki/display/TOP/Media+Operations">Media Operations</a></h2>
<h4>Page <b>added</b> by <a href="https://wiki.asterisk.org/wiki/display/~mmichelson">Mark Michelson</a>
</h4>
<br/>
<div class="notificationGreySide">
<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>This is a work in progress.
<p>In fact, definitely don't look at this yet. It's kind of a mess.</p></td></tr></table></div>
<h1><a name="MediaOperations-Introduction"></a>Introduction</h1>
<p>In Asterisk SCF, a "media operation" refers to a process by which media is manipulated. Common media operations would be transcoding, jitter buffering, volume adjustment, pitch shifting, and potentially media injection. What follows is a discussion of how media operations fit into the architecture of Asterisk SCF, and how they can be used.</p>
<h1><a name="MediaOperations-AsteriskSCFwithoutmediaoperations"></a>Asterisk SCF without media operations</h1>
<p>Without media operations, Asterisk SCF's media handling is straightforward, but not very effective. Each session is equipped with media stream sources and sinks. A stream source is where audio comes from, and a stream sink is where audio is sent. The bridging component can simply connect a source from one session to a sink of another session and everything works. This can quickly become a problem if two sessions are incapable of speaking the same media format to each other.</p>
<h1><a name="MediaOperations-Classificationofmediaoperations"></a>Classification of media operations</h1>
<p>Media operations can be categorized as follows:</p>
<ul>
        <li>Transforming</li>
        <li>Adjusting</li>
</ul>
<p>Transforming media operations are those whose purpose is to change the format of media arriving into something else. This may mean changing to a new media format, or it may mean changing the parameters of the current format. Examples of transforming media operations would be transcoding and resampling.</p>
<p>Adjusting media operations are those that make a change to the media without changing its compatibility in any way. Examples of adjusting media operations are jitter buffering and volume adjusting.</p>
<h1><a name="MediaOperations-Useofmediaoperations"></a>Use of media operations</h1>
<p>Media operations are valid to use anywhere that media exists. In practice, this means that there are two levels at which media operations may be used:</p>
<ul>
        <li>Session level. Session level media operations will affect media to and/or from a specific session. This can be useful for operations that should not affect all parties in a bridged call. If a conference participant has hearing issues, then it may be good to place a volume adjustment media operation for media going to his session.</li>
</ul>
<ul>
        <li>Bridge level. Bridge level media operations will affect media to and/or from all sessions involved in a particular bridge. This type will be more rare.</li>
</ul>
<p>How does a session or bridge know to use media operations? There are two ways to use them:</p>
<ul>
        <li>Configuration. Endpoints and bridges may be configured to have specific media operations placed on their sessions or bridges by default.</li>
        <li>Hooks. Session creation hooks and bridge creation hooks are ways to dynamically insert media operations for a session or bridge.</li>
</ul>
<h1><a name="MediaOperations-Mediaoperationslice"></a>Media operation slice</h1>
<p>Note: A good amount of this is derived from <a href="https://wiki.asterisk.org/wiki/display/~khunt/Media+Operations+supporting+Single+Streams" class="external-link" rel="nofollow">https://wiki.asterisk.org/wiki/display/~khunt/Media+Operations+supporting+Single+Streams</a></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">interface MediaOperation
{
/**
* Get stream source(s) for this operation.
*/
AsteriskSCF::Media::V1::StreamSourceSeq getSources();
/**
* Get stream sink(s) for this operation
*/
AsteriskSCF::Media::V1::StreamSinkSeq getSinks();
};</pre>
</div></div>
<p>The MediaOperation is straightforward. It simply provides sources and sinks for media. Someone simply can write to a media operation sink and have new audio come out one of the sources.</p>
<p>So how does one actually acquire a media operation? Via the service locator of course! Media operations have a bit more to ask of than simply a category.</p>
</div>
<div id="commentsSection" class="wiki-content pageSection">
<div style="float: right;" class="grey">
<a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=TOP">Stop watching space</a>
<span style="padding: 0px 5px;">|</span>
<a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
<a href="https://wiki.asterisk.org/wiki/display/TOP/Media+Operations">View Online</a>
|
<a href="https://wiki.asterisk.org/wiki/display/TOP/Media+Operations?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>