Skip Headers
Oracle® Communications WebRTC Session Controller Extension Developer's Guide
Release 7.0

E40977-01
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

4 Customizing Messages for New SIP or JSON Data

This chapter contains examples of how to use Oracle Communications WebRTC Session Controller Signaling Engine (Signaling Engine) to process customized SIP data in messages, and add new JSON data to support protocol changes.

Processing Messages With Custom SIP Data

This section provides some examples for how to translate SIP messages which contain custom SIP data.

Example SIP Request Variable

The examples in this chapter assume that you have created a custom sipReq variable as shown in this example:

// Create REGISTER request
def from = getFromAddress(context)
def to = getToAddress(context)
def sipReq = context.sipFactory.createSipRequest("REGISTER", from, to)
 
// Set request URI
sipReq.requestURI = context.sipFactory.createSipAddress(Constants.PROXY_SIP_URI).URI
 
// Set contact user
if (from.URI?.user) {
  sipReq.setContactUser(from.URI.user)
}
 
// Set sip.instance to allow container to use SIP Outbound
// for routing purposes as defined in RFC 5626
def sipInstance = "\"<urn:uuid:" + java.util.UUID.randomUUID() + ">\""
sipReq.setSipContactParameter("+sip.instance", sipInstance)
sipReq.setSipContactParameter("reg-id", "1")
context.subSessionStore.put("sip.instance", sipInstance)
 
// Enable GRUU support (disabled by default)
//sipReq.setHeader("Supported", "gruu")
 
// P-Charging-Vector example
//def icidValue = context.uniqueId
//def myIp = java.net.InetAddress.localHost.hostAddress
//sipReq.setHeader("P-Charging-Vector", "icid-value=" + icidValue + //";icid-generated-at=" + myIp)
 
sipReq.send()

Extending SIP Messages with New Headers

This Groovy code snippet from the default register package, in the FROM_APP/connect/request/default criteria (commented out) adds support for a Globally Routable User agent URI (GRUU).

sipReq.setHeader("Supported", "gruu")

Protecting System Performance by Removing SIP Messages

You can save network bandwidth by removing unimportant messages during processing. For example, you would use this code snippet to remove provisional SIP responses (the 1xx SIP messages). You would put this in the Groovy script for the FROM_NET/INVITE/response criteria:

if (sipResponse.status < 200) {
  // Ignore provisional responses
} else if (sipResponse.status < 300) 
  // Proceed with processing
}
{... }

Removing a SIP Header in a Message

Use this Groovy code snippet to remove a header. Headers cannot be renamed.

sipReq.removeHeader("headername")
 

Replacing a SIP Header in a Message

You use the setHeader method to replace a header in a SIP message. Setting a header overwrites its value.

Conditionally Passing SIP Headers in Messages

This example Groovy code snippet probes for a JSON parameter called myWebParmeter and if present it copies the value to a SIP header.

def myWebParameter = context.webMessage?.header.?myParameter
if (myWebParameter) {
  sipRequest.setHeader("MyHeader", myWebParameter)
}

You pass SIP headers as extension headers (extHeader) in the JSON API. See WebRTC Session Controller Web Application Developer's Guide for examples of using extension headers.

Changing JSON Data to Support Protocol Changes

If the JSON protocol specification changes, you can add processing for additional data in your Groovy scripts. WebRTC Session Controller ignores new JSON data if you do not use it in processing.

Extending WebRTC Session Controller Functionality

If your implementation requires client application logic that WebRTC Session Controller or Javascript does not support by default, you need to create new software packages to implement it. The procedure below offers guidelines for creating a new package. The exact steps and sequence depend on your requirements.

See "JsonRTC Protocol Reference" for details on the JsonRTC protocol that WebRTC uses to communicate with client applications. Also see "Prerequisites for Extending WebRTC Session Controller Functionality" for information on other protocols you may need to understand.

To create a new package:

  1. Design your new package.

    Include the new JSON to SIP message mapping and any new JSON and SIP data, formats, and headers.

  2. Use the WebRTC Session Controller console to create the criteria and Groovy script processing necessary to implement your new package.

    See "Creating Criteria"for details on creating criteria.

  3. Create or extend the tools necessary to use the package with a client application.

    • If you use the JavaScript Development Environment client operating system, see the WebRTC Session Controller Web Application Developer's Guide for more information.

    • If you use a different client operating system, see that operating system documentation for details. You may also find the WebRTC Session Controller Web Application Developer's Guide helpful.

  4. Write the client application.

    • To develop JavaScript client applications see the WebRTC Session Controller Web Application Developer's Guide for more information.

    • To develop client applications in another operating system, see that operating system documentation for information on how to communicate with WebRTC Session Controller.