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 <jc...@sangoma.com> wrote: > On Mon, May 10, 2021 at 9:09 AM Mohit Dhiman <mohitdhiman...@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
-- _____________________________________________________________________ -- 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