Author |
Message |
troelsmunch Brekeke Member
Joined: 31 Jan 2007 Posts: 18
|
Posted: Tue Apr 22, 2008 1:29 am Post subject: Dialplan plugin executed twice |
|
|
1. Brekeke Product Name and version: 2.0.7
2. Java version:Latest
3. OS type and the version:WIN2K3 R2
4. Your problem:
I know that this problem is discussed in another topic, but it seems to be a dead topic, and no solution has been found
http://www.brekeke-sip.com/bbs/viewtopic.php?t=5527&highlight=twice
I have the following dialplan:
Matching:
$request=^INVITE
To=(.+)
$dialplan.findtonumber( To )=(.+)
Deploy:
$session=com.adp.dialplan.plugin.adpfordialplan %1
$target=myTarget
To=sip:45440\#%2@myTarget
As you can see I have a session plugin which handles the billing. In addition to that I have a dialplan plugin which modifies the destination number based on some internal rules of mine.
The problem is that the dialplan plugin
$dialplan.findtonumber( To )=(.+)
is called twice. I'm writing to a file within the plugin code, and from that I can conclude that the plugin is executed twice for each incomming call.
Does anyone know how to avoid this?
Thanks,
Troels |
|
Back to top |
|
lakeview Brekeke Master Guru
Joined: 15 Nov 2007 Posts: 319
Location: Florida
|
Posted: Tue Apr 22, 2008 10:53 am Post subject: |
|
|
Do you have another DialPlan rule definition which calls $dialplan.findtonumber? If so, disable it. |
|
Back to top |
|
troelsmunch Brekeke Member
Joined: 31 Jan 2007 Posts: 18
|
Posted: Tue Apr 22, 2008 10:57 am Post subject: |
|
|
lakeview wrote: |
Do you have another DialPlan rule definition which calls $dialplan.findtonumber? If so, disable it. |
No I do not - this is the only rule. |
|
Back to top |
|
lakeview Brekeke Master Guru
Joined: 15 Nov 2007 Posts: 319
Location: Florida
|
Posted: Tue Apr 22, 2008 3:33 pm Post subject: |
|
|
When you make a call to the SIP Server, how many sessions can you see in [Active Sessions] page? |
|
Back to top |
|
troelsmunch Brekeke Member
Joined: 31 Jan 2007 Posts: 18
|
Posted: Tue Apr 22, 2008 11:55 pm Post subject: |
|
|
lakeview wrote: |
When you make a call to the SIP Server, how many sessions can you see in [Active Sessions] page? |
One - only one. |
|
Back to top |
|
lakeview Brekeke Master Guru
Joined: 15 Nov 2007 Posts: 319
Location: Florida
|
Posted: Wed Apr 23, 2008 10:35 am Post subject: |
|
|
I tried it in my environment.. but my plug-in was called once.. it seems no problem.
if possible, paste your code here. |
|
Back to top |
|
troelsmunch Brekeke Member
Joined: 31 Jan 2007 Posts: 18
|
Posted: Fri Apr 25, 2008 5:09 am Post subject: |
|
|
Yes, here is the code in dialplan.findtonumber
Code: |
static public String findtonumber(String[] arg, com.brekeke.net.sip.SIPpacket sippacket, Properties pr) throws Exception
{
String strSIPto = stripCalleeURL(sippacket.getValue("To"));
int iCallPatternID = Integer.parseInt(sippacket.getValue("X-callpatternid"));
//Adding leading 0 to all Italian landline numbers
if (iCallPatternID == 14848)
strSIPto = ItalyLandline(strSIPto);
try
{
FileWriter fil = new FileWriter("c:/ondo/test/" + evstat.callid + "-findtonumber.txt", true);
PrintWriter ud = new PrintWriter(fil);
ud.println(strSIPto);
ud.close();
}
catch (Exception e2)
{
}
return strSIPto;
}
|
In the output in the textfile I can see that there has been written twice for each call.
Thanks. |
|
Back to top |
|
lakeview Brekeke Master Guru
Joined: 15 Nov 2007 Posts: 319
Location: Florida
|
Posted: Mon Apr 28, 2008 12:58 pm Post subject: |
|
|
Hi
I looked at the above source code and tried the same plug-in in my environment, but I did not get any issue.
It means the plug-in was executed once with a call and the text file was written once.
If you use a packet capture (e.g...Wireshark), how many INVITE can you see when you make a call? |
|
Back to top |
|
|