Mike
2007-Aug-08 15:24 UTC
[asterisk-users] How to write a function with a return value in Asterisk
Hi, Is it possible to write a function in Asterisk, that returns a value? Sort of like any programming language allows? For example, I`d like function ReturnSipReg to return the right SipRegistration to dial, based on some value so that I could use it in my dial plan: i.e: exten => 1234,1,Dial(SIP/ReturnSipReg(John)) ; would dial John's extension, which I don't know at this point to which Sip Registration it's associated. ReturnSipReg would find that out for me. Unfortunately, doing it in two steps (by setting a variable and using it after) can't be done, I need it to all be done in the same Asterisk priority. See my previous email for background ("Buddy watch and the hint priority - brain teaser"). Any help is extremely appreciated. Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070808/f12debb6/attachment.htm
Andrew Kohlsmith
2007-Aug-08 15:34 UTC
[asterisk-users] How to write a function with a return value in Asterisk
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.
Anthony Francis
2007-Aug-08 16:00 UTC
[asterisk-users] How to write a function with a return value in Asterisk
Mike wrote:> Hi, > > Is it possible to write a function in Asterisk, that returns a value? > Sort of like any programming language allows? > > For example, I`d like function ReturnSipReg to return the right > SipRegistration to dial, based on some value so that I could use it in > my dial plan: > > i.e: > > exten => 1234,1,Dial(SIP/ReturnSipReg(John)) > ; would dial John's extension, which I don't know at this point to > which Sip Registration it's associated. ReturnSipReg would find that > out for me. > > > Unfortunately, doing it in two steps (by setting a variable and using > it after) can't be done, I need it to all be done in the same Asterisk > priority. See my previous email for background ("Buddy watch and the > hint priority - brain teaser"). > > > Any help is extremely appreciated. > > Mike > ------------------------------------------------------------------------ > > _______________________________________________ > --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-usersAGI