Koozali.org formerly Contribs.org

Obsolete Releases => SME VoIP (Asterisk, SAIL etc) => Topic started by: apmuthu on February 13, 2013, 09:22:52 PM

Title: sarkhpe - SayUnixTime AM/PM Error - Solved
Post by: apmuthu on February 13, 2013, 09:22:52 PM
On SAIL v3.1.1-22, the sarkhpe binary seems to be passing the wrong meridian time to the AGI:
Code: [Select]
Verbosity was 0 and is now 6
Core debug was 0 and is now 6
  == Using SIP RTP CoS mark 5
    -- Executing [*55*@internal:1] AGI("SIP/5001-00000002", "sarkhpe,OutCos,*55*,,") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sarkhpe
    -- <SIP/5001-00000002>AGI Script sarkhpe completed, returning 0
    -- Executing [*55*@5001opencos:1] AGI("SIP/5001-00000002", "sarkhpe,OutCluster,*55*,,") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sarkhpe
    -- AGI Script Executing Application: (Set) Options: (CDR(accountcode)=defaul                                          t)
    -- <SIP/5001-00000002>AGI Script sarkhpe completed, returning 0
    -- Executing [*55*@qrxvtmny:1] AGI("SIP/5001-00000002", "sarkhpe,*55*,,") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sarkhpe
    -- AGI Script Executing Application: (Wait) Options: (0.5)
    -- AGI Script Executing Application: (SayUnixTime) Options: (,GB,)
    -- <SIP/5001-00000002> Playing 'digits/day-4.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/14.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/mon-1.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/2.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/thousand.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/13.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/at.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/1.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/40.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/4.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/p-m.gsm' (language 'en-gb')
    -- AGI Script Executing Application: (Wait) Options: (1)
    -- AGI Script Executing Application: (SayUnixTime) Options: (,GB,)
    -- <SIP/5001-00000002> Playing 'digits/day-4.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/14.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/mon-1.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/2.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/thousand.gsm' (language 'en-gb')
    -- <SIP/5001-00000002> Playing 'digits/13.gsm' (language 'en-gb')
    -- <SIP/5001-00000002>AGI Script sarkhpe completed, returning 4
  == Spawn extension (qrxvtmny, *55*, 1) exited non-zero on 'SIP/5001-00000002'
    -- Executing [h@qrxvtmny:1] Hangup("SIP/5001-00000002", "") in new stack
  == Spawn extension (qrxvtmny, h, 1) exited non-zero on 'SIP/5001-00000002'

At 1:44am IST (Server Time), it was reading out 1:44pm

IST = UTC+5:30

This is hardcoded in /etc/asterisk/say.conf at lines 95-97:
Code: [Select]
    ; XXX too bad the '?' function does not remove the quotes
    ; _date:[pP]:. => digits/$[ ${SAY:10:2} > 12 ? "p-m" :: "a-m"] ; am pm
    _date:[pP]:. => digits/p-m ; am pm

This issue is now solved by replacing the above with:
Code: [Select]
    _date:[pP]:. => digits/$[ ${SAY:10:2}+0 > 12 ? p :: a ]-m ; am pm

Depending on where this file came from, it may be reported upstream.
 
Title: Re: sarkhpe - SayUnixTime AM/PM Error - Solved
Post by: apmuthu on April 02, 2013, 06:09:14 AM
A small typo in the solution - it was reading the minutes instead of the hour. It should be:
Code: [Select]
    _date:[pP]:. => digits/$[ ${SAY:8:2}+0 > 12 ? p :: a ]-m ; am pm