शिशिर [Shishir] पोखरेल http://www.shishir.com.np/home Because a thing seems difficult for you, do not think it impossible for anyone to accomplish. - Marcus Aurelius Sat, 16 May 2015 20:24:28 +0000 en-US hourly 1 https://wordpress.org/?v=4.7.5 Building module in asterisk part 3 http://www.shishir.com.np/home/2014/07/22/building-module-in-asterisk-part-3/ Tue, 22 Jul 2014 20:50:50 +0000 http://www.shishir.com.np/home/?p=399 /* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 1999 - 2012, Digium, Inc. * * Mark Spencer <markster@digium.com> * * See http://www.asterisk.org for more information about * the Asterisk project. Please do not directly contact … Read more]]> /* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 1999 - 2012, Digium, Inc. * * Mark Spencer <markster@digium.com> * * See http://www.asterisk.org for more information about * the Asterisk project. Please do not directly contact * any of the maintainers of this project for assistance; * the project provides a web site, mailing lists and IRC * channels for your use. * * This program is free software, distributed under the terms of * the GNU General Public License Version 2. See the LICENSE file * at the top of the source tree. */ /* * * * Sample module example for tutorial purpose * shishir.pokharel@gmail.com * * * * * */ #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision: 328259 $") //#include "asterisk/channel.h" #include "asterisk/module.h" #include "asterisk/cli.h" static char *handle_cli_cprint(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch(cmd){ case CLI_INIT: e->command = "cprint"; e->usage = "Usage : cprint <stuff>\n" " Print back the argument.\n" "Examples:\n" " cprint foo\n" " cprint \"foo bar\"\n" ""; return NULL; case CLI_GENERATE: return NULL; } if(a->argc == e->args) { ast_cli(a->fd,"You didn't provide an argument to sprintn command!\n"); return CLI_SHOWUSAGE; } ast_cli(a->fd,"%s\n",a->argv[1]); return CLI_SUCCESS; } static struct ast_cli_entry cli_testcprint[] = { AST_CLI_DEFINE(handle_cli_cprint, "print to the CLI"), }; static int unload_module(void) { ast_cli_unregister_multiple(cli_testcprint, ARRAY_LEN(cli_testcprint)); ast_log(LOG_NOTICE, "Hello foobar ! I am unloaded ! - Thanks Shishir\n"); return 0; } static int load_module(void) { ast_cli_register_multiple(cli_testcprint, ARRAY_LEN(cli_testcprint)); ast_log(LOG_NOTICE, "Hello foobar ! I am loaded ! - Thanks Shishir\n"); return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Test - module to check load and unload"); ]]> Building module in asterisk Part 2 http://www.shishir.com.np/home/2014/07/22/building-module-in-asterisk-p-2/ Tue, 22 Jul 2014 20:28:08 +0000 http://www.shishir.com.np/home/?p=391 For me previous tutorial “Building module in asterisk P.1” add a new funciton cdr_foobar and register it while loading a module and unregister it while unloading the module.

/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright 
Read more]]>
For me previous tutorial “Building module in asterisk P.1” add a new funciton cdr_foobar and register it while loading a module and unregister it while unloading the module.

/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 1999 - 2012, Digium, Inc.
 *
 * Mark Spencer <markster@digium.com>
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

/*
*
*
* Sample module example for tutorial purpose  
* shishir.pokharel@gmail.com
*
*
*
*
*
*/


#include "asterisk.h"


ASTERISK_FILE_VERSION(__FILE__, "$Revision: 328259 $")

//#include "asterisk/channel.h"
#include "asterisk/module.h"
#include "asterisk/cdr.h"

static int cdr_foobar(struct ast_cdr *cdr)
{
    ast_log(LOG_NOTICE, "Foobar got a CDR for channel '%s'.  "
        "Source: '%s', Dest: '%s', Duration: %ldn",
        cdr->channel, cdr->src, cdr->dst, cdr->duration);

    return 0;
}

static int unload_module(void)
{
	ast_cdr_unregister("foobar");
	ast_log(LOG_NOTICE, "Hello foobar ! I am unloaded ! - Thanks Shishir");
	return 0;
}

