<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
h1
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:24.0pt;
        font-family:"Times New Roman";
        font-weight:bold;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Managed to implement this on asterisk
v1.4.24.1, <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Also, Hangupcause updating to user field.
<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>However, this only works on the edge of
my voice network (demarcation point) <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>It does not work on my internal routing
boxes as I use IAX to route between remote sites.<o:p></o:p></span></font></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>I was
thinking of using some sort of SIP variables to transport these results over
the IAX trunk.. <o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>Any
bright ideas folks???<o:p></o:p></span></font></b></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>[outbound]</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(dial),gotoif($[${loadbalance} = 1 ]?balance) ;at dial decide if we want
to load balance</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(50)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;if no balance then
outbound call initiated with failover</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(balance),NoOp(&quot;Load Balancing
Active&quot;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;NoOp - display Load balancing status</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(counter1=${DB(data/counter)})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;retrieve counter value from astdb</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,NoOp(${counter1})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;display value of counter</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(counter=${MATH(${counter1}+1,int)})
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; increment counter</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(DB(data/counter)=${counter})
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;write incremented value back to asterisk db</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(result=${MATH(${counter}%2)})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;check for Odd/ Even using modulus of ${counter} via MATH function</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,NoOp(${result})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;Display output - 0 for even and 1 for odd</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt; _XXX.,n,GotoIf($[${result}
&gt; 0]?50:100)&nbsp;&nbsp;&nbsp; ;Odd calls route to outbound-1, even calls to
outbound-2</span></font><font color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(balance),NoOp(&quot;Load Balancing
Active&quot;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;NoOp - display
Load balancing status</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(counter1=${DB(data/counter)})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;retrieve counter value from astdb</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,NoOp(${counter1})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;display
value of counter</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(counter=${MATH(${counter1}+1,int)})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
; increment counter</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt; _XXX.,n,Set(DB(data/counter)=${counter})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;write incremented value back to asterisk db</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(result=${MATH(${counter}%2)})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;check for Odd/ Even using modulus of ${counter} via MATH function</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,NoOp(${result})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;Display output - 0 for even and 1 for odd</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,GotoIf($[${result} &gt;
0]?50:100)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;Odd calls route to
outbound-1, even calls to outbound-2</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,50,gotoif($[${dialout} &gt; 0 ]?firstfail)</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(dialout=${MATH(${dialout}+2)})</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,NoOp(${dialout})</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,dial(${route2}/${EXTEN}@${context2})</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(after-dial)</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(firstfail),set(try=${MATH(${dialout}+2)})</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,dial(${route2}/${EXTEN}@${context2})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;attempt to dial out via route 2</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(after-dial)&nbsp;&nbsp;&nbsp; ;after attempting to dial, go to
after-dial</span></font><font color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,100,gotoif($[${dialout} &gt; 0 ]?secondfail)</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,Set(dialout=${MATH(${dialout}+1))</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,NoOp(${dialout})</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,dial(${route1}/${EXTEN}@${context1})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;attempt dial out via route 1</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(after-dial)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;after attempting to dial, go to after-dial</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(secondfail),set(try=${MATH(${dialout}+2})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;If call has been dialled by other route and is failing over, set variable try
= 2</span></font><font color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,dial(${route1}/${EXTEN}@${context1})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;attempt to dial out via route 1</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(after-dial)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;after attempting to dial, go to after-dial</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(after-dial),Set(CDR(accountcode)=${DIALSTATUS})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;first step - add ${DIALSTATUS} to CDR in accountcode field</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(${DIALSTATUS})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;go to dial-status received from attempt</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(BUSY),,goto(set_cause)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;if Busy, go to set_cause</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(NOANSWER),goto(set_cause)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;if No answer, go to set_cause</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(CANCEL),goto(set_cause)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;if Cancel, go to set_cause</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(NOANSWER),goto(set_cause)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;if No Answer, go to set_cause</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(CHANUNAVAIL),gotoif($[${try} = 2
]?emergency-notify)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;If CHANUNAVAIL,check
if both routes are down. If yes, send emergency notification</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,gotoif($[${first-dial} = ${route1}
]?notify-1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;If this was first attempt from route 1, go to notification for route 1 down</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(notify-2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;else go to notification for route 2</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(set_cause),hangup()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;at set_cause, firstly hang up channel (if not done
already)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt; _XXX.,n,goto(CDRfield)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;go to CDR field mapping section</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(CDRfield),Set(CDR(userfield)=${HANGUPCAUSE})&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;set Hangupcause to user field in CDR</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(notify-1),System(echo &quot;Call redirect detected on
'${route1}'&quot;&nbsp; | mail -s &quot;Calls Fail Over&quot;
Neeraj.chand@ocis.com.au) ;send notification route 1 down</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(100)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;attempt dial via route 2</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(notify-2),System(echo &quot;Call redirect detected on
'${route2}'&quot;&nbsp; | mail -s &quot;Calls Fail Over&quot;
Neeraj.chand@ocis.com.au) ;send notification route 2 down</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(50)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;attempt
dial via route 1</span></font><font color=black><span lang=EN-AU
style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-AU style='font-size:12.0pt;color:black'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n(emergency-notify),System(echo &quot;Call redirect detected on BOTH
Routes!!!!!&quot;&nbsp; | mail -s &quot;Calls Fail Over&quot;
Neeraj.chand@ocis.com.au) ;send critical - both routes</span></font><font
color=black><span lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span lang=EN-AU
style='font-size:10.0pt;font-family:Arial;color:black'>exten =&gt;
_XXX.,n,goto(set_cause)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;attempt to hangup and set cause code.</span></font><font color=black><span
lang=EN-AU style='color:black'><o:p></o:p></span></font></p>

</div>

</body>

</html>