[OpenSER-Users] serialize_branches seems to be not working

Marcello Lupo mlist at itspecialist.it
Tue Oct 2 23:52:21 CEST 2007


Hi to all,
i digged more in the source code and found in the cfg.y that grammar for 
append_branch is valid in this way:

append_branch("","")  and i didn't found any documentation on it.

So deeping more i saw that it expect the qvalue to be passed separated 
from the URI and in this way it works.

       append_branch("sip:123456 at 10.0.0.1:5062","0.3");
       append_branch("sip:123456 at 10.0.0.2:5060","0.2");
       append_branch("sip:123456 at 10.0.0.3:5060","0.1");
       serialize_branches();

produces:

DEBUG:serialize_branches: loaded <sip:123456 at 10.0.0.1:5062>, q=300 
q_flag <16>
DEBUG:serialize_branches: loaded <sip:123456 at 10.0.0.3:5060>, q=100 
q_flag <0>
DEBUG:serialize_branches: loaded <sip:123456 at 10.0.0.2:5060>, q=200 
q_flag <16>

Now the big matter is that i saw in the exec_dset is not possible to 
have the same behavior because it use the standard
append_branch function in this way (exec.c line 172) :

                        if (append_branch(msg, &uri, 0, 0, 
Q_UNSPECIFIED, 0, 0)==-1) {
                                LOG(L_ERR, "ERROR: exec_str: 
append_branch failed;"
                                        " too many or too long URIs?\n");
                                goto error02;
                        }


It pass the qvalue as Q_UNSPECIFIED to append_branch. This is the reason 
it is not working. It is not considering the qvalue in the URI at all.
I think a solution can be to parse the lines received form exec_dset 
with a check on the  line for a  q= match and take the
value, or much more simple, assume that lines should be considered 
returned by exec_dset in order of q value already and let the
funtion to populate it with a FOR cycle. The second method cannot be 
applied if you want to have parallel forking obviously.
I will try to patch it by myself but if someone can help me it will be 
very appreciated because i'm not a C coder.

Any help is welcome.
Thanks,
Bye,
Marcello