static int load_module(void)
{
	ast_cdr_register("foobar", "foobar CDR Handler", cdr_foobar);
	ast_log(LOG_NOTICE, "Hello foobar ! I am loaded ! - Thanks Shishir");
	return AST_MODULE_LOAD_SUCCESS;
}


AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Test - module to check load and unload");
]]>
Building modules in asterisk part 1 http://www.shishir.com.np/home/2014/07/21/modules-in-asterisk/ Tue, 22 Jul 2014 00:47:37 +0000 http://www.shishir.com.np/home/?p=380 This is a basics of "How to build a module in asterisk " the following example was tested on asterisk 11.5 Create a res_foobar.c file on the asterisk source folder/res directory; 1) Include asterisk header file #include "asterisk.h" 2) Define … Read more]]> This is a basics of "How to build a module in asterisk " the following example was tested on asterisk 11.5 Create a res_foobar.c file on the asterisk source folder/res directory; 1) Include asterisk header file #include "asterisk.h" 2) Define asterisk file version ASTERISK_FILE_VERSION(__FILE__, "$Revision: XXXXXX $") /* where XXXXXX is a revision number*/ 3) Include asterisk module header file #include "asterisk/module.h" 4) Since, on this tutorial we are going to load and unload the module we are going to code. Create two function to load and unload the modules. /* To load module */ static int load_module(void) { ast_log(LOG_NOTICE, "Hello Foobar! I am loaded !"); return AST_MODULE_LOAD_SUCCESS; } /* To unload module */ static int unload_module(void) { ast_log(LOG_NOTICE, "Hello Foobar! I am unloaded !"); return 0; } 5) Define Asterisk module info AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Test - module to check load and unload"); 6) Save file and run make && make install from asterisk source directory. Once it complies and the module is copied to asterisk lib directory you should be able to load and unload modules as; module load res_foobar.so NOTICE[18009]: res_foobar.c:13 load_module: Hello Foobar! I am loaded ! module unload res_foobar.so NOTICE[18009]: res_foobar.c:19 load_module: Hello Foobar! I am unloaded !
The complete code :

#include "asterisk.h"

ASTERISK_FILE_VERSION(__FILE__, "$Revision: 328259 $")

//#include "asterisk/channel.h"
#include "asterisk/module.h"


static int unload_module(void)
{
	ast_log(LOG_NOTICE, "Hello Foobar ! I am unloaded !\n");
	return 0;
}

static int load_module(void)
{
	ast_log(LOG_NOTICE, "Hello Foobar ! I am loaded !\n");
	return AST_MODULE_LOAD_SUCCESS;
}


AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Test - module to check load and unload");
]]>
Distinctive Ring http://www.shishir.com.np/home/2013/04/07/distinctive-ring/ Mon, 08 Apr 2013 05:01:22 +0000 http://www.shishir.com.np/home/?p=346 What is Distinctive Ring

Distinctive Ring is marketed under a variety of names and can be used for different functions. It can be used for identifying which number a person has called if you have multiple phone numbers, or it … Read more

]]>
What is Distinctive Ring

Distinctive Ring is marketed under a variety of names and can be used for different functions. It can be used for identifying which number a person has called if you have multiple phone numbers, or it can be used to identify between internally generated or externally generated calls.

How to Use Distinctive Ring

Depending on the type of IP phone you have depends on what the requirements are. The core function is the same and that is to modify the SipAddHeader.
Linksys

To modify the distinctive ring on a Linksys phone is a matter of changing the SipAddHeader to your required ring type. As an example if you wanted to make a phone ring with a ring type of Classic-4 we would use the following command.
exten => s,1,SipAddHeader(Alert-Info: n=Classic-4;w=3;c=4)
exten => s,n,Dial(SIP/${EXTEN},70,TW)
exten => s,n,HangUp

Inbuilt Ring Tones

Examples of the inbuilt ring tones are:

n=Classic-1;w=3;c=1
n=Classic-2;w=3;c=2
n=Classic-3;w=3;c=3
n=Classic-4;w=3;c=4
n=Simple-1;w=2;c=1
n=Simple-2;w=2;c=2
n=Simple-3;w=2;c=3
n=Simple-4;w=2;c=4
n=Simple-5;w=2;c=5
n=Office;w=4;c=1

