[Freeswitch-users] Lua Script with mod_vmd, setInputCallback doesn't seem to get called
Michael De Lorenzo
delorenzodesign at gmail.com
Wed Mar 3 19:04:19 PST 2010
Has anyone experienced issues with vmd or dtmf with Verizon wireless? I
have another script that doesn't even register digits pressed -- it's like
no keys are pressed at all.
I've checked the FS log and it doesn't seem to log anything with regard to
the mod_vmd other than an indication of MIN_TIME of 8000 (not sure what that
does exactly).
Does anyone have any sample scripts available other than what's on the FS
wiki?
On Mon, Mar 1, 2010 at 10:17 PM, Michael De Lorenzo <
delorenzodesign at gmail.com> wrote:
> I've got the following Lua script working in a sense, but the InputCallback
> never seems to get called while the file is being streamed to the call
> recipient. I've tried moving the "vmd start" command and set input callback
> around a bit, but to no avail. I'm testing this against a cell phone voice
> mailbox (Verizon).
>
>
>> freeswitch.consoleLog("info","########################################################\n\n");
>>
>> number_to_call = argv[1]
>> message_to_play = "/opt/freeswitch/recordings/messages/" .. argv[2]
>>
>> voicemail_detected = false;
>>
>> function onInput(s, type, obj)
>> freeswitch.consoleLog("notice","*********** Type?: " .. type .. "
>> *************\n");
>> -- freeswitch.consoleLog("notice","*********** VMD?: " ..
>> session:getVariable("vmd_detect") .. " *************\n");
>>
>> if(type == "event" and voicemail_detected == false) then
>> freeswitch.consoleLog("notice","************ VOICE MAIL/ANSWERING
>> MACHINE DETECTED *************\n");
>> voicemail_detected = true;
>> return "break";
>> end
>> end
>>
>> function playbackMessage()
>> sleep_time = 1000;
>> if(voicemail_detected) then
>> sleep_time = 2500;
>> end
>> -- sleep a second
>> session:sleep(sleep_time);
>> -- play a file
>> session:streamFile(message_to_play);
>> end
>>
>> function notify()
>> session =
>> freeswitch.Session("{ignore_early_media=true}sofia/gateway/voicenetwork/1"
>> .. number_to_call)
>>
>>
>>
>> if(session:ready()) then
>> -- answer the call
>> session:answer();
>> session:setInputCallback("onInput", "");
>> session:execute("vmd","start");
>>
>> playbackMessage();
>> if(voicemail_detected) then
>> freeswitch.consoleLog("notice","************ DOING PLAYBACK
>> FOR VOICEMAIL/ANSWERING MACHINE *************\n");
>> playbackMessage();
>> end
>>
>> freeswitch.consoleLog("notice", "********* hanging up session
>> **********\n");
>> -- hangup
>> session:hangup();
>> end
>> end
>>
>> notify();
>>
>>
>> freeswitch.consoleLog("info","########################################################\n\n");
>>
>
> --
> Michael De Lorenzo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100303/5d4e041c/attachment-0002.html
More information about the FreeSWITCH-users
mailing list