Re: [SR-Users] decimal fraction problem
Hello, cc-ing to the mailing list is very important because even it is an email to show the previous answer was good, that will help other people with similar problem that search on web and read the mailing list archive to know the proposed solution worked and they can use it without asking again on mailing list if it was ok or not. Thanks, Daniel On 3/14/11 12:07 PM, 侯旭光 wrote: > got it > > thanks > > cheers > > 在 2011年3月14日 下午5:22,Daniel-Constantin Mierla 写道: >> Hello, >> >> are you using kamailio 3.1.x? If not, you have to upgrade, the >> $branch(...) variable was updated to be writable starting with this version. >> >> I played last week with it in a need of combining serial forking with >> parallel forking and all is ok with assigning values to $branch(...). >> >> Cheers, >> Daniel >> >> On 3/14/11 5:25 AM, 侯旭光 wrote: >>> sorry to bother again >>> >>> >>> $(branch(q)[-1]) = $var(q); >>> >>> this script line doesn't work and the pv $branch() aren't >>> writable,just readable . index -1 is not accessable either. >>> >>> if append_branch() function doesn't take the q value parameter,the >>> $branch(q) just return NULL (which I think is the default value >>> Q_UNSPECFIED=-1) >>> >>> I find a function set_ruri_q() in dset.c but I don't know how to call >>> it in the configure file. >>> >>> >>> 2011/2/23 Daniel-Constantin Mierla : Hello, On 2/21/11 10:28 AM, 侯旭光 wrote: Hello I need to add q value while using function append_branch(),but the function only takes decimal fraction as the parameter. What if I want to use pv to add q value? The $var and $avp just have string and integer type. Thanks a lot! do: km_append_branch("$var(branchuri)"); $(branch(q)[-1]) = $var(q); $var(q) has to hold an integer value that represents the decimal fraction value multiplied with 100 (so if q should be 0.5, then $var(q) = 50). Cheers, Daniel -- Daniel-Constantin Mierla http://www.asipto.com >>> ___ >>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list >>> sr-users@lists.sip-router.org >>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users >> -- >> Daniel-Constantin Mierla >> http://www.asipto.com >> >> -- Daniel-Constantin Mierla http://www.asipto.com ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] decimal fraction problem
Hello, are you using kamailio 3.1.x? If not, you have to upgrade, the $branch(...) variable was updated to be writable starting with this version. I played last week with it in a need of combining serial forking with parallel forking and all is ok with assigning values to $branch(...). Cheers, Daniel On 3/14/11 5:25 AM, 侯旭光 wrote: > sorry to bother again > > > $(branch(q)[-1]) = $var(q); > > this script line doesn't work and the pv $branch() aren't > writable,just readable . index -1 is not accessable either. > > if append_branch() function doesn't take the q value parameter,the > $branch(q) just return NULL (which I think is the default value > Q_UNSPECFIED=-1) > > I find a function set_ruri_q() in dset.c but I don't know how to call > it in the configure file. > > > 2011/2/23 Daniel-Constantin Mierla : >> Hello, >> >> On 2/21/11 10:28 AM, 侯旭光 wrote: >> >> Hello >> I need to add q value while using function append_branch(),but the function >> only takes decimal fraction as the parameter. >> What if I want to use pv to add q value? >> The $var and $avp just have string and integer type. >> Thanks a lot! >> >> do: >> >> km_append_branch("$var(branchuri)"); >> $(branch(q)[-1]) = $var(q); >> >> $var(q) has to hold an integer value that represents the decimal fraction >> value multiplied with 100 (so if q should be 0.5, then $var(q) = 50). >> >> Cheers, >> Daniel >> >> -- >> Daniel-Constantin Mierla >> http://www.asipto.com > ___ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla http://www.asipto.com ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] decimal fraction problem
sorry to bother again $(branch(q)[-1]) = $var(q); this script line doesn't work and the pv $branch() aren't writable,just readable . index -1 is not accessable either. if append_branch() function doesn't take the q value parameter,the $branch(q) just return NULL (which I think is the default value Q_UNSPECFIED=-1) I find a function set_ruri_q() in dset.c but I don't know how to call it in the configure file. 2011/2/23 Daniel-Constantin Mierla : > Hello, > > On 2/21/11 10:28 AM, 侯旭光 wrote: > > Hello > I need to add q value while using function append_branch(),but the function > only takes decimal fraction as the parameter. > What if I want to use pv to add q value? > The $var and $avp just have string and integer type. > Thanks a lot! > > do: > > km_append_branch("$var(branchuri)"); > $(branch(q)[-1]) = $var(q); > > $var(q) has to hold an integer value that represents the decimal fraction > value multiplied with 100 (so if q should be 0.5, then $var(q) = 50). > > Cheers, > Daniel > > -- > Daniel-Constantin Mierla > http://www.asipto.com ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] decimal fraction problem
Hello, On 2/21/11 10:28 AM, 侯旭光 wrote: Hello I need to add q value while using function append_branch(),but the function only takes decimal fraction as the parameter. What if I want to use pv to add q value? The $var and $avp just have string and integer type. Thanks a lot! do: km_append_branch("$var(branchuri)"); $(branch(q)[-1]) = $var(q); $var(q) has to hold an integer value that represents the decimal fraction value multiplied with 100 (so if q should be 0.5, then $var(q) = 50). Cheers, Daniel -- Daniel-Constantin Mierla http://www.asipto.com ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users