Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

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

[Freeswitch-users] Problem with originate in javascript.


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





PostPosted: Wed Apr 08, 2009 6:26 pm    Post subject: [Freeswitch-users] Problem with originate in javascript. Reply with quote

I want to run a script with a scheduler but I'm having a problem with how to set up the originate in Javascript.

The originate would go something like:

originate {id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/12223334444@10.0.0.5:5061 GINO_ANS

I can get this to work:

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061");

But I want to "drop" that into an extension that runs another script and can't get either of these to work:

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS");

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS XML default");

Also, will I have problems running the second script from the first script?

Thanks.


New Deals on Dell Netbooks - Now starting at $299
Back to top
anthony.minessale at g...
Guest





PostPosted: Thu Apr 09, 2009 8:34 am    Post subject: [Freeswitch-users] Problem with originate in javascript. Reply with quote

The 2nd 2 examples you provided are invalid, they depict the usage of the originate api command in the context of the constructor
to a JS session.

If you want to send the call to another extension you have to create the channel like you did in the first example followed by
session.execute("transfer", "GINO_ANS XML default");
at which time it would be wise if you deref the session object because its thread will be running in the new extension.


A better way would be to do both in one with a single call to the originate api command

apiExecute("originate", "{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS XML default");

This never gives you a session object it just creates a channel and transfers it to the desired extension.


A Documentation Re-factorial Engineer may be able to add it to the relevant page on the wiki if it is not already present.



On Wed, Apr 8, 2009 at 6:15 PM, <mszlazak@aol.com (mszlazak@aol.com)> wrote:
Quote:
I want to run a script with a scheduler but I'm having a problem with how to set up the originate in Javascript.

The originate would go something like:

originate {id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/12223334444@10.0.0.5:5061 GINO_ANS

I can get this to work:

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061");

But I want to "drop" that into an extension that runs another script and can't get either of these to work:

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS");

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS XML default");

Also, will I have problems running the second script from the first script?

Thanks.



New Deals on Dell Netbooks - Now starting at $299

_______________________________________________
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




--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
Back to top
mszlazak at aol.com
Guest





PostPosted: Thu Apr 09, 2009 11:36 am    Post subject: [Freeswitch-users] Problem with originate in javascript. Reply with quote

Hi Tony,

But I thought we settled on "Janitor." Wink
BTW, it was the other point about keeping the FS founders involved or not in the documentation process that concerned much much more. That was the big issue that got me going on that thread.

Anyway, I appreciate your help and will do some "document engineering" but need one further elaboration on de-referencing the original session object since I tried the execute("transfer" ...) before and couldn't get that to work. Can you show me an example and I can then put up both approaches.

Mark.





-----Original Message-----
From: Anthony Minessale <anthony.minessale@gmail.com>
To: freeswitch-users@lists.freeswitch.org
Sent: Thu, 9 Apr 2009 6:09 am
Subject: Re: [Freeswitch-users] Problem with originate in javascript.

The 2nd 2 examples you provided are invalid, they depict the usage of the originate api command in the context of the constructor
to a JS session.

If you want to send the call to another extension you have to create the channel like you did in the first example followed by
session.execute("transfer", "GINO_ANS XML default");
at which time it would be wise if you deref the session object because its thread will be running in the new extension.


A better way would be to do both in one with a single call to the originate api command

apiExecute("originate", "{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS XML default");

This never gives you a session object it just creates a channel and transfers it to the desired extension.


A Documentation Re-factorial Engineer may be able to add it to the relevant page on the wiki if it is not already present.



On Wed, Apr 8, 2009 at 6:15 PM, <mszlazak@aol.com (mszlazak@aol.com)> wrote:
Quote:
I want to run a script with a scheduler but I'm having a problem with how to set up the originate in Javascript.

The originate would go something like:

originate {id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/12223334444@10.0.0.5:5061 GINO_ANS

I can get this to work:

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061");

But I want to "drop" that into an extension that runs another script and can't get either of these to work:

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS");

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS XML default");

Also, will I have problems running the second script from the first script?

Thanks.



New Deals on Dell Netbooks - Now starting at $299

_______________________________________________
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




--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400

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

New Deals on Dell Netbooks - Now starting at $299
Back to top
anthony.minessale at g...
Guest





PostPosted: Thu Apr 09, 2009 11:52 am    Post subject: [Freeswitch-users] Problem with originate in javascript. Reply with quote

I think I forgot to mention you need to session.setAutoHangup(false) to stop the channel from being auto-hungup
when it goes out of scope of the script.

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061");
session.setAutoHangup(false);
session.execute("transfer", "GINO_ANS XML default");
session = undefined;



On Thu, Apr 9, 2009 at 11:22 AM, <mszlazak@aol.com (mszlazak@aol.com)> wrote:
Quote:
Hi Tony,

But I thought we settled on "Janitor." Wink
BTW, it was the other point about keeping the FS founders involved or not in the documentation process that concerned much much more. That was the big issue that got me going on that thread.

Anyway, I appreciate your help and will do some "document engineering" but need one further elaboration on de-referencing the original session object since I tried the execute("transfer" ...) before and couldn't get that to work. Can you show me an example and I can then put up both approaches.

Mark.






-----Original Message-----
From: Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)>
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)
Sent: Thu, 9 Apr 2009 6:09 am
Subject: Re: [Freeswitch-users] Problem with originate in javascript.

The 2nd 2 examples you provided are invalid, they depict the usage of the originate api command in the context of the constructor
to a JS session.

If you want to send the call to another extension you have to create the channel like you did in the first example followed by
session.execute("transfer", "GINO_ANS XML default");
at which time it would be wise if you deref the session object because its thread will be running in the new extension.


A better way would be to do both in one with a single call to the originate api command

apiExecute("originate", "{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS XML default");

This never gives you a session object it just creates a channel and transfers it to the desired extension.


A Documentation Re-factorial Engineer may be able to add it to the relevant page on the wiki if it is not already present.



On Wed, Apr 8, 2009 at 6:15 PM, <mszlazak@aol.com (mszlazak@aol.com)> wrote:
Quote:
I want to run a script with a scheduler but I'm having a problem with how to set up the originate in Javascript.

The originate would go something like:

originate {id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/12223334444@10.0.0.5:5061 GINO_ANS

I can get this to work:

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061");

But I want to "drop" that into an extension that runs another script and can't get either of these to work:

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS");

session = new Session("{id_name='${caller_id_name}',id_number=${caller_id_number}}sofia/gateway/spa3102PSTN/14082031170@10.0.0.5:5061 GINO_ANS XML default");

Also, will I have problems running the second script from the first script?

Thanks.



New Deals on Dell Netbooks - Now starting at $299

_______________________________________________
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




--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400

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


New Deals on Dell Netbooks - Now starting at $299



_______________________________________________
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




--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
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