<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)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><a
href="http://www.voip-info.org/tiki-index.php?page=Asterisk+variable+hangupcause">http://www.voip-info.org/tiki-index.php?page=Asterisk+variable+hangupcause</a><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Tobias Ahlander<br>
<b><span style='font-weight:bold'>Sent:</span></b> maandag 17 maart 2008 15:35<br>
<b><span style='font-weight:bold'>To:</span></b>
asterisk-users@lists.digium.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [asterisk-users]
Handling 3 different call ending causes</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Alex Balashov wrote:<br>
>> Hello List,<br>
>><br>
>> I'm using a dialstring like the one below. I want to have three <br>
>> different things happening depending on exit cause.<br>
>> <br>
>> Dial(SIP/${phonenumber},20,gL(20000[:5000][:5000]))<br>
>> <br>
>> These 3 things could happen:<br>
>> 1, Caller hangs up<br>
>> 2, Callee hangs up<br>
>> 3, The 20 seconds is up and call is terminated from Asterisk.<br>
>> <br>
>> Is there a way to separate these 3?<br>
><br>
>You can handle the 'h' extension in the dial plan, which will supply the
${CHANNEL} that was hung up, and possibly some additional dial plan variables
as well:<br>
><br>
><a href="http://www.voip-info.org/wiki/index.php?page=Asterisk+h+extension">http://www.voip-info.org/wiki/index.php?page=Asterisk+h+extension</a><br>
><br>
>Using these, you can piece together who hung up on whom, etc.<br>
><br>
>#2 is handled by fallthrough in the dial plan that causes the instructions
to continue executing to the next priority for that extension, whereas if the
call completes (Dial() is successfully connected), this does not happen.<br>
<br>
I''ve tried to use the h extension in combination with the ${CHANNEL} in the
dialplan as suggested on the wiki page, but I haven't had any luck with it. <br>
<br>
For this test I have a Sipura phone with number 1003 and a X-lite with 1203. If
I let the time go by (the 20 seconds defined in the Dial Command) I get the
following: <br>
-- Executing [h@hangupcause:1] NoOp("SIP/1003-08a491b8",
"Channel hungup is SIP/1003-08a491b8") in new stack<br>
<br>
If I let the Sipura hang up I get:<br>
-- Executing [h@hangupcause:1] NoOp("SIP/1003-08a491b8",
"Channel hungup is SIP/1003-08a491b8") in new stack<br>
<br>
Lastly if I let the X-lite hang up I get:<br>
-- Executing [h@hangupcause:1] NoOp("SIP/1003-08a491b8",
"Channel hungup is SIP/1003-08a491b8") in new stack<br>
<br>
Yes they are all the same :(<br>
<br>
Perhaps there's something wrong with my code? Its just a small context with the
following for this test:<br>
[hangupcause]<br>
exten => s,1,Dial(SIP/1203,30,gL(10000[:5000][:5000]))<br>
exten => h,1,NoOp(Channel hungup is ${CHANNEL})<br>
<br>
Have I missed something basic here or what? <br>
<br>
Thanks again, <br>
Best regards, <br>
Tobias<o:p></o:p></span></font></p>
</div>
</body>
</html>