Answer the question
In order to leave comments, you need to log in
How should I call a macro from the Dial application in extensions.ael?
Hello!
Tell me about the syntax: how to call a macro from the Dial application in extensions.ael
The logic is as follows: the from-trunk entering the context comes -> gets into the queue -> the queue creates a local channel for the queue operator -> the operator is called -> if the call was accepted, then execute the StoreCLID macro.
Actually, this is how it looks in the dialplan:
context from-trunk {
_X. => {
if (${DB_EXISTS(blacklist/${CALLERID(num)})}) {
Hangup();
} else {
Gosub(record-office,${EXTEN},1);
Set(__InternalCLID=${SIPCALLID});
Set(CALLERID(name)=VS ${EXTEN:4});
Progress();
Queue(330,,,,300);
.....
};
context from-queue {
hint(Custom:${EXTEN}) _X. => {
Set(GROUP()=${EXTEN});
Set(CALL-LIMIT=2);
if (${GROUP_COUNT(${GROUP})} > ${CALL-LIMIT}) {
Hangup;
} else {
switch(${DEVICE_STATE(SIP/${EXTEN})}) {
case NOT_INUSE:
switch(${DEVICE_STATE(Custom:${EXTEN})}) {
case NOT_INUSE:
Dial(SIP/${EXTEN},,tM(StoreCLID^${EXTEN}));
case UNKNOWN:
Dial(SIP/${EXTEN},,tM(StoreCLID^${EXTEN}));
default:
break;
};
default:
break;
};
};
};
};
macro StoreCLID( ext ) {
NoOp( == ${ext} == );
Set(__DIALEDPEERNUMBER=${ext});
NoOp(Answered is = ${DIALEDPEERNUMBER});
Set(DB(CLID/${DIALEDPEERNUMBER})=${InternalCLID});
return;
};
Dial(SIP/${EXTEN},,tM(StoreCLID^${EXTEN}));
Dial(SIP/${EXTEN},,tM(&StoreCLID^${EXTEN}));
Dial(SIP/${EXTEN},,tM(&StoreCLID(${EXTEN})));
Dial(SIP/${EXTEN},,tM(StoreCLID(${EXTEN})));
Answer the question
In order to leave comments, you need to log in
# aelparse -d -w
[from-queue]
...
exten => sw_3_UNKNOWN,10,Dial(SIP/${~~EXTEN~~},,tM(StoreCLID^${~~EXTEN~~}))
...
[StoreCLID]
exten => ~~s~~,1,Set(LOCAL(ext)=${ARG1})
macro macro-StoreCLID( ext ) {
...
}
In ael, macros are not macros. Calling a "macro"
which is equivalent in conf Gosub
So we call the same Gosub in Dial
U(x[^arg[^...]]):
x - Name of the subroutine to execute via Gosub
arg - Arguments for the Gosub routine
Execute via Gosub the routine <x> for the *called* channel before
connecting to the calling channel. Arguments can be specified to the Gosub
using '^' as a delimiter. The Gosub routine can set the variable ${GO
SUB_RESULT} to specify the following actions after the Gosub returns.
${GOSUB_RESULT}:
ABORT: Hangup both legs of the call.
CONGESTION: Behave as if line congestion was
encountered.
BUSY: Behave as if a busy signal was encountered.
CONTINUE: Hangup the called party and allow the
calling party to continue dialplan execution at the next priority.
GOTO:[[<context>^]<exten>^]<priority>: Transfer the
call to the specified destination.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question