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

Mohit Dhiman mohitdhiman736 at gmail.com
Mon May 10 09:25:34 CDT 2021


Thank you, Joshua,
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.
After your reply, I started looking in the "0" timeout direction and
found the problem in my code.


On Mon, 10 May 2021 at 18:00, Joshua C. Colp <jcolp at sangoma.com> wrote:

> 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
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20210510/6eaa000d/attachment.html>


More information about the asterisk-dev mailing list