abuzooz Posted March 18, 2020 Report Posted March 18, 2020 Hi All I want to ask if I can add a custom field in users schema, so I can use it when creating a new user via API, I want to add "team_id" to users so I can easily map this user to his team in other databases when fetching his data. Moreover, I was wondering if we can also include this custom field in the CDR response (in addition to the normal fields returned) Quote
Administrators mc_ Posted March 18, 2020 Administrators Report Posted March 18, 2020 If you create a user with any fields not defined in the schema, KAZOO will store them untouched. So you can easily add "team_id" to the user doc when you create it and you will get it back when you fetch the user doc. For the CDR portion, you should get the Owner-ID included if the device involved in the call leg is owned by a user. Assuming you track the KAZOO User's ID + "team_id", you should be able to receive the CDR, read the Owner-ID and associate the CDR with the user / team in your application. And welcome! :) Quote
abuzooz Posted March 19, 2020 Author Report Posted March 19, 2020 You Rock! Yes it worked to add team_id in the member creation request! Now for the CDR part, I want to enforce adding team_id custom field in each CDR record for historical trail reason, consider the following scenario: team X has 5 members and they made 10 calls on March 19, 2020, now if we relocated one of these team members (lets say member 123) to team Y, then we generated a report for team X to see all calls made on March 19, we will notice that the number of calls are different as we are not counting the calls made by (member 123) as Member 123 is part of a new team now, which will yield in a wrong reporting. Is there anyway to customize the fields written in the CDR document to include this new field? as the other option to solve this problem is to save CDRs data into another warehouse and add the team_id manually for each record as written which is a complicated and long process Quote
Administrators mc_ Posted March 20, 2020 Administrators Report Posted March 20, 2020 You have some options but nothing immediately straightforward that I can see. There are "custom_application_vars" that you can set in a callflow: https://docs.2600hz.com/dev/applications/callflow/doc/set_variables/ So if you have a callflow that goes to a ring_group for "team X" you could put 'set_variables' before the ring_group action and set the team_id in the CAVs. These CAVs will appear on the CDR. Quote
abuzooz Posted March 20, 2020 Author Report Posted March 20, 2020 I tired to set as it as you said, just before the main call flow for outbound calls, however, it havent written anything in the CDR when tested! Also I saw that SET CAV action was to set it manually not using the CAV(team_id) as a dynamic variable to be set from the user who is making the call. Quote
safarov Posted March 23, 2020 Report Posted March 23, 2020 This may be related to https://freeswitch.org/jira/browse/FS-11490 Quote
abuzooz Posted March 24, 2020 Author Report Posted March 24, 2020 On 3/23/2020 at 3:18 AM, safarov said: This may be related to https://freeswitch.org/jira/browse/FS-11490 I added this line <param name="send-all-headers" value="true" /> into Kazoo-freeswitch kazoo.conf file and I added set-cav manual value in outbound callflow with now luck. beside, I dont want to set a static value, I want to use a custom value (team_id) which I added while creating this user to be used in the CDRs Sorry guys, I am not Kazoo Guru Any advise? Quote
2600Hz Employees lazedo Posted March 24, 2020 2600Hz Employees Report Posted March 24, 2020 assuming you're running 4.3 releases, if you install kazoo-freeswitch >= 4.3.16 without change, it should work oob. make sure to look into freeswitch logs for kazoo initiated commands to set the cav variable don't do this, this is a developer setting, it will degrade your system 2 hours ago, abuzooz said: <param name="send-all-headers" value="true" /> Quote
abuzooz Posted March 25, 2020 Author Report Posted March 25, 2020 On 3/24/2020 at 1:24 PM, lazedo said: assuming you're running 4.3 releases, if you install kazoo-freeswitch >= 4.3.16 without change, it should work oob. make sure to look into freeswitch logs for kazoo initiated commands to set the cav variable don't do this, this is a developer setting, it will degrade your system Thank you, I was advised that send-all-headers is used for development purpose, is that correct? Beside, where can I find a list of kazoo dynamic variables, like (account_id), (caller_id_number) ..etc that can be set on runtime, I want it to pass the realm of the customer who is making the call (realm name not IP), I tried to use {realm) and it is received as is not its value. same if I want to user {user_id}..etc is this list of dynamic variables published anywhere? Quote
abuzooz Posted March 25, 2020 Author Report Posted March 25, 2020 (edited) As you can see in screenshot below, I want to set these variables to be passed in the sip header on run_time, this is important so our billing system will log these info in its CDRs I using API by patching the resource API, I was able to send user_caller_id_number for example using {caller_id_number}, but I cant figure out the dynamic variables names for the highlighted variables (user_id, cav_team_id, and most important real name (not IP)) Any advise? Edited March 25, 2020 by abuzooz (see edit history) Quote
Administrators mc_ Posted April 2, 2020 Administrators Report Posted April 2, 2020 If the fields are not defined in the JSON schemas, KAZOO will store them but they are unused. How would they show up in the CDR at that point? Instead, in the callflow, use https://docs.2600hz.com/dev/applications/callflow/doc/set_variables/ However, since you want to dynamically set team_id (or whatever) you will need to use Pivot in your callflow to set the variable on your server. So your callflow would for "no_match" would be Pivot -> Your HTTP Server. Your server would then return callflow JSON like "{"module":"set_variables", "data":{"custom_application_vars":{"team_id":"YOUR_DYNAMIC_TEAM_ID"}}, "children":{"_":{"module":"resources", "data":{...}}}}" I have not counted my curly braces so adjust accordingly :) Quote
abuzooz Posted April 2, 2020 Author Report Posted April 2, 2020 Will it took me a while to understand how to do it, but yes, it worked, thanks a lot! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.