<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
IMHO, is more easy in Perl that in dialplan but if for you work ......<br><br>*-------------------------------------------------------* <br>*-Edwin Quijada <br>*-Developer DataBase <br>*-JQ Microsistemas <br>
*-Soporte PostgreSQL<br>
*-www.jqmicrosistemas.com<br>*-809-849-8087<br>*-------------------------------------------------------*<br><br><br><br><br><br><hr id="stopSpelling">Date: Fri, 3 Sep 2010 10:29:02 +0200<br>From: ing.diasdanny@gmail.com<br>To: asterisk-users@lists.digium.com<br>Subject: Re: [asterisk-users] How to finish an AGI<br><br>&gt;Any particular reason you don't want to put the logic of the macro in your AGI?<br><br><div>Yes...i've no idea how to do it...it's a PERL script, i'm already checking how to do this...but it will be a little complicated :(&nbsp;<br>
<div><br></div><div><br><div class="ecxgmail_quote">2010/9/3 Steve Edwards <span dir="ltr">&lt;<a href="http://asterisk.org" target="_blank">asterisk.org</a>@<a href="http://sedwards.com" target="_blank">sedwards.com</a>&gt;</span><br><blockquote class="ecxgmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="ecxim">On Thu, 2 Sep 2010, Danny Dias wrote:<br>
<br>
</div><div class="ecxim"><blockquote class="ecxgmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Sorry for my poor explanation...what i'm trying to do is to invoke a Macro from my AGI, like this:<br>
<br>
$agi-&gt;exec("Macro","check-call-limit");<br>
<br>
If the Macro checks that the group_name is bigger than a number specified for every peer with setvar it should Hangup the call (frobidden,1 in the Gotoif...) but this<br>
is not happening, the AGI always continue with is process and it doesn´t play attention to the Hangup in the macro, the macro is here:<br>
<br>
[macro-check-call-limit]<br>
exten =&gt; s,1,Set(group_name=out_calls_user_${SIPCHANINFO(peername)})<br>
exten =&gt; s,n,Set(GROUP()=${group_name})<br>
exten =&gt; s,n,GotoIf($[${GROUP_COUNT(${group_name})} &gt; ${MAX_OUT_CALLS_PER_USER}] forbidden,1)<br>
; EXITO:<br>
exten =&gt; s,n,MacroExit<br>
; FRACASO:<br>
exten =&gt; forbidden,1,NoOp(*** llamada saliente bloqueada: el usuario ${SIPCHANINFO(peername)} tiene actualmente ${MATH(${GROUP_COUNT(${group_name})})-1,int)} llamadas<br>
salientes)<br>
exten =&gt; forbidden,n,Hangup(21) &nbsp;; ISUP 21 = SIP 403 (Forbidden)<br>
</blockquote>
<br></div>
The concept of calling a macro from within an AGI seem convoluted, but may work. I've never tried it.<br>
<br>
Any particular reason you don't want to put the logic of the macro in your AGI?<br><font color="#888888">
<br>
-- <br></font><div><div></div><div class="h5">
Thanks in advance,<br>
-------------------------------------------------------------------------<br>
Steve Edwards &nbsp; &nbsp; &nbsp; <a href="mailto:sedwards@sedwards.com">sedwards@sedwards.com</a> &nbsp; &nbsp; &nbsp;Voice: +1-760-468-3867 PST<br>
Newline &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Fax: +1-760-731-3000</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>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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>
 &nbsp; <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><br clear="all"><br>-- <br>Salu2<br><span></span><br>

</div></div>
<br>-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users                                               </body>
</html>