Skip to content

Instantly share code, notes, and snippets.

View whosgonna's full-sized avatar

Ben Kaufman whosgonna

  • AltiGen Communications, Inc
  • Minneapolis, MN
View GitHub Profile
#!KAMAILIO
## The following example will result in each subsequent transaction having it's rURI ADDED to the
## contact header, causing it to grow. For example, this would be the contact header of the third
## reply to this message:
## Contact: <sip:+16127359309@127.0.0.1:5050>, <sip:+16127359309@127.0.0.1:5050>, <sip:+16127359309@127.0.0.1:5050>
## Tested against Kamilio version:
## version: kamailio 5.5.2 (x86_64/linux)

I had a problem installing LWP::Protocol::https because the dependancy Net::SSLeay was failing to install. The issue was with missing development libraries for openssl and zlib1g.

The error in the log for missing the openssl development headers when installing Net::SSLeay looked like this:

cc -c   -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2   -DVERSION=\"1.88\" -DXS_VERSION=\"1.88\" -fPIC "-I/home/ben/.plenv/versions/5.32.0/lib/perl5/5.32.0/x86_64-linux-thread-multi/CORE"   SSLeay.c
SSLeay.xs:163:10: fatal error: openssl/err.h: No such file or directory
 #include <openssl/err.h>
 ^~~~~~~~~~~~~~~
@whosgonna
whosgonna / gist:5acfb33e064faf6d28e755dce0fe8b87
Last active September 17, 2020 20:53
Kamailio common tasks

Mosly transformations for which I forget the syntax:

Getting data out of a header:

In this example, assume the following X-Custom: header

X-Custom: "BetaUser01" <sip:+15555551234@host.domain.com:5075;user=phone>;tag=aa70809-41171;sgid=5;tenant=customer123

"X-Custom" is used for this example, because frequently common headers will not have existing psuedo variables to get specific sections. For exxample, to get the user portion of the URI in a from header it is easier to just use $fU.

@whosgonna
whosgonna / login_x
Created July 31, 2020 21:45
login_x
<?xml version="1.0"?>
<root>
<status>
<http_code>405</http_code>
<app_status href="https://tqa-cl1gw1.voiceforteams.com/rest/login">
<app_status_entry code="20034" params=""/>
</app_status>
</status>
</root>
@whosgonna
whosgonna / RemoteBulkExecutePowerShellJobs.ps1
Created May 21, 2020 19:59
How to execute tasks in bulk via powershell remoting
## General concept for running remote tasks in powershell on multiple domain computers
#
## First create a list of computer(s) on which to execute the job. This can be a single
## computer by hostname, like this:
$computers = 'COMPUTER1' ## A single Computer
## OR ##
$computers = @( 'COMPUTER1', 'COMPUTER2');
## OR ##
$computers = $(Get-ADComputer -Filter * -Searchbase 'OU=Computers,DC=DOMAIN,DC=COM') | ForEach-Object {$_.Name}

Keybase proof

I hereby claim:

  • I am whosgonna on github.
  • I am whosgonna (https://keybase.io/whosgonna) on keybase.
  • I have a public key ASCahD7xrTlOtqpcX3gCXpPwH_9uBwXL4e0fUZa-kyqxjAo

To claim this, I am signing this object:

@whosgonna
whosgonna / Excel_Named_Reference.pl
Created December 23, 2016 18:29
Created and used "named cells" in a perl created Excel document.
#!/usr/bin/env perl
use strict;
use warnings;
use Excel::Writer::XLSX;
use Excel::Writer::XLSX::Utility;
## Create the excel document, and add two worksheets, named "Page 1" and
## "Page 2" repectively.
my $wb = Excel::Writer::XLSX->new('Excel_Named_Reference.xlsx');
my $ws1 = $wb->add_worksheet('Page 1');
@whosgonna
whosgonna / create_users_multiple_servers.pl
Created March 20, 2016 22:13
Create an identical user on multiple Zabbix servers.
use strict;
use warnings;
use lib "../lib";
## This example allows to create a user on multiple Zabbix servers and accepts username, groups, name and surname on the
## commandline. Example invocation:
## perl create_user.pl --user rziema --group "Good users" --group "Nice users" --name Roberts --surname Ziema
## updated from Richlv's original - passing parameters as a hashref.