<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:595.3pt 841.9pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></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=IT link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US>This is what the log says:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>2018-06-17 11:18:41.186422 [ALERT] stuff.js:74 *********************** DIALING<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>2018-06-17 11:18:41.186422 [NOTICE] switch_channel.c:1104 New Channel sofia/external/065551234 [411ac79d-e8e0-4f77-b51f-7da24a71ea32]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>2018-06-17 11:18:45.606424 [NOTICE] sofia.c:8273 Hangup sofia/external/065551234 [CS_CONSUME_MEDIA] [UNALLOCATED_NUMBER]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>2018-06-17 11:18:45.626430 [NOTICE] switch_core_session.c:1683 Session 915 (sofia/external/065551234) Ended<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>2018-06-17 11:18:45.626430 [NOTICE] switch_core_session.c:1687 Close Channel sofia/external/065551234 [CS_DESTROY]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>2018-06-17 11:18:45.626430 [ALERT] stuff.js:74 *********************** WAITING FOR SESSION READY ..<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>2018-06-17 11:18:45.626430 [ALERT] stuff.js:74 *********************** DISCONNECT CAUSE :false:undefined<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>So this is what I want:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>2018-06-17 11:18:45.606424 [NOTICE] sofia.c:8273 Hangup sofia/external/065551234 [CS_CONSUME_MEDIA] [UNALLOCATED_NUMBER]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>So why do I get:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>False: undefined <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>from<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>console_log("notice", "************************* disconnect cause:" + sessOut.cause + ":" + sessOut.causeCode);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='mso-fareast-language:IT'>From:</span></b><span lang=EN-US style='mso-fareast-language:IT'> Francesco Facco de Lagarda <francesco@delagarda.com> <br><b>Sent:</b> domenica 17 giugno 2018 11:12<br><b>To:</b> 'FreeSWITCH Users Help' <freeswitch-users@lists.freeswitch.org><br><b>Subject:</b> session.cause and session.causecode<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>‘Morning all<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>I can’t get session.cause and session.causecode to work.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>All I get is false for the code and blank for the cause!<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Im running FS 1.6.20<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>This is a simplified version of my JS script<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>if (session.ready()) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> session.answer();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> var dialedNum = "3332094333"; <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> console_log("notice", "*********************** DIALING");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> var sessOut = new Session("sofia/gateway/realtoneFXO/" + dialedNum + "@192.168.0.216:5060");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> console_log("notice", "*********************** WAITING FOR SESSION READY ..");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> if (sessOut.ready()) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> console_log("notice", "*********************** SESSION READY");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> bridge(session, sessOut);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> } else {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> console_log("notice", "************************* disconnect cause:" + sessOut.cause + ":" + sessOut.causeCode);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> sessOut.hangup();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> session.hangup();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> console_log("notice", "*********************** CALL ENDED");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>