I have been working on this for a while today, and still no luck. This is my script:<br><br>#!/usr/bin/php<br>&lt;?php<br>$errno=0;<br>$errstr=0;<br>$fp = fsockopen (&quot;localhost&quot;,5038,$errno,$errstr,20);<br>if (!$fp) {<br>
        echo &quot;$errstr ($errno)&lt;br&gt;\n&quot;;<br>} else {<br><br>         fputs($fp, &quot;Action: Login\r\n&quot;);<br>         fputs($fp, &quot;Username: xxxx\r\n&quot;);<br>         fputs($fp, &quot;Secret: xxxx\r\n&quot;);<br>
         fputs($fp, &quot;Events: off\r\n&quot;);<br>        sleep(1);<br>         fputs($fp, &quot;Action: Originate\r\n&quot;);<br>         fputs($fp, &quot;Channel: SIP/trunk/1DIDNumber\r\n&quot;);<br>         fputs($fp, &quot;Context: CallContext\r\n\r\n&quot;);<br>
         fputs($fp, &quot;Exten: NumberToCall\r\n&quot;);<br>         fputs($fp, &quot;Priority: 1\r\n&quot;);<br>         fputs($fp, &quot;Timeout: 30000\r\n&quot;);<br>        sleep(2);<br>        fclose($fp);<br><br>}<br>
?&gt;<br><br>It seems simple enough, And I have no compilation errors. This is my output:<br><br> -- Launched AGI Script /var/lib/asterisk/agi-bin/MyScript.php<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_request: MyScript.php<br>
&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_channel: SIP/xx.xx.xxx.xx-00000111<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_language: en<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_type: SIP<br>
&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_uniqueid: 1281390000.000<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_version: 1.6.2.6<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_callerid: 1PhoneThatCalled The DID<br>
&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_calleridname: unknown<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_callingpres: 0<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_callingani2: 0<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_callington: 0<br>
&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_callingtns: 0<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_dnid: IncomingExt<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_rdnis: unknown<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_context: default<br>
&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_extension: incomingExt<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_priority: 3<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_enhanced: 0.0<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_accountcode:<br>
&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; agi_threadid: -1237000000<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt;<br>  == Manager &#39;Man&#39; logged on from 127.0.0.1<br>  == Manager &#39;Man&#39; logged off from 127.0.0.1<br>
&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Rx &lt;&lt;<br>&lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Tx &gt;&gt; 510 Invalid or unknown command<br>[Aug  9 17:44:10] ERROR[25594]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe<br>
[Aug  9 17:44:10] ERROR[25594]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe<br>    -- &lt;SIP/xx.xx.xxx.xx-00000111&gt;AGI Script MyScript.php completed, returning 0<br><br>Could someone please point me in the right direction?<br>
<br><br><br><div class="gmail_quote">On Mon, Aug 9, 2010 at 11:15 AM, Danny Nicholas <span dir="ltr">&lt;<a href="mailto:danny@debsinc.com">danny@debsinc.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">









<div link="blue" vlink="blue" lang="EN-US">

<div>

<div>

<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>
[mailto:<a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>] <b><span style="font-weight: bold;">On Behalf Of </span></b>Kathryn Jones<br>
<b><span style="font-weight: bold;">Sent:</span></b> Monday, August 09, 2010
11:22 AM<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [asterisk-users]
Connecting two calls with Originate</span></font></p>

</div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<div><div class="im">

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">On Mon, Aug 9, 2010 at 10:00 AM, Danny Nicholas &lt;<a href="mailto:danny@debsinc.com" target="_blank">danny@debsinc.com</a>&gt; wrote:</span></font></p>


<div link="blue" vlink="purple">

<div>

<div>

<p class="MsoNormal"><b><font size="2" color="navy" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; color: navy; font-weight: bold;">&gt;</span></font></b><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">&gt;From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>
[mailto:<a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>]
<b><span style="font-weight: bold;">On Behalf Of </span></b>Kathryn Jones<br>
<font color="navy"><span style="color: navy;">&gt;</span></font>&gt;<b><span style="font-weight: bold;">Subject:</span></b> [asterisk-users] Connecting two
calls with Originate</span></font></p>

</div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<div>

<p class="MsoNormal"><font size="3" color="navy" face="Times New Roman"><span style="font-size: 12pt; color: navy;">&gt;&gt;</span></font>Hello list!!<br>
<br>
<font color="navy"><span style="color: navy;">&gt;&gt;</span></font>I want to
connect an open call with an extension. I call in with a DID, them redirect to
the extension using AGI. Can I use agi&#39;s originate to make the second call <font color="navy"><span style="color: navy;">&gt;&gt;</span></font>without dropping the
first DID call? How would I go about this?</p>

</div>

<p class="MsoNormal"><font size="3" color="navy" face="Times New Roman"><span style="font-size: 12pt; color: navy;">&lt;snip&gt;</span></font></p>

<div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
<font color="navy"><span style="color: navy;">&gt;&gt;</span></font>I am not having
much luck, am I going about this the wrong way? Thanks in advance for your
replies.</span></font></p>

</div>

<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">-&gt;Assuming
that you’re not trying to dial back out on the same line, this should not be
problematic.  The AGI originate is not necessarily aware that it is
working in tandem with an existing call.  The “Channelopendidcall” is the
“wrong way” part of this equation.  For example, if the call comes in on
DAHDI/1-1, you can’t use DAHDI/1-1 </span></font></p>

<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">to open a second call whilst it is active;  you can make a
call on DAHDI/1-2 and join the 2 together.</span></font><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"></span></font></p>

</div>

</div>

</div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&gt;Wow, that was
fast. Thanks for your reply!!!<div class="im"><br>
&gt;So if I were to do:<br>
<br>
&gt;Action: login<br>
&gt;Username: xxxx<br>
&gt;Secret: xxxx<br>
&gt;Events: off<br>
<br>
&gt;Action: Originate<br>
&gt;Channel: SIP/trunk<br>
&gt;Context: context-for-second-call<br>
&gt;Exten: secondCall<br>
&gt;Priority: 1<br>
&gt;Callerid: CallerID<br>
&gt;Timeout: 30<br>
<br>
&gt;I could connect the 2 calls?<br>
<br>
</div><font color="navy"><span style="color: navy;">As best as I know, yes this should
work. You are actually creating a “new leg” with the originate, but the net
effect is a joined call.</span></font></span></font></p>

</div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

</div>

</div>


<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br>