[asterisk-users] How to write a function with a return value inAsterisk

Mike list at virtutel.ca
Wed Aug 8 10:41:38 CDT 2007


But what if I wanted to write my own custom application for one specific
purpose, I can't set a return value?  It's not possible at all?

Let me put it this way then, if I needed to have some processing all done in
the same Asterisk priority (in my case, I want to use the "hint" priority
but I need to find the value of a variable and use it in the same line).

i.e.:
1) First find out some value ${A}
2) Use ${A} in my Dial command (ex: Dial(SIP/${A})

But this has to be done in the same priority...since hint seems to be an
atomic priority that can only have one line.

Exten => 12345,hint,Dial(SIP/${A}) ; I need to know ${A} first, but I can't
know before this line is called (it's very DB driven).

What can I do? Am I dead in the water here?

Mike




-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Andrew
Kohlsmith
Sent: Wednesday, August 08, 2007 11:35
To: asterisk-users at lists.digium.com
Subject: Re: [asterisk-users] How to write a function with a return value
inAsterisk

On Wednesday 08 August 2007 11:24:45 am Mike wrote:
> Is it possible to write a function in Asterisk, that returns a value?  
> Sort of like any programming language allows?

Digium has taken the stance that it's better to set arbitrary variable names
to arbitrary values rather than allow what many would consider the perfectly
accepted method of using a $? type of return code in addition to any
application-specific variables.

It's been a long-standing sore point with me for sure, since there is no
standard way to see if an application returned successfully or not; you have
to consult the individual application to see what it sets.

-A.

_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list