[Freeswitch-users] ivr terminitor key?

Seven Du dujinfang at gmail.com
Mon Nov 1 15:53:19 PDT 2010


So I tried play_and_get_digits directly in lua, it seems that it
doesn't support min=0. Would like to make it support 0 so it can
return "" immediately. Do you accept a patch? I think it should not
break anything if no one use 0 in production.

btw, I using the following lua function to achieve this :

function getDigits(max, file, regex)
	-- digits = session:playAndGetDigits(0, max, tries, timeout, term,
file, invalid_file, regex);
	local d = ""
	while tries > 0 do
		if not session:ready() then return "" end;
		d = session:read(1, max, file, timeout, "#")
		if d == "" then return "" end;
		log("comparing [" .. d .. "] [" .. regex .. "]\n" );
		if d:match(regex) then
			return d
		else
			if tries == 1 then
				return ""
			end
			session:streamFile(file);
		end
		tries = tries - 1;
	end
	
end

Thanks.

On Sun, Oct 31, 2010 at 5:19 PM, Seven Du <dujinfang at gmail.com> wrote:
> confirm-key works that way if I enter some digits followed by #, but
> not if I directly press #.
>
> On Sun, Oct 31, 2010 at 4:54 PM, Seven Du <dujinfang at gmail.com> wrote:
>> Hi,
>>
>> For ivr menus that have digit-len > 1, is there a way to specify a
>> terminator key, say #, to stop digits collecting immediately? Default
>> behavior tends to wait until a timeout.
>>
>> Thanks.
>>
>> --
>> Blog: http://www.dujinfang.com
>> Proj:  http://www.freeswitch.org.cn
>>
>
>
>
> --
> Blog: http://www.dujinfang.com
> Proj:  http://www.freeswitch.org.cn
>



-- 
Blog: http://www.dujinfang.com
Proj:  http://www.freeswitch.org.cn



More information about the FreeSWITCH-users mailing list