Manually Creating Your Own Ring Tone

The syntax is:
Syntax: n=ring-tone-name;w=waveform-id-or-path;c=cadence-id;b=break-time;t=total-time
The description of each filed is as follows:
•ring-tone-name is a name to identify this ring tone specification. This name will appear on the Ring Tone menu of the
phone. The same name can be used in a SIP Alert-Info header in an inbound INVITE request to tell the phone to play the
corresponding ring tone specification. Because of this, the name should contain characters allowed in a URL only.
•Waveform-id is the index of the desired waveform to use in this ring tone specification. There are 4 built-in waveforms:
1 = A classic phone with mechanical bell
2 = Typical phone ring
3 = A classic ring tone
4 = A wide-band frequency sweep signal
This field can also be a network path (url) to download a ring tone data file from a server on-the-fly. In this case, the
syntax of the field is
w=[tftp://]hostname[:port]/path.
•cadence-id is the index of the desired cadence to play the given waveform. 8 cadences (1–8) as defined in <Cadence 1>
through <Cadence 8>. Cadence-id can be 0 If w=3,4, or an url. Setting c=0 implies the on-time is the natural length of the
ring tone file.
•break-time specifies the number of seconds to break between two bursts of ring tone, such as b=2.5
•total-time specifies the total number of seconds to play the ring tone before it times out

Polycom

The first step in using distinctive ring for a polycom is to configure the phone to accept a named SipAddHeader. If your provisioning file which is usually called sip.cfg you need to add a oIpProt.SIP.alertInfo.x.value and a voIpProt.SIP.alertInfo.x.class
In the alertInfo section add something like:
<voIpProt.SIP.alertInfo
voIpProt.SIP.alertInfo.1.class=”9″
voIpProt.SIP.alertInfo.1.value=”Internal”
voIpProt.SIP.alertInfo.2.class=”13″
voIpProt.SIP.alertInfo.2.value=”Office”
</voIpProt.SIP.alertInfo>
What we have done above is created an alertinfo called Internal with a ring type of 11. We now have to use this Internal ring type in a dial plan. So to do this we could do something like:
exten => s,1,SipAddHeader(Alert-Info: Internal)
exten => s,n,Macro(stdexten,${EXTEN},${EXTEN})
exten => s,n,HangUp
This will cause the phone to ring with the ring type 11 as defined in voIpProt.SIP.alertInfo.2.class and called using SipAddHeader. If the SipAddHeader is not used then the phone will ring with its default ring tone.
NOTE: The class and values are back to front as to what is in the Polycom SIP 4.0.1 guide.

 

src:http://www.klaverstyn.com.au

]]>
Sorry, but Nagios is currently not checking for external commands http://www.shishir.com.np/home/2012/12/12/sorry-but-nagios-is-currently-not-checking-for-external-commands/ Thu, 13 Dec 2012 01:51:00 +0000 http://www.shishir.com.np/home/?p=324

Sorry, but Nagios is currently not checking for external commands

You probably saw following message “Sorry, but Nagios is currently not checking for external commands, so your command will not be committed” when you tried to reschedule a service check

Read more]]>

Sorry, but Nagios is currently not checking for external commands

You probably saw following message “Sorry, but Nagios is currently not checking for external commands, so your command will not be committed” when you tried to reschedule a service check in nagios web interface. The reason behind this is that nagios by default does not check for external commands. To resolve that problem we need to reconfigure nagios.

To enable checking for external commands we have to edit main nagios configuration file nagios.cfg, which is usually located in /etc/nagios3. You have to change below line

 

check_external_commands=0

 

to

 

check_external_commands=1

 

and reload nagios using

 

/etc/init.d/nagios3 reload

 

When you try again to reschedule service check from web interface the following error can come up: Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!. This is because of the bug in Debian, which is described herehttp://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571801. The solution is quite simple:

 

