<?php // call.php // Copy to /var/www/html // Initiate a Two Party Call // Syntax http://AAH.Box.IP/call.php?from=1111111111&to=2222222222 // 1111111111 = From Phone Number // 2222222222 = To Phone Number // Change sip/telasip with your Prefered Trunk // // Add the Following to extensions_custom.conf, change 5 with your prefered runk number // [two-party-call] // exten => s,1,Playback(pls-wait-connect-call) // exten => s,2,Macro(dialout-trunk,5,${CALLERIDNUM},) // exten => s,3,Macro(outisbusy) $fromnumber=strtolower($_REQUEST['from']); $pos=strpos ($fromnumber,"local"); $tonumber=strtolower($_REQUEST['to']); if ($fromnumber == null) : exit() ; endif ; if ($pos===false) : $errno=0 ; $errstr=0 ; $fp = fsockopen ("localhost", 5038, &$errno, &$errstr, 20); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs ($fp, "Action: login\r\n"); fputs ($fp, "Username: phpagi\r\n"); fputs ($fp, "Secret: phpagi\r\n"); fputs ($fp, "Events: off\r\n\r\n"); sleep(1) ; fputs ($fp, "Action: Originate\r\n"); fputs ($fp, "Channel: sip/telasip/$fromnumber\r\n"); fputs ($fp, "Callerid: $tonumber\r\n"); fputs ($fp, "Context: two-party-call\r\n"); fputs ($fp, "Extension: s\r\n"); fputs ($fp, "Priority: 1\r\n\r\n"); sleep(2) ; fclose ($fp); } echo "$fromnumber should be ringing now." ; else : exit() ; endif ; ?>