Get in Touch

OpenSip Overview

Opensips is one of the best solution that are present in opensource, it provide you ITSP level services on good hardware box, Single box configure with opensips can supports 5000-10000 calls at time, which it make any teleco to operate with more then 5-10 billion mins per year. Anyone can use it to support their bussiness which is incuring lot of cost due high hardware cost such as VOIPLOGIC and PORTA. As there lot of development is required to start with and there is no good absolute billling platform in opensource market so noone is keen to use at enterprise level. There are other ways to use for outbound call center solution of decrease the cost for user making outbound call to customer care, as there is very good feature of click to dial, whicha cna be integrated to any website for customer care support. So now know lot more about what major usage, keep it in mind now when ever you require more then 1000 concurrent call, installation of opensips will reduce the cost, give us best you to integrate any type of technogy. Installing of opensips is very easy and if anyone knows the basic linux and few commands then he can install on the box:

REQUIRMENTS:

gcc / suncc / icc : gcc >= 2.9x; 4.[012] recommended (it will work with older version but it might require some options tweaking for best performance) bison or yacc (Berkley yacc) flex GNU make (on Linux this is the standard “make”, on FreeBSD and Solaris is called “gmake”) version >= 3.79. sed and tr (used in the makefiles) GNU tar (“gtar” on Solaris) and gzip if you want “make tar” to work GNU install or BSD install (on Solaris “ginstall”) if you want “make install”, “make bin”, “make sunpkg” to work openssl if you want to compile the TLS support libsctp if you want to compile the SCTP support libmysqlclient & libz (zlib) -libs and devel headers- if you want mysql DB support (the db_mysql module) libpq / postgresql -libs and devel headers- if you want postgres DB support (the db_postgres module) unixodbc -libs and devel headers- if you want unixodbc DB support (the db_unixodbc module) libexpat if you want the jabber gateway support (the jabber module) or the XMPP gateway support libxml2 if you want to use the cpl-c (Call Processing Language) or the presence modules (presence and pua*) libradius-ng -libs and devel headers- if you want to use functionalities with radius support – authentication, accounting, group support, etc unixodbc – libs and devel headers – if you want UNIXODBC support as DB underlayer libxmlrpc-c3 – libs and devel headers – if you want to have XML-RPC support for the Management interface (MI) libperl – libs and devel headers – if you want PERL connector to support perl scripting from you config file (perl module) libsnmp9 – libs and devel headers – if you want SNMP client functionality (SNMP AgentX subagent) for opensips libldap libs and devel headers v2.1 or greater – if you want LDAP support libconfuse and devel headers – if you want to compile the carrierroute module

INSTALLATION

cd /usr/src/ yum install bison bison-devel ncurses ncurses-devel zlib zlib-devel openssl openssl-devel gnutls-devel gcc gcc-c++ mysql-server mysql-client which flex make Download opensips (Opensips 1.5 wget http://opensips.org/pub/opensips/1.5.0/src/opensips-1.5.0-tls_src.tar.gz) tar -xzf opensips-1.5.0-tls_src.tar.gz make all make install make config

By following above 2 process we have installed the opensips server on our system now we have to configure the server corresponding to our requirement.

CONFIGURATION

We have following directory where all files has be installed:

    1. /usr/local/lib/opensips/ directory where all modules are installed
    2. /usr/local/etc/opensips/ directory where all configuration you have make

FOR LOAD

Under Load-balancing format The below setting will create alternate call from one server and other alternately it will create same number of calls from each gateway.

    1. log_stderror=yes
    2. log_facility=LOG_LOCAL0
    3. fork=yes
    4. children=4
    5. debug=2
    6. listen=5060

MODULE PATH

    1. mpath=”/usr/local/lib/opensips/modules/”

Modules Section

DB_MYSQL
    1. loadmodule “db_mysql.so”
    2. modparam(“db_mysql”, “ping_interval”, 300)
    3. modparam(“db_mysql”, “timeout_interval”, 10)
    4. modparam(“db_mysql”, “auto_reconnect”, 1))