# /etc/init.d/nagios3 stop 
Stopping nagios3 monitoring daemon: nagios3Waiting for nagios3 daemon to die... 
. 
# dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw 
# dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3 
# /etc/init.d/nagios3 start 
Starting nagios3 monitoring daemon: nagios3.
]]>
Installing heart beat on opensips /openser server http://www.shishir.com.np/home/2012/06/29/installing-heart-beat-on-opensips-openser-server/ Fri, 29 Jun 2012 23:30:35 +0000 http://www.shishir.com.np/home/?p=306 SERVER 1 Install heart beat from aptitude issing following command apt-get install heartbeat cd to installation folder e.g /etc/heartbeat create or edit a file with following parameters # Heartbeat logging configuration logfacility daemon # enabeld logging deamon use_logd on # … Read more]]> SERVER 1 Install heart beat from aptitude issing following command apt-get install heartbeat cd to installation folder e.g /etc/heartbeat create or edit a file with following parameters # Heartbeat logging configuration logfacility daemon # enabeld logging deamon use_logd on # If this is set to none set nodes below using node hostname autojoin none # Heartbeat cluster members node opensipserver1(opensipserver1 hostname alias) node opensipserver2(opensipserver2 hostname alias ) # Heartbeat communication timing keepalive 1 warntime 2 deadtime 3 initdead 10 # Heartbeat communication paths udpport 694 ucast eth1 192.168.1.90 (local private ip address of server 1) ucast eth1 192.168.1.90 (local private ip address of server 1) ucast eth0 202.70.xxx.xxx (public ip address of server 2) ucast eth0 202.70.xxx.xxx (public ip address of server 2) # Don't fail back automatically auto_failback on # Monitoring of network connection to default gateway.. or the other machine incase ther eis only two ping 202.70.xxx.xxx (public ip address of server 2) respawn hacluster /usr/lib/heartbeat/ipfail create or edit file haresources and add the following lines opensernode1 IPaddr::202.xxx.xxx.83/24/eth0 opensernode1 IPaddr::202.xxx.xxx.84/24/eth0 opensernode1 IPaddr::202.xxx.xxx.85/24/eth0 opensernode1 IPaddr::202.xxx.xxx.86/24/eth0 opensernode1 IPaddr::202.xxx.xxx.87/24/eth0 opensernode1 IPaddr::202.xxx.xxx.88/24/eth0 opensips where opensernode1 is the hostname alias of Server 1 and 202.xxx.xxx.83...88 are the heart beat ipaddresses. Also opensips on the bottom line is the service to start. NOTE : We have Opensernode1 in haresources file because its our primary heart beat server. Execute the following script which will create authkeys file with key hash on the same folder cat <<-!AUTH >/etc/ha.d/authkeys # Automatically generated authkeys file auth 1 1 sha1 `dd if=/dev/urandom count=4 2>/dev/null | md5sum | cut -c1-32` !AUTH Output :- # Automatically generated authkeys file auth 1 1 sha1 15dsdsse5192ad322246a61c475sddsefbs SERVER 2 Install heart beat from aptitude issing following command apt-get install heartbeat cd to installation folder e.g /etc/heartbeat create or edit a file with following parameters # Heartbeat logging configuration logfacility daemon # enabeld logging deamon use_logd on # If this is set to none set nodes below using node hostname autojoin none # Heartbeat cluster members node opensipserver1(opensipserver1 hostname alias) node opensipserver2(opensipserver2 hostname alias ) # Heartbeat communication timing keepalive 1 warntime 2 deadtime 3 initdead 10 # Heartbeat communication paths udpport 694 ucast eth1 192.168.1.89 (local private ip address of server 2) ucast eth1 192.168.1.89 (local private ip address of server 2) ucast eth0 202.70.xxx.xxx (public ip address of server 1) ucast eth0 202.70.xxx.xxx (public ip address of server 1) # Don't fail back automatically auto_failback on # Monitoring of network connection to default gateway.. or the other machine incase ther eis only two ping 202.70.xxx.xxx (public ip address of server 1) respawn hacluster /usr/lib/heartbeat/ipfail create or edit file haresources and add the following lines opensernode1 IPaddr::202.xxx.xxx.83/24/eth0 opensernode1 IPaddr::202.xxx.xxx.84/24/eth0 opensernode1 IPaddr::202.xxx.xxx.85/24/eth0 opensernode1 IPaddr::202.xxx.xxx.86/24/eth0 opensernode1 IPaddr::202.xxx.xxx.87/24/eth0 opensernode1 IPaddr::202.xxx.xxx.88/24/eth0 opensips where opensernode1 is the hostname alias of Server 1 and 202.70.xxx.83...88 are the heart beat ipaddresses. Also opensips on the bottom line is the service to start. Copy the same authkeys from Server 1 and paste it here on authkeys file Start heart beat in both servers and you should be good to go. ]]> Creating mysql master master replication http://www.shishir.com.np/home/2012/06/29/creating-mysql-master-master-replication/ Fri, 29 Jun 2012 23:16:11 +0000 http://www.shishir.com.np/home/?p=304 In order to create Master Master sql replication, Install the mysql server on both of the server and follow the following instructions;

