Brekeke Forum Index » Brekeke SIP Server Forum

Post new topic   Reply to topic
Converting old to new style "hold" reINVITE reques
Author Message
wsadkin
Brekeke Member


Joined: 14 Nov 2010
Posts: 17
Location: Massachusetts

PostPosted: Fri Jun 27, 2014 12:55 pm    Post subject: Converting old to new style "hold" reINVITE reques Reply with quote

1. Brekeke Product Name and Version: BSS 3.3.4.4 Evaluation
2. Java version: 1.7.0
3. OS type and the version: Windows 7
4. UA (phone), gateway or other hardware/software involved: Nuance NVP, Lync 2013
5. Your problem:

Nuance issues their "hold" reINVITE requests in the old RFC 2543 way, namely specifying a reINVITE with connection information of 0.0.0.0 as the IP address. However, this has been deprecated, being replaced with RFC 3264, section 8.4, where instead, you keep the Connection Information address, and change the media attribute on the stream from sendrecv to sendonly, and Lync 2013 only supports the latter.

So I need to know if the BSS can help me rewrite the SDP in the reINVITE packet to change the Connection Information address and add the media attribute I need, and if so, how to do it in the dial plan.

(Parenthetically, is there a document that indicates all the things that one can manipulate in packets traversing the BSS?)

Thanks in advance,
/Will Sadkin
Back to top
View user's profile
Laurie
Brekeke Master Guru


Joined: 07 Jan 2008
Posts: 243

PostPosted: Fri Jun 27, 2014 2:37 pm    Post subject: Reply with quote

Use Brekeke PBX instead of Brekeke SIP Server.
It will recognize 0.0.0.0 as call-hold and then the callee will hear call-hold music.

Another way is the plugin for Brekeke SIP Server.
This plugin converts SDP to meet the requirement.

The Plugin API is:
http://www.brekeke-sip.com/download/bss/bss_accountplugin_en.txt
With the plugin, you can keep using Brekeke SIP Server.
Back to top
View user's profile
wsadkin
Brekeke Member


Joined: 14 Nov 2010
Posts: 17
Location: Massachusetts

PostPosted: Mon Jun 30, 2014 9:03 am    Post subject: Reply with quote

Quote:

Another way is the plugin for Brekeke SIP Server.
This plugin converts SDP to meet the requirement.

The Plugin API is:
http://www.brekeke-sip.com/download/bss/bss_accountplugin_en.txt
With the plugin, you can keep using Brekeke SIP Server.


I cannot find "the plugin" for the BSS, or "this plugin [that] converts SDP to meet the requirement..." The document you linked to shows a sketch of how to roll my own using an API, but gives few details about the actual construction or the primitives available in that API. Is that what you intended, or is there a library of existing compiled, installable plugins I can choose/buy from?
Back to top
View user's profile
Laurie
Brekeke Master Guru


Joined: 07 Jan 2008
Posts: 243

PostPosted: Tue Jul 01, 2014 4:48 pm    Post subject: Reply with quote

Plugin java API are parts of Brekeke SIP Server's JAR files.


I tried to make the plugin and it seems to work.

Code:

package  plugin.session ;

import  java.util.regex.* ;
import  com.brekeke.net.sip.sv.session.plugins.* ;
import  com.brekeke.net.content.* ;

public class test extends AccountingBase
{
  static  Pattern  pattern = Pattern.compile( "c=IN *IP4 *(.+)" ) ;
  String  szConnectAddrUAC = null ;
  String  szConnectAddrUAS = null ;


