[Freeswitch-users] lua trouble

Alex alex at thewinelake.com
Tue Jun 19 12:14:19 MSD 2012


Yes, but this works:

function getDestNumber()
         session:execute("log", "INFO mcm2.lua getDestNumber")
         destnum = session:playAndGetDigits(3, 20, 3, 5000, "#", 
"/home/oev/fs-pabx/prompts/dmsb12_mcm3.wav", "", "\\d+\\*?")
         l = string.len(destnum)
         if string.sub(destnum,l)=="*" then
                 destnum = ""
         end
         return destnum
end

Unfortunately, it still doesn't quite work as I'd like. The * doesn't 
act as a "remembered but terminating" key, so the customer still has to 
press # (or, presumably, wait 5s) after pressing * for the message to 
get through!

Is there a DTMF history buffer one can inspect? Then I could make * a 
terminating key and then just see if that was the last DTMF.

Alex



> I didn't need to do any such thing... Did you get an error using 
> myString:len()?
> -Avi
>
>
> On Mon, Jun 18, 2012 at 8:07 PM, Alex <alex at thewinelake.com 
> <mailto:alex at thewinelake.com>> wrote:
>
>     OK, so replying to myself, I think I need to include the string
>     library... I can see in lua.conf.xml that one can have a
>     "module-directory" but I'm not sure where I should get these
>     modules from. Any recommended quick reading on this?
>>     More lua trouble - real beginner stuff, I'm afraid.
>>
>>     Why does this not work:
>>
>>             destnum = session:playAndGetDigits(3, 20, 3, 5000, "#",
>>     "/home/oev/fs-pabx/prompts/dmsb12_mcm3.wav", "", "\\d+\\*")
>>             l = strlen(destnum)
>>
>>     The objection is
>>
>>
>>     2012-06-18 16:52:30.415261 [ERR] mod_lua.cpp:198
>>     /usr/local/freeswitch/scripts/mcm2.lua:13: attempt to call global
>>     'strlen' (a nil value)
>>     stack traceback:
>>             /usr/local/freeswitch/scripts/mcm2.lua:13: in function
>>     'getDestNumber'
>>             /usr/local/freeswitch/scripts/mcm2.lua:49: in function
>>     'unattendedTransfer'
>>             /usr/local/freeswitch/scripts/mcm2.lua:24: in function
>>     'processMcmOption'
>>     /usr/local/freeswitch/scripts/mcm2.lua:153: in main chunk
>>
>>     I was just assuming that lua is lua and that anything in the lua
>>     wiki (eg. http://www.lua.org/manual/2.4/node32.html#exstring)
>>     would work.
>>
>>>     Phrases let you mix and match speak, say, play-file, silence,
>>>     other macros, and even passing in options.
>>>
>>>     http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_phrase
>>>     http://wiki.freeswitch.org/wiki/Speech_Phrase_Management
>>>
>>>     -Avi
>>>
>>>
>>>     _________________________________________________________________________
>>>     Professional FreeSWITCH Consulting Services:
>>>     consulting at freeswitch.org  <mailto:consulting at freeswitch.org>
>>>     http://www.freeswitchsolutions.com
>>>
>>>     
>>>     
>>>
>>>     Official FreeSWITCH Sites
>>>     http://www.freeswitch.org
>>>     http://wiki.freeswitch.org
>>>     http://www.cluecon.com
>>>
>>>     Join Us At ClueCon - Aug 7-9, 2012
>>>
>>>     FreeSWITCH-users mailing list
>>>     FreeSWITCH-users at lists.freeswitch.org  <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>>     http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>     UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>     http://www.freeswitch.org
>>>
>>>
>>>     No virus found in this message.
>>>     Checked by AVG - www.avg.com <http://www.avg.com>
>>>     Version: 2012.0.2177 / Virus Database: 2433/5076 - Release Date:
>>>     06/17/12
>>>
>>
>>
>>
>>
>>     _________________________________________________________________________
>>     Professional FreeSWITCH Consulting Services:
>>     consulting at freeswitch.org  <mailto:consulting at freeswitch.org>
>>     http://www.freeswitchsolutions.com
>>
>>     
>>     
>>
>>     Official FreeSWITCH Sites
>>     http://www.freeswitch.org
>>     http://wiki.freeswitch.org
>>     http://www.cluecon.com
>>
>>     Join Us At ClueCon - Aug 7-9, 2012
>>
>>     FreeSWITCH-users mailing list
>>     FreeSWITCH-users at lists.freeswitch.org  <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>     http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>     UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>     http://www.freeswitch.org
>>
>>
>>     No virus found in this message.
>>     Checked by AVG - www.avg.com <http://www.avg.com>
>>     Version: 2012.0.2177 / Virus Database: 2437/5077 - Release Date:
>>     06/18/12 
>
>
>
>     _________________________________________________________________________
>     Professional FreeSWITCH Consulting Services:
>     consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>     http://www.freeswitchsolutions.com
>
>     
>     
>
>     Official FreeSWITCH Sites
>     http://www.freeswitch.org
>     http://wiki.freeswitch.org
>     http://www.cluecon.com
>
>     Join Us At ClueCon - Aug 7-9, 2012
>
>     FreeSWITCH-users mailing list
>     FreeSWITCH-users at lists.freeswitch.org
>     <mailto:FreeSWITCH-users at lists.freeswitch.org>
>     http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>     UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>     http://www.freeswitch.org
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.2177 / Virus Database: 2437/5078 - Release Date: 06/18/12
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120619/3adc6da0/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list