Announce time & date

Discussion in 'CRM / Helpdesk / App Integration' started by eagle2, Sep 1, 2011.

Thread Status:
Not open for further replies.
  1. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    Does anybody has an idea how to implement announcing current date & time during a call ?
    I have a customer willing to have recorded the date & time of the call in the audio recording.

    The 3CX system can read the date and time of a left voice message.
    Generally there are time servers which can announce current time (usually operators have such service).

    Any ideas?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    You will need to manually create a user component in order to achieve this. You can send to it the date and time information as parameters, and then play the right audio files, selecting them using Conditional components. This is a complex task to do I have to admit, but currently there is no other way to go.
     
  3. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    thanks

    my idea is to play date & time info as dynamic greeting message, the same way or similar like this happens in voice-mail menu
    would this be possible?

    regards
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Yes, it is possible, but you will need to create the entire logic yourself. For example, to play the number 20 you will need a file 20.wav and choose to play that file using a Conditional component.

    Using the recently added feature that allows playing audio files creating the name in runtime with expressions, this is a bit easier than before, but still challenging...

    Regards,
     
  5. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    OK,

    I will take the challenge. It will take some time ...

    Regards
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    You could also use the built in Text-To-Speech engine in .Net if you don't mind the generic Microsoft voice (Microsoft calls here ANNA). We have done this in several projects, using a custom .Net component to generate the .wav file.

    We've also done it with better voices to customers who have paid for 3rd party licenses for other voices.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    I'm trying to run this example (which is the foundation for the task I want to implement):
    http://www.3cx.com/blog/voip-howto/javascript-3cx-vad/

    but the IVR terminates suddenly, leading me to a problem executing java expression:
    “new Date (). GetHours ()” - without the quotes.

    It looks like java statements are not executed by 3CX. I'm running Version 10 SP3.

    Code:
    11:53:00.226|2312|.\PbxMedia\IVREngine.cpp(1723):IvrService, IVREngine::RegisterLines(), Registering of lines done.
    11:56:04.215|1276|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgTypeError: (new Date()).GetHours is not a functionline1linetxttokentxt
    11:57:12.927|2312|.\PbxMedia\IVREngine.cpp(1597):IvrService, IVREngine::RegisterLines(), Registering of lines...127.0.0.1:5060127.0.0.1:5060999[901,910,912,913,905,851,861,862][][EndCall,IVRForward,MakeCall,PlayFile,RecordFile]
    11:57:12.927|2312|.\PbxMedia\IVREngine.cpp(1723):IvrService, IVREngine::RegisterLines(), Registering of lines done.
    11:57:46.031|4796|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgReferenceError: newDate is not definedline1linetxttokentxt
    11:58:11.748|4148|.\api\VXItelImpl.cpp(148):IvrDll, VXItelImpl::Impl::IntrnTransfer(), Error! Error of 'From_111_To_851_Menu_851_#0/2' session transferring to sip:901@127.0.0.1:5060. Status: NEAR_END_DISCONNECT. Transfer error. Session stopped
    11:58:12.210|4264|(0):Error! Module '3CX.com.OSBinet'. Error ID 302. URLhttp://localhost:5000/ivr/(S(2xiaevv1mwggzmdsvju5cmts))/dr.aspx?dr=901&to=901&from=111
    11:58:24.345|4332|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgReferenceError: newDate is not definedline1linetxttokentxt
    
    Any ideas ?

    ---------

    Reinstalling JRE at server (latest vesrion 1.7.0) and restarting 3CX server slightly improved the situation -- I can record a voice message to file or write some text (the filename should be put into single quotes, which by-the-way remain as part of the filename on disk). Otherwise the IVR either crashes (call drops) or is skipped (call continues).

    Still the example above is not working. However the built-in NOW() function is working.
    My feeling is either the VAD is either not well documented or is somehow buggy.

    Regards,
    Orlin.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Hi Orly,

    I think that the problem is the space between before parenthesis. You're using:
    new Date (). GetHours ()

    And it should be:
    new Date().GetHours()

    Give it a try and let me know.

    Thanks,
     
  9. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    OK

    I will try this also. Meanwhile is there a manual with detailed syntax description, etc.
    The existing VAD manual is good as giving an idea what is VAD doing, but not containing specifications or syntax details, etc.

    Kind regards,
    Orlin.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    That is javascript code. Here you have a good reference about it:
    https://developer.mozilla.org/en/JavaScript/Reference
     
  11. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    Thanks for the reference :)

    The above statement however is not working (exact typing) –– IVR crashes:
    Code:
    now Date().GetHours()
    I'm getting an error:
    Code:
    (0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgTypeError: (new Date()).GetHours is not a functionline1linetxttokentxt
    which looks like the parenthesis are misplaced for some reason in the code.

    Regards
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    You have entered:
    now Date().GetHours()

    And it should be:
    new Date().getHours()

    Pay attention to the case, and "new" instead of "now".
     
  13. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    This was a typing error - 'now' instead of 'new'.
    The problem was the capital 'G' in 'GetHours' -- now it is working with small 'g'.

    10x.
    Orlin
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Good to know!
     
  15. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    Thanks.

    Is it possible to use existing libraries (used in announcing date and time for voice message, when listening to voicemail) for the purpose, or I need to construct it myself (with prerecorded audio files) ?

    Can you give me a hint.

    Regards
    Orlin.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    No, currently there is no way to re-use the VXML scripts used by the voicemail to play dates and times. Currently the only way to do it with the VAD is manually playing files.
     
  17. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    OK, thanks.
    I'm almost ready with this.

    I have another issue -- in file management component I discovered that filename should be specified enclosed in single quotes, like: 'filename.txt', otherwise without quotes or with double quotes the VAD crashes. This also results the file created on disk contains the single quotes in its name and also is not possible to specify a path -- again VAD crashes or nothing happens.

    What is the syntax for file management and probably also other components ?
    I also don't have success in sending e-mails from VAD -- either nothing happens or VAD crashes. I assume this is also related to syntax.

    Kind regards,
    Orlin.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    The file name is not an expression, so you don't have to use quotes. The file name will be used as entered. If you need to use another path, you need to enter the path relative to the working directory. For example, use:
    ..\Files\MyFile.txt

    instead of:
    C:\ProgramData\3CX\Data\Http\Interface\ivr\Files\MyFile.txt

    If you're having problems using this component without quotes, then it is something else. Send the logs and we'll help you find out what's the problem.
     
  19. eagle2

    eagle2 Well-Known Member

    Joined:
    Apr 27, 2011
    Messages:
    1,085
    Likes Received:
    11
    Double backslash are necessary for describing the path in file management component, i.e.
    ..\\MyFile.txt
    otherwise VAD crashes.

    This issue believed to be solved.

    I still have problems with e-mail sender.

    If I put the SMTP server address (10.10.10.11) without any kind of quotes, the error log says:
    Code:
    17:34:13.358|4468|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgmissing ; before statementline1linetxt10.10.10.11tokentxt.10.11
    17:34:13.358|4468|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgSyntaxError: missing ; before statementline1linetxt10.10.10.11tokentxt.10.11
    
    If I'm using single or double quotes the result is the following:
    Code:
    17:53:32.398|3284|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgmissing ; before statementline1linetxt3cxtokentxtcx
    17:53:32.398|3284|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgSyntaxError: missing ; before statementline1linetxt3cxtokentxtcx
    
    If I'm using variables I got even more severe errors:
    Code:
    18:20:47.545|4336|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgmissing ; before statementline1linetxt10.10.10.11tokentxt.10.11
    18:20:47.545|4336|(0):Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgSyntaxError: missing ; before statementline1linetxt10.10.10.11tokentxt.10.11
    18:20:47.555|4336|(0):Error! Module '3CX.com.vxi'. Error ID 999. messageunexpected jump to a document
    18:20:47.557|4336|.\api\VXIFactory.cpp(330):IvrDll, VXISessionImpl::ProcessDocument(), Error! VXIinterpreter->Run() failed, error code -100
    18:20:47.557|4336|.\VXIMachine.cpp(55):IvrDll, VXISessionThread::Run(), Error! Call 'From_111_To_862_Menu_862_#0/0': session finished with error code -57. Error of document interpretation: -57, interp.code: -100
    
    Something's wrong.
    Any idea?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    As a rule of thumb, when you have the Expression Editor button on the right of a field, it is an expression field. In that case, in order to enter a constant string value you need to add single quotes.

    In regards to the SMTP Server address, that field is an expression, so you need to add single quotes if you want a constant string value. An expression is a javascript expression, that's why you need quotes. You can use the expression editor to create the expression easily using the VAD functions if you want.

    Here it's possible that you have another field with an invalid value. Open the configuration dialog and check if you're entering a string literal without quotes into a field that is an expression (with the expression button on the right).

    Hope that helps.
     
Thread Status:
Not open for further replies.