Server 1

 

  • Edit /etc/mysql/my.cnf
  • Move to the section where it contains [mysqld] and add the following lines
Read more]]>
In order to create Master Master sql replication, Install the mysql server on both of the server and follow the following instructions;

Server 1

 

  • Edit /etc/mysql/my.cnf
  • Move to the section where it contains [mysqld] and add the following lines
    • server-id=1
      replicate-same-server-id = 0
      auto-increment-increment = 2
      auto-increment-offset = 1master-host=192.168.0.189 (ip address of server 2)
      master-user=rep_user
      master-password=rep_passwd
      master-port=3306
      log-bin

 

  • Grant access to rep_user on database, by issuing following command
    •  grant replication slave on *.* to ‘rep_user’@’%’ identified by ‘rep_passwd’;
  •             Some useful commands  show master status;
                                                   start slave;
                                                   show master status\G;
                                                   show slave status\G;
                                                   show master logs; 

SERVER 2

 

  • Edit /etc/mysql/my.cnf
  • Move to the section where it contains [mysqld] and add the following lines
    • server-id=2
      replicate-same-server-id = 0
      auto-increment-increment = 2
      auto-increment-offset = 1master-host=192.168.0.190 (ip address of server 1)
      master-user=rep_user
      master-password=rep_passwd
      master-port=3306
      log-bin

 

  • Grant access to rep_user on database, by issuing following command
    •  grant replication slave on *.* to ‘rep_user’@’%’ identified by ‘rep_passwd’;

 

 

Restart sql server in both server and under mysql cli run command “start slave” if slave is not started by default.
It should now be running in master master replication.

]]>
Installing opensips server and opensips admin portal from source http://www.shishir.com.np/home/2012/06/29/installing-opensips-server-and-opensips-admin-portal-from-source/ Fri, 29 Jun 2012 23:13:35 +0000 http://www.shishir.com.np/home/?p=302 1. Get stable release of version 1.8 from svn directly with following command

 

  • svn co https://opensips.svn.sourceforge.net/svnroot/opensips/branches/1.8

2. Install prerequisites for menu config on opensips

  • apt-get install flex bison libncurses-dev =>  for parsing config file and for menu config

3.Run

Read more]]>
1. Get stable release of version 1.8 from svn directly with following command

 

  • svn co https://opensips.svn.sourceforge.net/svnroot/opensips/branches/1.8

2. Install prerequisites for menu config on opensips

  • apt-get install flex bison libncurses-dev =>  for parsing config file and for menu config

3.Run menu config command

  • make menuconfig 
        
   
  • If Mysql database is selected to install make sure libmysqlclient-dev is installed
        
  • select Comple and Install Opensips
        

4. Creating a opensips database

  • On opensips intallation folder e.g :/usr/local/opensips
  • cd etc/opensips
    • vim opensipsctlrc
      • DBENGINE=MYSQL
      • DBHOST=localhost
      • DBNAME=opensips
      • DBRWUSER=opensips
      • DBRWPW=”opensipsrw”
      • DBROOTUSER=”root”
  • cd /usr/local/opensips/sbin
    • ./opensipsdbctl create
      • Enter root password and select y/n depending upon requirement of tables e.g I used Install presence related tables? to yes and Install tables for imc cpl siptrace domainpolicy carrierroute user blacklist? to yes.

