How to insert the call-id through Asterisk Call-file? - asterisk

I need to extract the Call-id info from the calls started by a Call-file (in Asterisk), and use this value as a parameter of another function in order to return the full-cdr from the SIP-Proxy. Either i need to extract the call-id from call file based calls, or i gotta insert a call-id value through the file and use it. However, could not figure out how to do that. Looking forward to your replies, thanks in advance.
p.s. I'm not asking for Caller-id which refers to, as far as i understand, the from-number.

Call-id will be created by chan_sip AFTER you do call via call file.
So no, there are no way put it in file.
Maybe possible read by SIPHeader function AFTER call placed, but more likly you should do patch.
You can add special header like X-something if other part support search by it.

Related

In gatling, how do I validate the value of a string extracted via the css check?

I'm writing a Gatling simulation, and I want to verify both that a certain element exists, and that the content of one of its attributes starts with a certain substring. E.g.:
val scn: ScenarioBuilder = scenario("BasicSimulation")
.exec(http("request_1")
.get("/path/to/resource")
.check(
status.is(200),
css("form#name", "action").ofType[String].startsWith(BASE_URL).saveAs("next_url")))
Now, when I add the startsWith above, the compiler reports an error that says startsWith is not a member of io.gatling.http.check.body.HttpBodyCssCheckBuilder[String]. If I leave the startsWith out, then everything works just fine. I know that the expected form element is there, but I cant confirm that its #action attribute starts with the correct base.
How can I confirm that the attribute start with a certain substring?
Refer this https://gatling.io/docs/2.3/general/scenario/
I have copied the below from there but it is a session function and will work like below :-
doIf(session => session("myKey").as[String].startsWith("admin")) { // executed if the session value stored in "myKey" starts with "admin" exec(http("if true").get("..."))}
I just had the same problem. I guess one option is to use a validator, but I'm not sure how if you can declare one on the fly to validate against your BASE_URL (the documentation doesn't really give any examples). You can use transform and is.
Could look like this:
css("form#name", "action").transform(_.startsWith(BASE_URL)).is(true)
If you also want to include the saveAs call in one go you could probably also do something like this:
css("form#name", "action").transform(_.substring(0, BASE_URL.length)).is(BASE_URL).saveAs
But that's harder to read. Also I'm not sure what happens when substring throws an exception (like IndexOutOfBounds).

Dynamic Url in Jitterbit Http Target

I am wanting to call the following URL in my Jitterbit HTTP target:
https://xxx.visualstudio.com/DefaultCollection/_apis/wit/workitems/[vstsId]?api-version=1.0
where [vstsId] is dynamic and should be supplied from a global variable.
Is it possible to have dynamic urls in the target?
I could make the whole url dynamic if need be.
Any ideas? (I'm using javascript scripting rather than the Jitterbit scripting)
Thanks
Martin
Yes, you have it typed out correctly. At the beginning of your operation chain (or at the point where you know what $vstsld should be, and you can declare it), simply add a script to declare it, or add it into a transformation where you get the data from. At any point after that, in the current operation chain, you can access the value in that variable. Just make sure you set it with the $ symbol, which makes it global.
$vstsld='some value';
As W3bguy said. you call it in the script as $vstsld. Now you can pass in a test value data into your variable as well. just add the curly brackets inside your variable like the below
example
https://xxx.visualstudio.com/DefaultCollection/_apis/wit/workitems/[vstsId{1234}]?api-version=1.0

Wordpress PODS magic tags extend with parameters

I am wondering if there's any function that I can create in order to modify the magic tags behaviour.
Ideally, I would like to use a tag like this {#post_content|120} which would go through my custom function and check if there's a | character, then execute the original magic tag, while trimming text down to 120 characters.
But I don't know where to hook in order to filter this content.
I know that I can pass a function name with the magic tag but this isn't really helpful as I need to pass the characters limit parameter which PODS doesn't support.
Also, I can't be creating functions for all my characters limit as I have a lot of places where I need different limits and I would end up using tons of functions and no dynamic solution.
Can I somehow trigger a magic tag with a parameter? Any other thoughts about doing this another way?
Thank you!
I don't think that's possible, {#your_field, your_function} is how it works (the function takes the field value as input) - you could use different function names like trim_120, trim_100 and do the stuff you need in there - I guess it's to create excerpts with different length's although there are other ways to do that e.g use the_content filter for one ...

Using U-SQL MultiLevelJsonExtractor gives Error: Path returned multiple tokens

I am using the MultiLevelJsonExtractor forked on Git by kotvisbj, When I put a Path that contains an array (body.header.items[*] or body.header.items) into the JsonPaths parameter string, I get a "Error: Path returned multiple tokens". Is there a way to extract the paths in code so I can get an array like when using the Root? I tried to explain this the best way I could, I don't have excellent c# skills, it's been a few years.
I think it would be best to ask the owner of the branch to see if he can advise you. I assume that his code expects a single token only and not an array of tokens.
You can probably achieve what you need by using code similar to this: U-SQL - Extract data from json-array

Read and modify POST fields "on-the-fly" using Fiddler

I need to use Fiddler to modify the POST fields sent by a browser. I know I can do that using the Fiddler UI but I want to create a script to do it automatically.
I need to insert the code inside the OnBeforeRequest method and I know I can use regular expressions to parse the POST fields but maybe there is something already available to do it like some sort of object POST with all the current fields, e.g: POST["field1"], POST["field2"], etc.
So...is it possible or do I have to do it manually?
Thanks!
Fiddler itself does not contain a script-accessible POST body parser, which means you'd either need to import one, write one, or use string processing to accomplish this task.

Resources