[Freeswitch-users] Inline execute (subject renamed)

Michael Collins msc at freeswitch.org
Thu Feb 16 01:47:25 MSK 2012


Virendra,

If inline execution is still confusing you then it's because you are
probably having a difficult time visualizing the two steps in dialplan
processing: parsing and executing.

During the parsing phase, the dialplan module is going through each
extension looking at the conditions. Each time a condition matches (shows
"PASS" in the FS log) it then looks inside that condition to see if there
are any actions. If there are actions inside the matching condition then
each action is added to a "task list" in the order they appear in the
dialplan. These actions are *NOT* executed right now. They are simply added
to the big "to-do list" of actions. Then, once all the parsing is done, the
dialplan module goes back to the task list and starts executing each
action, one at a time.

Does that part make sense? If not, then the following information won't
help you...

The "inline" execution of an action means that the action is executed
*during the parsing phase*. In other words, when the dialplan module finds
a matching condition and there is an action to add to the task list, it
looks to see if there is an inline="true" attribute. If there is, then the
dialplan parser basically says, "Oh, I should not add this action to the
task list; instead I should *execute this action RIGHT NOW* before I
continue."

To see that for real, consider this extension:
  <extension name="inline test">
    <condition field="destination_number" expression="^(5599)$">
      <action application="log" data="INFO I'm first!"/>
      <action application="log" data="INFO Oh no you're not!"
inline="true"/>
      <action application="log" data="INFO Bummer, dude!"/>
    </condition>
  </extension>

So, when I dial 5599, which debug line gets printed first? To find out,
check out this pastebin <http://pastebin.freeswitch.org/18406>.

The dialplan processing starts at line #41 of the pastebin. Every log line
that starts with "Dialplan:" represents the dialplan module parsing the
dialplan. The interesting stuff occurs starting at line #269 - we match the
condition on the extension. Line #270 is the first action from this
condition to add to the task list. Now, look closely at lines #271-273. On
line #271 the dialplan parser sees the action - but notice the "INLINE"
there. At line #272 you see the actual log that the action is being
executed. On line #273 is the actual log application's output. So, this
action was not added to the task list but rather executed right there. It
was "executed inline." Note that at line #274 it goes back to dialplan
parsing and adding items to the task list.

Skip down to line #294 - there you'll see the items from the task list
actually being executed. The two log applications that were not executed
"inline" finally get executed there at the end.

If you really want to see how this works try adding and removing the
inline="true" on the various actions in this extension. Watch the logs.
You'll see that anything with inline="true" gets executed long before the
items that don't have inline="true".

Hope this helps.

-MC

On Tue, Feb 14, 2012 at 9:26 PM, virendra bhati <virbhati at gmail.com> wrote:

> Hi,
>
> I have FS 1.0.6 "bridge" book and after reading chapters 5 and 8. Still
> this is very confusing concept. that's why i want to know from you guys an
> simple language with 2 or more example if you can reply with answer. Inline
> execution is very confusing
>
concept for me.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120215/56cced5a/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list