Tanin,<div><br></div><div>Welcome to the FreeSWITCH community! We hope you enjoy your stay. :)</div><div><br></div><div>Okay, these are basic but very good questions. If you want a really in depth discussion I recommend getting the FreeSWITCH book and reviewing chapters 5 and 8 which discuss dialplan processing in great detail. However, here is a very brief answer to your question:</div>
<div><br></div><div>There are two basic "phases" to dialplan processing: "hunting" and "executing". During the hunting phase, the dialplan processor parses the dialplan looking for extensions with matching conditions. When a condition matches, any <actions> inside that condition are added to the "task list". (There are various ways to control this hunting behavior, but let's save that for a later discussion.)</div>
<div><br></div><div>Once the hunting phase is done, there is a list of actions that needs to be executed. It's at this point that variables get "expanded". For example this condition yields a value for $1:</div>
<div><font face="'courier new', monospace" size="1"><condition field="destination_number" expression="^(10[01][0-9])$"></font></div><div><br></div><div>$1 will contain whatever is matched in the expression. In this case, it will be a four-digit number, like "1000", "1001", etc. (For more information on this topic see <a href="http://wiki.freeswitch.org/wiki/Regex">http://wiki.freeswitch.org/wiki/Regex</a>)</div>
<div><br></div><div>See this pastebin where I have separated the hunting from the executing:</div><div><a href="http://pastebin.freeswitch.org/17732">http://pastebin.freeswitch.org/17732</a></div><div><br></div><div>It's a call to extension 1009. You first see the dialplan hunting starting at line #3. Notice all the debug lines that begin with "Dialplan:" - these represent the dialplan parser going over each extension's <condition> tags looking for matches. You'll see either PASS or FAIL on a match or no match. (Compare line #76 to line #78.) If there's a match then you'll see any actions being added to the task list. Look starting at line #79 and you'll see all the actions being added for this extension. NOTE: if you look in conf/dialplan/default.xml at the "Local_Extension" dialplan extension you'll see a direct correspondence to the <action> tags there and the actions being added here in the log.</div>
<div><br></div><div>Once the dialplan is done hunting it moves on to the execute phase. (See log entries after line #105.) Notice all the lines beginning with "EXECUTE:" - these represent the actions on the task list actually being executed, one at a time and in the order they were added. </div>
<div><br></div><div>That's it! Well, not exactly, but this will get you started. There are a number of tricks and a few caveats, but you'll get to those in due course. Feel free to join #freeswitch on <a href="http://irc.freenode.net">irc.freenode.net</a> and chat with us in realtime. Also, we have a conference call every Wednesday. See the main wiki page for more information.</div>
<div><br></div><div>-MC</div><div><br><div class="gmail_quote">On Wed, Nov 9, 2011 at 6:24 AM, hi tanin <span dir="ltr"><<a href="mailto:hi_tanin@yahoo.com" target="_blank">hi_tanin@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt">
<div>I am very new with FreeSwitch. Can anyone tell me:</div>
<div><span> What is mean by hunting phase?</span></div>
<div><span><span> When and how it is use and why and when it is required?</span></span></div>
<div><span><span><span>I want to know details about hunting phase, </span></span></span></div>
<div><span><span><span></span></span></span> </div>
<div><span><span><span>Also plese give me a way or tell me when and how the variables($0, $1, $2) are used?<var></var></span></span></span></div>
<div><span><span><span></span></span></span> </div>
<div><span><span><span>Please help me </span></span></span></div>
<div><span><span></span></span> </div>
<div> </div></div></div><br><br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>