[asterisk-users] How to finish an AGI

Steve Edwards asterisk.org at sedwards.com
Thu Sep 2 19:20:11 CDT 2010


On Thu, 2 Sep 2010, Danny Dias wrote:

> Sorry for my poor explanation...what i'm trying to do is to invoke a Macro from my AGI, like this:
> 
> $agi->exec("Macro","check-call-limit");
> 
> 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
> 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:
> 
> [macro-check-call-limit]
> exten => s,1,Set(group_name=out_calls_user_${SIPCHANINFO(peername)})
> exten => s,n,Set(GROUP()=${group_name})
> exten => s,n,GotoIf($[${GROUP_COUNT(${group_name})} > ${MAX_OUT_CALLS_PER_USER}] forbidden,1)
> ; EXITO:
> exten => s,n,MacroExit
> ; FRACASO:
> exten => forbidden,1,NoOp(*** llamada saliente bloqueada: el usuario ${SIPCHANINFO(peername)} tiene actualmente ${MATH(${GROUP_COUNT(${group_name})})-1,int)} llamadas
> salientes)
> exten => forbidden,n,Hangup(21)  ; ISUP 21 = SIP 403 (Forbidden)

The concept of calling a macro from within an AGI seem convoluted, but may 
work. I've never tried it.

Any particular reason you don't want to put the logic of the macro in your 
AGI?

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000


More information about the asterisk-users mailing list