[asterisk-users] Passing parameter to Queue-called macro

Marie Fischer marie at vtl.ee
Thu May 10 08:07:30 CDT 2018


Hi,

maybe I am overlooking something, but channel variables should be thread safe, shouldn't they?

I am using the following (sorry, in ael):

macro dial-queue (number) {
	Set(_ORIG_UNIQUEID=${UNIQUEID});
	Queue(${number},rCt,,,${timeout},,set-dst-agent);
	..
}

// the "context macro-..." things is an ael-specific workaround to get transfer working (macro sets context to app_queue_gosub_virtual_context)
context macro-set-dst-agent {
	s => {
		Noop(${ORIG_UNIQUEID});
		&add-current-call-agent(${ORIG_UNIQUEID},${MEMBERNAME});
	}
}

macro add-current-call-agent (id,num) {
	Set(ODBC_ADD_CURRENT_AGENT(${id},${num})=1);
	return;
}

-- 

marie

On 08.05.2018, at 16:16, Stefan Viljoen <viljoens at verishare.co.za> wrote:

> Hi all
> 
> I need to pass a parameter in a thread-safe manner to the Queue pickup
> macro. This is to know when (and who) picked up an incoming call to a queue
> and log that to my back-office system with a CURL to a HTTP endpoint.
> 
> However, the Queue application does not appear to allow passing of
> parameters to the called queue pickup macro.
> 
> E. g. non-working code is:
> 
> [queuetest]
> timeout = 60
> retry = 2
> member=>SIP/testnum
> 
> [macro-verdianswer]
> exten=>s,1,NoOp(Entering Verdi answer macro)
> exten=>s,n,NoOp(Value: ${ARG1})
> exten=>s,n,MacroExit
> 
> [incomingcontext]
> 
> exten=>tstqueue,1,NoOp(Incoming call for VerDi)
> same=>n,Set(curlResult=${SHELL(/usr/src/verdi/bash/verdiIncGetUUID.sh)})
> same=>n,Set(curlResultLength=${LEN(${curlResult})})
> same=>n,NoOp(Curl result for incoming call UUID from VerDi: ${curlResult})
> same=>n,Set(CDR(accountcode)=${curlResult})
> same=>n,Set(curIncAccCode=${curlResult},g)
> same=>n,Macro(VCRECORD,stefantestEXT${CALLERID(num)}ACC${CDR(accountcode)},$
> {EXTEN})
> same=>n,Queue(queuetest,trhc,,,60,,verdianswer(${curIncAccCode}))
> same=>n,Hangup()
> 
> This results, when executed, in:
> 
> [May  8 15:14:50] WARNING[20921]: app_macro.c:309 _macro_exec: No such
> context 'macro-verdianswer(2018050815141huzzu4
> ' for macro 'verdianswer(2018050815141huzzu4
> 
> How can one pass a paramter into the macro called by the Asterisk queue
> application on queue pickup?
> 
> Alternatively, how can a global variable or ASTDB entry be made thread safe
> to do the same?
> 
> Thank you
> 
> Stefan
> 
> 
> 
> 
> -- 
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> 
> Check out the new Asterisk community forum at: https://community.asterisk.org/
> 
> New to Asterisk? Start here:
>      https://wiki.asterisk.org/wiki/display/AST/Getting+Started
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list