  public void procINVITE( com.brekeke.net.sip.sv.ClientStat cs, com.brekeke.net.sip.SIPpacket sippacket, boolean bRequest )
  {

    try {
      // Get SDP Content
      Content  sdpContent = ( Content.getContent( sippacket.getContent(), "application/sdp" ) ) ;
      if ( sdpContent != null ) {

        String  data = sdpContent.toString() ;
        Matcher  matcher = pattern.matcher( data ) ;

        if ( matcher.find() ) {

          String  szConnectAddr = matcher.group( 1 ) ;


          if ( szConnectAddr.equals( "0.0.0.0" ) ) {

            // Replace
            if ( cs.bSrc ) {
              if ( szConnectAddrUAC != null ) {
                data = matcher.replaceFirst( "c=IN IP4 " + szConnectAddrUAC ) ;
              }
            }
            else {
              if ( szConnectAddrUAS != null ) {
                data = matcher.replaceFirst( "c=IN IP4 " + szConnectAddrUAS ) ;
              }
            }


            // Add "a=sendonly"
            if ( data.indexOf( "a=sendonly" ) < 0 ) {
              data += "a=sendonly\r\n" ;
            }


            sdpContent.setData( data.getBytes() ) ;

          }


          else {

            if ( cs.bSrc ) {
              if ( szConnectAddrUAC == null ) {
                szConnectAddrUAC = szConnectAddr ;
              }
            }
            else {
              if ( szConnectAddrUAS == null ) {
                szConnectAddrUAS = szConnectAddr ;
              }
            }


            // Add "a=sendrecv"
            if ( data.indexOf( "a=sendrecv" ) < 0 ) {
              data += "a=sendrecv\r\n" ;
            }


            sdpContent.setData( data.getBytes() ) ;
          }

        }

      }
    }

    catch ( Exception ex ) {
    }



    super.procINVITE( cs, sippacket, bRequest ) ;
  }

}
Back to top
View user's profile
wsadkin
Brekeke Member


Joined: 14 Nov 2010
Posts: 17
Location: Massachusetts

PostPosted: Wed Jul 16, 2014 11:40 am    Post subject: Reply with quote

Thanks Laurie;

There's only one problem: I've never worked with java or compiled a .jar file, so I don't know how to go from what you've graciously provided to something I can use. Can you provide me with the .jar you built and/or give me "face the stove" instructions on building it for myself and then installing it on my system?

Thanks,
/Will Sadkin
Back to top
View user's profile
wsadkin
Brekeke Member


Joined: 14 Nov 2010
Posts: 17
Location: Massachusetts

PostPosted: Wed Jul 16, 2014 2:23 pm    Post subject: Reply with quote

(I should reiterate that I'm on Windows...)
Back to top
View user's profile
Tata
Brekeke Master Guru


Joined: 27 Jan 2008
Posts: 223

PostPosted: Wed Jul 16, 2014 7:03 pm    Post subject: Reply with quote

Brekeke's plug-in is java based.
It means OS is not a matter.
Back to top
View user's profile
wsadkin
Brekeke Member


Joined: 14 Nov 2010
Posts: 17
Location: Massachusetts

PostPosted: Thu Jul 17, 2014 12:58 pm    Post subject: Reply with quote

Laurie,

I found this post (http://www.brekeke-sip.com/bbs/viewtopic.php?t=5338) which pointed me in enough of the right direction that I think I have compiled and produced the necessary jar file. (I had to replace "proxy" with "sip" in the paths, but it seemed to compile with no errors, and I put the resulting jar in the appropriate lib dir with the others.)

I then went to the Configuration/Advanced tab in the BSS control UI, and specified

Code:
dialplan.plugins.matching.pkg = plugin.session


since that seems to be what's at the top of your example. (Please let me know if this is correct or if not, how I should activate the plugin.)

However, I'm a bit confused on the resulting dial plan/admin UI details; your classes' procINVITE method signature looks like:

Code:
public void procINVITE( com.brekeke.net.sip.sv.ClientStat cs, com.brekeke.net.sip.SIPpacket sippacket, boolean bRequest )
   {

That is, it takes something other than a string as its first argument, and it doesn't return anything, so it doesn't follow the tutorial's model of invoking the plugin, as there's no deployment pattern that seems applicable, so I don't understand how to therefore apply this method in the dial plan.

Can you give me an example of how you would write a rule that uses this?

Thanks in advance
Back to top
View user's profile
Laurie
Brekeke Master Guru


Joined: 07 Jan 2008
Posts: 243

PostPosted: Wed Jul 23, 2014 5:02 pm    Post subject: Reply with quote

Hi

> I then went to the Configuration/Advanced tab in the BSS control UI, and specified
> dialplan.plugins.matching.pkg = plugin.session


You don't have to put it in the [Advanced] page.

For executing the plugin, use this line in the Deploy Pattern.
$session = plugin.session.test


so the DialPlan rule will look like this.
Matching Patterns
$request = ^INVITE
Deploy Patterns
$session = plugin.session.test
$continue = true



> and it doesn't return anything, so it doesn't follow the tutorial's model of invoking the plugin,

Refer the section "3. SIP-METHOD PROCEDURE".
A method named "procXXX" doesn't return anything.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Brekeke Forum Index » Brekeke SIP Server Forum All times are GMT - 7 Hours
Page 1 of 1