[asterisk-dev] when will be the reason for not having a channel in monitor_dial of dial.c

Joshua C. Colp jcolp at sangoma.com
Mon May 10 07:30:01 CDT 2021


On Mon, May 10, 2021 at 9:09 AM Mohit Dhiman <mohitdhiman736 at gmail.com>
wrote:

> Hi,
> I am having trouble understanding a piece of code in the function
> monitor_dial of the file main/dial.c
>
> who = ast_waitfor_n(cs, pos, &timeout);
>
> /* If the timeout no longer exists OR *if we got no channel* it basically
> means the timeout was tripped, so handle it */
> if (!timeout || !who) {
>     timeout = handle_timeout_trip(dial, start);
>     continue;
> }
>
> my question is what will be the reason for not having the channel "who"
> as mentioned in the comment above the condition?
> The reason I am asking this is that "who" is returned from the channel
> list "cs" which cannot be of size 0 as the "count" variable is being
> checked and also the "pos" value can't be less than 1.
>
> can please anybody explain what could be the conditions for "who" to be
> returned NULL.
>

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.

-- 
Joshua C. Colp
Asterisk Technical Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20210510/6d41f93d/attachment.html>


More information about the asterisk-dev mailing list