<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">That perl script will not run at all until the dialplan parsing is complete. You would need to run the perl script inline (which I am not sure we allow) or run the perl script, then transfer to re-enter the dialplan after it is run.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 10, 2014, at 12:56 PM, Liam Farr <<a href="mailto:liam@maxumdata.com" class="">liam@maxumdata.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><p class="">Heres an expanded example;</p><p class=""><br class=""></p><p class=""><br class=""></p><p class="">Extension runs the perl script as part of the public dialplan first;</p><p class=""><br class=""></p><p class=""><extension name="run-script" continue="true"></p><p class=""> <condition></p><p class=""><span class="" style="white-space:pre">        </span> <action application="perl" data="/etc/freeswitch/scripts/<a href="http://my-script.pl/" class="">my-script.pl</a>"/></p><p class=""> </condition></p><p class=""></extension></p><p class=""><br class=""></p><p class=""><br class=""></p><p class="">Script sets some variables;</p><p class=""><br class=""></p><p class="">$my_value = "123";</p><p class="">$session->setVariable('some_var',$my_value);</p><p class=""><br class=""></p><p class=""><br class=""></p><p class="">Use that variable later in another extension in the public dialplan as a condition selector;</p><p class=""><br class=""></p><p class=""><br class=""></p><p class=""><extension name="bridge-call" ></p><p class=""> <condition field="context" expression="public" /></p><p class=""> <condition field="${some_var}" expression="123" ></p><p class=""><span class="" style="white-space:pre">        </span> <action application="set" data="call_direction=inbound"/></p><p class=""><span class="" style="white-space:pre">        </span> <action application="bridge" data="sofia/internal/${<a href="http://destination_number}@1.2.3.4:5060" class="">destination_number}@1.2.3.4:5060</a>" /></p><p class=""> </condition></p><p class=""></extension></p><p class=""><br class=""></p><p class=""><br class=""></p><p class="">However this will fail, because the perl script "$session->setVariable" run earlier is not inline, so you cant make use of it in the condition (<condition field="${some_var}" expression="123" >) in the second extension that exists in a later part of the public dialplan. Hence I need a way to set inline variables from my perl script.</p><p class=""><br class=""></p><p class=""><br class=""></p><p class="">Cheers</p><p class=""><br class=""></p><p class="">Liam Farr</p><p class=""><br class=""></p></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 11 December 2014 at 06:28, Michael Jerris <span dir="ltr" class=""><<a href="mailto:mike@jerris.com" target="_blank" class="">mike@jerris.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you are in a perl script using session->setVariable, how are you still in the dialplan? This doesn't make sense to me. There should be no need for an inline if you are already in the script.<br class="">
<div class=""><div class="h5"><br class="">
> On Dec 10, 2014, at 4:20 AM, Liam Farr <<a href="mailto:liam@maxumdata.com" class="">liam@maxumdata.com</a>> wrote:<br class="">
><br class="">
> Hi,<br class="">
><br class="">
> I need to set a variable using a perl script inline.<br class="">
><br class="">
> Normally I would use $session->setVariable('some_var',$my_value);<br class="">
><br class="">
> However I cant find any options to execute this inline / as an inline action. (I need to evaluate the variable later in the hunting phase of the dialplan hence need it to be an inline action).<br class="">
><br class="">
> Is there a way to do this?<br class="">
><br class="">
> Or is there another way to achieve the same result, e.g. hacking $session->execute("set","some_var=$my_value") to run as an inline action?<br class="">
><br class="">
> Any help would be much appreciated, I've scoured the wiki, confluence and git repo and come up empty.<br class="">
><br class="">
> --<br class="">
> Kind Regards<br class="">
><br class="">
><br class="">
> Liam Farr<br class="">
<br class=""></div></div></blockquote></div></div></div></div></blockquote></div><br class=""></div></body></html>