<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Andrew,<BR> <BR>Unfortunately that has stopped working when using chan_pjsip and asterisk 13.<BR> <BR>The CDR is closed too early after a dial attempt. This is the expected behaviour for Asterisk 13, however you should be able to set the variable before the CDR is locked/committed and before another dial attempt.<BR> <BR>The hangup_handler should be the way to do this as it's run within the same dial command.<BR> <BR>I think I will need to raise an issue as this has only stopped working in Asterisk 13.<BR> <BR>Thank you for your feedback,<BR> <BR>Ross<br> <BR><div><hr id="stopSpelling">From: andrew@convergedgroup.net<br>To: asterisk-users@lists.digium.com<br>Date: Fri, 9 Oct 2015 14:50:51 +0200<br>Subject: Re: [asterisk-users] Storing HANGUPCAUSE in CDR<br><br><style><!--
.ExternalClass p.ecxMsoNormal, .ExternalClass li.ecxMsoNormal, .ExternalClass div.ecxMsoNormal {
font-size:12.0pt;
font-family:"Times New Roman",serif;
}

.ExternalClass a:link, .ExternalClass span.ecxMsoHyperlink {
color:#0563C1;
text-decoration:underline;
}

.ExternalClass span.ecxMsoHyperlinkFollowed {
color:#954F72;
text-decoration:underline;
}

.ExternalClass p {
font-size:12.0pt;
font-family:"Times New Roman",serif;
}

.ExternalClass pre {
font-size:10.0pt;
font-family:"Courier New";
}

.ExternalClass span.ecxHTMLPreformattedChar {
font-family:"Consolas",serif;
}

.ExternalClass span.ecxEmailStyle20 {
font-family:"Calibri",sans-serif;
color:#1F497D;
}

.ExternalClass .ecxMsoChpDefault {
font-size:10.0pt;
}

.ExternalClass div.ecxWordSection1 {
}

--></style><div class="ecxWordSection1"><p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri",sans-serif; font-size: 11pt;'>You can use this</span></p><p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri",sans-serif; font-size: 11pt;'> </span></p><p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri",sans-serif; font-size: 11pt;'>exten => h,1,Set(CDR(userfield)=Hangupcause:${HANGUPCAUSE})</span></p><div><div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(225, 225, 225) currentColor currentColor; padding: 3pt 0in 0in;"><p class="ecxMsoNormal"><b><span style='font-family: "Calibri",sans-serif; font-size: 11pt;'>From:</span></b><span style='font-family: "Calibri",sans-serif; font-size: 11pt;'> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Ross Beer<br><b>Sent:</b> Friday, October 9, 2015 1:52 PM<br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users@lists.digium.com><br><b>Subject:</b> Re: [asterisk-users] Storing HANGUPCAUSE in CDR</span></p></div></div><p class="ecxMsoNormal"> </p><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>This was always possible in the past, however does not work in the current release.<br> <br>I believe this is a bug.<br> </span></p><div><div align="center" class="ecxMsoNormal" style="text-align: center;"><span style='font-family: "Calibri",sans-serif;'><hr width="100%" size="2" align="center" id="ecxstopSpelling"></span></div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>To: <a href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</a><br>From: <a href="mailto:cervajs@fpf.slu.cz">cervajs@fpf.slu.cz</a><br>Date: Fri, 9 Oct 2015 10:04:47 +0200<br>Subject: Re: [asterisk-users] Storing HANGUPCAUSE in CDR</span></p><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>search in archives<br>save the records to another table like cdr_extended<br><br><br>Dne 7.10.2015 v 15:26 Ross Beer napsal(a):</span></p></div><blockquote><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>Hi, </span></p><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>I have the following code that operates when a channel is hung-up:</span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><blockquote style="border: currentColor;"><div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>[record-hangupcause]</span></p></div></div><div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>exten => 1,n,Set(CDR(hangupcause)=${HANGUPCAUSE})</span></p></div></div><div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>exten => s,n,Return()</span></p></div></div></blockquote><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>Before the dial a hangup handler is registered:</span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><blockquote style="border: currentColor;"><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>Set(CHANNEL(hangup_handler_push)=record-hangupcause,s,1)</span></p></div></blockquote><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>The routine is called and the variables are being set, however not on the channel's CDR which made the call. I believe this is due to the CDR being closes as soon as the dial returns. </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>By changing the cdr option 'endbeforehexten=no' this should keep the CDR accessible, however all this does is cause another CDR to be created for the 'h' extension.</span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>Is there a way to update the CDR so that a result can be stored per dial?</span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>Thank you in advance,</span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'>Ross</span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div><div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p></div></div><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'><br><br></span></p></blockquote><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'> </span></p><pre>-- </pre><pre>---------------------------------------</pre><pre>Marek Cervenka</pre><pre>=======================================</pre><p class="ecxMsoNormal"><span style='font-family: "Calibri",sans-serif;'><br>-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> -- New to Asterisk? Join us for a live introductory webinar every Thurs: <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a> asterisk-users mailing list To UNSUBSCRIBE or update options visit: <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></span></p></div></div></div><br>-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users</div>                                    </div></body>
</html>