<p>Maximilian Fridrich has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18387">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_dial: Flip stream direction of outgoing channel.<br><br>When executing dial, the topology of the incoming channel is cloned and<br>used for the outgoing channel. This creates issues when an incoming<br>stream is sendonly or recvonly as the stream state of the outgoing<br>channel will be the same as the stream state of the incoming channel.<br><br>Now the stream state is flipped for the outgoing stream in<br>dial_exec_full if the incoming stream topology is recvonly or sendonly.<br><br>ASTERISK-29655<br>Reported by: Michael Auracher<br><br>ASTERISK-29638<br>Reported by: Michael Auracher<br><br>Change-Id: I294dc834ac9a5f048b101b691669959e9df630e1<br>---<br>M apps/app_dial.c<br>1 file changed, 17 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/87/18387/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_dial.c b/apps/app_dial.c</span><br><span>index 8be6eff..7ea23f3 100644</span><br><span>--- a/apps/app_dial.c</span><br><span>+++ b/apps/app_dial.c</span><br><span>@@ -2607,9 +2607,11 @@</span><br><span> struct ast_channel *tc; /* channel for this destination */</span><br><span> char *number;</span><br><span> char *tech;</span><br><span style="color: hsl(120, 100%, 40%);">+ int i;</span><br><span> size_t tech_len;</span><br><span> size_t number_len;</span><br><span> struct ast_stream_topology *topology;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_stream *stream;</span><br><span> </span><br><span> cur = ast_strip(cur);</span><br><span> if (ast_strlen_zero(cur)) {</span><br><span>@@ -2675,6 +2677,21 @@</span><br><span> </span><br><span> ast_channel_unlock(chan);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ for (i = 0; i < ast_stream_topology_get_count(topology); ++i) {</span><br><span style="color: hsl(120, 100%, 40%);">+ stream = ast_stream_topology_get_stream(topology, i);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* For both recvonly and sendonly the stream state reflects our state, that is we</span><br><span style="color: hsl(120, 100%, 40%);">+ * are receiving only and we are sending only. Since we are requesting a</span><br><span style="color: hsl(120, 100%, 40%);">+ * channel for the peer, we need to swap this to reflect what we will be doing.</span><br><span style="color: hsl(120, 100%, 40%);">+ * That is, if we are receiving from Alice then we want to be sending to Bob,</span><br><span style="color: hsl(120, 100%, 40%);">+ * so swap recvonly to sendonly and vice versa.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_stream_get_state(stream) == AST_STREAM_STATE_RECVONLY) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_state(stream, AST_STREAM_STATE_SENDONLY);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (ast_stream_get_state(stream) == AST_STREAM_STATE_SENDONLY) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_state(stream, AST_STREAM_STATE_RECVONLY);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> tc = ast_request_with_stream_topology(tmp->tech, topology, NULL, chan, tmp->number, &cause);</span><br><span> </span><br><span> ast_stream_topology_free(topology);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18387">change 18387</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18387"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I294dc834ac9a5f048b101b691669959e9df630e1 </div>
<div style="display:none"> Gerrit-Change-Number: 18387 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Maximilian Fridrich <m.fridrich@commend.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>