Custom SIP Header In Kamailio - sip

I need to set a custom header in Kamailio 3.3.1 from a Lua script.
I can theoretically set one in the config script like this -
append_hf("X-MyHeader: myvalue\r\n");
but I cannot work out how to call it from a Lua script, which is my preferred place to do this from. I have the following in my CFG file -
modparam("app_lua", "load", "/usr/local/etc/kamailio/lua/kamailio.lua")
modparam("app_lua", "register", "sl")
modparam("app_lua", "register", "rr")
modparam("app_lua", "register", "tm")
and my Lua script works fine as far as it goes. Documentation seems to suggest that append_hf() is part of the textops module, but I can see no way to expose that to the Lua script.
Please can anyone help me understand this or maybe suggest an alternative way to achieve my goal?

Done it.
You need to use -
sr.hdr.append("header: value\r\n");
I've spent 2 days looking for that. And 5 mins after posting I find it. Here's the URL where i got the answer from -
http://www.kamailio.org/wiki/embeddedapi/3.2.x/lua

Related

Getting started with a custom function with Excel Add-Ins

I followed this guide: https://learn.microsoft.com/en-us/office/dev/add-ins/quickstarts/excel-custom-functions-quickstart?tabs=excel-windows
So far everything went fine. I can use the =CONTOSO.CLOCK and other example functions.
If I add a function to the functions.ts file, it rebuilds... but I can't use the custom function on the web in any way.
Somehow I'm missing how I can register this function and run it in Excel...
Other question is: How can I change the name of the namespace from CONTOSO in something else?
Regards, Peter
Okay, a valid JSDoc was needed to work. After running a new build it worked out. https://learn.microsoft.com/en-us/office/dev/add-ins/excel/custom-functions-json-autogeneration

Is it possible to send HTTP GET Requests from a Simulink Block?

basically the title says it all. I'm working on a model that needs (there is no way around it) to load data from a website, parse it and pass it onto another block. I thought I could use an S-Function written in C++, which didn't properly work, then I tried to use webread()
which also didn't work in Simulink because I can't use extrinsic functions on the device this will run on.
I thought I could work around it by downloading the file externally and then reading it through fscanfbut it turned out that Matlab CODER doesn't support that as well.
After putting 2 1/2 days into this now, I'm asking myself whether it is even possible to do something like an HTTP Request through a Simulink block. That's why I went here to ask that question. Thanks for every answer!
I figured out a way to do it with a C++ S-Function by now.
I also created a GitHub Repo for it. If you're stuck with the same problem as I was, try to take a look at this. I'm pretty sure it will help you.

IIS 6 Parameterized Redirects

It looks like there's a way to, in IIS 6, do the following:
Redirect http://mydomain.com/old_page.asp?oldparam=111 to http://mydomain.com/new-page/111
But, I'm not sure how best to achieve this.
I'm reading up about using VBScript to access the MetaBase to set this up as shown on this page http://msdn.microsoft.com/en-us/library/ms525728%28v=vs.90%29.aspx, but so far I've had no luck. The documentation seems to assume and advanced user... I need something a little more novice.
(Also you seem to be able to use the Active Directory version or WMI version in VBS - I don't know either of them)
Any ideas?
Regards,
Jacques

Problems with Forms2Go script

I am currently trying to make a form for a website in work. I have created the script in Perl using Forms2Go and have entered the send mail and bin paths given to me. At the first the script wouldn't execute but the hosts made changes to the sever and now it does.
Problem now is the script executes and takes the user to the thank you page but doesn't send the form to the e-mail address which has been tested by the hosting company.
I have a feeling that the send-mail path isn't correct and that is why it is executing but not sending the email, anything else it might be?
Thanks for reading.
Tom
Forms To Go is payware and they do not provide their source code publicly which makes trouble-shooting by the general Internet populace rather difficult. Try their support forum instead. If you're looking for a form mailer that does not suck, install nms TFMail.

How do I implement cookie based auth for a Perl website on shared hosting?

I'm very new to Perl, and I have absolutely no idea how to approach this. We have an old Perl application which previously used Apache auth; we'd like to replace this with a cookie based form-style authentication. I understand that this is very case-specific, and there is no one answer as such, but some general tips would be much appreciated.
Will I need to edit all .pl files in the website? Or is there a "golden hammer" solution I can use? Is there something on CPAN I can use? We're using Perl v5.8.8 if it matters, and we're using Apache 2 shared hosting. I am happy to provide additional information as is necessary.
For the authentication to be recognized/required, it will need to be checked by the .pl file that initially receives the user's request. So the answer to whether all .pl files will need to be changed depends on how your application is structured:
If the user goes to http://myserver.com/one.pl to do the first thing and http://myserver.com/two.pl to do the second thing, then, yes, you'll need to change them all because they're all receiving requests individually.
If the user goes to http://myserver.com/dispatch.pl?mode=one for the first thing and http://myserver.com/dispatch.pl?mode=two for the second thing and dispatch.pl calls either one.pl or two.pl behind the scenes based on the mode parameter, then you only need to change dispatch.pl, since it's the only one directly receiving requests from the user.
Edited to add: If you're dealing with the first model, then I'd strongly recommend setting up an external module (.pm file) with the cookie-handling code and calling that from each of your individual .pl files instead of duplicating that code all over the place. Ideally, this would let you get by with only a few lines of added code in each .pl:
use MyCookieHandlingModule qw(verify_cookie redirect_to_login);
my $q = CGI->new; # ...unless you're already using CGI in object-oriented mode
redirect_to_login unless verify_cookie($q);
You could do it at a level outside the Perl program.
Thanks for your answers guys, but I eventually decided on CGI::Session::Auth::DBI which works well on shared hosting.