Isolating the session plugin - dialplan issues.
Moderator: Brekeke Support Team
-
- Posts: 18
- Joined: Wed Jan 31, 2007 1:22 am
Isolating the session plugin - dialplan issues.
1. Brekeke Product Name and version: 2.0.7.2
2. Java version:Latest
3. OS type and the version: Win2k3 Server
4. Your problem:
I have the following dialplan (in this specific order):
Matching:
$request=^INVITE
Deploy:
To=(.+)
$session=com.test.dialplan.plugin.adpfordialplan
$continue=true
Matching:
$request=^INVITE
$dialplan.findtonumber( To )=(.+)
Deploy:
$target="someIP":5060
To=sip:%1@"someIP"
Both the session and the dialplan plugin works very good.
A little brief information is needed to understand my problem:
The session plugin is primarily for accounting. It checks the callers current balance within our system and sets a scheduled timeout for the call according to the user's balance and the dialed destination. I the session plugin I look up the corresponding CallPatern (Destination) and price based on the dialed number - if the session plugin can not determine the destination of the call, hence can not decide how to charge the call, the call is ended.
The dialplan plugin will in some cases change the To field. In some cases the plugin adds some digits in the beginning of the dialed number, because it is need by our service provider.
Now, the problem is when the To field is changed by the dialplan plugin then the session plugin can not look up the number, because the number does not match any of my callpaterns due to the changed to field.
I would like to be able to isolate the the first dialplan rule (session plugin) so that whatever is done later in the dialplan would not affect the session plugin.
I very open to other solutions as well, as long as it is done within the dialplan.
Thanks!
2. Java version:Latest
3. OS type and the version: Win2k3 Server
4. Your problem:
I have the following dialplan (in this specific order):
Matching:
$request=^INVITE
Deploy:
To=(.+)
$session=com.test.dialplan.plugin.adpfordialplan
$continue=true
Matching:
$request=^INVITE
$dialplan.findtonumber( To )=(.+)
Deploy:
$target="someIP":5060
To=sip:%1@"someIP"
Both the session and the dialplan plugin works very good.
A little brief information is needed to understand my problem:
The session plugin is primarily for accounting. It checks the callers current balance within our system and sets a scheduled timeout for the call according to the user's balance and the dialed destination. I the session plugin I look up the corresponding CallPatern (Destination) and price based on the dialed number - if the session plugin can not determine the destination of the call, hence can not decide how to charge the call, the call is ended.
The dialplan plugin will in some cases change the To field. In some cases the plugin adds some digits in the beginning of the dialed number, because it is need by our service provider.
Now, the problem is when the To field is changed by the dialplan plugin then the session plugin can not look up the number, because the number does not match any of my callpaterns due to the changed to field.
I would like to be able to isolate the the first dialplan rule (session plugin) so that whatever is done later in the dialplan would not affect the session plugin.
I very open to other solutions as well, as long as it is done within the dialplan.
Thanks!
Hi troelsmunch,
How about this idea??
Matching:
$request = ^INVITE
To = (.+)
Deploy:
X-Original-To = %1
$session = com.test.dialplan.plugin.adpfordialplan
$continue = true
By the above new your first DialPlan rule, the original To header is stored in "X-Original-To" header.
So you can obtain original To's information by "X-Original-To" in the session plugin even if the DialPlan plugin changes To header.
How about this idea??
Matching:
$request = ^INVITE
To = (.+)
Deploy:
X-Original-To = %1
$session = com.test.dialplan.plugin.adpfordialplan
$continue = true
By the above new your first DialPlan rule, the original To header is stored in "X-Original-To" header.
So you can obtain original To's information by "X-Original-To" in the session plugin even if the DialPlan plugin changes To header.
-
- Posts: 18
- Joined: Wed Jan 31, 2007 1:22 am
Hi
Try the following in your session plugin.
Try the following in your session plugin.
Code: Select all
String originalTo = sippacket.getValue( "X-Original-To" ) ;
-
- Posts: 18
- Joined: Wed Jan 31, 2007 1:22 am
But is the sippacket object passed on to the session plugin?lakeview wrote:Code: Select all
String originalTo = sippacket.getValue( "X-Original-To" ) ;
My session plugin looks like this:
Code: Select all
public class adpfordialplan extends AccountingBase
{
String connectionUrl = "myConnectionURL";
String jdbcPath = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
int mIntTalkTimeout;
public adpfordialplan()
{
mIntTalkTimeout = 0;
}
public int eventSessionStart(EventStat evstat, String[] argprm)
{
logic objLogic = new logic();
beginSession objBeginSession = objLogic.sessionStart (evstat);
if (objBeginSession.getMIntMaxTalktime () > 0)
mIntTalkTimeout = objBeginSession.getMIntMaxTalktime();
else if (objBeginSession.getMIntSIPreturnValue() == 0)
{
java.util.Date dateToday = new java.util.Date();
return 402;
}
return objBeginSession.getMIntSIPreturnValue ();
}
public void eventTalkStart(EventStat evstat)
{
setScheduleTerminate(mIntTalkTimeout);
}
public void eventTalkEnd(EventStat evstat)
{
//Nothing here
}
public void eventSessionEnd(EventStat evstat)
{
logic objLogic = new logic();
objLogic.sessionEnd (evstat, getTalkLength ());
}
public void eventTimerup(EventStat evstat, long id)
{
}
}
Thanks
Hi,
Please modify your eventSessionStart as the following...
And use the DialPlan rule below.
Please modify your eventSessionStart as the following...
Code: Select all
public int eventSessionStart( EventStat evstat, String[] argprm )
{
String originalTo = null ;
if ( ( argprm != null ) && ( argprm.length >= 2 ) && ( argprm[1] != null ) ) {
// get the original To header
originalTo = argprm[1] ;
}
//
// Your current code here.
//
}
I tried the above and it worked.Matching:
$request = ^INVITE
To = (.+)
Deploy:
$session = com.test.dialplan.plugin.adpfordialplan %1
$continue = true
-
- Posts: 18
- Joined: Wed Jan 31, 2007 1:22 am