- Building Telephony Systems with OpenSIPS(Second Edition)
- Flavio E. Goncalves Bogdan-Andrei Iancu
- 607字
- 2021-08-20 10:43:16
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:

- Navigate to Generate OpenSIPS Script | Residential Script | Configure Residential Script. For now, just enable TCP:
- 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
- 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:
- 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
- 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.
- To simplify the access, create a symbolic link to
/usr/local/etc/opensips
at/etc/opensips
:ln –s /usr/local/etc/opensips /etc/opensips
- 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
- Java范例大全
- Delphi程序設計基礎:教程、實驗、習題
- Visual C++串口通信開發入門與編程實踐
- C++ Builder 6.0下OpenGL編程技術
- Java Web開發之道
- Learning Data Mining with Python
- Microsoft System Center Orchestrator 2012 R2 Essentials
- 深入淺出RxJS
- Python編程:從入門到實踐
- JAVA程序設計實驗教程
- Python忍者秘籍
- Mastering Linux Security and Hardening
- Xamarin Blueprints
- Xamarin Cross-Platform Development Cookbook
- FORTRAN程序設計權威指南