Call file - Connect two calls

Hey guys I got this code and right now what it does it only calls the one extension.

[code]<?php
// Change the values below to reflect your setup
$remote_ip=$_SERVER[“REMOTE_ADDR”];

$this_ip = “192.168.0.201”;
$asterisk_outgoing = “/var/spool/asterisk/outgoing/”;
$asterisk_tmp = “/tmp/”;
$asterisk_toext = “5”; // the extension you want to call.

$asterisk_cid = “DOMOFON”; // the from caller id you’d like to display.

if ($remote_ip == $this_ip){
// create the file in a temp location
$file = “/$asterisk_tmp/call.txt”;
$call = fopen($file, ‘w’) or die(“can’t open file”);
$data = “Channel: SIP/$asterisk_toext\nExtension: s\nCallerID: $asterisk_cid\nWaitTime: 15”;
fwrite($call, $data);
fclose($call);

    // chmod, chown and chgrp the file to asterisk:asterisk
    chmod ("/$asterisk_tmp/arduino_call.txt", 0666);
    chown ("/$asterisk_tmp/arduino_call.txt", "asterisk");
    chgrp ("/$asterisk_tmp/arduino_call.txt", "asterisk");

    // move the file to /var/spool/asterisk/outgoing
    rename("/$asterisk_tmp/call.txt", "/$asterisk_outgoing/call.call");

}
else{
//Denied
echo “unauthorized access”;
}
?>[/code]

What I’d like it to do now is call two numbers and connect them. I can’t manage to make it work

The structure is like this for just 1 call now and it hangs up should I answer:

$data = “Channel: SIP/$asterisk_toext\nExtension: s\nCallerID: $asterisk_cid\nWaitTime: 15”;

I can’t work our what you are trying to do. Your call file calls two devices, one in terms of an extension and one directly by the device name.