<div dir="ltr">Thank you, Joshua,<div>It helped a lot, I was actually writing some custom code to include the "ring timeout" in the function but my custom build was keep on crashing.</div><div>After your reply, I started looking in the "<font face="monospace">0</font>" timeout direction and found the problem in my code.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 10 May 2021 at 18:00, Joshua C. Colp <<a href="mailto:jcolp@sangoma.com">jcolp@sangoma.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Mon, May 10, 2021 at 9:09 AM Mohit Dhiman <<a href="mailto:mohitdhiman736@gmail.com" target="_blank">mohitdhiman736@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div>I am having trouble understanding a piece of code in the function <font face="monospace">monitor_dial</font> of the file <font face="monospace">main/dial.c</font></div><div><br></div><div><font face="monospace">who = ast_waitfor_n(cs, pos, &timeout);</font><br></div><div><br><font face="monospace">/* If the timeout no longer exists OR <b><font color="#ff0000">if we got no channel</font></b> it basically means the timeout was tripped, so handle it */<br></font></div><span style="font-family:monospace">if (!timeout || !who) {</span><br><span style="font-family:monospace">    timeout = handle_timeout_trip(dial, start);</span><br><span style="font-family:monospace">    continue;</span><br><div><font face="monospace">}</font></div><div><br></div><div>my question is what will be the reason for not having the channel <font face="monospace">"who"</font> as mentioned in the comment above the condition?</div><div>The reason I am asking this is that <font face="monospace">"who"</font> is returned from the channel list <font face="monospace">"cs"</font> which cannot be of size <font face="monospace">0</font> as the "<font face="monospace">count"</font> variable is being checked and also the "<font face="monospace">pos"</font> value can't be less than 1.</div><div><br></div><div>can please anybody explain what could be the conditions for <font face="monospace">"who"</font> to be returned NULL.</div></div></blockquote><div><br></div><div>It could be NULL if the timeout is reached, but timeout should be 0 then. It's likely there just in case or things changed since the code was written. Most likely just in case, though.</div></div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-family:tahoma,sans-serif"><font color="#073763">Joshua C. Colp</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Asterisk Technical Lead</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Sangoma Technologies</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Check us out at <a href="http://www.sangoma.com" target="_blank">www.sangoma.com</a> and <a href="http://www.asterisk.org" target="_blank">www.asterisk.org</a></font><br></div></div></div></div></div></div></div></div></div></div></div>
-- <br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a></blockquote></div>