[Freeswitch-users] collectInput does not call callback function
Grmt
garmt.noname at gmail.com
Mon May 30 00:37:44 MSD 2011
Some clarification from a quick inspection of the code:
The callback function can be a generic function and possibly be used by
other functions that specify a callbackfunction: it can also capture
"events". So callbackfunction can be called with two different types: "dtmf"
or "events". collectInput will result calling your callbackfunction with
type="dtmf". Checking for "digits" is indeed useless ...
Note that the last argument(s) of collectInput are optional.
What is that second argument?
It should be: "an object dtmf which turns as arg parameter in callback
function."
(I'm guessing a bit here, because I don't know javascript or
mod_spidermonkey, and don't know about the quotes and I didn't try it out
and I did only a quick inspection of the code).
Garmt
-----Original Message-----
From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Kamen
Sent: Sunday, 29 May, 2011 17:39
To: freeswitch-users at lists.freeswitch.org
Subject: Re: [Freeswitch-users] collectInput does not call callback function
Good point grmt!
But that is where I am getting confused. What is that second argument?
According to collectInput description in wiki (
http://wiki.freeswitch.org/wiki/Session_collectInput
http://wiki.freeswitch.org/wiki/Session_collectInput ) it is a
"callbackArguments" which in the example given is the last argument (is it?
because no more explanation is given):
function mycb( session, type, data, arg )
So I take that "dtmf" of the collectInput is arg of the callback function.
session.collectInput( mycb, "dtmf", 3000, 0)
But why is it a string type in the example? Isn't dtmf defined as an object
and then used in callback function as an object?
arg.digits += data.digit;
At the same time in callback function example type parameter is apparently
expected to be a string "dtmf". Is it a coincidence or I am missing
something here? If collectInput second parameter is string "dtmf" then it
also looks that in callback function it is apparently a second parameter
(type). So what is it? Is it an object dtmf which turns as arg parameter in
callback function, or it is a string which in callback function turns into
type parameter? I took it should be a string turning into "type" of
callback function, so it does not matter what string is as long as it is the
same. So I made it "digit".
If I am missing something here, I'd really appreciate if someone let me
know. I also tried it to be just an object (without quotes, in spite of the
example), or followed the example exactly. In any case the callback is not
happening - the first line of my callback function is a console prompt,
which is not printed. Thus is my question.
Regards,
Sergei Kamen
--
View this message in context:
http://freeswitch-users.2379917.n2.nabble.com/collectInput-does-not-call-cal
lback-function-tp6414679p6416704.html
Sent from the freeswitch-users mailing list archive at Nabble.com.
_______________________________________________
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
More information about the FreeSWITCH-users
mailing list