Re: [Freeswitch-users] setInputCallback not working with Javascript?
Regarding the second part of his question, I am having a hard time stripping SpeechTools.jm into a very simple speech recognition example. I also cannot get collectInput to receive the type of "event", only "dtmf" -- Greg Thoen, Vice President CGI Communications, Inc. 1-585-427-0020 x260 On Mar 24, 2009, at 9:47 AM, Brian West wrote: Javascript doesn't use the Core Session constructor. Its not the same as the other languages. /b On Mar 24, 2009, at 1:40 AM, mszla...@aol.com wrote: I'm getting in build 12653M: [ERR] notify.js:130 mod_spidermonkey() TypeError: session.setInputCallback is not a function The wiki says this function should work in Javascript. http://wiki.freeswitch.org/wiki/ CoreSession_Constructor#session:setInputCallback Also, has there been changes to session.collectInput with type="event"? I get dtmf type events with my callback function but can't seem to get type="event" with speech events. Mark. ___ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Stumped on speech recognition
Still stumped on trying to write a streamlined pocketsphinx speech recognition. I went through SpeechTools.jm and I think I pulled out the necessary pieces, but the speech event is not being fired. I get dtmf events if I push a key, but not speech. I must be missing a piece, but I have stared at SpeechTools.jm until I can't see straight. Here is my code: function onInput(s, type, inputEvent, _this) { console_log("debug", "EVENT:" + type + "\n"); } session.answer(); var blankobj = new Object(); var rv; var hit; var dup; var grammar_name="pizza_yesno"; var collected_index=0; var req=1; var obj_path="result"; var halt=true; var min_score=20; var confirm_score=10; console_log('INFO', "Setting grammar\n"); session.execute("detect_speech", "nogrammar " + grammar_name); session.execute("detect_speech", "pocketsphinx " + grammar_name); session.execute("detect_speech", "resume"); console_log('INFO', "entering while loop\n"); session.streamFile( "audiofile.wav", onInput, "blankobj") ; while(session.ready() && collected_index < req) { var x; if (!rv) { rv = session.collectInput(onInput, "blankobj", 500); if (rv && !rv[0]) { rv = false; } } if (!rv) { session.execute("detect_speech", "resume"); rv = session.collectInput(onInput, "blankobj", 5000); } hit = false; if (rv) { var items = rv; rv = undefined; for (y = 0; y < items.length; y++) { console_log("debug", " "+items[y]+"\n"); } } if (!rv) { rv = session.collectInput(onInput, "blankobj", 1000); } } And here is some of the output from the console: 2009-07-29 16:10:09 [INFO] stest-examp.js:1 console_log() Setting grammar EXECUTE sofia/internal/+...@199.173.94.88:5060 detect_speech(nogrammar pizza_yesno) EXECUTE sofia/internal/+...@199.173.94.88:5060 detect_speech(pocketsphinx pizza_yesno) EXECUTE sofia/internal/+...@199.173.94.88:5060 detect_speech(resume) 2009-07-29 16:10:09 [INFO] stest-examp.js:1 console_log() entering while loop 2009-07-29 16:10:09 [DEBUG] switch_ivr_play_say.c:1084 switch_ivr_play_file() Codec Activated l...@8000hz 1 channels 20ms 2009-07-29 16:10:09 [DEBUG] switch_core_io.c:649 switch_core_session_write_frame() sofia/internal/+...@199.173.94.88:5060 receive message [TRANSCODING_NECESSARY] 2009-07-29 16:10:09 [DEBUG] sofia.c:2979 sofia_handle_sip_i_state() Channel sofia/internal/+...@199.173.94.88:5060 entering state [ready][200] 2009-07-29 16:10:12 [DEBUG] switch_ivr_play_say.c:1379 switch_ivr_play_file() done playing file EXECUTE sofia/internal/+...@199.173.94.88:5060 detect_speech(resume) 2009-07-29 16:10:16 [DEBUG] switch_rtp.c:1876 switch_rtp_dequeue_dtmf() RTP RECV DTMF 5:2440 2009-07-29 16:10:16 [DEBUG] stest-examp.js:45 console_log() EVENT:dtmf EXECUTE sofia/internal/+...@199.173.94.88:5060 detect_speech(resume) EXECUTE sofia/internal/+...@199.173.94.88:5060 detect_speech(resume) 2009-07-29 16:10:27 [DEBUG] switch_rtp.c:1876 switch_rtp_dequeue_dtmf() RTP RECV DTMF 5:2320 2009-07-29 16:10:27 [DEBUG] stest-examp.js:45 console_log() EVENT:dtmf Greg ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re: [Freeswitch-users] Stumped on speech recognition
Hi. Yes, I have had that running, no problem. I agree that SpeechTools as a class is easy to use, but I am trying to write a smaller version that I can integrate more with what I am doing; so I am trying to pull out pieces of it. In the example I gave, I am concerned that I can't even get my onInput to see the event. I feel I must be missing some step in my code. -- Greg Thoen, Vice President CGI Communications, Inc. 1-585-427-0020 x260 On Jul 29, 2009, at 4:34 PM, Brian West wrote: SpeechTools.jm is rather simple if you look at ps_pizza.js that uses it.. you'll get a better feel for how that works. Have you looked at the pizza demo javascript? /b On Jul 29, 2009, at 3:28 PM, Greg Thoen wrote: Still stumped on trying to write a streamlined pocketsphinx speech recognition. I went through SpeechTools.jm and I think I pulled out the necessary pieces, but the speech event is not being fired. I get dtmf events if I push a key, but not speech. I must be missing a piece, but I have stared at SpeechTools.jm until I can't see straight. Here is my code: ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Outbound socket PHP question
Hi, does anyone have an example of a simple PHP socket script that will listen and spawn of a process that handles the incoming call? I understand the inbound socket and code such as this http://wiki.freeswitch.org/wiki/PHP_Event_Socket that will let me initiate operations. It's the constantly running php socket program that I can't get my head around, and how it will spawn another php script that will be able to do things like answer the session, get dtmf, etc. -- Greg On Aug 2, 2009, at 6:35 PM, Michael Collins wrote: On Sun, Aug 2, 2009 at 12:38 PM, Nik Middleton > wrote: Hi Guys, I’m using an outbound socket to control calls, and it works a charm. However, what I’d like to do is send a custom event regarding the call on hang-up. The way I see things happening at the moment, and I could be wrong, is that the socket is closed when a hang-up occurs, so am I taking a chance trying to send the event then? (try to sneak out the event before socket closure happens) The other option is of course to open an inbound socket and send the event, but I’d rather not do that if possible. Nik, Perhaps the "linger" event socket command will do what you need? Check out this commit: http://lists.freeswitch.org/pipermail/freeswitch-svn/2009-January/009391.html Let me know if it works for you and I'll be sure to get it documented properly. If you get it working I'd love to see a code snippet so we can wikify this knowledge. :) Thanks, MC ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re: [Freeswitch-users] Outbound socket PHP question
Thanks so much, William. This gives me a great start. -- Greg On Aug 4, 2009, at 7:04 PM, William Suffill wrote: I wrote some notes on this but have yet to wiki it. example of an outbound socket connection where the call is answered, a variable is set then perhaps play one of the pre-installed files and hangup. ivrd fs_ivrd comes with freeswitch. It being a small daemon just invokes the script defined in a variable and passes data from it via STDIN/OUT Since this is an outbound socket connections it needs to be defined in the dialplan. Ex: The above dialplan sample would invoke ivr-demo.php when 55522 is called as long as fs_ivrd is running. To start fs_ivrd: /usr/local/freeswitch/bin/fs_ivrd -h 127.0.0.1 -p 8004 It takes 2 arguments -h for hostname and -p for port. PHP Code #!/usr/bin/php -q /usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr- welcome_to_freeswitch.wav\n\n"; // Wait sleep(5); // Hangup echo "sendmsg\n"; echo "call-command: hangup\n\n"; fclose($in); ?> ivrd will call this script for each call. All itdoes is answer the channel tell FreeSWITCH to play the “welcome to freeswitch” prompt. Since the script is now controlling all call flow I needed to add a wait or it would send the hangup immediately before the prompt was played. Some improvements possible but that's 1 way to do it. It would be possible to do the socket directly in PHP but fs_ivrd is a nice option too. -- W ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] phpmod compile error
Trying to make phpmod and it fails with this: /usr/bin/ld: cannot find -laspell collect2: ld returned 1 exit status make[1]: *** [ESL.so] Error 1 I do have php-devel on this Centos 5.2 machine. Any ideas? -- Greg___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re: [Freeswitch-users] phpmod compile error
Oops, what thread did I hijack? I just sent a new email message to freeswitch-users@lists.freeswitch.org What should I have done? -- Greg On Aug 5, 2009, at 10:46 AM, Brian West wrote: install aspell-devel also Please don't hijack threads... please click new message and start a new thread. Thanks, Brian On Aug 5, 2009, at 9:40 AM, Greg Thoen wrote: Trying to make phpmod and it fails with this: /usr/bin/ld: cannot find -laspell collect2: ld returned 1 exit status make[1]: *** [ESL.so] Error 1 I do have php-devel on this Centos 5.2 machine. Any ideas? -- Greg ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Best practice for inbound calls with scripting
Hi. I am setting up a large inbound only system with multiple DIDs coming in; each call is processed fairly intensively with db lookups, wav files played, pocketsphinx is used, wav files recorded, etc. Before I get too far down one path, I was wondering if anyone had any insight into the best, most scaleable way to do this out of the several methods I can do: 1 Call comes in dialplan calls specific javascript based on DID javascript uses ODBC to pull info from local mysql db call is handled in javascript 2 Call comes in dialplan calls specific javascript based on DID javascript uses CURL to get info from local mysql db call is handled in javascript 3 Call comes in php socket is listening for call php script runs, pulling info from mysql db call is handled in php using esl.php 4 Call comes in dialplan calls specific lua script based on DID lua uses luasql.mysql to get info from local mysql db call is handled in lua using lua api 5 Call comes in xml_curl is used for dynamic dialplan js called, continues like #1 I know that they will all do essentially the same thing. But once I go down the path, I don't want to find out that the way I chose chokes with 50 simultaneous inbound calls on different DIDs. Any comments would be appreciated. Thanks. -- Greg ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Odd sonus warning
Hi, I have some DIDs from Bandwidth.com and when they call in I see this in the console: 2009-08-27 11:01:47 [WARNING] sofia_glue.c:2701 sofia_glue_negotiate_sdp() Hello, I see you have a Sonus! FYI, Sonus cannot follow the RFC on the proper way to send DTMF. Sadly, my creator had to spend several hours figuring this out so I thought you'd like to know that! Don't worry, DTMF will work but you may want to ask them to fix it.. Anything I should worry about? -- Greg ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Mixing mod_curl_xml dynamic dialplans and static ones
I have mod_curl_xml working, but I also have several static dialplans in dialplan/public/ and I can't seem to get it to search those if my php generated xml page does not return a result. I know in the static public.xml there is this Do I need my php page to generate something like that so it will continue looking in the static pages if it does not find a match in the xml_curl dynamic dialplan? I don't know if I have given enough data for someone to point me in the right direction... This is in the console when I have mod_xml_curl enabled: 2009-08-27 16:39:52 [INFO] mod_dialplan_xml.c:252 dialplan_hunt() Processing ->15854199896 in context public Dialplan: sofia/internal/585...@208.34.86.39 parsing [public- >curl_test] continue=false Dialplan: sofia/internal/585...@208.34.86.39 Regex (FAIL) [curl_test] destination_number(15854199896) =~ /^(18775844111)$/ break=on-false 2009-08-27 16:39:52 [INFO] switch_core_state_machine.c:136 switch_core_standard_on_routing() No Route, Aborting -- Greg ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Incorrect method of PHP call control?
Hi. Before I go to far down this path, I wonder if what I intend to do is not a good practice. I started using mod_xml_curl to use PHP on localhost to generate a dialplan dynamically, based on the Caller-Destination-Number variable that is posted. It prints out the XML that calls the javascript that then controls the call. For example, $response = <<< XML XML; Then I thought, that's silly to go back out to javascript to handle the actions, playing files, using pocketsphinx, etc. I should just stay in PHP, using esl.php to answer and handle the call. Then I rethought, is that a good practice to take over the call control from freeswitch at that point, while it is in the xml-curl dialplan hunt? Then I also thought, is it even possible to do some of the things I need to do from the php esl, like the equivalent of this javascript: session.collectInput(onInputsml, "emptyobject", 7000); -- Greg Thoen ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re: [Freeswitch-users] Incorrect method of PHP call control?
Thanks for the input. You'll have to decide on static vs. dynamic based on your needs. In either case, once the call is connected to your socket you've got all sorts of control options. PHP has an ESL abstraction just like the other languages so there shouldn't be any issue about PHP lacking the ability to control calls. But I'm having a hard time seeing how the ESL would duplicate this JS functionality: session.collectInput(onInputsml, "emptyobject", 7000); How do I set the PHP callback routine, etc.? -- Greg Thoen On Aug 31, 2009, at 12:55 PM, Michael Collins wrote: On Mon, Aug 31, 2009 at 8:22 AM, Greg Thoen > wrote: Hi. Before I go to far down this path, I wonder if what I intend to do is not a good practice. I started using mod_xml_curl to use PHP on localhost to generate a dialplan dynamically, based on the Caller-Destination-Number variable that is posted. It prints out the XML that calls the javascript that then controls the call. For example, $response = <<< XML XML; Then I thought, that's silly to go back out to javascript to handle the actions, playing files, using pocketsphinx, etc. I should just stay in PHP, using esl.php to answer and handle the call. Then I rethought, is that a good practice to take over the call control from freeswitch at that point, while it is in the xml-curl dialplan hunt? Then I also thought, is it even possible to do some of the things I need to do from the php esl, like the equivalent of this javascript: session.collectInput(onInputsml, "emptyobject", 7000); -- Greg Thoen Just remember that you're dealing with two somewhat related but still distinctly separate entities: generating a dialplan and executing some sort of call control from the dialplan. You need some sort of dialplan no matter what, so the issue there is whether you need a dynamic one or not. If you're just going to drop calls to an extension that opens an outbound socket to your call control program then you may not need the dynamic dp generation that mod_xml_curl gives you. You'll have to decide on static vs. dynamic based on your needs. In either case, once the call is connected to your socket you've got all sorts of control options. PHP has an ESL abstraction just like the other languages so there shouldn't be any issue about PHP lacking the ability to control calls. I say start hacking away at it and see what happens. :) Definitely join us in #freeswitch on irc.freenode.net if you want to discuss this more in realtime. -MC ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Stops accepting calls when idle for four minutes
[Just learning Freeswitch, but I really did search this list looking for my answer for awhile] I compiled the latest trunk release from svn two days ago. I have a DID from flowroute.com pointing to it. Added the flowroute IP to acl.conf.domains and added flowroute.xml to conf/sip_profiles/ internal/ with: Start up freeswitch and it works! Dialing into the flowroute number connects, everything works exactly as expected. But if I don't call in for four minutes, it stops taking accepting the call. Freeswitch has not crashed, it seems up and running; but nothing is even logged when I try to call. It's as if it never reaches freeswitch. Shutdown and restart Freeswitch, and again it works. It will continue to work as long as I call in every minute or so. If I wait four minutes and then call in again, the call never makes it to Freeswitch again. Oddly, I have another test machine running Freeswitch 1.03 release and a nearly identical setup with the flowroute number, and it works fine all the time. Anyone think they can point me in the right direction? -- Greg ___ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re: [Freeswitch-users] Stops accepting calls when idle for four minutes
That solved it! Is there any downside to this method of keeping the nat binding alive? -- Greg On May 8, 2009, at 12:49 PM, Mike Tkachuk wrote: Hello Greg, It's a NAT box issue. Nat bindings expire if no activity. Try adding a: to your gateway params. But to be honest it's flowroute duty to keep a connection alive by sending keepalives. -- Mike Tkachuk ___ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Transcoding question
Is transcoding a wav file something that I should try to avoid? I have my files encoded as 16kbit, 8000hz, mono files, yet still in the logs I see: 2009-05-27 11:55:18 [DEBUG] switch_ivr_play_say.c:1084 switch_ivr_play_file() Codec Activated l...@8000hz 1 channels 20ms 2009-05-27 11:55:18 [DEBUG] switch_core_io.c:649 switch_core_session_write_frame() sofia/internal/ 5853297...@64.24.35.78 receive message [TRANSCODING_NECESSARY] I have to think that not transcoding would be easier on the server, yet I don't know why it needs to transcode the audio file if it is, I think, already in the correct format for that codec... -- Greg Thoen, Vice President CGI Communications, Inc. 1-585-427-0020 x260 http://www.cgicommunications.com/ http://www.elocallink.com/ ___ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
[Freeswitch-users] Speechtools and pocketsphinx always scoring zero
Hi, I have the pizza demo running on my test box, but the debug shows that while it seems to recognize the words, the score is always zero so it never progresses. Any ideas? 2008-09-17 13:51:25 [DEBUG] mod_pocketsphinx.c:389 pocketsphinx_asr_get_results() Recognized: LARGE, Score: 0 2008-09-17 13:51:25 [DEBUG] SpeechTools.jm:150 console_log() XML: LARGE LARGE 2008-09-17 13:51:25 [DEBUG] SpeechTools.jm:150 console_log() Heard [LARGE] 2008-09-17 13:51:25 [DEBUG] SpeechTools.jm:150 console_log() Hit score 0/40/70 2008-09-17 13:51:25 [DEBUG] SpeechTools.jm:365 console_log() We don't understand this -- Greg Thoen, Vice President CGI Communications, Inc. 1-585-427-0020 x260 http://www.cgicommunications.com/ http://www.elocallink.com/ ___ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org