<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=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@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","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Do you know that it is coming back as FALSE, or are you assuming that from examining the expression?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>   --Don<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><a name="_MailEndCompose"><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></a></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Dovid Bender<br><b>Sent:</b> Thursday, February 13, 2020 1:13 PM<br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br><b>Subject:</b> Re: [asterisk-users] Help with FUNC_MATH<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>John,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>That is correct. I am trying to figure out why Asterisk is executing the set part of the execif, if it's coming back as false.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Thu, Feb 13, 2020 at 2:10 PM John Kiniston <<a href="mailto:johnkiniston@gmail.com">johnkiniston@gmail.com</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>My Apologies Dovid, I think I misunderstood your request.<o:p></o:p></p></div><p class=MsoNormal>You don't have the time you need to convert in the format of date string, Instead you have your users entering via DTMF when they want something to happen?<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Thu, Feb 13, 2020 at 11:08 AM Dovid Bender <<a href="mailto:dovid@telecurve.com" target="_blank">dovid@telecurve.com</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><p class=MsoNormal>John,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>From looking at the wiki won't STRFIME just give me what I need based on the unix time that I put in? What I am actually looking to do is convert over from 12 hour format to 24 (unless strftime does just that and I don't kow what am I am doing?).<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Thu, Feb 13, 2020 at 12:03 PM John Kiniston <<a href="mailto:johnkiniston@gmail.com" target="_blank">johnkiniston@gmail.com</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Try using the STRFIME function instead of doing this by hand.<br><br><a href="https://wiki.asterisk.org/wiki/display/AST/Function_STRFTIME" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Function_STRFTIME</a><o:p></o:p></p><p><b>%H</b> <o:p></o:p></p><p>The hour as a decimal number using a 24-hour clock (range 00 to 23). <o:p></o:p></p><p><b>%I</b> <o:p></o:p></p><p>The hour as a decimal number using a 12-hour clock (range 01 to 12). <o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Thu, Feb 13, 2020 at 3:49 AM Dovid Bender <<a href="mailto:dovid@telecurve.com" target="_blank">dovid@telecurve.com</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><p class=MsoNormal>Hi,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I have some dialplan code that is trying to convert 12 hour time with AM/PM to 24 hour format. The code has something like this:<br>Exten => 2,1,ExecIf(${MATH(${HOUR_SELECTED}<12)}?Set(HOUR_SELECTED=${MATH(${HOUR_SELECTED}+12,int)}))<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Earlier on in the dialplan HOUR_SELECTED is set to 12. When they press option 2 they are selecting PM. If the time is from 1PM to 11PM then I want to add 12 to the number (so if it's 1 make it 13 etc.). When I run the above the logs show the result as false yet if the user sets HOUR_SELECTED to 12 then after this line of dialplan code it gets switched to 24. What am I doing wrong here?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The exact DP code is:<o:p></o:p></p></div><div><p class=MsoNormal>Exten => 2,     1, Noop(BEFORE CHECK HOUR_SELECTED is ${HOUR_SELECTED})<br> same =>        n, ExecIf(${MATH(${HOUR_SELECTED}<12)}?Set(HOUR_SELECTED=${MATH(${HOUR_SELECTED}+12,int)}))<br> same =>        n, Noop(AFTER CHECK HOUR_SELECTED IS ${HOUR_SELECTED})<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>And the output of the logs is:<o:p></o:p></p></div><div><p class=MsoNormal>[Feb 13 10:46:18] VERBOSE[1580][C-00007bc6] pbx.c: Executing [2@am_pm_select:1] NoOp("SIP/204.145.219.31-000081c6", "BEFORE CHECK HOUR_SELECTED is 12") in new stack<br>[Feb 13 10:46:18] DEBUG[1580][C-00007bc6] pbx_variables.c: Result of 'HOUR_SELECTED' is '12'<br>[Feb 13 10:46:18] DEBUG[1580][C-00007bc6] pbx_variables.c: Function MATH(12<12) result is 'FALSE'<br>[Feb 13 10:46:18] DEBUG[1580][C-00007bc6] pbx_variables.c: Result of 'HOUR_SELECTED' is '12'<br>[Feb 13 10:46:18] DEBUG[1580][C-00007bc6] pbx_variables.c: Function MATH(12+12,int) result is '24'<br>[Feb 13 10:46:18] DEBUG[1580][C-00007bc6] pbx.c: Launching 'ExecIf'<br>[Feb 13 10:46:18] VERBOSE[1580][C-00007bc6] pbx.c: Executing [2@am_pm_select:2] ExecIf("SIP/204.145.219.31-000081c6", "FALSE?Set(HOUR_SELECTED=24)") in new stack<br>[Feb 13 10:46:18] DEBUG[1580][C-00007bc6] pbx_variables.c: Result of 'HOUR_SELECTED' is '24'<br>[Feb 13 10:46:18] DEBUG[1580][C-00007bc6] pbx.c: Launching 'NoOp'<br>[Feb 13 10:46:18] VERBOSE[1580][C-00007bc6] pbx.c: Executing [2@am_pm_select:3] NoOp("SIP/204.145.219.31-000081c6", "AFTER CHECK HOUR_SELECTED IS 24") in new stack<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>TIA.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Dovid<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal>-- <br>_____________________________________________________________________<br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br><br>Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" target="_blank">https://community.asterisk.org/</a><br><br>New to Asterisk? Start here:<br>      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br>   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><br clear=all><br>-- <o:p></o:p></p><div><p class=MsoNormal>A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.<br>---Heinlein<o:p></o:p></p></div><p class=MsoNormal>-- <br>_____________________________________________________________________<br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br><br>Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" target="_blank">https://community.asterisk.org/</a><br><br>New to Asterisk? Start here:<br>      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br>   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><o:p></o:p></p></blockquote></div><p class=MsoNormal>-- <br>_____________________________________________________________________<br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br><br>Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" target="_blank">https://community.asterisk.org/</a><br><br>New to Asterisk? Start here:<br>      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br>   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><br clear=all><br>-- <o:p></o:p></p><div><p class=MsoNormal>A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.<br>---Heinlein<o:p></o:p></p></div><p class=MsoNormal>-- <br>_____________________________________________________________________<br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br><br>Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" target="_blank">https://community.asterisk.org/</a><br><br>New to Asterisk? Start here:<br>      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br>   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><o:p></o:p></p></blockquote></div></div></body></html>