[asterisk-users] Passing parameter from executable program to asterisk dialplan
I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. Thanks Sam -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
On Sun, Jul 25, 2010 at 8:18 AM, Muro, Sam resea...@businesstz.com wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. Thanks Sam -- Hopefully you can modify the executable #./retrieve 8675309 SET VARIABLE name Jenny SET VARIABLE status Active When running an AGI asterisk expects to have a conversation with the application, so when the AGI does a command asterisk reports back with whether or not it worked. I know a person can set one variable that way, but when I got a need to set two variables I finally broke down and read the documentation on AGI's :) Start Readlines from input until line is blank print SET VARIABLE name Jenny readline print SET VARIABLE status Active End -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
On Sun, 25 Jul 2010, Muro, Sam wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. AGI is a protocol used to interact with Asterisk. An AGI is a separate process created by Asterisk when you execute agi() in the dialplan. From best to worst... 1) You could recode your retrieve application so it uses the AGI protocol. Then, you could set channel variables to make these values accessible to the rest of your dialplan. 2) You could cobble up an AGI to execute your retrieve application using a pipe (popen() in c), parse the output and set channel variables. 3) You could cobble up something to execute your retrieve application, redirecting the output to a file and then use the FILE function read the text file and then parse the output using dialplan functions. -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
Kyle Kienapfel wrote: On Sun, Jul 25, 2010 at 8:18 AM, Muro, Sam resea...@businesstz.com wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. Thanks Sam -- Hopefully you can modify the executable #./retrieve 8675309 SET VARIABLE name Jenny SET VARIABLE status Active When running an AGI asterisk expects to have a conversation with the application, so when the AGI does a command asterisk reports back with whether or not it worked. I know a person can set one variable that way, but when I got a need to set two variables I finally broke down and read the documentation on AGI's :) Start Readlines from input until line is blank print SET VARIABLE name Jenny readline print SET VARIABLE status Active End -- Thanks, So I you suggesting that the executable to changed to output say cout SET VARIABLE name Jenny; and let the AGI retrieve them as per the pseudo you mentioned? Sam -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
On Sun, Jul 25, 2010 at 8:18 AM, Muro, Sam resea...@businesstz.com wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. On Sun, 25 Jul 2010, Kyle Kienapfel wrote: Hopefully you can modify the executable #./retrieve 8675309 SET VARIABLE name Jenny SET VARIABLE status Active A creative hack, but since it violates the AGI protocol, may be subject to failure now or sometime in the future. (Quoting the values would allow embedded spaces.) When running an AGI asterisk expects to have a conversation with the application, so when the AGI does a command asterisk reports back with whether or not it worked. I know a person can set one variable that way, but when I got a need to set two variables I finally broke down and read the documentation on AGI's :) Start Readlines from input until line is blank print SET VARIABLE name Jenny readline print SET VARIABLE status Active End You should add a readline to read the response after the second request. -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
On Sun, 25 Jul 2010, Muro, Sam wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. So I you suggesting that the executable to changed to output say cout SET VARIABLE name Jenny; and let the AGI retrieve them as per the pseudo you mentioned? It's a little bit more involved than than. You should google for an AGI library for your source language. It's a lot easier to use an established, debugged framework than figure it out yourself. Nobody gets it right the first time. If you follow the protocol, your retrieve application will be stable and reliable. If you just hack it up, it may work now but not under load or not in the future or not when your boss is looking or not when... -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
Steve Edwards wrote: On Sun, 25 Jul 2010, Muro, Sam wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. AGI is a protocol used to interact with Asterisk. An AGI is a separate process created by Asterisk when you execute agi() in the dialplan. From best to worst... 1) You could recode your retrieve application so it uses the AGI protocol. Then, you could set channel variables to make these values accessible to the rest of your dialplan. 2) You could cobble up an AGI to execute your retrieve application using a pipe (popen() in c), parse the output and set channel variables. 3) You could cobble up something to execute your retrieve application, redirecting the output to a file and then use the FILE function read the text file and then parse the output using dialplan functions. -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- Thanks Steve Option one and two looks more ideal. Let stick on option one, the program is written in C++ (Actually is a corba interface). I have tried looking on how to write AGI script using C++ in vain. I am used to perl/php for scripting.. Can you post a snippet of c++ agi script. Sam -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
On Sun, Jul 25, 2010 at 9:04 AM, Muro, Sam resea...@businesstz.com wrote: Kyle Kienapfel wrote: On Sun, Jul 25, 2010 at 8:18 AM, Muro, Sam resea...@businesstz.com wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. Thanks Sam -- Hopefully you can modify the executable #./retrieve 8675309 SET VARIABLE name Jenny SET VARIABLE status Active When running an AGI asterisk expects to have a conversation with the application, so when the AGI does a command asterisk reports back with whether or not it worked. I know a person can set one variable that way, but when I got a need to set two variables I finally broke down and read the documentation on AGI's :) Start Readlines from input until line is blank print SET VARIABLE name Jenny readline print SET VARIABLE status Active End -- Thanks, So I you suggesting that the executable to changed to output say cout SET VARIABLE name Jenny; and let the AGI retrieve them as per the pseudo you mentioned? Sam Does doing that output a newline at the end of the line? If it doesn't you might want something more like (i am just guessing syntax here btw) cout SET VARIABLE name Jenny ENDL; or cout SET VARIABLE name Jenny\n; -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
Kyle Kienapfel wrote: On Sun, Jul 25, 2010 at 9:04 AM, Muro, Sam resea...@businesstz.com wrote: Kyle Kienapfel wrote: On Sun, Jul 25, 2010 at 8:18 AM, Muro, Sam resea...@businesstz.com wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. Thanks Sam -- Hopefully you can modify the executable #./retrieve 8675309 SET VARIABLE name Jenny SET VARIABLE status Active When running an AGI asterisk expects to have a conversation with the application, so when the AGI does a command asterisk reports back with whether or not it worked. I know a person can set one variable that way, but when I got a need to set two variables I finally broke down and read the documentation on AGI's :) Start Readlines from input until line is blank print SET VARIABLE name Jenny readline print SET VARIABLE status Active End -- Thanks, So I you suggesting that the executable to changed to output say cout SET VARIABLE name Jenny; and let the AGI retrieve them as per the pseudo you mentioned? Sam Does doing that output a newline at the end of the line? If it doesn't you might want something more like (i am just guessing syntax here btw) cout SET VARIABLE name Jenny ENDL; or cout SET VARIABLE name Jenny\n; -- You are right. Both of them are correct syntax I will give it a try and revert Sam -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
On Sun, 25 Jul 2010, Muro, Sam wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. Steve Edwards wrote: AGI is a protocol used to interact with Asterisk. An AGI is a separate process created by Asterisk when you execute agi() in the dialplan. From best to worst... 1) You could recode your retrieve application so it uses the AGI protocol. Then, you could set channel variables to make these values accessible to the rest of your dialplan. 2) You could cobble up an AGI to execute your retrieve application using a pipe (popen() in c), parse the output and set channel variables. 3) You could cobble up something to execute your retrieve application, redirecting the output to a file and then use the FILE function read the text file and then parse the output using dialplan functions. On Sun, 25 Jul 2010, Muro, Sam wrote: Option one and two looks more ideal. Let stick on option one, the program is written in C++ (Actually is a corba interface). I have tried looking on how to write AGI script using C++ in vain. I am used to perl/php for scripting.. Can you post a snippet of c++ agi script. I'm a c weenie myself. I coded my own library way too long ago and remember the scars :) If you google for asterisk agi c++ library you'll find links to cagi, quivr, and probably a couple more. I don't know if any are c++ specific. The basic outline is: call a function to read the AGI environment from stdin. (Mine is named agi_read_environment()) get your customer ID number either from the command line or from a channel variable. (argv[] or agi_get_variable(CUSTOMER-ID, customer_id.) retrieve your values from your database. set your channel variables. (agi_set_variable(CUSTOMER-NAME, mysql_row[CUSTOMER_NAME])) -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Passing parameter from executable program to asterisk dialplan
Steve Edwards wrote: On Sun, 25 Jul 2010, Muro, Sam wrote: I am having a problem understanding the way to retrieve some parameters to asterisk via AGI or what ever method that fits. I have an executable program that accept one parameter (CALLERID) and return customer status from the database server which can be printed in the console. #./retrive 0117473789 NAME: Franklin John STATUS: Active Can someone advice on how i can catch this values from AGI or directly on dialplan. Steve Edwards wrote: AGI is a protocol used to interact with Asterisk. An AGI is a separate process created by Asterisk when you execute agi() in the dialplan. From best to worst... 1) You could recode your retrieve application so it uses the AGI protocol. Then, you could set channel variables to make these values accessible to the rest of your dialplan. 2) You could cobble up an AGI to execute your retrieve application using a pipe (popen() in c), parse the output and set channel variables. 3) You could cobble up something to execute your retrieve application, redirecting the output to a file and then use the FILE function read the text file and then parse the output using dialplan functions. On Sun, 25 Jul 2010, Muro, Sam wrote: Option one and two looks more ideal. Let stick on option one, the program is written in C++ (Actually is a corba interface). I have tried looking on how to write AGI script using C++ in vain. I am used to perl/php for scripting.. Can you post a snippet of c++ agi script. I'm a c weenie myself. I coded my own library way too long ago and remember the scars :) If you google for asterisk agi c++ library you'll find links to cagi, quivr, and probably a couple more. I don't know if any are c++ specific. The basic outline is: call a function to read the AGI environment from stdin. (Mine is named agi_read_environment()) get your customer ID number either from the command line or from a channel variable. (argv[] or agi_get_variable(CUSTOMER-ID, customer_id.) retrieve your values from your database. set your channel variables. (agi_set_variable(CUSTOMER-NAME, mysql_row[CUSTOMER_NAME])) -- Thanks Steve Let me check them out and give them a try. I really appreciate your input Sam -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users