Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] pass arguments into javascript


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
davis.erwin at gmail.com
Guest





PostPosted: Wed Oct 28, 2009 9:29 pm    Post subject: [Freeswitch-users] pass arguments into javascript Reply with quote

Hi, new to javascript. I tried to pass two arguments into javascript,

Quote:
<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,
Back to top
egable+freeswitch at g...
Guest





PostPosted: Wed Oct 28, 2009 10:35 pm    Post subject: [Freeswitch-users] pass arguments into javascript Reply with quote

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@gmail.com> wrote:
Quote:
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@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

_______________________________________________
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
Back to top
davis.erwin at gmail.com
Guest





PostPosted: Thu Oct 29, 2009 10:07 am    Post subject: [Freeswitch-users] pass arguments into javascript Reply with quote

yes, I forgot the single quota in javascript statement. Now I saw the aruments. Thanks,

On 10/28/09, Eliot Gable <egable+freeswitch@gmail.com ([email]egable%2Bfreeswitch@gmail.com[/email])> wrote:
Quote:
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@gmail.com (davis.erwin@gmail.com)> wrote:
Quote:
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,


Quote:
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (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





--
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

_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services