官术网_书友最值得收藏!

Generating OpenSIPS scripts

One of the goals for the OpenSIPS project is to make the software simpler to use. A great milestone in this direction was the script generator. Now, we can generate scripts for several scenarios. This can save a lot of time in coding and reduce errors. This book will use the Residential Script as the basis for most of the chapters. So, let's generate a residential script to start with:

  1. Navigate to Generate OpenSIPS Script | Residential Script | Configure Residential Script. For now, just enable TCP:
  2. Generate the script and copy it to /usr/local/etc/opensips and change the specific date generated by your installation:
    cp /usr/src/opensips_210/etc/opensips_residential_2014-12-22_9\:25\:40.cfg /etc/opensips/opensips.cfg
    
  3. After generating the script, customize some lines of the code to your current IP address:
    listen=udp:127.0.0.1:5060   # CUSTOMIZE ME
    listen=tcp:127.0.0.1:5060   # CUSTOMIZE ME

Running OpenSIPS at the Linux boot time

Now, we will insert OpenSIPS at the Linux boot time to load the server whenever the server restarts:

  1. Include OpenSIPS in the Linux boot:
    cd /usr/src/opensips_210/packaging/debian
    cp opensips.default /etc/default/opensips
    cp opensips.init /etc/init.d/opensips
    nano /etc/init.d/opensips
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
    DAEMON=/usr/local/sbin/opensips
    chmod 755 /etc/init.d/opensips
    update-rc.d opensips defaults 99
    
  2. Edit /etc/default/opensips and change the shared memory parameter to 128 MB, packaged memory to 4 MB, and RUN_OPENSIPS to yes. You can check the usage of the shared memory and package memory using the following commands:
    opensipsctl fifo get_statistics shmem:
    opensipsctl fifo get_statistics pkmem:
    

    It is hard to predict exactly how much memory your system will consume. It depends on the routing script, caching, and number of transactions and routes. You will probably be surprised on how low the memory requirements are.

  3. To simplify the access, create a symbolic link to /usr/local/etc/opensips at /etc/opensips:
    ln –s /usr/local/etc/opensips /etc/opensips
    
  4. Restart the computer to see if OpenSIPS starts. Confirm using the following command:
    ps-ef |grep opensips
    

Note

It is highly recommended that you change the username and group used to run OpenSIPS in the /etc/init.d/opensips file.

The OpenSIPS v2.1.x directory structure

After the installation, OpenSIPS will create a file structure. It is important to understand the file structure in order to locate the main folders where the system is stored. You will need this information to update or remove the software.

The configuration files

This is the directory of the configuration files with their respective samples:

opensips-1:/etc/opensips# ls -l
-rw------- 1 root root 6226 Dec 22 09:55 opensips.cfg
-rw------- 1 root staff 6078 Dec 22 10:05 opensips.cfg.sample
-rw-r--r-- 1 root staff 3696 Dec 22 09:41 opensipsctlrc
-rw-r--r-- 1 root staff 3696 Dec 22 10:05 opensipsctlrc.sample
-rw-r--r-- 1 root staff 3028 Dec 22 09:41 osipsconsolerc
-rw-r--r-- 1 root staff 3028 Dec 22 10:05 osipsconsolerc.sample
drwxr-sr-x 4 root staff 4096 Dec 22 10:05 tls

Modules

This is the directory for the modules. It is important to check if all the required modules are present after compilation:

opensips-1:/lib/opensips/modules# ls
root@bookosips:/usr/local/lib/opensips/modules# ls
acc.so dialplan.so mi_fifo.so signaling.so
alias_db.so dispatcher.so mi_http.so sipcapture.so
auth_aaa.so diversion.so mi_json.so sipmsgops.so
auth_db.so dns_cache.so msilo.so siptrace.so
auth_diameter.so domainpolicy.so nathelper.so sl.so
auth.so domain.so nat_traversal.so sms.so
avpops.so drouting.so options.so speeddial.so
b2b_entities.so enum.so path.so sst.so
b2b_sca.so event_datagram.so pdt.so statistics.so
benchmark.so event_route.so peering.so stun.so
cachedb_local.so event_xmlrpc.so permissions.so textops.so
cachedb_sql.so exec.so pike.so tm.so
call_center.so fraud_detection.so presence_callinfo.so uac_auth.so
call_control.so gflags.so presence_xcapdiff.so uac_redirect.so
cfgutils.so group.so qos.so uac_registrant.so
closeddial.so imc.so ratelimit.so uac.so
db_cachedb.so load_balancer.so registrar.so uri.so
db_flatstore.so mangler.so rr.so userblacklist.so
db_mysql.so mathops.so rtpengine.so usrloc.so
db_text.so maxfwd.so rtpproxy.so
db_virtual.so mediaproxy.so script_helper.so
dialog.so mi_datagram.so seas.so
Binaries (/usr/local/sbin)
openips-1:/sbin# ls -l op*
total 2832
-rwxr-xr-x 1 root staff 2594007 2009-10-09 17:04 opensips
-rwxr-xr-x 1 root staff 52695 2009-10-09 17:04 opensipsctl
-rwxr-xr-x 1 root staff 6270 2009-10-09 17:04 opensipsdbctl
-rwxr-xr-x 1 root staff 13442 2009-10-09 17:04 opensipsunix
-rwxr-xr-x 1 root staff 212692 2009-10-09 17:04 osipsconsole
主站蜘蛛池模板: 奉化市| 万州区| 加查县| 丰镇市| 江西省| 宜都市| 肥东县| 晋中市| 怀柔区| 涟水县| 井陉县| 林西县| 长沙市| 阿拉善右旗| 台北县| 兴义市| 天峨县| 普宁市| 南江县| 涿州市| 定兴县| 伊春市| 阿勒泰市| 金阳县| 双鸭山市| 湘西| 青神县| 东阳市| 莆田市| 宕昌县| 越西县| 德惠市| 乐业县| 铁岭市| 任丘市| 山西省| 巫溪县| 南郑县| 沿河| 佳木斯市| 龙门县|