I've done it ;) This is what i did:
In the Macro: [macro-check-call-limit-mercurios] 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,Set(toagi=1);en este caso la llamada no la cuelga la macro como en endpoints la cuelga el agi. exten => forbidden,n,Hangup() Then, in the AGI: AGI: $AGI->exec(Macro,"check-call-limit-mercurios"); $limitada = $AGI->get_variable('toagi'); if ($limitada eq '1'){ $AGI->verbose("Superado el limite de llamadas salientes out.agi tira el canal"); $AGI->hangup($chann); } # # By the way, is it necessary to Hangup the Macro if the AGI is already doing this? BR ;) 2010/9/3 Steve Edwards <asterisk....@sedwards.com> > 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 sedwa...@sedwards.com Voice: +1-760-468-3867 PST > Newline Fax: +1-760-731-3000 > > -- > _____________________________________________________________________ > -- 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 > -- Salu2
-- _____________________________________________________________________ -- 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