Call Bridge using phpagi

Hello Team,

I am trying to bridge 2 calls using phpgi, find below my phpagi code, I am stuck at trying to get the channel object for the 2nd call executed from the phpagi script.

Can anyone assist?

#!/usr/bin/php
<?php 
//set_time_limit(30);
require('phpagi.php');
error_reporting(E_ALL);

$agi = new AGI();

$calleridnum    = $agi->request['agi_callerid'];
$callerid       = $agi->request['agi_callerid'];
$callidname     = $agi->request['agi_calleridname'];
$phoneno        = $agi->request['agi_dnid'];
$channel        = $agi->request['agi_channel'];
$uniqueid       = $agi->request['agi_uniqueid'];


$dd = $agi->exec("Dial","SIP/ICNGwP/07061140114","555");
 

$agi->verbose("|--1---".$calleridnum."----|");
$agi->verbose("|--2---".$callerid."----|");
$agi->verbose("|--3---".$callidname."----|");
$agi->verbose("|--4---".$phoneno."----|");
$agi->verbose("|--5---".$channel."----|");
$agi->verbose("|--6---".$uniqueid."----|");



$dialstatus = $agi -> get_variable("DIALSTATUS");
$ds = $agi -> get_variable("STATUS");

$ch=$agi->request['agi_channel'];

if($dialstatus[data]=="ANSWER")
{
	$agi->verbose("|---------------------------".$dialstatus[data]."---------------TIME TO BRIDGE ----------------------------------------------------|");

	//$agi->exec("Bridge $ch");
	$agi->verbose("|-------------------$ch-----------------------BRIDGE DONE---------------------$channel-------------------------------|");

}

I have used the PHPAGI class but not for AMI related stuff. If you provide more details of what you are trying to do, I could try to help you.

HI,

I want to Bridge 2 Calls using PHPAGI

  1. Party A calls an IVR script
  2. IVR Script calls Party B
  3. IVR Script Connects Party A to Party B.

This is what I want to achieve.

Let’s see if I understood

alice(A) call to an IVR on Asterisk. Then this IVR call to Bob and then bridge Alice and Bob (B) ?

Yes,

How can I achieve this?

[quote=“ambiorixg12”]Let’s see if I understood

alice(A) call to an IVR on Asterisk. Then this IVR call to Bob and then bridge Alice and Bob (B) ?[/quote]

How does this differ from a simple IVR ending in the DIal application to both call Bob and bridge Alice to them?

Why do you need to use AGI at all?

I don’t know what special function does your IVR script, But the above statement can be achieve, as David55 says, a simple IVR ending in the Dial application

Hello Friends,

Can you share a code to achieve this?
The reason I want to go through IVR/PHPAGI is that i need the PartyA to enter a pin number that must be verified before calling Party B.

Any working code samples will be apreciated.

Michael

You dont need PHPAGI for this task, you can do this using Read() and ExecIF() or GotoIf() Logic, This is really simple…

Hi,

I have not done something like this before, can you help with some code/conf sample?

there are multiples examples on the webs and a lot of help resources , Start reading and learning and come back after you have read the information of the below links

the-asterisk-book.com/1.6/applik … -read.html
asteriskdocs.org/en/2nd_Edit … ECT-3.html
voip-info.org/wiki/view/Asterisk+cmd+ExecIf

I wonder if he is re-inventing DISA?

DISA?

there is a point where i have to confirm the pin number entered, so i have to interface with a Database, can I do this without AGI?

Here is an output of what I have so far, its getting bridged, but there is no audio in or out

== Using SIP RTP CoS mark 5
    -- Executing [5555@default:1] Goto("SIP/50.62.149.238-0038c3c8", "goinone,s,1") in new stack
    -- Goto (goinone,s,1)
    -- Executing [s@goinone:1] Answer("SIP/50.62.149.238-0038c3c8", "500") in new stack
    -- Executing [s@goinone:2] AGI("SIP/50.62.149.238-0038c3c8", "roll.php,s,mikeosake") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/roll.php
    -- AGI Script Executing Application: (Dial) Options: (SIP/ICNGwP/07061140114)
  == Using SIP RTP CoS mark 5
    -- Called SIP/ICNGwP/07061140114
    -- SIP/ICNGwP-0038c3c9 is making progress passing it to SIP/50.62.149.238-0038c3c8
[Feb  6 21:31:35] NOTICE[30677][C-00395733]: res_rtp_asterisk.c:3671 ast_rtp_read: Unknown RTP codec 126 received from '192.168.1.3:58650'
    -- SIP/ICNGwP-0038c3c9 is ringing
    -- SIP/ICNGwP-0038c3c9 is making progress passing it to SIP/50.62.149.238-0038c3c8
    -- SIP/ICNGwP-0038c3c9 answered SIP/50.62.149.238-0038c3c8
    -- Remotely bridging SIP/50.62.149.238-0038c3c8 and SIP/ICNGwP-0038c3c9

Solved this,
It was an issue with X-Lite.

It works as expected now

core show application disa

Direct Inward System Access (DISA)