Jan Janak writes:
At least for me
personally, having the branches cleared in t_load_contacts is kinda
unexpected side-effect. We should probably document it in the README
(I can take care of that, I want to update the README anyway).
there has been no effort to somehow merge the existing branches with
load_contacts branches. when you call load_contacts(), you start from
scratch.
Yes, that's how it works, I checked that.
t_load_contacts clears
branches only if it produces something that can actually by used by
t_next_contacts. And because t_load_contacts clears branches, the
script writer has to call t_next_contacts in this case, otherwise some
of the contacts could be lost.
yes, no branches exist after load_contacts() is called and if you don't
call next_contacts(), you will not have anything. this is the intended
behavior.
Things could break if the script writer calls
t_load_contacts and does
not call t_next_contacts.
this is how it is supposed to work.
I suggest that we change this after the
release and make t_next_contacts to clear the branches if needed. Then
nothing bad would happen if the script writer only calls
t_load_contacts, it will just create the AVP but if you do not call
t_next_contacts then things would work as usual, the request will be
forked to all branches in parallel.
i don't know if that kind of change is necessary, because
next_contacts() is supposed to be called after load_contacts(). if
script writer does not do that, it is his/her fault. in that case
better not to call load_contacts() either.
This way it would be also possible to fill the AVP
with contacs from
other sources than t_load_contacts (i.e. the database). That is not
possible right now, because t_next_contacts does not clear branches
for itself--t_load_contacts has to be called first.
you get contacts from wherever, e.g. database, and append them as
branches before calling load_contacts().
while we are at this, i suggest that also sr simplifies r-uri/branch
handling as described in this message:
http://lists.opensips.org/pipermail/users/2009-January/002365.html
-- juha