Skip to content

Commit

Permalink
Updated for OSP Toolkit 4.5.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Di-Shi Sun committed Jun 4, 2015
1 parent 31ddc49 commit e72d1ef
Show file tree
Hide file tree
Showing 12 changed files with 385 additions and 117 deletions.
3 changes: 2 additions & 1 deletion modules/osp/Makefile
@@ -1,3 +1,4 @@

# osp module makefile

# WARNING: do not run this directly, it should be run by the master Makefile
Expand Down Expand Up @@ -32,7 +33,7 @@ include ../../Makefile.modules
install_module_custom:
echo "OSP module overwrites the default configuration file"
sed \
-e "s#/usr/local/lib/opensips#$(modules-target)/$(lib-dir)#g" \
-e "s#/usr/local/lib/opensips#$(modules-prefix)/$(lib-dir)#g" \
< etc/sample-osp-opensips.cfg \
> $(cfg-prefix)/$(cfg-dir)/opensips.cfg

32 changes: 22 additions & 10 deletions modules/osp/README
Expand Up @@ -128,17 +128,28 @@ Chapter 1. Admin Guide

The OSP module depends on the following modules which must be
loaded before the OSP module.
* sl -- stateless replier
* tm -- stateful processing
* rr -- Record-Route/Route operation
* textops -- text based operation
* auth -- Remote-Party-ID operattion
* auth -- Authentication Framework module
* avpops -- AVP operation module
* maxfwd -- Max-Forward processor module
* mi_fifo -- FIFO support for Management Interface
* options -- OPTIONS server replier module
* registrar -- SIP Registrar implementation module
* rr -- Record-Route and Route module
* signaling -- SIP signaling module
* sipmsgops -- SIP operations module
* sl -- Stateless replier module
* tm -- Transaction (stateful) module
* uac -- UAC functionalies (FROM mangling and UAC auth)
* uac_auth -- UAC Authentication functionality
* usrloc -- User location implementation module
* OSP Toolkit -- The OSP Toolkit, available from
http://sourceforge.net/projects/osp-toolkit, must be built
before building OpenSIPS with the OSP module. For
instructions on building OpenSIPS with the OSP Toolkit, see
http://www.transnexus.com/White%20Papers/Multi-Lateral_Peer
ing_with_OpenSIPS_V1.6.pdf
http://www.http://transnexus.com/wp-content/uploads/OSP-Rou
ting-and-CDR-Collection-Server-with-OpenSIPS-1.7.2.pdf. For
OpenSIPS 1.11.5, OSP Toolkit 4.5.0 or later versions should
be used.

1.3. Exported Parameters

Expand Down Expand Up @@ -190,7 +201,8 @@ modparam("osp","service_type",0)
included.

Example 1.3. Setting the OSP servers
modparam("osp","sp1_uri","http://osptestserver.transnexus.com:5045/osp")
modparam("osp","sp1_uri","http://osptestserver.transnexus.com:5045/osp"
)
modparam("osp","sp2_uri","https://[1.2.3.4]:1443/osp")

