[kamailio] Added modparam id_in_avp for carrierroute (#221)
We have 2M lines in carrierroute, so we often need to get back the ID of the line from the DB from carrierroute. This commit creates a new modparam "id_in_avp" for the module carrierroute which may be 0 - 2 0 - no ID, only the description is saved in the avp 1 - ID and descrptiotion is saved in the AVP 2 - Only ID is saved in the AVP. You can view, comment on, or merge this pull request online at: https://github.com/kamailio/kamailio/pull/221 -- Commit Summary -- * Added modparam id_in_avp for carrierroute so the ID may be returned to the AVP variable for easier debugging -- File Changes -- M modules/carrierroute/carrierroute.c (7) M modules/carrierroute/cr_db.c (61) -- Patch Links -- https://github.com/kamailio/kamailio/pull/221.patch https://github.com/kamailio/kamailio/pull/221.diff --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221
forgotte to save changes in carrierroute.h extern int cr_id_in_avp; is defined in this file. Please revise, after revising I will push it too --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#issuecomment-114987951
any updates? --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#issuecomment-116524992
Also, it would be simpler to declare a static container for tmp_comment (look at static char query[QUERY_LEN] in cr_db.c) instead of you taking care of the allocaion each time. This is possible because add_route actually duplicates the string in tmp_comment. --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#issuecomment-117753968
@@ -349,7 +349,29 @@ int load_route_data_db(struct route_data_t * rd) { tmp_rewrite_host.s=(char *)row->values[COL_REWRITE_HOST].val.string_val; tmp_rewrite_prefix.s=(char *)row->values[COL_REWRITE_PREFIX].val.string_val; tmp_rewrite_suffix.s=(char *)row->values[COL_REWRITE_SUFFIX].val.string_val; - tmp_comment.s=(char *)row->values[COL_COMMENT].val.string_val; + switch(cr_id_in_avp) { + case 0: + //Description only + tmp_comment.s=(char *)row->values[COL_COMMENT].val.string_val; + break; + case 1: + //ID of row + comment
I would declare a static char comment[COMMENT_LEN] ( similar to query[QUERY_LEN] ) instead of managing the allocation/deallocation on my own as add_route function seems to duplicate the iformation in the comment parameter. --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221/files#r33700814
Hi @fr6nco , Do you have any more news about this enhancement? Thank you --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#issuecomment-172521358
Hi @fr6nco , Do you have any more news about this enhancement? Thank you --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#issuecomment-172521451
Closed #221. --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#event-517890436
Reopened #221. --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#event-517893494
Closing pull request because of no more activity. Will reopen the issue if need arises. --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#issuecomment-172828315
Closed #221. --- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/221#event-518989559
participants (2)
-
Lucian Balaceanu -
Thomas Boros