That&#39;s a little much to explain over email.<div>maybe you should just study the code a little and look at examples in switch_ivr_async.c<br><br><div class="gmail_quote">On Tue, Jul 27, 2010 at 6:25 AM, Achim Stamm <span dir="ltr">&lt;<a href="mailto:stamm@lyth.de">stamm@lyth.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
thanks for your reply.<br>
I found a Core Library called Media Bugs with several functions.<br>
How can i use this functions ?<br>
Can you give me an example using media bugs.<br>
Whats the difference between using hooks and using media bugs?<br>
<br>
regards<br>
<br>
Achim Stamm<br>
<br>
<br>
Anthony Minessale schrieb:<br>
<div class="im">&gt; You can&#39;t, that&#39;s all wrong.<br>
&gt;<br>
&gt; look for media bugs.<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Jul 26, 2010 at 5:08 AM, Achim Stamm &lt;<a href="mailto:stamm@lyth.de">stamm@lyth.de</a><br>
</div><div><div></div><div class="h5">&gt; &lt;mailto:<a href="mailto:stamm@lyth.de">stamm@lyth.de</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Hello!<br>
&gt;<br>
&gt;     I have following problem:<br>
&gt;     My current session is connected to my own module which uses the<br>
&gt;     freeswitch API doing Read and write frames in the while loop.<br>
&gt;     I want bridge my current session to make an outbound call within<br>
&gt;     my while loop.<br>
&gt;     The calling of method bridge runs in a thread using modificated bgapi.<br>
&gt;     The outbounded phone rings and after picking it up the reading and<br>
&gt;     writing of frames is done only by freeswitch core and not any more<br>
&gt;     in my while<br>
&gt;     loop. But after bridging I want to keep control over reading and<br>
&gt;     writing<br>
&gt;     frames.<br>
&gt;<br>
&gt;     How can i gain control back or keep it over reading and writing<br>
&gt;     frames after bridging ?<br>
&gt;<br>
&gt;     A solution may be to run an extension instead of making the call<br>
&gt;     in while loop.<br>
&gt;     How can i execute an extension with<br>
&gt;     switch_core_session_execute_exten ?<br>
&gt;<br>
&gt;     Here is a snippet of my Dialplan:<br>
&gt;<br>
&gt;     &lt;extension name=&quot;Caller&quot;&gt;<br>
&gt;          &lt;condition field=&quot;destination_number&quot; expression=&quot;^1000$&quot;&gt;<br>
&gt;                 &lt;action application=&quot;answer&quot;/&gt;<br>
&gt;                     &lt;action application=&quot;info&quot;/&gt;<br>
&gt;                     &lt;action application=&quot;set&quot;<br>
&gt;     data=&quot;hangup_after_bridge=false&quot;/&gt;<br>
&gt;                     &lt;action application=&quot;set&quot;<br>
&gt;     data=&quot;ignore_early_media=true&quot;/&gt;<br>
&gt;                     &lt;action application=&quot;myapplication&quot;<br>
&gt;     data=&quot;DoingReadAndWriteFrames&quot;/&gt;<br>
&gt;          &lt;/condition&gt;<br>
&gt;        &lt;/extension&gt;<br>
&gt;<br>
&gt;     Here is a snippet of my DoingReadAndWriteFrames from myapplication:<br>
&gt;<br>
&gt;     static switch_status_t DoingBridge(switch_core_session_t *session,<br>
&gt;     switch_input_args_t *args)<br>
&gt;     {<br>
&gt;            switch_codec_t codec = { 0 };<br>
&gt;            switch_status_t status;<br>
&gt;            switch_frame_t *read_frame;<br>
&gt;            switch_channel_t *channel =<br>
&gt;     switch_core_session_get_channel(session);<br>
&gt;            switch_stream_handle_t dstream = { 0 };<br>
&gt;<br>
&gt;            // Bridge to phone in a thread:<br>
&gt;            SWITCH_STANDARD_STREAM(dstream);<br>
&gt;            mybg_bridge(&quot;user/<a href="mailto:1012@192.168.1.30">1012@192.168.1.30</a><br>
</div></div>&gt;     &lt;mailto:<a href="mailto:1012@192.168.1.30">1012@192.168.1.30</a>&gt;&quot; ,60, session, &amp;dstream);<br>
<div class="im">&gt;<br>
&gt;            while (switch_channel_ready(channel))<br>
&gt;            {<br>
&gt;                    // Read Frame :<br>
&gt;                    status = switch_core_session_read_frame(session,<br>
&gt;     &amp;read_frame, SWITCH_IO_FLAG_NONE, 0);<br>
&gt;                    ...<br>
&gt;<br>
&gt;      CControlThirdPartyApplication::getInstance().setAudio(session,vucInAudio);<br>
&gt;<br>
&gt;                    // Write Frame :<br>
&gt;                    vucOutAudio =<br>
&gt;     CControlThirdPartyApplication::getInstance().getAudio(session);<br>
&gt;                    ...<br>
&gt;                    switch_status_t tstatus_caller =<br>
&gt;     switch_core_session_write_frame(session, read_frame,<br>
&gt;     SWITCH_IO_FLAG_NONE, 0);<br>
&gt;<br>
&gt;                    // Make Outbound Call:<br>
&gt;                    string dialNumber =<br>
&gt;     CControlThirdPartyApplication::getInstance().getDialNumber(session);<br>
&gt;                    if (!dialNumber.empty())<br>
&gt;                    {<br>
&gt;                            // @ ToDo Dial outbound:<br>
&gt;                            // execute another extension (&quot;Test&quot;), that<br>
&gt;     is doing our outbound call ??:<br>
&gt;<br>
&gt;      switch_core_session_execute_exten(session,&quot;Test&quot;,&quot;XML&quot;,&quot;default&quot;);<br>
&gt;                            // or Bridge to dialNumber in a thread:<br>
&gt;                            //SWITCH_STANDARD_STREAM(dstream);<br>
&gt;                            dialNumber = &quot;user/&quot; + dialNumber;<br>
&gt;                            dialNumber = dialNumber + &quot;@<a href="http://192.168.1.30" target="_blank">192.168.1.30</a><br>
</div>&gt;     &lt;<a href="http://192.168.1.30" target="_blank">http://192.168.1.30</a>&gt;&quot;;<br>
<div class="im">&gt;                            mybg(dialNumber.c_str(), 60, session,<br>
&gt;     &amp;dstream);<br>
&gt;                            // if dialNumber pickup, than freeswitch<br>
&gt;     core read and write frames ?? I want control over read and write frame<br>
&gt;                    }<br>
&gt;            }<br>
&gt;     }<br>
&gt;<br>
&gt;     regards<br>
&gt;<br>
&gt;     Achim Stamm<br>
&gt;<br>
&gt;     --<br>
&gt;     Achim Stamm, Dipl.-Inform. (FH)<br>
&gt;<br>
&gt;<br>
&gt;     Lyncker &amp; Theis GmbH<br>
&gt;     Wilhelmstr. 16<br>
&gt;     65185 Wiesbaden<br>
&gt;     Germany<br>
&gt;<br>
&gt;     Fon +49 611/9006951<br>
&gt;     Fax +49 611/9406125<br>
&gt;<br>
&gt;<br>
&gt;     Handelsregister: HRB 23156 Amtsgericht Wiesbaden<br>
&gt;     Steuernummer: 04323897052<br>
&gt;     USt-IdNr.: DE255806399<br>
&gt;<br>
&gt;     Geschäftsführer:<br>
&gt;     Filip Lyncker,<br>
&gt;     Armin Theis<br>
&gt;<br>
&gt;<br>
&gt;     _______________________________________________<br>
&gt;     FreeSWITCH-dev mailing list<br>
&gt;     <a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
</div>&gt;     &lt;mailto:<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a>&gt;<br>
<div class="im">&gt;     <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
&gt;     UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
&gt;     <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Anthony Minessale II<br>
&gt;<br>
&gt; FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>
&gt; ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
&gt; Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br>
&gt;<br>
&gt; AIM: anthm<br>
&gt; <a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>
</div>&gt; &lt;mailto:<a href="mailto:MSN%253Aanthony_minessale@hotmail.com">MSN%3Aanthony_minessale@hotmail.com</a>&gt;<br>
<div class="im">&gt; GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
</div>&gt; &lt;mailto:<a href="mailto:PAYPAL%253Aanthony.minessale@gmail.com">PAYPAL%3Aanthony.minessale@gmail.com</a>&gt;<br>
&gt; IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> &lt;<a href="http://irc.freenode.net" target="_blank">http://irc.freenode.net</a>&gt; #freeswitch<br>
<div class="im">&gt;<br>
&gt; FreeSWITCH Developer Conference<br>
&gt; <a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br>
</div>&gt; &lt;mailto:<a href="mailto:sip%253A888@conference.freeswitch.org">sip%3A888@conference.freeswitch.org</a>&gt;<br>
<div class="im">&gt; <a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
</div>&gt; &lt;mailto:<a href="mailto:googletalk%253Aconf%252B888@conference.freeswitch.org">googletalk%3Aconf%2B888@conference.freeswitch.org</a>&gt;<br>
&gt; pstn:+19193869900<br>
&gt; ------------------------------------------------------------------------<br>
<div><div></div><div class="h5">&gt;<br>
&gt; _______________________________________________<br>
&gt; FreeSWITCH-dev mailing list<br>
&gt; <a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
<br>
<br>
--<br>
Achim Stamm, Dipl.-Inform. (FH)<br>
<br>
<br>
Lyncker &amp; Theis GmbH<br>
Wilhelmstr. 16<br>
65185 Wiesbaden<br>
Germany<br>
<br>
Fon +49 611/9006951<br>
Fax +49 611/9406125<br>
<br>
<br>
Handelsregister: HRB 23156 Amtsgericht Wiesbaden<br>
Steuernummer: 04323897052<br>
USt-IdNr.: DE255806399<br>
<br>
Geschäftsführer:<br>
Filip Lyncker,<br>
Armin Theis<br>
<br>
<br>
_______________________________________________<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900<br>
</div>