1.3.4. sp1_weight, sp2_weight, ..., sp16_weight
Expand Down Expand Up @@ -278,8 +290,8 @@ modparam("osp","token_format",2)
If the default CFG_DIR value was used at compile time, the
files will be loaded from:
modparam("osp","private_key","/usr/local/etc/opensips/pkey.pem")
modparam("osp","local_certificate","/usr/local/etc/opensips/localcert.pe
m")
modparam("osp","local_certificate","/usr/local/etc/opensips/localcert.p
em")
modparam("osp","ca_certificates","/usr/local/etc/opensips/cacert.pem")

1.3.9. enable_crypto_hardware_support
Expand Down
12 changes: 12 additions & 0 deletions modules/osp/RELEASE-NOTES.txt
Expand Up @@ -164,3 +164,15 @@ Added support for called number digit filtering.
Added support for calling number invalid.
Fixed network ID reporting issue.
Fixed t_relay check issue in sample configuration file.

2015 June 4
Updated to support more OSP server response codes.
Fixed the bug of source network ID in OSP cookie.
Updated to support 603 Decline status code.
Different timeout values for receiving 18x and not receiving 18x.
Hardcoded not to report redirect CDRs.
Support CDRProxy
Support FromDisplayName
Support User-Agent
Support TotalSetupAttempts for completed calls.

1 change: 1 addition & 0 deletions modules/osp/destination.h
Expand Up @@ -59,6 +59,7 @@ typedef struct _osp_dest {
char npcic[OSP_STRBUF_SIZE];
int npdi;
char opname[OSPC_OPNAME_NUMBER][OSP_STRBUF_SIZE];
char display[OSP_STRBUF_SIZE];
char rpid[OSP_STRBUF_SIZE];
char pai[OSP_STRBUF_SIZE];
char divuser[OSP_STRBUF_SIZE];
Expand Down
39 changes: 33 additions & 6 deletions modules/osp/doc/osp_admin.xml
Expand Up @@ -23,22 +23,49 @@
<para>The OSP module depends on the following modules which must be loaded before the OSP module.</para>
<itemizedlist>
<listitem>
<para><emphasis>sl</emphasis> -- stateless replier</para>
<para><emphasis>auth</emphasis> -- Authentication Framework module</para>
</listitem>
<listitem>
<para><emphasis>tm</emphasis> -- stateful processing</para>
<para><emphasis>avpops</emphasis> -- AVP operation module</para>
</listitem>
<listitem>
<para><emphasis>rr</emphasis> -- Record-Route/Route operation</para>
<para><emphasis>maxfwd</emphasis> -- Max-Forward processor module</para>
</listitem>
<listitem>
<para><emphasis>textops</emphasis> -- text based operation</para>
<para><emphasis>mi_fifo</emphasis> -- FIFO support for Management Interface</para>
</listitem>
<listitem>
<para><emphasis>auth</emphasis> -- Remote-Party-ID operattion</para>
<para><emphasis>options</emphasis> -- OPTIONS server replier module</para>
</listitem>
<listitem>
<para><emphasis>OSP Toolkit</emphasis> -- The OSP Toolkit, available from http://sourceforge.net/projects/osp-toolkit, must be built before building OpenSIPS with the OSP module. For instructions on building OpenSIPS with the OSP Toolkit, see http://www.transnexus.com/White%20Papers/Multi-Lateral_Peering_with_OpenSIPS_V1.6.pdf</para>
<para><emphasis>registrar</emphasis> -- SIP Registrar implementation module</para>
</listitem>
<listitem>
<para><emphasis>rr</emphasis> -- Record-Route and Route module</para>
</listitem>
<listitem>
<para><emphasis>signaling</emphasis> -- SIP signaling module</para>
</listitem>
<listitem>
<para><emphasis>sipmsgops</emphasis> -- SIP operations module</para>
</listitem>
<listitem>
<para><emphasis>sl</emphasis> -- Stateless replier module</para>
</listitem>
<listitem>
<para><emphasis>tm</emphasis> -- Transaction (stateful) module</para>
</listitem>
<listitem>
<para><emphasis>uac</emphasis> -- UAC functionalies (FROM mangling and UAC auth)</para>
</listitem>
<listitem>
<para><emphasis>uac_auth</emphasis> -- UAC Authentication functionality</para>
</listitem>
<listitem>
<para><emphasis>usrloc</emphasis> -- User location implementation module</para>
</listitem>
<listitem>
<para><emphasis>OSP Toolkit</emphasis> -- The OSP Toolkit, available from http://sourceforge.net/projects/osp-toolkit, must be built before building OpenSIPS with the OSP module. For instructions on building OpenSIPS with the OSP Toolkit, see http://www.http://transnexus.com/wp-content/uploads/OSP-Routing-and-CDR-Collection-Server-with-OpenSIPS-1.7.2.pdf. For OpenSIPS 1.11.5, OSP Toolkit 4.5.0 or later versions should be used.</para>
</listitem>
</itemizedlist>
</section>
Expand Down
74 changes: 58 additions & 16 deletions modules/osp/etc/sample-osp-opensips.cfg
Expand Up @@ -14,7 +14,6 @@ dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
disable_dns_blacklist=yes
disable_tcp=yes
disable_tls=yes
port=5060
children=64

Expand Down Expand Up @@ -158,8 +157,8 @@ modparam("osp", "sp1_uri", "http://osptestserver.transnexus.com:5045/osp")
#
# Support non-SIP signaling protocols
# ====================================================================
# This parameter is used to tell the OSP module if non-SIP signaling
# protocols are supported. The default value is 0.
# This parameter is used to tell the OSP module if non-SIP signaling
# protocols are supported. The default value is 0.
#
# modparam("osp", "support_nonsip_protocol", 0)

Expand Down Expand Up @@ -213,7 +212,7 @@ modparam("osp", "sp1_uri", "http://osptestserver.transnexus.com:5045/osp")
# ====================================================================
# This parameter is used to tell the OSP module where the destination
# network ID should be appended. The default value is 2.
#
#
# 0 - network ID is not appended.
# 1 - network ID is appended as userinfo parameter.
# 2 - network ID is appended as URI parameter.
Expand All @@ -235,7 +234,7 @@ modparam("osp", "sp1_uri", "http://osptestserver.transnexus.com:5045/osp")
# This parameter is used to tell the OSP module where the parameter
# string should be appended in the outbound URI. The default value is
# 0.
#
#
# 0 - parameter string is not appended.
# 1 - parameter string is appended as userinfo parameter.
# 2 - parameter string is appended as URI parameter.
Expand Down Expand Up @@ -308,7 +307,7 @@ modparam("rr", "append_fromtag", 1)
#
# Timer which hits if there is no response (including provisional
# messages such as 100, 180, 183, ..., etc.) for a request such as
# INVITE, RE-INVITE or BYE after fr_timer seconds.
# INVITE, RE-INVITE or BYE after fr_timeout seconds.
#
# For the INVITE use case, if the proxy does not receive a response
# to an INVITE before this timer expires, the proxy will retry the
Expand All @@ -319,15 +318,16 @@ modparam("rr", "append_fromtag", 1)
# a response before this timer expires, the proxy will send a SIP 408
# Timeout message to the source of the request.
#
modparam("tm", "fr_timer", 2)
modparam("tm", "fr_timeout", 2)

#
# Timer which hits if no final reply for an INVITE arrives after a
# provisional message was received (in seconds). For example, user is
# not picking up the phone.
#
modparam("tm", "fr_inv_timer", 300)

modparam("tm", "fr_inv_timeout", 5)
modparam("tm", "onreply_avp_mode", 1)
modparam("tm", "restart_fr_on_each_reply", 1)

# --------- request routing logic ------------------------------------

Expand Down Expand Up @@ -617,31 +617,55 @@ route[2] {
sl_send_reply("404", "Route Not Found - No supported route");
}
break;
case -401:
case -4000: # HTTP 400, missing OSP elements or bad message
case -4001: # AuthRsp 400, not used
xlog("L_WARN", "----ROUTE: Call to '$tU' from source device '$si' is a bad request.\n");
sl_send_reply("400", "Bad Request");
break;
case -4010: # HTTP 401, invalid wire device
case -4011: # AuthRsp 401, invalid transport or source device
xlog("L_WARN", "----ROUTE: Call to '$tU' from source device '$si' is unauthorized on OSP Server.\n");
sl_send_reply("401", "Unauthorized");
break;
case -403:
case -4030: # Route blocked
xlog("L_WARN", "----ROUTE: Call to '$tU' from source device '$si' is blocked on OSP Server.\n");
sl_send_reply("403", "Forbidden - Call is blocked");
break;
case -404:
case -4040: # Route not found
xlog("L_WARN", "----ROUTE: No route on OSP server for call to '$tU' from source device '$si'.\n");
sl_send_reply("404", "Route Not Found");
break;
case -428:
case -4050: # Source may not originate
xlog("L_WARN", "----ROUTE: Method not allowed on OSP server for call to '$tU' from source device '$si'.\n");
sl_send_reply("405", "Method Not Allowed");
break;
case -4280: # Invalid calling number
xlog("L_WARN", "----ROUTE: Calling number invalid for call to '$tU' from source device '$si'.\n");
sl_send_reply("400", "Bad Request - Calling number invalid");
break;
case -484:
case -4800: # OSPrey server not start
case -4801: # OSPrey server timeout
case -4802: # OSPrey server not ready
xlog("L_WARN", "----ROUTE: Server not ready for call to '$tU' from source device '$si'.\n");
sl_send_reply("480", "Temporarily Unavailable - Server not ready");
break;
case -4840: # Invalid called number
xlog("L_WARN", "----ROUTE: Address incomplete for call to '$tU' from source device '$si'.\n");
sl_send_reply("484", "Address Incomplete");
break;
case -2:
case -5030: # Routing feature off, license exceeded or inbound device throttle
xlog("L_WARN", "----ROUTE: Service not available for call to '$tU' from source device '$si'.\n");
sl_send_reply("503", "Service Not Available");
break;
case -6030: # Fraud detected
xlog("L_WARN", "----ROUTE: Call to '$tU' from source device '$si' is declined on OSP Server.\n");
sl_send_reply("603", "Decline");
break;
case -2: # Internal error
log(2, "----ROUTE: Internal server error\n");
sl_send_reply("500", "Internal Server Error");
break;
default:
default: # Unspecified server error
log(2, "----ROUTE: OSP Authorization failed\n");
sl_send_reply("503", "Service Not Available");
}
Expand Down Expand Up @@ -696,8 +720,13 @@ route[5] {

t_on_branch("1");

t_on_reply("1");

t_on_failure("1");

# Reset fr_inv_timeout
$T_fr_inv_timeout = null;

# For SIP From header modification
# route(7);

Expand All @@ -714,8 +743,13 @@ route[6] {
if (checkosproute()) {
t_on_branch("1");

t_on_reply("1");

t_on_failure("1");

# Reset fr_inv_timeout
$T_fr_inv_timeout = null;

if (!t_relay("0x02")) {
xlog("L_WARN", "----ROUTE: t_relay failed.\n");
route(6);
Expand All @@ -741,6 +775,14 @@ route[6] {
# }
#}

onreply_route[1] {
if (t_check_status("180") || t_check_status("183")) {
log(3, "180/183 received\n");

# Reset fr_inv_timeout
$T_fr_inv_timeout = 60;
}
}

failure_route[1] {
if (t_check_status("487")) {
Expand Down

0 comments on commit e72d1ef

Please sign in to comment.