AGI without answer call

Hi all and thanks for your attention. Is many time that i not write in Asterisk Forum and i see today the new “forum dress”.
Here is my first post, i signup today.
About my question: is possible execute an AGI script (PHP AGI in my case) without answare a call?
My asterisk is connected with another PBX trought SIP channel, like an extension of the other PBX.
Thi extension is part of a GROUP and when from the primary PBX i call the group, other extension ring and the call come in my asterisk to.
My PHP AGI script only make an API call to a WEB Server with the caller ID in the link.
I desire that the PHP AGI run but the call is not answered from asterisk, so the other extension continue ring.
Is this possible?
Thanks.
Mauro.

Why not just try? However, there wouldn’t be much point in having an Answer command if it wasn’t.

Thanks David551.
Sorry for my poor english, but … sure i try … and the AGI script works, but answer the call and the other extension stop to ring:

/etc/asterisk/extensions_custom.conf

[from-xxx]
exten => _.,1,AGI(yyy.php)
exten => _.,n,Wait(60)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup

my AGI-PHP script /var/lib/asterisk/agi-bin/yyy.php

#!/usr/bin/php -q

<html>
<head>
<title>WebServices Call</title>

<?php

$now = date("Y-m-d H:i:s");
$timestamp = strtotime($now);
set_time_limit(30);
require('phpagi.php');
$agi = new AGI();
; $agi->answer();
$callerID = $agi->request["agi_callerid"];

$ch = curl_init("https://www.oooo.com/ticket.asp?telefono=$callerID");

curl_exec($ch);
curl_close($ch);

?>

Like you can see, i comment $agi->answer(); too, but it answer the call anyway.

David551
When i answer you i see one BIG mistake that i do … in PHP the comment is not with “;” but is with "/*"
So, when i comment in the right way the line $agi->answer(); all work: the AGI Script do the WEB Server API call and other extension continue ringing.
New Code:

#!/usr/bin/php -q

<html>
<head>
<title>WebServices Call</title>

<?php

$now = date("Y-m-d H:i:s");
$timestamp = strtotime($now);
set_time_limit(30);
require('phpagi.php');
$agi = new AGI();
/* $agi->answer(); */
$callerID = $agi->request["agi_callerid"];

$ch = curl_init("https://www.oooo.com/ticket.asp?telefono=$callerID");


curl_exec($ch);
curl_close($ch);

?>

Thank you very much.
Mauro.

Glad to hear that, but I cannot see any reason to use AGI here; it looks to me as though this can all be done directly from the dialplan.

1 Like

Really David?
And how i can do this? You can put me in the right direction?
Thanks.

https://www.voip-info.org/wiki/view/Asterisk+cmd+Curl

1 Like

Nice, intresting.
Thank you another time david551.
Mauro.