Custom Extension/Macro variable not working as expected

Hey all! If this has been answered I’m so sorry I’ve searched for hours to try to find something that works. We have a ticket platform we’d like calls sent to a queue to trigger an API via email. Here is what I have so far, the only thing missing is the DID the caller dialed or the Queue name they hit? I’ve manually added the queue and just plan to make a new custom extension per queue if needed, but I cannot fake which inbound route was used to get to the queue. Is there a variable I’m missing?

Both of these work, 9990002 is the test I was using to dump as many variables out I could think might help me… They unfortunately do not. :frowning:

exten => 9990001,1,NoOp(Entering user defined context [send-email] in extensions_custom.conf)

exten => 9990001,n,System(echo '{ "calleridname": "${CALLERID(name)}", "calleridnum": "${CALLERID(number)}", "queue": "stinoc"}' | mail -s 'PBX-01' 'emailaddresshere')

exten => 9990001,n,Congestion

exten => 9990002,1,NoOp(Entering user defined context [send-email] in extensions_custom.conf)

exten => 9990002,n,System(echo '{ "calleridname": "${CALLERID(name)}", "calleridnum": "${CALLERID(number)}", "queue": "vienoc"}' | mail -s 'PBX-01' 'emailaddresshere')

exten => 9990002,n,NoOp(ACCOUNTCODE=${ACCOUNTCODE})

exten => 9990002,n,NoOp(ANSWEREDTIME=${ANSWEREDTIME})

exten => 9990002,n,NoOp(BLINDTRANSFER=${BLINDTRANSFER})

exten => 9990002,n,NoOp(CALLERID=${CALLERID(all)})

exten => 9990002,n,NoOp(CALLERID(name)=${CALLERID(name)})

exten => 9990002,n,NoOp(CALLERID(number)=${CALLERID(number)})

exten => 9990002,n,NoOp(CALLINGPRES=${CALLINGPRES})

exten => 9990002,n,NoOp(CHANNEL=${CHANNEL})

exten => 9990002,n,NoOp(CONTEXT=${CONTEXT})

exten => 9990002,n,NoOp(DATETIME=${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})

exten => 9990002,n,NoOp(DIALEDPEERNAME=${DIALEDPEERNAME})

exten => 9990002,n,NoOp(DIALEDPEERNUMBER=${DIALEDPEERNUMBER})

exten => 9990002,n,NoOp(DIALEDTIME=${DIALEDTIME})

exten => 9990002,n,NoOp(DIALSTATUS=${DIALSTATUS})

exten => 9990002,n,NoOp(DNID=${CALLERID(dnid)})

exten => 9990002,n,NoOp(EPOCH=${EPOCH})

exten => 9990002,n,NoOp(EXTEN=${EXTEN})

exten => 9990002,n,NoOp(HANGUPCAUSE=${HANGUPCAUSE})

exten => 9990002,n,NoOp(INVALID_EXTEN=${INVALID_EXTEN})

exten => 9990002,n,NoOp(LANGUAGE=${LANGUAGE()})

exten => 9990002,n,NoOp(MEETMESECS=${MEETMESECS})

exten => 9990002,n,NoOp(PRIORITY=${PRIORITY})

exten => 9990002,n,NoOp(RDNIS=${CALLERID(rdnis)}})

exten => 9990002,n,NoOp(SIPDOMAIN=${SIPDOMAIN})

exten => 9990002,n,NoOp(SIP_CODEC=${SIP_CODEC})

exten => 9990002,n,NoOp(SIPCALLID=${SIPCALLID})

exten => 9990002,n,NoOp(SIPUSERAGENT=${SIPUSERAGENT})

exten => 9990002,n,NoOp(TXTCIDNAME=${TXTCIDNAME})

exten => 9990002,n,NoOp(UNIQUEID=${UNIQUEID})

exten => 9990002,n,NoOp(TOUCH_MONITOR=${TOUCH_MONITOR})

exten => 9990002,n,NoOp(MACRO_CONTEXT=${MACRO_CONTEXT})

exten => 9990002,n,NoOp(MACRO_EXTEN=${MACRO_EXTEN})

exten => 9990002,n,NoOp(MACRO_PRIORITY=${MACRO_PRIORITY})

exten => 9990002,n,NoOp(CDRDID=${CDR(did)})

exten => 9990002,n,Congestion

Logs from these tests:

[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:1] NoOp("Local/9990002@from-queue-000000a1;2", "Entering user defined context  [send-email] in extensions_custom.conf") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:2] System("Local/9990002@from-queue-000000a1;2", "echo '{    "calleridname": "redacted KARA",    "calleridnum": "redacted",    "queue": "vienoc"}' | mail -s 'PBX-01' 'email'") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:3] NoOp("Local/9990002@from-queue-000000a1;2", "ACCOUNTCODE=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:4] NoOp("Local/9990002@from-queue-000000a1;2", "ANSWEREDTIME=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:5] NoOp("Local/9990002@from-queue-000000a1;2", "BLINDTRANSFER=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:6] NoOp("Local/9990002@from-queue-000000a1;2", "CALLERID="VIE NOC:redeacted" <redacted>") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:7] NoOp("Local/9990002@from-queue-000000a1;2", "CALLERID(name)=VIE NOC:redacted") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:8] NoOp("Local/9990002@from-queue-000000a1;2", "CALLERID(number)=redacted") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:9] NoOp("Local/9990002@from-queue-000000a1;2", "CALLINGPRES=0") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:10] NoOp("Local/9990002@from-queue-000000a1;2", "CHANNEL=Local/9990002@from-queue-000000a1;2") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:11] NoOp("Local/9990002@from-queue-000000a1;2", "CONTEXT=from-internal") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:12] NoOp("Local/9990002@from-queue-000000a1;2", "DATETIME=08122023-23:51:49") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:13] NoOp("Local/9990002@from-queue-000000a1;2", "DIALEDPEERNAME=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:14] NoOp("Local/9990002@from-queue-000000a1;2", "DIALEDPEERNUMBER=9990002@from-queue/n") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:15] NoOp("Local/9990002@from-queue-000000a1;2", "DIALEDTIME=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:16] NoOp("Local/9990002@from-queue-000000a1;2", "DIALSTATUS=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:17] NoOp("Local/9990002@from-queue-000000a1;2", "DNID=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:18] NoOp("Local/9990002@from-queue-000000a1;2", "EPOCH=1702079509") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:19] NoOp("Local/9990002@from-queue-000000a1;2", "EXTEN=9990002") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:20] NoOp("Local/9990002@from-queue-000000a1;2", "HANGUPCAUSE=26") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:21] NoOp("Local/9990002@from-queue-000000a1;2", "INVALID_EXTEN=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:22] NoOp("Local/9990002@from-queue-000000a1;2", "LANGUAGE=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:23] NoOp("Local/9990002@from-queue-000000a1;2", "MEETMESECS=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:24] NoOp("Local/9990002@from-queue-000000a1;2", "PRIORITY=24") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:25] NoOp("Local/9990002@from-queue-000000a1;2", "RDNIS=}") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:26] NoOp("Local/9990002@from-queue-000000a1;2", "SIPDOMAIN=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:27] NoOp("Local/9990002@from-queue-000000a1;2", "SIP_CODEC=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:28] NoOp("Local/9990002@from-queue-000000a1;2", "SIPCALLID=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:29] NoOp("Local/9990002@from-queue-000000a1;2", "SIPUSERAGENT=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:30] NoOp("Local/9990002@from-queue-000000a1;2", "TXTCIDNAME=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:31] NoOp("Local/9990002@from-queue-000000a1;2", "UNIQUEID=1702079509.617") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:32] NoOp("Local/9990002@from-queue-000000a1;2", "TOUCH_MONITOR=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:33] NoOp("Local/9990002@from-queue-000000a1;2", "MACRO_CONTEXT=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:34] NoOp("Local/9990002@from-queue-000000a1;2", "MACRO_EXTEN=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:35] NoOp("Local/9990002@from-queue-000000a1;2", "MACRO_PRIORITY=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:36] NoOp("Local/9990002@from-queue-000000a1;2", "CDRDID=") in new stack
[2023-12-08 23:51:49] VERBOSE[7360][C-00000011] pbx.c: Executing [9990002@from-internal:37] Congestion("Local/9990002@from-queue-000000a1;2", "") in new stack

Maybe somebody here could help but I wonder if this question is better asked in the asterisk community as this is more an asterisk question?

Fair enough :slight_smile: I’ve posted there as well. Hopefully I’m not the only crazy person out there trying to open tickets with phone calls lol.

a system call to /bin/echo would not expand any $VARIABLES enclosed by single quotes, use double quotes escaping any double quotes you want in the string.

Use the DumpChan dialplan application in place of all the NoOp lines, it will dump all channel variable names and values to the console and full log. If the call is handled in the usual way with an inbound route, then the DID will be stored in the FROM_DID channel variable.

exten => 9990002,1,NoOp(Entering user defined context  [send-email] in extensions_custom.conf)
exten => 9990002,n,DumpChan
 etc...
2 Likes

Hmm. It looks like when you run a call through a queue, you get way less info than say a ring group or just inbound route to extension?

Callflow: Inbound Route DID > Queue > to this Extension 9990002

[2023-12-09 19:43:59] VERBOSE[24894][C-00000020] pbx.c: Executing [9990002@from-internal:3] DumpChan(“Local/9990002@from-queue-00000148;2”, “”) in new stack
Dumping Info For Channel: Local/9990002@from-queue-00000148;2:
Name= Local/9990002@from-queue-00000148;2
Extension= 9990002
QAGENT=9990002
DIALEDPEERNUMBER=9990002@from-queue/n

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.