[Freeswitch-users] pass arguments into javascript

Eliot Gable egable+freeswitch at gmail.com
Wed Oct 28 20:23:09 PDT 2009


Should work fine. I use this:

var calling_num = argv[0];
var called_num = argv[1];

Are you sure you actually had valid data in $1 and $2? Try to call it
from the CLI:

jsrun test.js testvar1 testvar2



On Wed, Oct 28, 2009 at 10:22 PM, Erwin Davis <davis.erwin at gmail.com> wrote:
> Hi, new to javascript. I tried to pass two arguments into javascript,
>
> <action application="javascript" data="test.js $1 $2"/>
>
>
> In test.js, I tried to use argv[1]  to retrieve $1 and argv[2] to retrieve
> $2, however, the javascript test.js complained about argv[] as undefined
> variables. How to retrieve the passing arguments in a javascript same as the
> case above. Thanks,
>
> _______________________________________________
> 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
>
>



-- 
Eliot Gable

"We do not inherit the Earth from our ancestors: we borrow it from our
children." ~David Brower

"I decided the words were too conservative for me. We're not borrowing
from our children, we're stealing from them--and it's not even
considered to be a crime." ~David Brower

"Esse oportet ut vivas, non vivere ut edas." (Thou shouldst eat to
live; not live to eat.) ~Marcus Tullius Cicero




More information about the FreeSWITCH-users mailing list