opensips config file not working - voip

Opensips config file
Name : opensips.cfg
location :- /usr/local/etc/opensips
#
# $Id$
#
# OpenSIPS residential configuration script
# by OpenSIPS Solutions <team#opensips-solutions.com>
#
# This script was generated via "make menuconfig", from
# the "Residential" scenario.
# You can enable / disable more features / functionalities by
# re-generating the scenario with different options.#
#
# Please refer to the Core CookBook at:
# http://www.opensips.org/Resources/DocsCookbooks
# for a explanation of possible statements, functions and parameters.
#
####### Global Parameters #########
debug=3
log_stderror=no
log_facility=LOG_LOCAL0
fork=yes
children=4
/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
#log_stderror=yes
/* uncomment the next line to enable the auto temporary blacklisting of
not available destinations (default disabled) */
#disable_dns_blacklist=no
/* uncomment the next line to enable IPv6 lookup after IPv4 dns
lookup failures (default disabled) */
#dns_try_ipv6=yes
/* comment the next line to enable the auto discovery of local aliases
based on revers DNS on IPs */
auto_aliases=no
listen=udp:192.168.2.16:5060 # CUSTOMIZE ME
disable_tcp=yes
disable_tls=yes
####### Modules Section ########
#set module path
mpath="/usr/local/lib64/opensips/modules/"
#### SIGNALING module
loadmodule "signaling.so"
#### StateLess module
loadmodule "sl.so"
#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 5)
modparam("tm", "fr_inv_timeout", 30)
modparam("tm", "restart_fr_on_each_reply", 0)
modparam("tm", "onreply_avp_mode", 1)
#### Record Route Module
loadmodule "rr.so"
/* do not append from tag to the RR (no need for this script) */
modparam("rr", "append_fromtag", 0)
#### MAX ForWarD module
loadmodule "maxfwd.so"
#### SIP MSG OPerationS module
loadmodule "sipmsgops.so"
#### FIFO Management Interface
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("mi_fifo", "fifo_mode", 0666)
#### URI module
loadmodule "uri.so"
modparam("uri", "use_uri_table", 0)
#### MYSQL module
loadmodule "db_mysql.so"
#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "db_mode", 0)
#### REGISTRAR module
loadmodule "registrar.so"
modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
#### ACCounting module
loadmodule "acc.so"
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_cancels", 0)
/* by default we do not adjust the direct of the sequential requests.
if you enable this parameter, be sure the enable "append_fromtag"
in "rr" module */
modparam("acc", "detect_direction", 0)
modparam("acc", "failed_transaction_flag", "ACC_FAILED")
/* account triggers (flags) */
modparam("acc", "log_flag", "ACC_DO")
modparam("acc", "log_missed_flag", "ACC_MISSED")
#### AUTHentication modules
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url",
"mysql://root:root#localhost/opensips") # CUSTOMIZE ME
modparam("auth_db", "load_credentials", "")
####### Routing Logic ########
# main request routing logic
route{
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(ACC_DO); # do accounting ...
setflag(ACC_FAILED); # ... even if the transaction fails
} else if (is_method("INVITE")) {
# even if in most of the cases is useless, do RR for
# re-INVITEs alos, as some buggy clients do change route set
# during the dialog.
record_route();
}
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(relay);
} else {
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK; must be an ACK after
# a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction ->
# ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
if ( !(is_method("REGISTER") ) ) {
if (from_uri==myself)
{
# authenticate if from local subscriber
# authenticate all initial non-REGISTER request that pretend to be
# generated by local subscriber (domain from FROM URI is local)
if (!proxy_authorize("", "subscriber")) {
proxy_challenge("", "0");
exit;
}
if (!db_check_from()) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
consume_credentials();
# caller authenticated
} else {
# if caller is not local, then called number must be local
if (!uri==myself) {
send_reply("403","Rely forbidden");
exit;
}
}
}
# preloaded route checking
if (loose_route()) {
xlog("L_ERR",
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK"))
sl_send_reply("403","Preload Route denied");
exit;
}
# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();
# account only INVITEs
if (is_method("INVITE")) {
setflag(ACC_DO); # do accounting
}
if (!uri==myself) {
append_hf("P-hint: outbound\r\n");
route(relay);
}
# requests for my domain
if (is_method("PUBLISH|SUBSCRIBE"))
{
sl_send_reply("503", "Service Unavailable");
exit;
}
if (is_method("REGISTER"))
{
# authenticate the REGISTER requests
if (!www_authorize("", "subscriber"))
{
www_challenge("", "0");
exit;
}
if (!db_check_to())
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
if ( 0 ) setflag(TCP_PERSISTENT);
if (!save("location"))
sl_reply_error();
exit;
}
if ($rU==NULL) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# do lookup with method filtering
if (!lookup("location","m")) {
if (!db_does_uri_exist()) {
send_reply("420","Bad Extension");
exit;
}
t_newtran();
t_reply("404", "Not Found");
exit;
}
# when routing via usrloc, log the missed calls also
setflag(ACC_MISSED);
route(relay);
}
route[relay] {
# for INVITEs enable some additional helper routes
if (is_method("INVITE")) {
t_on_branch("per_branch_ops");
t_on_reply("handle_nat");
t_on_failure("missed_call");
}
if (!t_relay()) {
send_reply("500","Internal Error");
};
exit;
}
branch_route[per_branch_ops] {
xlog("new branch at $ru\n");
}
onreply_route[handle_nat] {
xlog("incoming reply\n");
}
failure_route[missed_call] {
if (t_was_cancelled()) {
exit;
}
# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply("404","Not found");
## exit;
##}
}
using this config file i am unable to connect my Zoiper softphone.
it is showing SIP 408 Request Timeout
Note :-opensip ver 1.11
It is working fine when i am not using authentication module.

If you are unable to REGISTER and authenticate your phone, chances are the cause is external (script, hardware/software, etc.), rather than a OpenSIPS bug.
Please extract a network capture with ngrep or wireshark, and try to understand where the authentication is failing. You can post a link with the capture here if you cannot solve the problem by yourself.

Related

Kamailio as load balancer for multiple asterisk servers

I have three virtual servers running Ubuntu 14.04. On one server I installed Kamailio and on the others Asterisk. I want that the Kamailio server works as a load balancer and forwards the incoming calls to the asterisk servers (round robin).
I want to test it first with one asterisk server and if that works, I can add more for more performance.
I added my SIP provider credentials like this:
kamctl add test testpasswd
Then I added the asterisk server to the dispatcher table like this:
INSERT INTO dispatcher (setid,destination,flags,priority,attrs,description) VALUES (1,"sip:10.1.1.3:5060",0,0,"","Asteriskl-I");
I changed the sip.conf file on my asterisk server that it connects to my kamailio server and that seems to work.
My kamailio.cfg file looks like this:
#!KAMAILIO
#
# sample config file for dispatcher module
# - load balancing of VoIP calls with round robin
# - no TPC listening
# - don't dispatch REGISTER and presence requests
#
# Kamailio (OpenSER) SIP Server v3.2
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#
# Direct your questions about this file to: sr-users#lists.sip-router.org
#
# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
# for an explanation of possible statements, functions and parameters.
#
# Several features can be enabled using '#!define WITH_FEATURE' directives:
#
# *** To run in debug mode:
# - define WITH_DEBUG
#
####### Global Parameters #########
#!define WITH_DEBUG
#!ifdef WITH_DEBUG
debug=4
log_stderror=yes
#!else
debug=2
log_stderror=no
#!endif
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
fork=yes
children=4
/* comment the next line to enable TCP */
disable_tcp=yes
/* uncomment the next line to disable the auto discovery of local aliases
based on revers DNS on IPs (default on) */
auto_aliases=no
/* add local domain aliases */
# alias="mysipserver.com"
port=5060
/* uncomment and configure the following line if you want Kamailio to
bind on a specific interface/port/proto (default bind on all available) */
# listen=udp:127.0.0.1:5060
sip_warning=no
####### Modules Section ########
#set module path
mpath="/usr/local/lib64/kamailio/modules/"
# loadmodule "db_mysql.so"
loadmodule "mi_fifo.so"
loadmodule "kex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
# loadmodule "ctl.so"
loadmodule "mi_rpc.so"
loadmodule "acc.so"
loadmodule "dispatcher.so"
# ----------------- setting module-specific parameters ---------------
# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)
# ----- acc params -----
modparam("acc", "log_flag", 1)
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")
# ----- tm params -----
modparam("tm", "fr_timer", 2000)
modparam("tm", "fr_inv_timer", 40000)
# ----- dispatcher params -----
# modparam("dispatcher", "db_url",
# "mysql://kamailio:123456#localhost/kamailio")
modparam("dispatcher", "table_name", "dispatcher")
modparam("dispatcher", "flags", 2)
modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
####### Routing Logic ########
# main request routing logic
route {
# per request initial checks
route(REQINIT);
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
remove_hf("Route");
if (is_method("INVITE|SUBSCRIBE"))
record_route();
#if (is_method("INVITE"))
#{
# ds_select_domain("1","4");
# #sl_send_reply("300","Redirect");
# #t_relay();
# exit;
#}
# account only INVITEs
if (is_method("INVITE"))
{
setflag(1); # do accounting
}
# handle presence related requests
route(PRESENCE);
# handle registrations
route(REGISTRAR);
if ($rU==$null)
{
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# dispatch destinations
route(DISPATCH);
route(RELAY);
}
route[RELAY] {
if (!t_relay()) {
sl_reply_error();
}
exit;
}
# Per SIP request initial checks
route[REQINIT] {
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if(!sanity_check("1511", "7"))
{
xlog("Malformed SIP message from $si:$sp\n");
exit;
}
}
# Handle requests within SIP dialogs
route[WITHINDLG] {
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(1); # do accounting ...
setflag(3); # ... even if the transaction fails
}
route(RELAY);
} else {
if (is_method("SUBSCRIBE") && uri == myself) {
# in-dialog subscribe requests
route(PRESENCE);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK;
# must be ACK after a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction ... ignore and discard.
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
}
# Handle SIP registrations
route[REGISTRAR] {
if(!is_method("REGISTER"))
return;
#sl_send_reply("404", "No registrar");
#t_relay();
if(!ds_select_dst("1", "4"))
{
sl_send_reply("404", "No registrar");
exit;
}
forward();
exit;
}
# Presence server route
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE"))
return;
sl_send_reply("404", "Not here");
exit;
}
# Dispatch requests
route[DISPATCH] {
# round robin dispatching on gateways group '1'
if(!ds_select_dst("1", "4"))
{
send_reply("404", "No destination");
exit;
}
xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");
t_on_failure("RTF_DISPATCH");
return;
}
# Sample failure route
failure_route[RTF_DISPATCH] {
if (t_is_canceled()) {
exit;
}
# next DST - only for 500 or local timeout
if (t_check_status("500")
or (t_branch_timeout() and !t_branch_replied()))
{
if(ds_next_dst())
{
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
}
}
If I connect my asterisk box directly to my SIP provider it works perfectly. But if I connect it to the kamailio server and the kamailio server to the SIP provider it doesn't.
I googled for hours and tried a lot of things and I really have no idea what I could try next... If anyone could help me I would be very happy!
Thank you very much and best regards
I added my SIP provider credentials like this:
kamctl add test testpasswd - This is wrong.
Check following link for detailed info how you should set-up SIP trunk on Kamailio, which are using username/password authentication:
http://lists.sip-router.org/pipermail/sr-users/2015-September/090001.html

How to add custom services in Nixos

using nixops one can easily configure services like:
{
network.description = "Web server";
webserver = { config, pkgs, ... }:
{
services.mysql = {
enable = true;
package = pkgs.mysql51;
};
but i want to extend services. for example by using override as done for pkgs below:
let
myfoo = callPackage ...
in
pkgs = pkgs.override {
overrides = self: super: {
myfoo-core = myfoo;
};
}
question
how to do that for services?
Adding a service requires that you first write a service definition for your service. That is, a nix file that declares the options of your service and provides an implementation.
Let's say our service is called foo, then we write a service definition for it an save it as the file foo.nix:
{ config, lib, pkgs, ... }:
with lib; # use the functions from lib, such as mkIf
let
# the values of the options set for the service by the user of the service
foocfg = config.services.foo;
in {
##### interface. here we define the options that users of our service can specify
options = {
# the options for our service will be located under services.foo
services.foo = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable foo.
'';
};
barOption = {
type = types.str;
default = "qux";
description = ''
The bar option for foo.
'';
};
};
};
##### implementation
config = mkIf foocfg.enable { # only apply the following settings if enabled
# here all options that can be specified in configuration.nix may be used
# configure systemd services
# add system users
# write config files, just as an example here:
environment.etc."foo-bar" = {
text = foocfg.bar; # we can use values of options for this service here
};
};
For example, for Hydra, this file can be found here: https://github.com/NixOS/hydra/blob/dd32033657fc7d6a755c2feae1714148ee43fc7e/hydra-module.nix.
After having written the service definition, we can use it our main configuration like this:
{
network.description = "Web server";
webserver = { config, pkgs, ... }: {
imports = [ ./foo.nix ]; # import our service
services.mysql = {
enable = true;
package = pkgs.mysql51;
};
services.foo = {
enable = true;
bar = "hello nixos modules!";
};
};
}
Disclaimer: there might be some typos in this, I have not tested it.
according to aszlig, we can do this:
configuration.nix
{ config, lib, ... }:
{
disabledModules = [ "services/monitoring/nagios.nix" ];
options.services.nagios.enable = lib.mkOption {
# Make sure that this option type conflicts with the one in
# the original NixOS module for illustration purposes.
type = lib.types.str;
default = "of course";
description = "Really enable nagios?";
};
config = lib.mkIf (config.services.nagios.enable == "of course") {
systemd.services.nagios = {
description = "my own shiny nagios service...";
};
};
}
evaluate it
$ nix-instantiate --eval '<nixpkgs/nixos>' --arg configuration ./test-disable.nix -A config.systemd.services.nagios.description
"my own shiny nagios service..."

versus without disabledModules:
$ nix-instantiate --eval '<nixpkgs/nixos>' --arg configuration ./test-disable.nix -A config.systemd.services.nagios.description
error: The option `services.nagios.enable' in `/home/aszlig/test-disable.nix' is already declared in `/nix/var/nix/profiles/per-user/root/channels/vuizvui/nixpkgs/nixos/modules/services/monitoring/nagios.nix'.
(use '--show-trace' to show detailed location information)

Parsoid doesn't start

I installed parsoid from its official repository, and configured it correctly by adding my Mediawiki API to /etc/mediawiki/parsoid/settings.js. I also removed the Interwiki options from my /usr/lib/parsoid/src/api/localsettings.jsfile, because they seem to be replaced by the parsoidConfig.setMwApi option in the settings.js file.
When running nodejs /usr/lib/parsoid/src/api/server.js from the command promt, I get the following error message:
[fatal][worker][4915] uncaught exception object is not a function
TypeError: object is not a function
at new ParsoidService (/usr/lib/parsoid/src/api/ParsoidService.js:43:12)
at Object.<anonymous> (/usr/lib/parsoid/src/api/server.js:203:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
[warning][master][4882] worker 4911 died (1), restarting.
When I run service parsoid start and service parsoid status I am always getting the information, that there is no parsoid process running.
Can someone explain me why Parsoid does not work?
EDIT:
localsettings.js
/*
* This is a sample configuration file.
*
* Copy this file to localsettings.js and edit that file to fit your needs.
*
* Also see the file ParserService.js for more information.
*/
exports.setup = function( parsoidConfig ) {
// The URL here is supposed to be your MediaWiki installation root
//parsoidConfig.setInterwiki( 'localhost', 'http://domain.com/Wiki/api.php' );
//parsoidConfig.setInterwiki( 'foo', 'http://localhost/wikiarst/api.php' );
//parsoidConfig.setInterwiki( 'noconn', 'http://213.127.84.12:80/wikiarst/api.php' );
//parsoidConfig.setInterwiki( 'disney', 'http://disneychannel.wikia.com/api.php' );
// Use the PHP preprocessor to expand templates via the MW API (default true)
//parsoidConfig.usePHPPreProcessor = true;
// Use selective serialization (default false)
parsoidConfig.useSelser = true;
// parsoid cache url
//parsoidConfig.parsoidCacheURI = 'http://localhost:8000/';
//parsoidConfig.trace = true;
//parsoidConfig.traceFlags = 'selser,wts';
//parsoidConfig.traceFlags = 'selser';
//parsoidConfig.defaultAPIProxyURI = 'http://localhost/';
};
/* vim: set filetype=javascript noexpandtab ts=4 sw=4 cindent : */
settings.js
/*
* This is a sample configuration file.
*
* Copy this file to localsettings.js and edit that file to fit your needs.
*
* Also see:
* - api/server.js for more information about passing config files via
* the commandline.
* - lib/mediawiki.ParsoidConfig.js all the properties
* that you can configure here. Not all properties are
* documented here.
*/
'use strict';
exports.setup = function(parsoidConfig) {
// Set your own user-agent string
// Otherwise, defaults to "Parsoid/<current-version-defined-in-package.json>"
//parsoidConfig.userAgent = "My-User-Agent-String";
// The URL of your MediaWiki API endpoint.
parsoidConfig.setMwApi({ prefix: 'localhost', uri: 'http://domain.com/Wiki/api.php' });
// To specify a proxy (or proxy headers) specific to this prefix (which
// overrides defaultAPIProxyURI) use:
/*
parsoidConfig.setMwApi({
prefix: 'localhost',
uri: 'http://localhost/w/api.php',
// set `proxy` to `null` to override and force no proxying.
proxy: {
uri: 'http://my.proxy:1234/',
headers: { 'X-Forwarded-Proto': 'https' } // headers are optional
}
});
*/
// We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly
// for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks',
// 'enwikivoyage' etc. (default true)
//parsoidConfig.loadWMF = false;
// A default proxy to connect to the API endpoints.
// Default: undefined (no proxying).
// Overridden by per-wiki proxy config in setMwApi.
//parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080';
// Enable debug mode (prints extra debugging messages)
//parsoidConfig.debug = true;
// Use the PHP preprocessor to expand templates via the MW API (default true)
//parsoidConfig.usePHPPreProcessor = false;
// Use selective serialization (default false)
parsoidConfig.useSelser = true;
// Allow cross-domain requests to the API (default '*')
// Sets Access-Control-Allow-Origin header
// disable:
//parsoidConfig.allowCORS = false;
// restrict:
//parsoidConfig.allowCORS = 'some.domain.org';
// Set to true for using the default performance metrics reporting to statsd
// If true, provide the statsd host/port values
/*
parsoidConfig.useDefaultPerformanceTimer = true;
parsoidConfig.txstatsdHost = 'statsd.domain.org';
parsoidConfig.txstatsdPort = 8125;
*/
// Alternatively, define performanceTimer as follows:
/*
parsoidConfig.performanceTimer = {
timing: function(metricName, time) { }, // do-something-with-it
count: function(metricName, value) { }, // do-something-with-it
};
*/
// How often should we emit a heap sample? Time in ms.
// This setting is only relevant if you have enabled
// performance monitoring either via the default metrics
// OR by defining your own performanceTimer properties
//parsoidConfig.heapUsageSampleInterval = 5 * 60 * 1000;
// Allow override of port/interface:
//parsoidConfig.serverPort = 8000;
//parsoidConfig.serverInterface = '127.0.0.1';
// The URL of your LintBridge API endpoint
//parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add';
// Require SSL certificates to be valid (default true)
// Set to false when using self-signed SSL certificates
//parsoidConfig.strictSSL = false;
// Use a different server for CSS style modules.
// Set to true to use bits.wikimedia.org, or to a string with the URI.
// Leaving it undefined (the default) will use the same URI as the MW API,
// changing api.php for load.php.
//parsoidConfig.modulesLoadURI = true;
// Suppress some warnings from the Mediawiki API
// (defaults to suppressing warnings which the Parsoid team knows to
// be harmless)
//parsoidConfig.suppressMwApiWarnings = /annoying warning|other warning/;
};
It seems that your /etc/mediawiki/parsoid/settings.js and or /usr/lib/parsoid/src/api/localsettings.js is broken, and Parsoid is crashing as soon as it tries to look at your parsoidConfig. I recommend going through the instructions at https://www.mediawiki.org/wiki/Parsoid/Setup#Configuration carefully, and if you still have problems then please post excerpts of your settings files.

Opensips 1.11 + RTPproxy 1.2.1 integration in ubuntu 14.04

I have configure opensips server with rtpproxy in a 32 bit ubuntu server .
My config file is given below
#
# $Id$
#
# OpenSIPS residential configuration script
# by OpenSIPS Solutions <team#opensips-solutions.com>
#
# This script was generated via "make menuconfig", from
# the "Residential" scenario.
# You can enable / disable more features / functionalities by
# re-generating the scenario with different options.#
#
# Please refer to the Core CookBook at:
# http://www.opensips.org/Resources/DocsCookbooks
# for a explanation of possible statements, functions and parameters.
#
####### Global Parameters #########
debug=3
log_stderror=yes
log_facility=LOG_LOCAL0
fork=yes
children=4
mhomed=yes
/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
#log_stderror=yes
/* uncomment the next line to enable the auto temporary blacklisting of
not available destinations (default disabled) */
#disable_dns_blacklist=no
/* uncomment the next line to enable IPv6 lookup after IPv4 dns
lookup failures (default disabled) */
#dns_try_ipv6=yes
/* comment the next line to enable the auto discovery of local aliases
based on revers DNS on IPs */
auto_aliases=no
listen=udp:public ip:5060 # CUSTOMIZE ME
disable_tcp=yes
disable_tls=yes
####### Modules Section ########
#set module path
mpath="/usr/local/lib/opensips/modules/"
#### SIGNALING module
loadmodule "signaling.so"
#### StateLess module
loadmodule "sl.so"
#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 5)
modparam("tm", "fr_inv_timeout", 30)
modparam("tm", "restart_fr_on_each_reply", 0)
modparam("tm", "onreply_avp_mode", 1)
#### Record Route Module
loadmodule "rr.so"
/* do not append from tag to the RR (no need for this script) */
modparam("rr", "append_fromtag", 0)
#### MAX ForWarD module
loadmodule "maxfwd.so"
#### SIP MSG OPerationS module
loadmodule "sipmsgops.so"
#### FIFO Management Interface
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("mi_fifo", "fifo_mode", 0666)
#### URI module
loadmodule "uri.so"
modparam("uri", "use_uri_table", 0)
#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "db_mode", 0)
#### REGISTRAR module
loadmodule "registrar.so"
modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")
modparam("registrar", "received_avp", "$avp(received_nh)")
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
#### ACCounting module
loadmodule "acc.so"
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_cancels", 0)
/* by default we do not adjust the direct of the sequential requests.
if you enable this parameter, be sure the enable "append_fromtag"
in "rr" module */
modparam("acc", "detect_direction", 0)
modparam("acc", "failed_transaction_flag", "ACC_FAILED")
/* account triggers (flags) */
modparam("acc", "log_flag", "ACC_DO")
modparam("acc", "log_missed_flag", "ACC_MISSED")
#### NAT modules
loadmodule "nathelper.so"
modparam("nathelper", "natping_interval", 10)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "received_avp", "$avp(received_nh)")
loadmodule "rtpproxy.so"
modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:7890") # CUSTOMIZE ME
modparam("nathelper", "force_socket", "udp:localhost:7890")
####### Routing Logic ########
# main request routing logic
route{
force_rport();
if (nat_uac_test("23")) {
if (is_method("REGISTER")) {
fix_nated_register();
setbflag(NAT);
} else {
fix_nated_contact();
setflag(NAT);
}
}
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(ACC_DO); # do accounting ...
setflag(ACC_FAILED); # ... even if the transaction fails
} else if (is_method("INVITE")) {
# even if in most of the cases is useless, do RR for
# re-INVITEs alos, as some buggy clients do change route set
# during the dialog.
record_route();
}
if (check_route_param("nat=yes"))
setflag(NAT);
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(relay);
} else {
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK; must be an ACK after
# a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction ->
# ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
if ( !(is_method("REGISTER") ) ) {
if (from_uri==myself)
{
} else {
# if caller is not local, then called number must be local
if (!uri==myself) {
send_reply("403","Rely forbidden");
exit;
}
}
}
# preloaded route checking
if (loose_route()) {
xlog("L_ERR",
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK"))
sl_send_reply("403","Preload Route denied");
exit;
}
# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();
# account only INVITEs
if (is_method("INVITE")) {
setflag(ACC_DO); # do accounting
}
if (!uri==myself) {
append_hf("P-hint: outbound\r\n");
route(relay);
}
# requests for my domain
if (is_method("PUBLISH|SUBSCRIBE"))
{
sl_send_reply("503", "Service Unavailable");
exit;
}
if (is_method("REGISTER"))
{
if ( 0 ) setflag(TCP_PERSISTENT);
if (!save("location"))
sl_reply_error();
exit;
}
if ($rU==NULL) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# do lookup with method filtering
if (!lookup("location","m")) {
t_newtran();
t_reply("404", "Not Found");
exit;
}
if (isbflagset(NAT)) setflag(NAT);
# when routing via usrloc, log the missed calls also
setflag(ACC_MISSED);
route(relay);
}
route[relay] {
# for INVITEs enable some additional helper routes
if (is_method("INVITE")) {
if (isflagset(NAT)) {
rtpproxy_offer("ro");
}
t_on_branch("per_branch_ops");
t_on_reply("handle_nat");
t_on_failure("missed_call");
}
if (isflagset(NAT)) {
add_rr_param(";nat=yes");
}
if (!t_relay()) {
send_reply("500","Internal Error");
};
exit;
}
branch_route[per_branch_ops] {
xlog("new branch at $ru\n");
}
onreply_route[handle_nat] {
if (nat_uac_test("1"))
fix_nated_contact();
if ( isflagset(NAT) )
rtpproxy_answer("ro");
xlog("incoming reply\n");
}
failure_route[missed_call] {
if (t_was_cancelled()) {
exit;
}
# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply("404","Not found");
## exit;
##}
}
Using this config file i am able to connect my soft phones, i can make calls as well. But when the call is initiated it is printing the below logs. what am i doing wrong?
new branch at sip:user5#192.168.0.245:43249;transport=udp
Sep 3 12:10:41 [1475] ERROR:rtpproxy:force_rtp_proxy: Unable to parse body
incoming reply
incoming reply
ACC: transaction answered: timestamp=1409726454;method=INVITE;from_tag=467f1820;to_tag=3361724647;call_id=MDE2ZDExYTIyYmEzMGVkZGNhZGIwMzM2NDhjYTcwODk.;code=200;reason=OK
incoming reply
ACC: transaction answered: timestamp=1409726476;method=BYE;from_tag=3361724647;to_tag=467f1820;call_id=MDE2ZDExYTIyYmEzMGVkZGNhZGIwMzM2NDhjYTcwODk.;code=200;reason=OK
Thanks in advance.
It looks like you've called engage_rtp_proxy() or rtpproxy_offer() on requests without a SDP body.
To prevent this, you should use the following conditional on your rtpproxy code:
if (has_body("application/sdp")) {
... rtpproxy stuff ...
}

Varnish won't recognize req.grace variable

I have a fresh install of Slackware 64 14bit, and looking through Varnish installation documentation I have all the dependencies installed and compiled varnish with no error (make check passes all tests)
Yet, when I try to run varnish using
varnishd -f /etc/varnish/user.vcl -s malloc,4G -T 127.0.0.1:2000
I get
Message from VCC-compiler:
Unknown variable 'req.grace'
At: ('input' Line 17 Pos 9)
set req.grace = 15s;
--------#########-------
Running VCC-compiler failed, exit 1
VCL compilation failed
My very simple /etc/varnish/ucer.vcl file looks like this:
vcl 4.0;
# set default backend if no server cluster specified
backend default {
.host = "127.0.0.1";
.port = "8080";
.probe = {
.url = "/";
.timeout = 34ms;
.interval = 1s;
.window = 10;
.threshold = 8;
}
}
sub vcl_recv {
set req.grace = 15s;
}
sub vcl_fetch {
set beresp.grace = 30m;
}
The variable names are identical to this example.
varnishd -V returns
varnishd (varnish-4.0.0 revision 2acedeb)
By removing both sub vcl_recv and sub vcl_fetch (using only backend default) varnish works fine and I can see it's headers, but I need to edit the VCL file.
Any ideas?
You are using Varnish 4.0.0, which needs updating from the 3.0 format your VCL code is based on.
req.grace is gone (you usually don't need it) and vcl_fetch is now called vcl_backend_response.
See the upgrade documentation: https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html
For reference, it is possible to handle properly the grace feature, following what is said in this blog post:
(copy/paste of the code, for more details refer to the blog)
sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return (deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";
return (deliver);
} else {
# No candidate for grace. Fetch a fresh object.
return(fetch);
}
} else {
# backend is sick - use full grace
if (obj.ttl + obj.grace > 0s) {
set req.http.grace = "full";
return (deliver);
} else {
# no graced object.
return (fetch);
}
}
}
HTH

Resources