SL

    1. loadmodule “sl.so”
    2. modparam(“sl”, “enable_stats”, 1)

TM

    1. loadmodule “tm.so”
    2. modparam(“tm”, “fr_timer”, 30)
    3. modparam(“tm”, “fr_inv_timer”, 120)
    4. modparam(“tm”, “wt_timer”, 5)
    5. modparam(“tm”, “delete_timer”, 2)
    6. #modparam(“tm”, “noisy_ctimer”, 0)
    7. modparam(“tm”, “ruri_matching”, 1)
    8. modparam(“tm”, “via1_matching”, 1)
    9. modparam(“tm”, “unix_tx_timeout”, 2)
    10. modparam(“tm”, “restart_fr_on_each_reply”, 1)
    11. modparam(“tm”, “pass_provisional_replies”, 0)
    12. modparam(“tm”, “fr_inv_timer_avp”, “$avp(s:callee_fr_inv_timer)”)

RR

    1. loadmodule “rr.so”
    2. modparam(“rr”, “enable_full_lr”, 0)
    3. modparam(“rr”, “append_fromtag”, 1)
    4. modparam(“rr”, “enable_double_rr”, 0)
    5. modparam(“rr”, “add_username”, 0)

MAXFWD

    1. loadmodule “maxfwd.so”o

USRLOC

    1. loadmodule “usrloc.so”
    2. modparam(“usrloc”, “user_column”, “username”)
    3. modparam(“usrloc”, “domain_column”, “domain”))
    4. modparam(“usrloc”, “contact_column”, “contact”)
    5. modparam(“usrloc”, “expires_column”, “expires”)
    6. modparam(“usrloc”, “q_column”, “q”)
    7. modparam(“usrloc”, “callid_column”, “callid”)
    8. modparam(“usrloc”, “cseq_column”, “cseq”)
    9. modparam(“usrloc”, “methods_column”, “methods”)
    10. modparam(“usrloc”, “flags_column”, “flags”)
    11. modparam(“usrloc”, “user_agent_column”, “user_agent”)
    12. modparam(“usrloc”, “received_column”, “received”)
    13. modparam(“usrloc”, “socket_column”, “socket”)
    14. modparam(“usrloc”, “use_domain”, 0)
    15. modparam(“usrloc”, “desc_time_order”, 0)
    16. modparam(“usrloc”, “timer_interval”, 60)
    17. modparam(“usrloc”, “db_mode”, 2)
    18. modparam(“usrloc”, “db_url” , “mysql://opensips:opensips@database/opensips”)
    19. modparam(“usrloc”, “matching_mode”, 0)
    20. modparam(“usrloc”, “cseq_delay”, 20)
    21. modparam(“usrloc”, “nat_bflag”, 6)

REGISTRAR

    1. loadmodule “registrar.so”
    2. modparam(“registrar”, “method_filtering”, 1)
    3. modparam(“registrar”, “default_expires”, 3600)
    4. modparam(“registrar”, “min_expires”, 60)
    5. modparam(“registrar”, “max_expires”, 0)
    6. modparam(“registrar”, “default_q”, 0)
    7. modparam(“registrar”, “append_branches”, 1)
    8. modparam(“registrar”, “case_sensitive”, 0))
    9. modparam(“registrar”, “received_param”, “received”)
    10. modparam(“registrar”, “max_contacts”, 10)
    11. modparam(“registrar”, “retry_after”, 0)
    12. modparam(“registrar”, “path_mode”, 2)
    13. modparam(“registrar”, “path_use_received”, 0)
    14. #modparam(“registrar”, “received_avp”, “$avp(i:801)”)
    15. modparam(“registrar”, “aor_avp”, “$avp(i:3223)”)
    16. modparam(“registrar”, “received_avp”, “$avp(s:rcv)”)

TEXTOPS

    1. loadmodule “textops.so”

