3
« on: January 06, 2009, 16:54:30 »
Hello, I am still not able to get this script working with DRUID. Below is the Macro DRUID uses for outbound calls. Can you someone please suggest how this macro be incorporated with the outbound script.
Thank you
This is the Dial string from extensions.conf
exten=>_XXXXXXXXXX,n,Macro(ael-druid-trunkdial,SIP/ipcomms,${EXTEN},WTK,,,,,${EXTEN})
This is the macro in extensions.ael
macro ael-druid-trunkdial( dev, number, options, accountcode, callerid, authzone, backuptrunk, backupnumber ) {
TRANSFER_CONTEXT="druid-default";
DYNAMIC_FEATURES=automon;
channeltype = "${CUT(CHANNEL|/|1)}";
if ("${channeltype}" == "Zap") {
mydev = "${CUT(CHANNEL|-|1)}";
}
else {
mydev = "${CUT(CHANNEL|-|1-3)}";
}
&ael-druid-hotdesk-outbound(${mydev});
monitor = "${DRUID_USERFIELD(${CALLERID(number)}|monitor)}";
if (${monitor}) {
MONITOR_FILE="auto-${EPOCH}-${CALLERID(number)}-${number}";
Monitor(wav,${MONITOR_FILE},mb);
}
// Check mobile bridge
mobilenum = "${CUT(DIALEDPEERNUMBER|@|1)}";
mobileexten = "${DRUID_MOBILEUSEREXTEN(${mobilenum})}";
if (!${ISNULL(${mobileexten})}) {
options = "wWtTkKM(ael-druid-mobilebridge)";
CALLERID(number)=${mobileexten};
}
TOUCH_MONITOR="${CALLERID(number)}-${number}";
Verbose(3|- Authenticating outbound call to);
if (!${ISNULL(${authzone})}) {
Verbose(3|- Zone ${authzone});
auth = "${DRUID_ZONE(${CALLERID(number)}|${authzone})}";
if (${auth} == 0) {
if (${ISNULL(${mobileexten})}) {
Playback(not-auth-pstn);
};
MacroExit;
}
}
Verbose(3|- Setting outbound accountcode);
if (!${ISNULL(${accountcode})}) {
Set(CDR(accountcode)=${accountcode});
}
else {
accountcode = "${DRUID_USERFIELD(${CALLERID(number)}|accountcode)}";
amaflags = "${DRUID_USERFIELD(${CALLERID(number)}|amaflags)}";
if (!${ISNULL(${accountcode})}) {
Set(CDR(accountcode)=${accountcode});
};
if (!${ISNULL(${amaflags})}) {
switch (${amaflags}) {
case omit:
Set(CDR(amaflags)=1);
break;
case billing:
Set(CDR(amaflags)=2);
break;
case documentation:
Set(CDR(amaflags)=3);
break;
default:
break;
};
}
};
Verbose(3|- Setting outbound callerid);
name = "${DRUID_USERFIELD(${CALLERID(number)}|fullname)}";
cid = "${DRUID_USERFIELD(${CALLERID(number)}|cidnumber)}";
if (!${ISNULL(${cid})}) {
CALLERID(name)="${name}";
CALLERID(number)=${cid};
}
else {
if (!${ISNULL(${callerid})}) {
Set(CALLERID(all)=${callerid});
};
};
Verbose(3|- Checking if trunk is available);
ChanIsAvail(${dev});
if (${ISNULL(${AVAILCHAN})}) {
if (${ISNULL(${backuptrunk})}) {
Verbose(3|- No backup trunk configured);
Congestion;
}
else {
&ael-druid-backuptrunkdial(${backuptrunk}, ${backupnumber}, ${number});
}
}
else {
Verbose(3|- Normal trunk operation);
Dial(${dev}/${number}||${options});
switch(${DIALSTATUS}) {
case CONGESTION:
case CHANUNAVAIL:
&ael-druid-backuptrunkdial(${backuptrunk}, ${backupnumber}, ${number});
}
}
StopMonitor();
}