>Date: Wed, 19 Mar 2008 11:31:57 +0200<br>>From: "Atis Lezdins" <<a href="mailto:atis@iq-labs.net">atis@iq-labs.net</a>><br>>Subject: Re: [asterisk-users] Handling 3 different call ending causes<br>
>To: "Asterisk Users Mailing List - Non-Commercial Discussion"<br>> <<a href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</a>><br>>Message-ID:<br>> <<a href="mailto:670f60170803190231l7d92c26fg697baf635788e6c0@mail.gmail.com">670f60170803190231l7d92c26fg697baf635788e6c0@mail.gmail.com</a>><br>
>Content-Type: text/plain; charset=ISO-8859-1<br>><br>>On 3/17/08, Tobias Ahlander <<a href="mailto:plyschen@gmail.com">plyschen@gmail.com</a>> wrote:<br>>> 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 <br>>> >the<br>>> ${CHANNEL} that was hung up, and possibly some additional dial plan <br>
>> 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 <br>>> >instructions<br>>> to continue executing to the next priority for that extension, whereas <br>
>> 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} <br>>> 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.<br>>> If I let the time go by (the 20 seconds defined in the Dial Command) I <br>>> get the following:<br>>> -- Executing [h@hangupcause:1] NoOp("SIP/1003-08a491b8", "Channel <br>
>> hungup is<br>>> 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 <br>
>> hungup is<br>>> 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 <br>
>> hungup is<br>>> 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 <br>>> context with the following for this test:<br>
><br>>> [hangupcause]<br>>> exten => s,1,Dial(SIP/1203,30,gL(10000[:5000][:5000]))<br>><br>>exten => s,2,NoOp(Callee hangup)<br>><br>>> exten => h,1,NoOp(Channel hungup is ${CHANNEL})<br>
>><br>>> Have I missed something basic here or what?<br>><br>><br>>This should allow you to distinguish caller and callee hangups. I suppose dial time limit will match Callee hangup, but you can check that by >${ANSWEREDTIME} or some sort of timestamp checking before and after Dial (altough that would include ringing time)<br>
><br>>Regards,<br>>Atis<br>><br>>--<br>>Atis Lezdins,<br>>VoIP Project Manager / Developer,<br>><a href="mailto:atis@iq-labs.net">atis@iq-labs.net</a><br>>Skype: atis.lezdins<br>>Cell Phone: +371 28806004<br>
>Cell Phone: +1 800 7300689<br>>Work phone: +1 800 7502835<br><br>Atis, <br><br>It's always the simplest answers that are the best, this seems to work indeed (thinking about putting a goto instead of NoOp). Will try this out during the day tomorrow and I will let you guys know the results :)<br>
<br>Thank you very much, <br>Best regards, <br>Tobias<br><br><br>