5. Generating configuration life

  • Make sure m4 application is installed
  • cd /usr/local/opensips/sbin
    • ./osipsconfig
  • choose the service and select Generate Load_Balancer Script
          
  • File in /usr/local/opensips//etc/opensips/ will be created automatically with unix time stamp on it e.g opensips_loadbalancer_2012-6-20_11:55:44.cfg  
  • Open /usr/local/opensips//etc/opensips/opensips_loadbalancer_2012-6-20_11:55:44.cfg and atleast configure following parameters
    • listen=udp:192.168.0.1:5060   # FOR UDP
    • disable_tcp=no    # FOR TCP
    • listen=tcp:192.168.0.1:5060   # FOR TCP
    • mpath=”/usr/local/opensips/lib64/opensips/modules/”
    • modparam(“acc”, “db_url”,”mysql://opensips:opensipsrw@localhost/opensips”)
    • modparam(“dispatcher”, “db_url”,”mysql://opensips:opensipsrw@localhost/opensips”) 

6 Configuring INIT script

  •  Goto src folder and cd to packaging/debian  e.g    /usr/src/1.8/packaging/debian (if you are in debain system)
  • cp opensips.init /etc/init.d/opensips   (copy opensips.init to /etc/init.d/opensips)
  • chmod +x /etc/init.d/opensips (Give execution permission to the script)
  • Open /etc/init.d/opensips and change the following variables
    • DAEMON=/usr/local/opensips/sbin/opensips
    • if [ “$1” != “debug” ]; then
      check_fork
      fi (Delete this block if you want to use it in production level, its a debug information)
    • Locate OPTIONS=”-P $PIDFILE -m $S_MEMORY -M $P_MEMORY -u $USER -g $GROUP ” and append following parameter -f /usr/local/opensips/etc/opensips/opensips_loadbalancer_2012-6-20_11:55:44.cfg . e.g
      OPTIONS=”-P $PIDFILE -m $S_MEMORY -M $P_MEMORY -u $USER -g $GROUP -f /usr/local/opensips/etc/opensips/opensips_loadbalancer_2012-6-20_11:55:44.cfg”
    • Configure DEFAULTS=/etc/default/opensips
      • cp /usr/src/1.8/packaging/debian/opensips.default /etc/default/opensips
      • change the following files
        • RUN_OPENSIPS=yes
          USER=root
          GROUP=root
          S_MEMORY=128

7 Logging Opensips

  • open confiuration file e.g  /usr/local/opensips/etc/opensips/opensips_loadbalancer_2012-6-20_11\:55\:44.cfg
  • added log_facility=LOG_LOCAL0
  • vim /etc/rsyslog.conf and add following line
    local0.*                        -/var/log/opensips.log
  • /etc/init.d/rsyslog restart

8 Installing web Interface for opensips (Opensips Control Panel)

  • cd /var/www/
  • svn co https://opensips-cp.svn.sourceforge.net/svnroot/opensips-cp/trunk/ opensips-cp
  • Install dependencies
    • apt-get install libapache2-mod-php5 php5 php5-cli php5-gd php5-mysql php-pear
  • pear install mdb2
  • pear install mdb2#mysql
  • cd /var/www/opensips-cp/config
  • vim db.inc.php
    •  $config->db_user = “opensips”;
      $config->db_pass = “opensipsrw”
  • vim boxes.global.inc.php
  • disable $boxes[$box_id][‘mi’][‘conn’]=”127.0.0.1:8000″;
  • enable $boxes[$box_id][‘mi’][‘conn’]=”/tmp/opensips_fifo”;
  • Create a admin username
    • execute followin in sql cmd line
      CREATE TABLE `ocp_admin_privileges` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `first_name` varchar(64) NOT NULL default ”,
      `last_name` varchar(64) NOT NULL default ”,
      `username` varchar(64) NOT NULL default ”,
      `password` varchar(64) NOT NULL default ”,
      `ha1` varchar(256) default ”,
      `available_tools` varchar(512) NOT NULL default ”,
      `permissions` varchar(512) default NULL,
      PRIMARY KEY  (`id`)
      ) ENGINE=MyISAM AUTO_INCREMENT=55 DEFAULT CHARSET=latin1;
    • also
      INSERT INTO ocp_admin_privileges (username,password,ha1,available_tools,permissions) values (‘admin’,’admin’,md5(‘admin:admin’),’all’,’all’);
    • Now we have username admin with password admin to access opensips control panel

TroubleShooting :

If errors occured like for module dispatcher 
Array ( [0] => Cannot connect to OpenSIPS Server via Management Interface (/tmp/opensips_proxy_fifo))
  • Goto /var/www/opensips-cp/config/tools/system/dispatcher
  • vim local.inc.php
  • change  $box[1][‘mi’][‘conn’]=”/tmp/opensips_proxy_fifo”; to  $box[1][‘mi’][‘conn’]=”/tmp/opensips_fifo”;
                
]]>
Installing asterisk 10.6.0 on DEBIAN SQUEEZE http://www.shishir.com.np/home/2012/06/12/installing-asterisk-10-6-0/ Tue, 12 Jun 2012 23:59:47 +0000 http://www.shishir.com.np/home/?p=298 Install dependencies:

# apt-get install linux-headers-$(uname -r) build-essential libxml2-dev libncurses5-dev libsqlite3-dev libssl-dev libsrtp0-dev unixodbc-dev

Since version 1.8 Asterisk is using unixODBC for storing CDR and CEL data into database. Old MySQL backend, cdr_mysql, is still supported. Also I’m installing libsrtp0-dev … Read more

]]>
Install dependencies:

# apt-get install linux-headers-$(uname -r) build-essential libxml2-dev libncurses5-dev libsqlite3-dev libssl-dev libsrtp0-dev unixodbc-dev

Since version 1.8 Asterisk is using unixODBC for storing CDR and CEL data into database. Old MySQL backend, cdr_mysql, is still supported. Also I’m installing libsrtp0-dev to successfully compile core channel chan_sip. This is also required since 1.8 version because of secure RTP support.

Go to /usr/src/ and install LibPRI:

# wget http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.12.tar.gz # tar -xzf libpri-1.4.12.tar.gz # cd libpri* # make && make install

Install DAHDI Linux and DAHDI Tools:

# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.6.1+2.6.1.tar.gz  # tar -xzf dahdi-linux-complete-2.6.1+2.6.1.tar.gz # cd dahdi* # make && make install && make config

Get latest Asterisk 10:

# wgethttp://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-10.6.0-rc1.tar.gz # tar -xzf asterisk-10.6.0-rc1.tar.gz # cd asterisk* # ./configure && make menuselect

Choose needed modules and compile Asterisk:

# make && make install && make config && make install-logrotate
]]>
Adding user and assigning password for user in LDAP http://www.shishir.com.np/home/2012/06/11/adding-user-in-ldap/ Mon, 11 Jun 2012 21:58:16 +0000 http://www.shishir.com.np/home/?p=283 Sample  file

cat user.ildf

dn: cn=server1user1,ou=group,dc=ldap,dc=devserver,dc=local
cn: server1user1
objectClass: top
objectClass: posixGroup
gidNumber: 10000

# User account
dn: uid=server1user1,ou=people,dc=ldap,dc=devserver,dc=local
cn: Server1 user1
givenName: Suesr1
sn: user1
uid: server1user1
uidNumber: 120000
gidNumber: 120000
homeDirectory: /home/server1user1
mail: server1user1@dev.local
objectClass: top
objectClass: posixAccount… Read more

]]>
Sample  file

cat user.ildf

dn: cn=server1user1,ou=group,dc=ldap,dc=devserver,dc=local
cn: server1user1
objectClass: top
objectClass: posixGroup
gidNumber: 10000

# User account
dn: uid=server1user1,ou=people,dc=ldap,dc=devserver,dc=local
cn: Server1 user1
givenName: Suesr1
sn: user1
uid: server1user1
uidNumber: 120000
gidNumber: 120000
homeDirectory: /home/server1user1
mail: server1user1@dev.local
objectClass: top
objectClass: posixAccount
objectClass: shadowAccount
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
loginShell: /bin/bash
userPassword: {CRYPT}*

 

Adding User command 

ldapadd -c -x -D cn=admin,dc=ldap,dc=devserver,dc=local -W -f /tmp/addUser.ldif  

Adding password for that user command

ldappasswd -x -D cn=admin,dc=ldap,dc=devserver,dc=local -W -S uid=server1test3,ou=people,dc=ldap,dc=devserver,dc=local

 

]]>