Asterisk, generete unique identifier per call - asterisk

I was trying to get a unique identifier for each call that is not the caller phone number (CALLERID(num)) + some kind of timestamp.
Is there a variable a uniquely identifies a call in asterisk?

Asterisk already have that variable:
CDR(uniqueid)
have unique value for each call.
Also if you are using sip, each sip have SIPCALLID variable, which is unique per call-leg.
https://wiki.asterisk.org/wiki/display/AST/chan_sip+Channel+Variables
If you need more unique values - you can add more variables using function RANDOM.

Related

DynamoDBVersionAttribute for a frequency field

I have a DDB table, 4 attributes, key (PK - a string), date (sort/range key), status, frequency.
I have multiple clients that will write to this table based on the 'key' and date value
I want to increment frequency every time a client makes a write.
Can I just use DynamoDBVersionAttribute on an int field and use this as a proxy for frequency?
I understand this is not meant for this use case, but I want to avoid having to first read and then write the item. Any thoughts?
Since you're already doing an update expression, just add an ADD action to increment the frequency by 1. The ADD action doesn't need to know the original value to increment it.
See the example from the docs here:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.SET.IncrementAndDecrement

Using MessageAttributes in AWS SNS Post request

I am trying to use the MessageAttributes parameter in AWS SNS POST request. This is to customize the Sender ID (by AWS.SNS.SMS.SenderID). I am trying for Germany phone number and hence is allowed to customize the Sender ID. Can any one help me with the correct syntax?
Thanks,
Subhajit
You need to send 3 key/value pairs for each attribute:
MessageAttributes.entry.${index}.Name=${attributeName}&
MessageAttributes.entry.${index}.Value.DataType=String&
MessageAttributes.entry.${index}.Value.StringValue=${attributeValue}
${index} is the numerical index of each attribute, starting with 1
On the second line you need to specify the type of the value. Most common cases are String.
The third line is the actual value. You can see more information in the link above, I have only used strings and StringValue.
All the values need to be url-encoded for obvious reasons.
I was able to solve it using the following:
MessageAttributes.entry.N.Name (key)
MessageAttributes.entry.N.Value (value)

Firebase Remote Config: user in randome percentile. Are users assigned only once?

Suppose I create a parameter with conditions such that users in random percentile < 10% will be assigned a certain value. The client fetches this value parameter and gets this value with 10% probability, if not it gets the default value. Next session the client fetches the same parameter. Will he get the same value again? Do users stay in the same percentile indefinitely or is a dice thrown each time they fetch the parameter value?
From the documentation:
Each app instance is consistently mapped to a random whole or fractional number within a project, so you can use a rule of this type to consistently address the same app instances.
For example, to create two related conditions that each apply to a non-overlapping .05% of an app's user base, you could have one condition include a <= .05% rule, and another condition include both a > .05% rule and a <= .10% rule.
So they receive the same value consistently.

Retain value/state of a variable for a particular id of a spout in storm

I have defined a single bolt that calculates certain threshold. The bolt is receiving data for several values of a field. Is it possible that I can retain the value/state of a variable for a particular value of field.
Suppose I have two set of tuple inputs s$tuple$input:
s$id = "21343254545454354343" s$id="45645465645456561234"
s$tuple$input = ["ABC",2] s$tuple$input= ["CDE",5]
Is it possible to retain the value of a variable like counter=5 for "ABC" and counter=9 for "CDE" and update them only when a tuple for corresponding id is received.
I haven't played with Storm and R but hopefully the ideas will be similar to Java.
You have a few options for storing state:
In worker memory (per bolt)
External store (not within Storm)
What you choose depends on your requirements but lets assume you're just trying to count words and don't really care if a worker dies. For this, the implementation is simple. Just create a private variable in your bolt and keep track.
For example, lets say you have a counts variable:
Map<String, Integer> counts = new HashMap<String, Integer>();
Then, in your bolt's execute method you just check if you've gotten the word before and if so increment the count:
Integer count = counts.get(word);
if (count == null)
count = 0;
count++;
counts.put(word, count);
Source: WordCountBolt.java
You also want to consider how tuples flow to the workers. You probably don't want to use shuffle grouping anymore. Instead you want to do a field grouping by ID so that tuples with the same ID go to the same bolt.
Going forward you probably want something more durable (so if you lost a worker then you don't lose all your counts) so you'd probably store your counts in something like HBase.

How can I get results for a dimension (custom variables), where the value is not set?

I am using custom variables to track order ids. In order to aggregate analytics data into out data warehouse, I want to select a number of metrics with the custom variable as a dimension. However, if I do so, I will not get the entries where the variable is not set (E.g. sessions that didn't result in a sale). I need to get these as well.
Can I write a filter or segment that selects only the entries that doesn't have a particular custom variable? I have tried:
segment=dynamic::ga:customVarValue1==
But that doesn't seem to work (It gives no results back).
Basically I'm looking for the equivalent to where ga:customVarValue1 is null in sql.
In short, it's not possible to get the nullset data, as explained by a Google rep:
For some dimensions, GA uses the default value of (not set).
Custom Variable do not have a default value, so if a hit does not have a
custom variable associated with it, all the other dimensions in the query
are not added to the reports.
The original answer is a little confusing, but when you read between the lines it suggests that they throw out these "empty" values when they run their aggregates.
The "correct" approach, as he explains, is to set a default value for any row you want reported:
If you need to see the (not set) value, you could try sending a default
value for custom variables.
For example if you use visitor level custom vars to track member vs
non-member, you should always set non-member as a default for everybody;
then modify to member once they register.
Details are here: http://groups.google.com/group/google-analytics-data-export-api/browse_thread/thread/cd078ddb26ca18d5?pli=1
I've just had some success solving this by using a Regex to capture users or sessions where the custom dimension has no value. In my case I want to separate logged in and logged out users.
The Regex .+ will capture any non-empty value, so can be used to get the job done.
The filters for my Returning users segment is matches regex: .+ like this:
For the Customer prospects I used: does not match regex: .+ like this:
It's early days, but this appears to be working:

Resources