I have been working on a small Javascript application to determine the specific Javascript application to execute based on the DNIS. The goal is: * Provide an entry in a dialplan public XML file to invoke the application. * Use a database lookup (ODBC) using DNIS. * Fail if the DNIS is not found (hangup the session) * If the DNIS is found: ** use another entry in the database to determine ** the working application and any static parameters. * Invoke/Transfer to/Activate the other application. It is fairly simple to do all but the first step. I have been having problems trying to get the last step to work. What I would like is something like this: session.execute("transfer", transfer_string); Where transfer_string is the string from the Database. Or where transfer_string is the string from the DB plus some fixed options. I would prefer not to have to add entries into the dialplan/pubic/00_xx.xml file but will if I have to. I did notice an option called "inline" which potentially avoid this. I suspect part of my problem is not quite understanding the transfer syntax. If I ever get this running properly, I will provide a Wiki example of a simplified version of this (ie, without some of work specific code). Regards, David Swardstrom (profile)http://wiki.freeswitch.org/wiki/User:Dswardstrom
when you say execute an application do you mean literally a dp application like set or voicemail ? transfer takes an extension as an arg not an application and when you do run that transfer command you must exit your script so the transfer can take place. session.execute("transfer", "<SOME EXTENSION NUMBER"); //exit the script asap if you want to just execute an app do session.execute("<some app", "<some args>"); // control returns here or if you want to run an extension like an app and return to your script do session.execute("execute_extension", "<SOME EXTENSION NUMBER>"); // control returns here On Wed, Jun 9, 2010 at 6:05 PM, David Swardstrom <dswardstrom@remotelink.com
wrote:
I have been working on a small Javascript application to determine the specific Javascript application to execute based on the DNIS. The goal is: * Provide an entry in a dialplan public XML file to invoke the application. * Use a database lookup (ODBC) using DNIS. * Fail if the DNIS is not found (hangup the session) * If the DNIS is found: ** use another entry in the database to determine ** the working application and any static parameters. * Invoke/Transfer to/Activate the other application.
It is fairly simple to do all but the first step. I have been having problems trying to get the last step to work.
What I would like is something like this: session.execute("transfer", transfer_string); Where transfer_string is the string from the Database. Or where transfer_string is the string from the DB plus some fixed options.
I would prefer not to have to add entries into the dialplan/pubic/00_xx.xml file but will if I have to. I did notice an option called "inline" which potentially avoid this.
I suspect part of my problem is not quite understanding the transfer syntax.
If I ever get this running properly, I will provide a Wiki example of a simplified version of this (ie, without some of work specific code).
Regards, David Swardstrom (profile)http://wiki.freeswitch.org/wiki/User:Dswardstrom
_______________________________________________ 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
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
I really want to do the transfer and plan to exit() after the transfer takes place. What I have is a string like the following: "conf-ivr.js 6". The conf-ivr.js is my version of the conf-ivr.js example. The value "6" indicates a sub-type of conference so that we can support different flavors. I guess I could use the following: session.execute("transfer", "conf-ivr6"); Then put the following into the xml: <extension name="JavaScript Transfer to Conference application"> <condition field="destination_number" expression="^conf-ivr6$"> <action application="javascript" data="conf-ivr.js 6"/> </condition> </extension> What I hoped for was a way to avoid putting specific stuff for each application into the XML. I just wanted to be able to provide a new JS application or a new flavor of a JS application without having to also modify the XML and get the XML reloaded into FreeSwitch. Is it possible to pass parameters via the transfer so the XML would look like this: <extension name="JavaScript Transfer to JS application"> <condition field="destination_number" expression="^myjsapp$"> <action application="javascript" data="$1"/> </condition> </extension> There was a hint about using something called "inline" which indicated that an XML dialplan would not be needed. -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/JavaScript-control-Transfer-tp... Sent from the freeswitch-users mailing list archive at Nabble.com.
session.execute("transfer", "<application>:'<app args>' inline"); On Wed, Jun 9, 2010 at 7:14 PM, David Swardstrom <dswardstrom@remotelink.com
wrote:
I really want to do the transfer and plan to exit() after the transfer takes place. What I have is a string like the following: "conf-ivr.js 6". The conf-ivr.js is my version of the conf-ivr.js example. The value "6" indicates a sub-type of conference so that we can support different flavors. I guess I could use the following: session.execute("transfer", "conf-ivr6"); Then put the following into the xml: <extension name="JavaScript Transfer to Conference application"> <condition field="destination_number" expression="^conf-ivr6$"> <action application="javascript" data="conf-ivr.js 6"/> </condition> </extension>
What I hoped for was a way to avoid putting specific stuff for each application into the XML. I just wanted to be able to provide a new JS application or a new flavor of a JS application without having to also modify the XML and get the XML reloaded into FreeSwitch.
Is it possible to pass parameters via the transfer so the XML would look like this: <extension name="JavaScript Transfer to JS application"> <condition field="destination_number" expression="^myjsapp$"> <action application="javascript" data="$1"/> </condition> </extension>
There was a hint about using something called "inline" which indicated that an XML dialplan would not be needed. -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/JavaScript-control-Transfer-tp... Sent from the freeswitch-users mailing list archive at Nabble.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
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
On Thu, Jun 10, 2010 at 9:24 AM, Anthony Minessale < anthony.minessale@gmail.com> wrote:
session.execute("transfer", "<application>:'<app args>' inline");
Just to add, the inline dialplan trick is quite handy. More info here: http://wiki.freeswitch.org/wiki/Inline_Dialplan You can do crazy fun things with inline. Check out the cool auto-answer trick for portaudio calls. ;) -MC
participants (3)
-
Anthony Minessale
-
David Swardstrom
-
Michael Collins