Brekeke Forum Index » Brekeke SIP Server Forum

Post new topic   Reply to topic
Dialplan plugin executed twice
Author Message
troelsmunch
Brekeke Member


Joined: 31 Jan 2007
Posts: 18

PostPosted: Tue Apr 22, 2008 1:29 am    Post subject: Dialplan plugin executed twice Reply with quote

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
View user's profile
lakeview
Brekeke Master Guru


Joined: 15 Nov 2007
Posts: 319
Location: Florida

PostPosted: Tue Apr 22, 2008 10:53 am    Post subject: Reply with quote

Do you have another DialPlan rule definition which calls $dialplan.findtonumber? If so, disable it.
Back to top
View user's profile
troelsmunch
Brekeke Member


Joined: 31 Jan 2007
Posts: 18

PostPosted: Tue Apr 22, 2008 10:57 am    Post subject: Reply with quote

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
View user's profile
lakeview
Brekeke Master Guru


Joined: 15 Nov 2007
Posts: 319
Location: Florida

PostPosted: Tue Apr 22, 2008 3:33 pm    Post subject: Reply with quote

When you make a call to the SIP Server, how many sessions can you see in [Active Sessions] page?
Back to top
View user's profile
troelsmunch
Brekeke Member


Joined: 31 Jan 2007
Posts: 18

PostPosted: Tue Apr 22, 2008 11:55 pm    Post subject: Reply with quote

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
View user's profile
lakeview
Brekeke Master Guru


Joined: 15 Nov 2007
Posts: 319
Location: Florida

PostPosted: Wed Apr 23, 2008 10:35 am    Post subject: Reply with quote

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
View user's profile
troelsmunch
Brekeke Member


Joined: 31 Jan 2007
Posts: 18

PostPosted: Fri Apr 25, 2008 5:09 am    Post subject: Reply with quote

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
View user's profile
lakeview
Brekeke Master Guru


Joined: 15 Nov 2007
Posts: 319
Location: Florida

PostPosted: Mon Apr 28, 2008 12:58 pm    Post subject: Reply with quote

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
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