[asterisk-bugs] [JIRA] (ASTERISK-28276) TESTTIME feature not working

Chris Savinovich (JIRA) noreply at issues.asterisk.org
Fri Feb 15 16:54:48 CST 2019


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=246239#comment-246239 ] 

Chris Savinovich edited comment on ASTERISK-28276 at 2/15/19 4:54 PM:
----------------------------------------------------------------------

Hello granjerox, thanks for reporting this issue.  After reviewing the code I can let you know you are not using the TESTTIME() function the way it is intended to.  The documentation on the function certainly could be better and I will be making the necessary changes in the documentation to explain its usage in a more clear manner.

It works like this:
1.The function TESTTIME() works by filling up channel variable ${TESTTIME} with the desired date.
2. The value saved on channel variable ${TESTTIME} after successfully invoking function TESTTIME() will be a long integer corresponding to a date value. To display it in readable format it will be necessary to use function STRFTIME(), like this:

same => n,NoOp(${STRFTIME(${TESTTIME},GMT-6)})

3. function IFTIME() *does not*  use the time value saved on
 ${TESTTIME} Only current date.

4. function GoToIfTime() *does* use the time valued saved on ${TESTTIME} and will use it provided the value is valid (not null), otherwise it will use the system's value.


SAMPLE CODE:
exten => Test5,1,NoOp(Today's date is ${STRFTIME()}")
    same => n,Set(TESTTIME()=2018/10/30 18:00:00 Europe/Madrid)
    same => n,NoOp(--->TESTIME=${STRFTIME(${TESTTIME})})

    same => n,GotoIfTime(*,*,*,dec?decok:decnok)

    same => n(decok),NoOp(---->IT IS DECEMBER-OK)
    same => n,Goto(goodbye)
    same => n(decnok),NoOp(---->IT IS NOT DECEMBER-NOK)
    same => n,Goto(goodbye)

    same => n(goodbye),Hangup()

Thank you. I am closing this issue, should you find it still doesn't work as desired please reopen.



was (Author: csavinovich):
Hello granjerox, thanks for reporting this issue.  After reviewing the code I can let you know you are not using the TESTTIME() function the way it is intended to.  The documentation on the function certainly could be better and I will be making the necessary changes in the documentation to explain its usage in a more clear manner.

It works like this:
1.The function TESTTIME() works by filling up channel variable ${TESTTIME} with the desired date.
2. The value saved on channel variable ${TESTTIME} after successfully invoking function TESTTIME() will be a long integer corresponding to a date value. To display it in readable format it will be necessary to use function STRFTIME(), like this:

same => n,NoOp(${STRFTIME(${TESTTIME},GMT-6)})

3. function IFTIME() *does not*  use the time value saved on ${TESTTIME} Only current date.

4. function GoToIfTime() *does* use the time valued saved on ${TESTTIME} and will use it provided the value is valid (not null), otherwise it will use the system's value.


SAMPLE CODE:
exten => Test5,1,NoOp(Today's date is ${STRFTIME()}")
    same => n,Set(TESTTIME()=2018/10/30 18:00:00 Europe/Madrid)
    same => n,NoOp(--->TESTIME=${STRFTIME(${TESTTIME})})

    same => n,GotoIfTime(*,*,*,dec?decok:decnok)

    same => n(decok),NoOp(---->IT IS DECEMBER-OK)
    same => n,Goto(goodbye)
    same => n(decnok),NoOp(---->IT IS NOT DECEMBER-NOK)
    same => n,Goto(goodbye)

    same => n(goodbye),Hangup()

Thank you. I am closing this issue, should you find it still doesn't work as desired please reopen.


> TESTTIME feature not working
> ----------------------------
>
>                 Key: ASTERISK-28276
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28276
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: PBX/General
>    Affects Versions: 13.22.0
>         Environment: Ubuntu Linux
>            Reporter: granjerox
>            Assignee: Unassigned
>
> Can't get iftime nor gotoiftime to use a diferent datetime than systemtime.
> {code}
> Asterisk version
> iospbx004*CLI> core show version 
> Asterisk 13.22.0 built by root @ iospbx004 on a x86_64 running Linux on 2018-08-10 10:22:19 UTC
> {code}
> *DIALPLAN*
> {code}
> [test]
> exten => s,1,NoOp(Time is ${STRFTIME()} - TESTTIME IS ${TESTTIME})
>     same => n,NoOp(Test IFTIME DEC ${IFTIME(*,*,*,dec?ok:nok)})
>     same => n,GotoIfTime(*,*,*,dec?decok:decnok)
>         same => n(decok),NoOp(GotoIftime DEC - OK)
>         same => n,Goto(feb)
>         same => n(decnok),NoOp(GotoIftime DEC - NOK)
>     same => n(feb),NoOp(Test IFTIME FEB ${IFTIME(*,*,*,feb?ok:nook)})
>     same => n,GotoIfTime(*,*,*,feb?febok:febnook)
>         same => n(febok),NoOp(GotoIftime FEB - OK)
>         same => n,Goto(end)
>         same => n(febnook),NoOp(GotoIftime FEB - NOK)
>     same => n(end),Hangup
> exten => Test1,1,NoOp(Time is ${STRFTIME()}")
>     same => n,Set(__TESTTIME=2018-12-30 18:00:00 Europe/Madrid)
>     same => n,Goto(s,1)
> exten => Test2,1,NoOp(Time is ${STRFTIME()}")
>     same => n,Set(__TESTTIME=2018-12-30,18:00:00,Europe/Madrid)
>     same => n,Goto(s,1)
> exten => Test3,1,NoOp(Time is ${STRFTIME()}")
>     same => n,Set(TESTTIME(2018-12-30,18:00:00,Europe/Madrid)=TestTime)
>     same => n,Goto(s,1)
> exten => Test4,1,NoOp(Time is ${STRFTIME()}")
>     same => n,Set(TESTTIME()=2018-12-30,18:00:00,Europe/Madrid)
>     same => n,Goto(s,1)
> {code}
> *test 0: not using testtime - Expected consistent with real*
> * Expected Result:
> ** IFTIME DEC nok
> ** GotoIftime DEC nok
> ** IFTIME FEB ok
> ** GotoIftime FEB ok
> * Obtained Result:
> ** IFTIME DEC nok
> ** GotoIftime DEC nok
> ** IFTIME FEB ok
> ** GotoIftime FEB ok
> {code}
> iospbx004*CLI> originate local/s at test application wait 5
>     -- Called s at test
>     -- Executing [s at test:1] NoOp("Local/s at test-00000035;2", "Time is Thu Feb  7 12:53:34 2019 - TESTTIME IS ") in new stack
>     -- Executing [s at test:2] NoOp("Local/s at test-00000035;2", "Test IFTIME DEC nok") in new stack
>     -- Executing [s at test:3] GotoIfTime("Local/s at test-00000035;2", "*,*,*,dec?decok:decnok") in new stack
>     -- Goto (test,s,6)
>     -- Executing [s at test:6] NoOp("Local/s at test-00000035;2", "GotoIftime DEC - NOK") in new stack
>     -- Executing [s at test:7] NoOp("Local/s at test-00000035;2", "Test IFTIME FEB ok") in new stack
>     -- Executing [s at test:8] GotoIfTime("Local/s at test-00000035;2", "*,*,*,feb?febok:febnook") in new stack
>     -- Goto (test,s,9)
>     -- Executing [s at test:9] NoOp("Local/s at test-00000035;2", "GotoIftime FEB - OK") in new stack
>     -- Executing [s at test:10] Goto("Local/s at test-00000035;2", "end") in new stack
>     -- Goto (test,s,12)
>     -- Executing [s at test:12] Hangup("Local/s at test-00000035;2", "") in new stack
>   == Spawn extension (test, s, 12) exited non-zero on 'Local/s at test-00000035;2'
> {code}
> *test 1: Setting TESTTIME Variable with spaces - Expected NOT consistent with real. But modifies gotoiftime result*
> * Expected Result:
> ** IFTIME DEC ok
> ** GotoIftime DEC ok
> ** IFTIME FEB nok
> ** GotoIftime FEB nok
> * Obtained Result:
> ** IFTIME DEC nok
> ** GotoIftime DEC nok
> ** IFTIME FEB ok
> ** GotoIftime FEB nok
> {code}
> iospbx004*CLI> originate local/Test1 at test application wait 5
>     -- Called Test1 at test
>     -- Executing [Test1 at test:1] NoOp("Local/Test1 at test-00000036;2", "Time is Thu Feb  7 12:54:15 2019"") in new stack
>     -- Executing [Test1 at test:2] Set("Local/Test1 at test-00000036;2", "__TESTTIME=2018-12-30 18:00:00 Europe/Madrid") in new stack
>     -- Executing [Test1 at test:3] Goto("Local/Test1 at test-00000036;2", "s,1") in new stack
>     -- Goto (test,s,1)
>     -- Executing [s at test:1] NoOp("Local/Test1 at test-00000036;2", "Time is Thu Feb  7 12:54:15 2019 - TESTTIME IS 2018-12-30 18:00:00 Europe/Madrid") in new stack
>     -- Executing [s at test:2] NoOp("Local/Test1 at test-00000036;2", "Test IFTIME DEC nok") in new stack
>     -- Executing [s at test:3] GotoIfTime("Local/Test1 at test-00000036;2", "*,*,*,dec?decok:decnok") in new stack
>     -- Goto (test,s,6)
>     -- Executing [s at test:6] NoOp("Local/Test1 at test-00000036;2", "GotoIftime DEC - NOK") in new stack
>     -- Executing [s at test:7] NoOp("Local/Test1 at test-00000036;2", "Test IFTIME FEB ok") in new stack
>     -- Executing [s at test:8] GotoIfTime("Local/Test1 at test-00000036;2", "*,*,*,feb?febok:febnook") in new stack
>     -- Goto (test,s,11)
>     -- Executing [s at test:11] NoOp("Local/Test1 at test-00000036;2", "GotoIftime FEB - NOK") in new stack
>     -- Executing [s at test:12] Hangup("Local/Test1 at test-00000036;2", "") in new stack
>   == Spawn extension (test, s, 12) exited non-zero on 'Local/Test1 at test-00000036;2'
> {code}
> *test 2: Setting TESTTIME Variable with comas - Expected NOT consistent with real, But modifies gotoiftime result*
> * Expected Result:
> ** IFTIME DEC ok
> ** GotoIftime DEC ok
> ** IFTIME FEB nok
> ** GotoIftime FEB nok
> * Obtained Result:
> ** IFTIME DEC nok
> ** GotoIftime DEC nok
> ** IFTIME FEB ok
> ** GotoIftime FEB nok
> {code}
> iospbx004*CLI> originate local/Test2 at test application wait 5
>     -- Called Test2 at test
>     -- Executing [Test2 at test:1] NoOp("Local/Test2 at test-00000037;2", "Time is Thu Feb  7 12:54:18 2019"") in new stack
>     -- Executing [Test2 at test:2] Set("Local/Test2 at test-00000037;2", "__TESTTIME=2018-12-30,18:00:00,Europe/Madrid") in new stack
>     -- Executing [Test2 at test:3] Goto("Local/Test2 at test-00000037;2", "s,1") in new stack
>     -- Goto (test,s,1)
>     -- Executing [s at test:1] NoOp("Local/Test2 at test-00000037;2", "Time is Thu Feb  7 12:54:18 2019 - TESTTIME IS 2018-12-30,18:00:00,Europe/Madrid") in new stack
>     -- Executing [s at test:2] NoOp("Local/Test2 at test-00000037;2", "Test IFTIME DEC nok") in new stack
>     -- Executing [s at test:3] GotoIfTime("Local/Test2 at test-00000037;2", "*,*,*,dec?decok:decnok") in new stack
>     -- Goto (test,s,6)
>     -- Executing [s at test:6] NoOp("Local/Test2 at test-00000037;2", "GotoIftime DEC - NOK") in new stack
>     -- Executing [s at test:7] NoOp("Local/Test2 at test-00000037;2", "Test IFTIME FEB ok") in new stack
>     -- Executing [s at test:8] GotoIfTime("Local/Test2 at test-00000037;2", "*,*,*,feb?febok:febnook") in new stack
>     -- Goto (test,s,11)
>     -- Executing [s at test:11] NoOp("Local/Test2 at test-00000037;2", "GotoIftime FEB - NOK") in new stack
>     -- Executing [s at test:12] Hangup("Local/Test2 at test-00000037;2", "") in new stack
>   == Spawn extension (test, s, 12) exited non-zero on 'Local/Test2 at test-00000037;2'
> {code}
> *test 3: Setting TESTTIME function by values - Expected NOT consistent with real. Nothing seems to happen, same behabiour as test0*
> * Expected Result:
> ** IFTIME DEC ok
> ** GotoIftime DEC ok
> ** IFTIME FEB nok
> ** GotoIftime FEB nok
> * Obtained Result:
> ** IFTIME DEC nok
> ** GotoIftime DEC nok
> ** IFTIME FEB ok
> ** GotoIftime FEB ok
> {code}
> iospbx004*CLI> originate local/Test3 at test application wait 5
>     -- Called Test3 at test
>     -- Executing [Test3 at test:1] NoOp("Local/Test3 at test-00000038;2", "Time is Thu Feb  7 12:54:21 2019"") in new stack
>     -- Executing [Test3 at test:2] Set("Local/Test3 at test-00000038;2", "TESTTIME(2018-12-30,18:00:00,Europe/Madrid)=TestTime") in new stack
>     -- Executing [Test3 at test:3] Goto("Local/Test3 at test-00000038;2", "s,1") in new stack
>     -- Goto (test,s,1)
>     -- Executing [s at test:1] NoOp("Local/Test3 at test-00000038;2", "Time is Thu Feb  7 12:54:21 2019 - TESTTIME IS ") in new stack
>     -- Executing [s at test:2] NoOp("Local/Test3 at test-00000038;2", "Test IFTIME DEC nok") in new stack
>     -- Executing [s at test:3] GotoIfTime("Local/Test3 at test-00000038;2", "*,*,*,dec?decok:decnok") in new stack
>     -- Goto (test,s,6)
>     -- Executing [s at test:6] NoOp("Local/Test3 at test-00000038;2", "GotoIftime DEC - NOK") in new stack
>     -- Executing [s at test:7] NoOp("Local/Test3 at test-00000038;2", "Test IFTIME FEB ok") in new stack
>     -- Executing [s at test:8] GotoIfTime("Local/Test3 at test-00000038;2", "*,*,*,feb?febok:febnook") in new stack
>     -- Goto (test,s,9)
>     -- Executing [s at test:9] NoOp("Local/Test3 at test-00000038;2", "GotoIftime FEB - OK") in new stack
>     -- Executing [s at test:10] Goto("Local/Test3 at test-00000038;2", "end") in new stack
>     -- Goto (test,s,12)
>     -- Executing [s at test:12] Hangup("Local/Test3 at test-00000038;2", "") in new stack
>   == Spawn extension (test, s, 12) exited non-zero on 'Local/Test3 at test-00000038;2'
> {code}
> *test 4: Setting TESTTIME function by args - Expected NOT consistent with real Nothing seems to happen, same behabiour as test0*
> * Expected Result:
> ** IFTIME DEC ok
> ** GotoIftime DEC ok
> ** IFTIME FEB nok
> ** GotoIftime FEB nok
> * Obtained Result:
> ** IFTIME DEC nok
> ** GotoIftime DEC nok
> ** IFTIME FEB ok
> ** GotoIftime FEB ok
> {code}
> iospbx004*CLI> originate local/Test4 at test application wait 5
>     -- Called Test4 at test
>     -- Executing [Test4 at test:1] NoOp("Local/Test4 at test-00000039;2", "Time is Thu Feb  7 12:54:24 2019"") in new stack
>     -- Executing [Test4 at test:2] Set("Local/Test4 at test-00000039;2", "TESTTIME()=2018-12-30,18:00:00,Europe/Madrid") in new stack
>     -- Executing [Test4 at test:3] Goto("Local/Test4 at test-00000039;2", "s,1") in new stack
>     -- Goto (test,s,1)
>     -- Executing [s at test:1] NoOp("Local/Test4 at test-00000039;2", "Time is Thu Feb  7 12:54:24 2019 - TESTTIME IS ") in new stack
>     -- Executing [s at test:2] NoOp("Local/Test4 at test-00000039;2", "Test IFTIME DEC nok") in new stack
>     -- Executing [s at test:3] GotoIfTime("Local/Test4 at test-00000039;2", "*,*,*,dec?decok:decnok") in new stack
>     -- Goto (test,s,6)
>     -- Executing [s at test:6] NoOp("Local/Test4 at test-00000039;2", "GotoIftime DEC - NOK") in new stack
>     -- Executing [s at test:7] NoOp("Local/Test4 at test-00000039;2", "Test IFTIME FEB ok") in new stack
>     -- Executing [s at test:8] GotoIfTime("Local/Test4 at test-00000039;2", "*,*,*,feb?febok:febnook") in new stack
>     -- Goto (test,s,9)
>     -- Executing [s at test:9] NoOp("Local/Test4 at test-00000039;2", "GotoIftime FEB - OK") in new stack
>     -- Executing [s at test:10] Goto("Local/Test4 at test-00000039;2", "end") in new stack
>     -- Goto (test,s,12)
>     -- Executing [s at test:12] Hangup("Local/Test4 at test-00000039;2", "") in new stack
>   == Spawn extension (test, s, 12) exited non-zero on 'Local/Test4 at test-00000039;2'
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list