Answer Extension Macro


#1

Hello,

I’m trying to create a macro that contains extensions number which answered the call in a queue. What I have in my extensions.conf is:

exten => 1006,1,Verbose(2,${CALLERID(all)} entering the support queue)
same => n,Queue(support, , , , , ,answer)
same => n,Hangup()
[macro-answer]
exten = s,1,NoOp()
same = n,Verbose(2,Ext: ${EXTEN} dnid: ${CALLERID(dnid)} Macro Ext: ${MACRO_EXTEN})

However I got:

-- PJSIP/1001-00000019 answered PJSIP/1000-00000018
    -- Executing [s@macro-answer:1] NoOp("PJSIP/1001-00000019", "") in new stack
    -- Executing [s@macro-answer:2] Verbose("PJSIP/1001-00000019", "2,Ext: s dnid:  Macro Ext: 1006") in new stack

Is there a way to get the extension number 1001 for example ?

Thanks !!!


#2

The macro or subroutine to launch isn’t the second argument to the Queue application, I can’t see how this is possibly working at all for you.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue


#3

Sorry my fault when I copied it…

exten => 1006,1,Verbose(2,${CALLERID(all)} entering the support queue)
same => n,Queue(support,,,,,,answer)
same => n,Hangup()

I’m going to fix my post…

Thanks !


#4

Its a forum bug… the text was right but I need to add some space between the comman


#5

The things that get called from the queue are not extensions! 1001 is not an extension number. It is either a device name or diallled digits to be passed to a device.

Taking this out of context, you want ${CHANNEL}, suitably parsed, but with the full context there may well be a better way, as this looks like some sort of logging exercise.

You should use gosub, as macros are deprecated.


#6

Hello David thank you for you replay… I re-wrote my extensions.conf to use gosub:

exten => 1006,1,Verbose(2,${CALLERID(all)} entering the support queue)
same => n,Queue(support,c,,,,,,sub-answer)
same = n,Verbose(2,CALLID 1: ${UNIQUEID} GOSUB: ${GOSUB_RETVAL})
same => n,Goto(ThanksMessage,s,1)
same => n,Hangup()
[sub-answer]
exten = s,1,NoOp()
same = n,Set(EXTENSION=${CUT(CUT(CHANNEL,-,1),/,2)})
same = n,Verbose(2,CALLID 2: ${UNIQUEID} Ext: ${EXTENSION})
same => n,Return(${UNIQUEID})

And I got what I want… Now I need to link both calls but my GOSUB_RETVAL from Queue is returning NULL… Do you have any suggestion ?

Thanks ! Again bellow my execution log:

-- PJSIP/1001-00000039 answered PJSIP/1000-00000038
    -- PJSIP/1001-00000039 Internal Gosub(sub-answer,s,1) start
    -- Executing [s@sub-answer:1] NoOp("PJSIP/1001-00000039", "") in new stack
    -- Executing [s@sub-answer:2] Set("PJSIP/1001-00000039", "EXTENSION=1001") in new stack
    -- Executing [s@sub-answer:3] Verbose("PJSIP/1001-00000039", "2,CALLID 2: 1552338170.113 Ext: 1001") in new stack
	-- PJSIP/1001-00000039 Internal Gosub(sub-answer,s,1) complete GOSUB_RETVAL=1552338170.113
	
	Executing [1006@gateway:3] Verbose("PJSIP/1000-00000038", "2,CALLID 1: 1552338170.112 GOSUB: ") in new stack
  == CALLID 1: 1552338170.112 GOSUB:
    -- Executing [1006@gateway:4] Goto("PJSIP/1000-00000038", "ThanksMessage,s,1") in new stack
    -- Goto (ThanksMessage,s,1)