<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content=text/html;charset=ISO-8859-1>
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2>Thanks for all the replies, after some thinking AGI seems
like the way to go (writing a function in C would certainly work, but I
want to avoid anything that makes upgrading to newer version of Asterisk a
potential pain. Let's say using C is plan
B).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2>So, I wrote (well, plagarized directly from the Web) a
simple Perl program that prints "Hello World". I call it using
this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2>exten =>
12345,1,AGI(agi-helloworld.agi)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2>Seems to work (I'm not expecting anything, really, just no
Asterisk error).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2>When I try to use it as part Noop like
this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2>
<DIV dir=ltr align=left><SPAN class=515333017-08082007><FONT face=Arial
color=#0000ff size=2>exten =>
12345,1,Noop(${AGI(agi-helloworld.agi)})</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=515333017-08082007>In the hope of getting to
see Noop(Hello World) in my CLI, I get the following Asterisk
error:</SPAN></DIV>
<DIV dir=ltr align=left><SPAN
class=515333017-08082007></SPAN> </DIV></FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Aug 8 13:40:48 ERROR[5771]:
pbx.c:1402 ast_func_read: Function AGI not registered</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=515333017-08082007>AGI
certainly seems registered as it worked in the first case. Again,
something obvious I missed?</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=515333017-08082007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=515333017-08082007>Thank
you,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=515333017-08082007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=515333017-08082007>Mike</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <B>On Behalf Of </B>Anthony
Francis<BR><B>Sent:</B> Wednesday, August 08, 2007 12:39<BR><B>To:</B> Asterisk
Users Mailing List - Non-Commercial Discussion<BR><B>Subject:</B> Re:
[asterisk-users] How to write a function with a return value in
Asterisk<BR></FONT><BR></DIV>
<DIV></DIV>You are looking for the AGI: <A class=moz-txt-link-freetext
href="http://www.voip-info.org/wiki-Asterisk+AGI">http://www.voip-info.org/wiki-Asterisk+AGI</A><BR><BR>Anthony<BR><BR>James
FitzGibbon wrote:
<BLOCKQUOTE cite=midb1c051a50708080930r7994cd41h7362928e586a2759@mail.gmail.com
type="cite">On 8/8/07, <B class=gmail_sendername>Mike</B> <<A
href="mailto:list@virtutel.ca">list@virtutel.ca</A>> wrote:
<DIV><SPAN class=gmail_quote></SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">I'd
be most thankful for some link to a page that shows how to write such
a<BR>function in Asterisk.</BLOCKQUOTE>
<DIV><BR>There is a test application in the source tree (not built by default
I believe), but it doesn't look like anyone has made an equivalent sample
function. <BR><BR>However, many of the functions in 1.4 are pretty simple, and
would be a good jumping off point. Take func_sha1.c for example: 83
lines in the file, 4 functions and one macro. You could copy that and do
the proper renaming to make MY_FUNKY_NEW_FUNC that does exactly what func_sha1
does (or alternatively, nothing by getting rid of the bulk of the sha1()
function therein. <BR><BR>How big it gets as you add whatever magic that
function should perform is up to you of course.<BR><BR></DIV></DIV>-- <BR>j. <PRE wrap=""><HR width="90%" SIZE=4>
_______________________________________________
--Bandwidth and Colocation Provided by <A class=moz-txt-link-freetext href="http://www.api-digital.com">http://www.api-digital.com</A>--
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
<A class=moz-txt-link-freetext href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</A></PRE></BLOCKQUOTE><BR></BODY></HTML>