MI_FIFO

    1. loadmodule “mi_fifo.so”
    2. modparam(“mi_fifo”, “fifo_name”, “/tmp/opensips_fifo”)
    3. #modparam(“mi_fifo”, “fifo_mode”, 0660)
    4. #modparam(“mi_fifo”, “fifo_group”, “opensips”))
    5. #modparam(“mi_fifo”, “fifo_user”, “opensips”)
    6. #modparam(“mi_fifo”, “reply_dir”, “/tmp/”)
    7. #modparam(“mi_fifo”, “reply_dir”, “/tmp/”)
    8. #modparam(“mi_fifo”, “reply_indent”, “\t”)

URI

    1. loadmodule “uri.so”

URI_DB

    1. loadmodule “uri_db.so”
    2. modparam(“uri_db”, “db_url”, “mysql://opensips:opensips@database/opensips”)
    3. modparam(“uri_db”, “db_table”, “uri”)
    4. modparam(“uri_db”, “use_uri_table”, 1)
    5. modparam(“uri_db”, “use_domain”, 1)
    6. modparam(“uri_db”, “user_column”, “username”)
    7. modparam(“uri_db”, “domain_column”, “domain”)
    8. modparam(“uri_db”, “uriuser_column”, “uri_user”)

xlog

    1. loadmodule “xlog.so”
    2. modparam(“xlog”, “force_color”, 1)
    3. modparam(“xlog”, “buf_size”, 4096)

acc

    1. loadmodule “acc.so”
    2. modparam(“acc”, “db_url”, “mysql://opensips:opensips@database/opensips”)
    3. modparam(“acc”, “early_media”, 1)
    4. modparam(“acc”, “report_ack”, 1)
    5. modparam(“acc”, “report_cancels”, 1)
    6. modparam(“acc”, “detect_direction”, 1)
    7. modparam(“acc”, “failed_transaction_flag”, 3)
    8. modparam(“acc”, “log_flag”, 1)
    9. modparam(“acc”, “log_missed_flag”, 2)
    10. modparam(“acc”, “db_flag”, 1))
    11. modparam(“acc”, “db_missed_flag”, 2)
    12. modparam(“acc”, “db_extra” , “ua=$hdr(User-Agent); src_user=$avp(i:100);
    13. src_domain=$fd; src_port=$sp; dst_user=$rU; dst_domain=$rd; dst_port=$rp;
    14. mmessage=$mf; unixtime=$Ts; avp_var=$avp(s:can_uri); callstate=$avp(s:callstate);
    15. usercode=$avp(i:1000); recieved=$avp(s:rcv); aor_avp=$avp(i:3223)”)

auth

    1. loadmodule “auth.so”
    2. modparam(“auth”, “nonce_expire”, 300)
    3. modparam(“auth”, “rpid_suffix”, “;party=calling;id-type=subscriber;screen=yes”)
    4. modparam(“auth”, “rpid_avp”, “$avp(s:rpid)”)

AVPOPS

    1. loadmodule “avpops.so”
    2. modparam(“avpops”, “db_url”, “mysql://opensips:opensips@database/opensips”)
    3. mmodparam(“avpops”, “avp_table”, “usr_preferences”)
    4. modparam(“avpops”, “use_domain”, 0)
    5. modparam(“avpops”, “uuid_column”, “uuid”)
    6. modparam(“avpops”, “username_column”, “username”)
    7. modparam(“avpops”, “domain_column”, “domain”
    8. modparam(“avpops”, “attribute_column”, “attribute”)
    9. modparam(“avpops”, “value_column”, “value”)
    10. modparam(“avpops”, “type_column”, “type”)
    11. #modparam(“avpops”, “avp_aliases”, “c_uri” )

DIALOG

    1. loadmodule “dialog.so”
    2. modparam(“dialog”, “enable_stats”, 1)
    3. modparam(“dialog”, “db_url”, “mysql://opensips:opensips@database/opensips”)
    4. modparam(“dialog”, “db_mode”, 1))
    5. modparam(“dialog”, “dlg_flag”, 4)

DIAPLAN

    1. loadmodule “dialplan.so”
    2. modparam(“dialplan”, “db_url”, “mysql://opensips:opensips@database/opensips”)
    3. modparam(“dialplan”, “attrs_pvar”, “$avp(s:dest)”)

SIPTRACE

    1. loadmodule “siptrace.so”
    2. modparam(“siptrace”,”db_url”,”mysql://opensips:opensips@database/opensips”)
    3. modparam(“siptrace”, “trace_on”, 1))
    4. modparam(“siptrace”, “trace_flag”, 22)

AUTH_DB

    1. loadmodule “auth_db.so”
    2. modparam(“auth_db”, “calculate_ha1”, 1)
    3. modparam(“auth_db”, “db_url”, “mysql://opensips:opensips@database/opensips”)
    4. modparam(“auth_db”, “use_domain”, 1)
    5. modparam(“auth_db”, “user_column”, “username”)
    6. modparam(“auth_db”, “password_column”, “password”)
    7. modparam(“auth_db”, “password_column_2”, “ha1b”)
    8. odparam(“auth_db”, “load_credentials”, “$avp(i:1001)=email_address;$avp(i:1000)=usercode”))

MI_DATAGRAM

    1. loadmodule “mi_datagram.so”
    2. modparam(“mi_fifo”, “fifo_name”, “/tmp/opensips_fifo”)
    3. modparam(“mi_datagram”, “socket_name”, “udp:10.10.2.144:8080”)

Routing Logic

    1. main request routing logic
    2. route{
    3. sip_trace(); # Recording all sip signal for each calls connect through this server
    4. xlog(“Recive call variable : $avp(s:rcv) $avp(i:3223)\n”); # prints the cli log
    5. if($fU==NULL){
    6. $avp(i:100)=”0″;
    7. }
    8. else
    9. $avp(i:100)=$fU;
    10. if (!mf_process_maxfwd_header(“10”)) {
    11. sl_send_reply(“483″,”Too Many Hops”);
    12. exit;
    13. }
    14. if (has_totag()) {
    15. if (loose_route()) {
    16. if(is_method(“BYE”)){
    17. #setting for call accounting
    18. setflag(1);
    19. setflag(3);
    20. }
    21. route(1);
    22. } else {
    23. if ( is_method(“ACK”) ) {
    24. if ( t_check_trans() ) {
    25. t_relay();
    26. exit;
    27. } else {
    28. exit;
    29. }
    30. }
    31. sl_send_reply(“404″,”Not here”);
    32. }
    33. exit;
    34. }
    35. if (is_method(“CANCEL”))
    36. {
    37. if (t_check_trans())
    38. t_relay();
    39. exit;
    40. t_relay();
    41. t_check_trans();
    42. # record routing
    43. if (!is_method(“REGISTER|MESSAGE”)){
    44. record_route();
    45. }
    46. # account only INVITEs
    47. if (is_method(“INVITE”)) {
    48. if(from_uri=~”.*@10.10.2.136″ || from_uri=~”.*@10.10.2.134″){
    49. }
    50. ielse{
    51. avp_db_query(“select id_skillgroup from subscriber u where username=’$rU'”, “$avp(i:2001)”);
    52. avp_db_query(“select id from ast_skillgroup where id=’$avp(i:2001)'”, “$avp(i:2002)”);
    53. avp_db_query(“select id, serverip, callerid from ast_servers where id_skillgroup=’$avp(i:2002)’
    54. ORDER by calls asc limit 1″, “$avp(i:2003);$avp(i:2004);$avp(i:2005)”);
    55. avp_db_query(“Update ast_servers SET calls=calls+1 WHERE id=$avp(i:2003)”);
    56. avp_pushto(“$ru/domain”,”$avp(i:2004)”);
    57. avp_pushto(“$ru/domain”,”$avp(i:2004)”);
    58. if (!t_relay()) {
    59. sl_reply_error();
    60. if};
    61. exit;
    62. }
    63. }
    64. if (!uri==myself)
    65. {
    66. append_hf(“P-hint: outbound\r\n”);
    67. exit;
    68. route(1);
    69. }
    70. if (is_method(“PUBLISH”))
    71. {
    72. sl_send_reply(“503”, “Service Unavailable”);
    73. exit;
    74. }
    75. if (is_method(“REGISTER”))
    76. {
    77. # authenticate the REGISTER requests (uncomment to enable auth)
    78. x if (www_authorize(“”, “subscriber”))
    79. {
    80. xlog(“User credentals : $avp(i:1000)\n”);
    81. if (!save(“location”))
    82. sl_reply_error();
    83. exit;
    84. }
    85. else{
    86. www_challenge(“”, “0”);
    87. exit;
    88. }
    89. if (!check_to())
    90. {
    91. sl_send_reply(“403″,”Forbidden auth ID”);
    92. exit;
    93. }
    94. }
    95. if ($rU==NULL) {
    96. sl_send_reply(“484″,”Address Incomplete”);
    97. exit;
    98. }
    99. if (!lookup(“location”)) {
    100. switch ($retcode) {
    101. case -1:
    102. case -3:
    103. t_newtran();
    104. t_reply(“404”, “Not Found”);
    105. exit;
    106. case -2:
    107. sl_send_reply(“405”, “Method Not Allowed”);
    108. exit;
    109. }
    110. }
    111. setflag(2);
    112. xlog(“Script is at the end\n”);
    113. route(1);
    114. }
    115. route[1] {
    116. # for INVITEs enable some additional helper routes
    117. if (is_method(“INVITE”)) {
    118. avp_db_query(“select uuid from subscriber where username = ‘$rU'”, “$avp(s:callee_uuid)”);
    119. $avp(s:can_uri) = $ru;
    120. xlog(“User credentals : $avp(s:callee_uuid)\n”);
    121. t_on_branch(“2”);
    122. t_on_reply(“2”);
    123. t_on_failure(“1”);
    124. }
    125. if (!t_relay()) {
    126. sl_reply_error();
    127. };
    128. branch_route[2] {
    129. xlog(“new branch at $ru\n”);
    130. $avp(s:can_uri) = $ru;
    131. $avp(s:callstate)=”CALL REROUTED”;
    132. add_rr_param(“;foo=true;user=vivek”);
    133. xlog(“Call is forwared to asterisk\n”);
    134. }
    135. onreply_route[2] {
    136. xlog(“incoming reply\n”);
    137. }
    138. failure_route[1] {
    139. if (t_was_cancelled()) {
    140. exit;
    141. }
    142. }

Above configurate is sampled crossponding to load balanced format where calls are forwarded to different gatey crossponding to our require and avialability of gateway.

Related Post

FreeSwitch

The Future Prospect of Telephony Freeswitch is an open- standards VoIP telecom platform. It can be…

Read More

OpenSip

Opensips is one of the best solution that are present in opensource, it provide you ITSP…

Read More

Kamailio

Kamailio (successor of OpenSER and SER) is an Open Source SIP Server released under GPL, able…

Read More

Installation

Asterisk is one of the best telephony solutions which is free to use. There are others…

Read More

IVR Setting

Interactive Voice Response (IVR) allows your organizations to interact with customers through voice and DTMF tones…

Read More

Open Source

Elastix Elastix is appliance server software that integrates the most effective tools available for Asterisk-based PBXs…

Read More

MySql

Currently we are doing replication between two servers i.e. VPN3 and VPN4. Our project needed persistent…

Read More

Apache

Apache HTTP Server is an open-source HTTP server to develop and maintain modern operating systems including…

Read More

Subversion

Subversion is a open-source version control tool. It is open-source and distributed as free software over…

Read More

Copyright © 2016 GVenture Technology Pvt. Ltd., All Rights Reserved.