Dial Plan Plugin Help
Moderator: Brekeke Support Team
Dial Plan Plugin Help
1. Brekeke Product Name and Version: Brekeke SIP Server 3.6.2.5
2. Java version:1.7
3. OS type and the version: 64-bit RHEL6.6
4. UA (phone), gateway or other hardware/software involved:
5. Your problem:Dial Plan Plugin Not Working
Here is what I did.
1. Created a CLASS_PATH environment variable with value
CLASS_PATH=/usr/local/apache-tomcat-7.0.72/webapps/sip/WEB-INF/lib/ondosip.jar
2. Created sni.java file with following content:
package plugin ;
import java.util.* ;
public class sni
{
static public String hello( String[] arg, com.brekeke.net.sip.SIPpacket sippacket, Properties pr ) throws Exception
{
return ( "hello" ) ;
}
static public String get_sip_call_id( String[] arg, com.brekeke.net.sip.SIPpacket sippacket, Properties pr ) throws Exception
{
String sipcallid = sippacket.getValue("Call-ID");
return ( sipcallid ) ;
}
}
3. Compiled it by "javac -g sni.java".
4. Created a jar file by "jar -tvf sni.jar sni.class"
5. copied the sni.jar file in /usr/local/apache-tomcat-7.0.72/webapps/sip/WEB-INF/lib
6. added the following line in a working DialPlan Matching Pattern
[Matching Pattern]
$sni.get_sip_call_id = (.+)
7. Added the following line in deploy pattern
$log = mydebug:%3
When the call comes in call it not matching on the dial plan. What am I doing wrong?
2. Java version:1.7
3. OS type and the version: 64-bit RHEL6.6
4. UA (phone), gateway or other hardware/software involved:
5. Your problem:Dial Plan Plugin Not Working
Here is what I did.
1. Created a CLASS_PATH environment variable with value
CLASS_PATH=/usr/local/apache-tomcat-7.0.72/webapps/sip/WEB-INF/lib/ondosip.jar
2. Created sni.java file with following content:
package plugin ;
import java.util.* ;
public class sni
{
static public String hello( String[] arg, com.brekeke.net.sip.SIPpacket sippacket, Properties pr ) throws Exception
{
return ( "hello" ) ;
}
static public String get_sip_call_id( String[] arg, com.brekeke.net.sip.SIPpacket sippacket, Properties pr ) throws Exception
{
String sipcallid = sippacket.getValue("Call-ID");
return ( sipcallid ) ;
}
}
3. Compiled it by "javac -g sni.java".
4. Created a jar file by "jar -tvf sni.jar sni.class"
5. copied the sni.jar file in /usr/local/apache-tomcat-7.0.72/webapps/sip/WEB-INF/lib
6. added the following line in a working DialPlan Matching Pattern
[Matching Pattern]
$sni.get_sip_call_id = (.+)
7. Added the following line in deploy pattern
$log = mydebug:%3
When the call comes in call it not matching on the dial plan. What am I doing wrong?
For getting Call-ID, you just use "Call-ID = (.+)" in Matching Pattern.
> 7. Added the following line in deploy pattern
> $log = mydebug:%3
Why is it %3 not %1?
Try this.
Deploy Patterns
$log = mydebug:%{$sni.get_sip_call_id}
For debugging Dial Plan script, check "Dial Plan" in [Diagnostics]->[Debug Logs] page.
> 7. Added the following line in deploy pattern
> $log = mydebug:%3
Why is it %3 not %1?
Try this.
Deploy Patterns
$log = mydebug:%{$sni.get_sip_call_id}
For debugging Dial Plan script, check "Dial Plan" in [Diagnostics]->[Debug Logs] page.
I appreciate your response. I know I can use Call-ID= (.+) in the matching pattern to get the value of call-id. But I was trying to write a simple pluging to see if it works or not.
Here is my complete matching and deploy patters
[Matching Patterns]
$addr = 10\.1\.1\.1
From = sip:(.+)@
$request = sip:123(.+)@
$getUri(Call-ID) = (.+)
$sni.get_sip_call_id = (.+)
[Deploy Patterns]
From = sip:%1@10.2.2.2
To = sip:%2@10.3.3.3
$b2bua = true
$rtp = false
$session = sdp
&sdp.audio.a.1 = ptime:20
&sdp.audio.a.2 = silenceSupp:off - - - -
Call-ID = B%3
$log = myDebug_BrekekeVar3:%3
$log = myDebug_myPluginVar4:%4
Eventually. my goal is to get the SIP CALL-ID from leg-A and prefix it with "B" and send it on leg-B.
Call is not matching on my dial plan because plugin may be returning null value.
Question1: I would appreciate if you can tell me what I am doing wrong in the plugin?
Question2: I went through the instructions mentioned on http://www.brekeke.com/doc/sip/sip_tuto ... plugin.txt. Do I have to complete the step # 2 along with step # 1 under section 3. HOW TO INSTALL PLUGIN?
Question3: How Can I set the value of Call-ID in plugin, may be something like
sippacket.setValue( "header_name","header_value" )?
Here is my complete matching and deploy patters
[Matching Patterns]
$addr = 10\.1\.1\.1
From = sip:(.+)@
$request = sip:123(.+)@
$getUri(Call-ID) = (.+)
$sni.get_sip_call_id = (.+)
[Deploy Patterns]
From = sip:%1@10.2.2.2
To = sip:%2@10.3.3.3
$b2bua = true
$rtp = false
$session = sdp
&sdp.audio.a.1 = ptime:20
&sdp.audio.a.2 = silenceSupp:off - - - -
Call-ID = B%3
$log = myDebug_BrekekeVar3:%3
$log = myDebug_myPluginVar4:%4
Eventually. my goal is to get the SIP CALL-ID from leg-A and prefix it with "B" and send it on leg-B.
Call is not matching on my dial plan because plugin may be returning null value.
Question1: I would appreciate if you can tell me what I am doing wrong in the plugin?
Question2: I went through the instructions mentioned on http://www.brekeke.com/doc/sip/sip_tuto ... plugin.txt. Do I have to complete the step # 2 along with step # 1 under section 3. HOW TO INSTALL PLUGIN?
Question3: How Can I set the value of Call-ID in plugin, may be something like
sippacket.setValue( "header_name","header_value" )?
Since this is User Discussion Forum, I recommend that you contact Brekeke's tech support if you want to develop own plugin.
http://www.brekeke.com/company/inquiry.php
http://www.brekeke.com/company/inquiry.php
Harold, keeping business requirements aside, I would like to learn about the dial Plan plugins. I would appreciate if you can guide me for this simple plugin. I have modified the dial plan as per your suggestion.
[Matching Patterns]
$addr = 10\.1\.1\.1
From = sip:(.+)@
$request = sip:123(.+)@
[Deploy Patterns]
From = sip:%1@10.2.2.2
To = sip:%2@10.3.3.3
$b2bua = true
$rtp = false
$log = mydebug:%{$sni.get_sip_call_id}
I am getting the following error.
[Matching Patterns]
$addr = 10\.1\.1\.1
From = sip:(.+)@
$request = sip:123(.+)@
[Deploy Patterns]
From = sip:%1@10.2.2.2
To = sip:%2@10.3.3.3
$b2bua = true
$rtp = false
$log = mydebug:%{$sni.get_sip_call_id}
I am getting the following error.
Code: Select all
Rule: Error: class=com.brekeke.plugin.sni method=get_sip_call_id ex=java.lang.ClassNotFoundException: com.brekeke.plugin.sni
Rule: Error: class=com.brekeke.net.sip.sv.rule.matching.plugins.sni method=get_sip_call_id ex=java.lang.ClassNotFoundException: com.brekeke.net.sip.sv.rule.matching.plugins.sni
Rule: Error: class=com.brekeke.plugin.sni method=doDispatch ex=java.lang.ClassNotFoundException: com.brekeke.plugin.sni
Rule: Error: class=com.brekeke.net.sip.sv.rule.matching.plugins.sni method=doDispatch ex=java.lang.ClassNotFoundException: com.brekeke.net.sip.sv.rule.matching.plugins.sni
> method=get_sip_call_id ex=java.lang.ClassNotFoundException: com.brekeke.plugin.sni
The error message indicates that the plugin's class and/or method is not found.
What Java package path did you specify for the class sni?
Is it "package plugin"? If so, the package is "plugin".
Put the line below at [Configuration]->[Advanced] page, and restart the SIP Server,
-------------------------
dialplan.plugins.matching.pkg = plugin
-------------------------
The error message indicates that the plugin's class and/or method is not found.
What Java package path did you specify for the class sni?
Is it "package plugin"? If so, the package is "plugin".
Put the line below at [Configuration]->[Advanced] page, and restart the SIP Server,
-------------------------
dialplan.plugins.matching.pkg = plugin
-------------------------
Ericcc, appreciate your response.
I have gone through the following steps:
Following is the source code in the sni.java file
Following are Matching/Deploy pattern
[Matching Patterns]
$addr = 10\.1\.1\.1
From = sip:(.+)@
$request = sip:123(.+)@
[Deploy Patterns]
From = sip:%1@10.2.2.2
To = sip:%2@10.3.3.3
$b2bua = true
$rtp = false
$log = mydebug:%{$sni.get_sip_call_id}
I am still getting the following errors:
I have gone through the following steps:
Code: Select all
1 ## Added the following.
[Configuration]->[Advanced] --> dialplan.plugins.matching.pkg = plugin
2 ## Added classpath to environment
CLASSPATH=/usr/local/apache-tomcat-7.0.72/webapps/sip/WEB-INF/lib/ondosip.jar
3 ##Created java code file.
/home/skb007/java> vi sni.java
4 ##Complied the java file.
/home/skb007/java> javac -g sni.java
5 ## Created the jar file.
/home/skb007/java> jar -cvf sni.jar sni.class
6 ## check the contents of the jar file.
/home/skb007/java> jar -tvf sni.jar
0 Mon Oct 02 15:11:54 EDT 2017 META-INF/
68 Mon Oct 02 15:11:54 EDT 2017 META-INF/MANIFEST.MF
855 Mon Oct 02 15:09:38 EDT 2017 sni.class
7 ## copied the jar file to /usr/local/apache-tomcat-7.0.72/webapps/sip/WEB-INF/lib/
/home/skb007/java> cp sni.jar /usr/local/apache-tomcat-7.0.72/webapps/sip/WEB-INF/lib/sni.jar
8 ## Restarted the Apache-Tomcat server
/home/skb007/java> /usr/local/apache-tomcat-7.0.72/bin/shutdown.sh
/home/skb007/java> /usr/local/apache-tomcat-7.0.72/bin/startup.sh
Code: Select all
package plugin ;
import java.util.* ;
public class sni
{
static public String hello( String[] arg, com.brekeke.net.sip.SIPpacket sippacket, Properties pr ) throws Exception
{
return ( "hello" ) ;
}
static public String get_sip_call_id( String[] arg, com.brekeke.net.sip.SIPpacket sippacket, Properties pr ) throws Exception
{
String sipcallid = sippacket.getValue("Call-ID");
return ( sipcallid ) ;
}
}
[Matching Patterns]
$addr = 10\.1\.1\.1
From = sip:(.+)@
$request = sip:123(.+)@
[Deploy Patterns]
From = sip:%1@10.2.2.2
To = sip:%2@10.3.3.3
$b2bua = true
$rtp = false
$log = mydebug:%{$sni.get_sip_call_id}
I am still getting the following errors:
Code: Select all
Rule: Error: class=plugin.sni method=get_sip_call_id ex=java.lang.ClassNotFoundException: plugin.sni
Rule: Error: class=com.brekeke.net.sip.sv.rule.matching.plugins.sni method=get_sip_call_id ex=java.lang.ClassNotFoundException: com.brekeke.net.sip.sv.rule.matching.plugins.sni
Rule: Error: class=plugin.sni method=doDispatch ex=java.lang.ClassNotFoundException: plugin.sni
Rule: Error: class=com.brekeke.net.sip.sv.rule.matching.plugins.sni method=doDispatch ex=java.lang.ClassNotFoundException: com.brekeke.net.sip.sv.rule.matching.plugins.sni
Is it the purpose of DialPlan plugin?
Note that DialPlan plugin is executed with each initial INVITE only.
It means you can manipulate first SDP attached in an initial INVITE.
If you want to manipulate all SDP including 200 OK's and re-INVITE's, you need to use Session Plugin instead of DialPlan plugin.
Note that DialPlan plugin is executed with each initial INVITE only.
It means you can manipulate first SDP attached in an initial INVITE.
If you want to manipulate all SDP including 200 OK's and re-INVITE's, you need to use Session Plugin instead of DialPlan plugin.