Marcello Lupo wrote:
> Hi Klaus,
> i followed your suggestion and tried to add branches manually and 
> serialize_branches does not work the same.
>
> Instead of my exec_dset i used following lines:
>
>        append_branch("sip:123456 at 10.0.0.1:5062;q=0.3");
>        append_branch("sip:123456 at 10.0.0.2:5060;q=0.2");
>        append_branch("sip:123456 at 10.0.0.3:5060;q=0.1");
>        serialize_branches();
>
> and i still get :
>
> DEBUG:serialize_branches: nothing to do - all same q!
>
> I digged in serialize.c source code and saw at line 92 this statements:
>
> *************************************************************************
>        for( idx=0 ; 
> (branch.s=get_branch(idx,&branch.len,&q,0,0,0,0))!=0 ; idx++ ) {
>                if (q != ruri_q)
>                        break;
>        }
>        if (branch.s==0) {
>                DBG("DEBUG:serialize_branches: nothing to do - all same 
> q!\n");
>                return 0;
>        }
> *************************************************************************
>
> I changed if condition from if (q != ruri_q) to if (q == ruri_q) and 
> recompiled.
> In this way serialize branches load branches in serial_avp but still 
> have problems loading the qvalue
> correctly. It put all qvalues to -1 . Look at the log:
>
> DEBUG:serialize_branches: loaded <sip:123456 at 10.0.0.1:5062;q=0.3>, 
> q=-1 q_flag <0>
> DEBUG:serialize_branches: loaded <sip:123456 at 10.0.0.2:5060;q=0.2>, 
> q=-1 q_flag <0>
> DEBUG:serialize_branches: loaded <sip:123456 at 10.0.0.3:5060;q=0.1>, 
> q=-1 q_flag <0>
>
> This lead me to understand that the real problem is to parse and get 
> the qvalue from the URIs.
> I'm not a C coder so i'm not able to go deeper in the issue.
> I posted a bugreport on yesterday about it.
> Thank you for your help and if you, or some one else out there, have 
> ideas on how to solve the issue let me know please, it is very
> important to have this to work for me.
>
> A curiosity: There is someone having serialize_branches to work 
> correctly in some way out there?
>
> Bye,
> Marcello
>
>
> Klaus Darilion wrote:
>>
>>
>> Marcello Lupo schrieb:
>>> Hi Klaus,
>>> i tested the exec_dset without the serialiaze_branches() and it is 
>>> working correctly going in parallel forking to
>>> the 2 gateways in parallel. So I'm sure that branches are correct.
>>> It seems to be really a serialize_branches() bug.
>>> Do you know to who ask about the serialize_branches(), some 
>>> developer os similar?
>>
>> As you already know how it should work you can try to dig into the 
>> source code yourself. (use debug=4 to find out what is going on 
>> internally in openser). I guess the answer is somewhere in 
>> serialize.c or dset.c.
>>
>> You could also file a bugreport on the bugtracker on sourceforge.
>>
>> regards
>> klaus
>>
>>> Any way thanks for your help.
>>> Bye,
>>> Marcello
>>>
>>> Klaus Darilion wrote:
>>>> I've never used serialize_branches() yet - but I think you are 
>>>> doing it correctly and the destination set looks fine.
>>>>
>>>> regards
>>>> klaus
>>>>
>>>> Marcello Lupo schrieb:
>>>>> Hi Klaus,
>>>>> thanks for the answer, i will try it in few minutes. Anyway i have 
>>>>> a question.
>>>>> As i know append_branch(...) is used to appen branches to the 
>>>>> destination set.
>>>>> After the execution of exec_dset i have already the destination 
>>>>> set populated with my gateways information ($ds and $bR confirm it).
>>>>> In my tests i tried getting 2 gateways from exec_dset with q value 
>>>>> of 0.1 and 0.2 as follows:
>>>>>
>>>>> sip:123456 at 10.10.10.1:5062;q=0.2
>>>>> sip:123456 at 10.10.10.10:5060;q=0.1
>>>>>
>>>>> $ds become : Contact: sip:123456 at 10.10.10.1:5062;q=0.2, 
>>>>> sip:123456 at 10.10.10.10:5060;q=0.1
>>>>>
>>>>> RURI become: sip:123456 at 10.10.10.1:5062;q=0.2
>>>>>
>>>>> $bR become: sip:123456 at 10.10.10.10:5060;q=0.1
>>>>>
>>>>> Is possible that i miss understood something in the 
>>>>> append_branch() and serialize_branches() usage?
>>>>> Thanks,
>>>>> Bye,
>>>>> Marcello
>>>>>
>>>>>
>>>>> Klaus Darilion wrote:
>>>>>> Hi Marcello!
>>>>>>
>>>>>> does serialize_branches() work if you add the branches in 
>>>>>> openser.cfg? E.g. you could use append_branch(......) to add the 
>>>>>> branches manually and then try serialize_branches() .
>>>>>>
>>>>>> klaus
>>>>>>
>>>>>> Marcello Lupo schrieb:
>>>>>>> Hi to all,
>>>>>>> i made some other tests about this issue and i think it can be a 
>>>>>>> bug somewhere in the serialize_branches() executed after 
>>>>>>> exec_dset().
>>>>>>> I made tests changing the qvalue to format:
>>>>>>>
>>>>>>> q=1.0
>>>>>>> q=0.1
>>>>>>> q=1
>>>>>>>
>>>>>>> both with \n and \r\n at the end of lines and 
>>>>>>> serialize_branches() give me all the time the same result:
>>>>>>>
>>>>>>> DEBUG:serialize_branches: nothing to do - all same q!
>>>>>>>
>>>>>>> But if i got only one line from exec_dset() it give me:
>>>>>>>
>>>>>>> DEBUG:serialize_branches: nothing to do - no branches!
>>>>>>>
>>>>>>> So it see the difference between one line and more lines from 
>>>>>>> exec_dset() .
>>>>>>> Please help me with this issue i really need serial forking from 
>>>>>>> exec_dset() to work.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Bye,
>>>>>>> Marcello
>>>>>>>
>>>>>>>
>>>>>>> Marcello Lupo wrote:
>>>>>>>> Hi to all,
>>>>>>>> i'm using openser 1.2.2 no tls and i use exec_dset to get list 
>>>>>>>> of gateways in destination set to be serialized.
>>>>>>>>
>>>>>>>> After execution of exec_dset i get in output:
>>>>>>>>
>>>>>>>> sip:123456 at 10.10.10.1:5062;q=0.2
>>>>>>>> sip:123456 at 10.10.10.10:5060;q=0.1
>>>>>>>>
>>>>>>>> $ds become : Contact: sip:123456 at 10.10.10.1:5062;q=0.2, 
>>>>>>>> sip:123456 at 10.10.10.10:5060;q=0.1
>>>>>>>>
>>>>>>>> RURI become: sip:123456 at 10.10.10.1:5062;q=0.2
>>>>>>>>
>>>>>>>> $bR become: sip:123456 at 10.10.10.10:5060;q=0.1
>>>>>>>>
>>>>>>>> All seems to be fine but when i run serialize_branches() i get:
>>>>>>>>
>>>>>>>> DEBUG:serialize_branches: nothing to do - all same q!
>>>>>>>>
>>>>>>>> Any ideas on what i'm missing?
>>>>>>>>
>>>>>>>> May be something in the output of exec_dset??
>>>>>>>> I'm using the \n between lines in my custom LCR scripts to get 
>>>>>>>> gateways from DB.
>
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>
>





More information about the sr-users mailing list