[SR-Users] Suggestions for time utils

Brandon Armstead brandon at cryy.com
Tue Aug 14 23:14:56 CEST 2012


Daniel,

   One question I do have - is the $timef(%Y%m%d)  evaluated only once at
run time (when kamailio is started) - or is it evaluated at the time of the
ACC'ing action.

Sincerely,
Brandon Armstead

On Tue, Aug 14, 2012 at 1:22 PM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:

>  Hello,
>
> the $timef(...) is evaluated, but you don't have time specifiers there,
> only static letters. You have to use % in front of the letters, as I guess
> from the example:
>
> http://www.kamailio.org/wiki/cookbooks/3.2.x/pseudovariables
>
> Try acc_$timef(%Y%m%d).
>
> Cheers,
> Daniel
>
>
>
> On 8/14/12 10:17 PM, Brandon Armstead wrote:
>
> Daniel,
>
>      My apologies - forgot to make clean.  However still no cigar.
>
>  Aug 14 20:16:40 /usr/local/sbin/kamailio[12410]: ERROR: db_mysql
> [km_dbase.c:122]: driver error on query: Table 'kamailio.acc_Ymd' doesn't
> exist
> Aug 14 20:16:40 /usr/local/sbin/kamailio[12410]: ERROR: acc [acc.c:405]:
> failed to insert into database
>
>  Sincerely,
> Brandon Armstead
>
> On Tue, Aug 14, 2012 at 1:11 PM, Daniel-Constantin Mierla <
> miconda at gmail.com> wrote:
>
>>  Hello,
>>
>> are you sure you re-installed and the right acc.so is used?
>>
>> The support is for generic PV, if it works with one it should work with
>> any. Which one does work for you?
>>
>> Can you give exact table name as printed in the SQL query? Does it have
>> the parenthesis and the format string?
>>
>> Cheers,
>> Daniel
>>
>>
>> On 8/14/12 9:55 PM, Brandon Armstead wrote:
>>
>> Daniel,
>>
>>     Patch applies fine - it still does not seem to take when using
>> $timef, i..e
>>
>>  modparam("acc", "db_table_acc", "acc_$timef(Ymd)")
>>
>>  It looks as if the $timef is not being interpreted and is simply
>> writing to acc'ing i.e. INSERT INTO acc_$timef
>>
>>  Thanks!
>>
>>  Sincerely,
>> Brandon Armstead
>> On Tue, Aug 14, 2012 at 12:48 PM, Daniel-Constantin Mierla <
>> miconda at gmail.com> wrote:
>>
>>>  Hello,
>>>
>>> I reapplied the patch (cherry-picked from the initial one) to the master
>>> branch.
>>>
>>> Can you test that and see if it works fine?
>>>
>>> You can cherry-picked to your branch, try:
>>>
>>> git pull origin
>>> git cherry-pick -x 95ee0a3ee75556a25f3a9286837a57decf6c3c91
>>>
>>> If it applies fine, compiles and the test go ok, then I will backport as
>>> soon as Juha confirms that was no solid reason in discarding this feature
>>> by his commit.
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>> On 8/14/12 9:21 PM, Brandon Armstead wrote:
>>>
>>> Daniel,
>>>
>>>     In my research I saw that commit as well but figured it was some
>>> kind of weird merging error.  Thanks for your time!  Look forward to
>>> hearing back from you guys.
>>>
>>>  Sincerely,
>>> Brandon Armstead
>>>
>>> On Tue, Aug 14, 2012 at 12:04 PM, Daniel-Constantin Mierla <
>>> miconda at gmail.com> wrote:
>>>
>>>>  Hello,
>>>>
>>>> checked the sources and it seems that Juha reverted this feature with
>>>> the commit:
>>>>
>>>>
>>>> http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=commitdiff;h=959ab319903b9625ead7292cc9638a20146e1cca
>>>>
>>>> I guess it was accidentally, I will ask on devels list.
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>>
>>>> On 8/14/12 7:34 PM, Brandon Armstead wrote:
>>>>
>>>> Let me also add that I am using 3.2 but I see the commit was quite some
>>>> time ago so I have a feeling it wouldn't work in 3.3 either.  Thanks!
>>>>
>>>> Sent from my iPhone
>>>>
>>>> On Aug 14, 2012, at 10:27 AM, Daniel-Constantin Mierla <
>>>> miconda at gmail.com> wrote:
>>>>
>>>>   Hello,
>>>>
>>>> this functionality should be already there. Doesn't work for you?
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>> On 8/14/12 7:16 PM, Brandon Armstead wrote:
>>>>
>>>> Sorry to wake up an old thread.
>>>>
>>>>  However - I am looking to export this $timef function to the param
>>>> initialization for accounting, i.e. db_table_acc
>>>>
>>>>  modparam("db_table_acc", "acc_$ftime(Ymd)");
>>>>
>>>>  I've looked into completing this myself however I simply am not
>>>> familiar enough at this point between the three different modules that it
>>>> would take to implement this (acc, dbsr1, pv).
>>>>
>>>>  Look forward to any help / insight you may be able to provide.
>>>>
>>>>  Thanks as always!
>>>>
>>>>  Sincerely,
>>>> Brandon Armstead
>>>>
>>>> On Mon, Dec 19, 2011 at 11:55 AM, Daniel-Constantin Mierla <
>>>> miconda at gmail.com> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>>
>>>>> On 12/19/11 7:50 PM, Andreas Granig wrote:
>>>>>
>>>>>> Hi Daniel,
>>>>>>
>>>>>> On 12/19/2011 07:29 PM, Daniel-Constantin Mierla wrote:
>>>>>>
>>>>>>> I don't know what are all the functions you think of, but for the
>>>>>>> example provided above, config file does it easy right now. There is
>>>>>>> a
>>>>>>> pseudo-variable that gives broken-time attribute that can be used
>>>>>>> with
>>>>>>> avp_check(), iirc, should be:
>>>>>>>
>>>>>>> avp_db_load(...);
>>>>>>> if(avp_check("$time(wday)", "eq/$avp(s:cf_weekday)/g")) { do CF }
>>>>>>>
>>>>>>> Of course there is the option of doing while loop, but maybe gets to
>>>>>>> large for desired config file.
>>>>>>>
>>>>>> This is pretty much what I had in mind with my new functions/module,
>>>>>> but
>>>>>> I've completely overlooked that PV when searching the docs for this
>>>>>> feature. Thank you very much for pointing that out!
>>>>>>
>>>>>  for sake of public knowledge, just to add on time specific features:
>>>>> there is also $timef(format) which returns current time attributes based on
>>>>> strftime specifiers -- its documentation was missing, I just added it.
>>>>> Also, there is a transformation {s.ftime,format) which can take any integer
>>>>> variable holding timestamp and return value based on strftime format.
>>>>>
>>>>>
>>>>> Cheers,
>>>>> Daniel
>>>>>
>>>>> --
>>>>> Daniel-Constantin Mierla -- http://www.asipto.com
>>>>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>>>> sr-users at lists.sip-router.org
>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>>
>>>>
>>>>
>>>> --
>>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
>>>> Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw
>>>>
>>>>
>>>> --
>>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
>>>> Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw
>>>>
>>>>
>>>
>>> --
>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
>>> Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw
>>>
>>>
>>
>> --
>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
>> Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw
>>
>>
>
> --
> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
> Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120814/819510c4/attachment-0001.htm>


More information about the sr-users mailing list