MySQL Query in Dial Plan

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

MySQL Query in Dial Plan

Post by Izzyg »

1. Brekeke Product Name and Version: SIP Proxy Server

2. Java version:

3. OS type and the version: Windows

4. UA (phone), gateway or other hardware/software involved:

5. Your problem:

im trying to execute a MySQL Cmmand thru the Dial Plan, but its failing



com.brekeke.net.sip.sv.rule.matching.plugins.db.query (null:-1)
sun.reflect.NativeMethodAccessorImpl.invoke0 (null:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (null:-1)
sun.reflect.DelegatingMethodAccessorImpl.invoke (null:-1)
java.lang.reflect.Method.invoke (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getSpecialValue (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getValue (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.evalRule (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getMatch (null:-1)
com.brekeke.net.sip.sv.Dispatcher.run (null:-1)
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by ambrosio »

What's the exception message?

Did you follow wiki?
http://wiki.brekeke.com/wiki/Execute-SQ ... m-Dialplan
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

Exception: 06/06/15 03:38:05.354
java.lang.NullPointerException
com.brekeke.net.sip.sv.rule.matching.plugins.db.newConnection (null:-1)
com.brekeke.net.sip.sv.rule.matching.plugins.db.getConnection (null:-1)
com.brekeke.net.sip.sv.rule.matching.plugins.db.query (null:-1)
sun.reflect.NativeMethodAccessorImpl.invoke0 (null:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (null:-1)
sun.reflect.DelegatingMethodAccessorImpl.invoke (null:-1)
java.lang.reflect.Method.invoke (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getSpecialValue (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getValue (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.evalRule (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getMatch (null:-1)
com.brekeke.net.sip.sv.Dispatcher.run (null:-1)

Exception: 06/06/15 03:40:37.626
java.lang.NullPointerException
com.brekeke.net.sip.sv.rule.matching.plugins.db.newConnection (null:-1)
com.brekeke.net.sip.sv.rule.matching.plugins.db.getConnection (null:-1)
com.brekeke.net.sip.sv.rule.matching.plugins.db.query (null:-1)
sun.reflect.NativeMethodAccessorImpl.invoke0 (null:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (null:-1)
sun.reflect.DelegatingMethodAccessorImpl.invoke (null:-1)
java.lang.reflect.Method.invoke (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getSpecialValue (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getValue (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.evalRule (null:-1)
com.brekeke.net.sip.sv.rule.RuleTable.getMatch (null:-1)
com.brekeke.net.sip.sv.Dispatcher.run (null:-1)



Matching Pattern

$request=^INVITE
$addr=(.+)
$alias.lookup ("%1","AAA")=1
To=sip:(.*)(\d{10})@
From=sip:(.+)@
$alias.lookup ("%3","REG")=(.+)
$regaddr("%5")=(.+)
$db.query( "serverdb_sts1", "SELECT RegisteredAccount FROM serverdb_sts1.t_userdir WHERE username = '2025551212' " )=(.+)


Deploy Pattern

To=sip:%7@%6
From=sip:%4@10.0.0.14
$auth=false
$continue=false
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by ambrosio »

Izzyg,

It seems you didn't configure the DB settings correctly.

Do you have variables such as "serverdb_sts1.driver" in the [Configuration] > [Advanced] page ?

Have you read the wiki?
http://wiki.brekeke.com/wiki/Execute-SQ ... m-Dialplan
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

These are in the advanced configuration


# Failover settings
failover.timer.inviting=10
failover.timer.provisional=360
#net.listener.loglevel.file=255
#net.sip.loglevel.file=255
#dialplan.debug.log = true
#net.registrar.loglevel.file=255
file.log.system.size=10728640
file.log.system.overflow=2
file.log.session.date.str = true
#net.sip.timer.t1=500
net.dispatcher.max.stacked.time = 86400000
net.webget.log = true


db-name.driver = com.mysql.jdbc.Driver
db-name.url = jdbc:mysql://serverdns.com/serverdb_sts1
db-name.user = brekeke_sts1_rw
db-name.password = SecuredPassword

sipadmin.cmd.hosts.allow = ^10.10.0.11$|^10.10.0.15$
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by ambrosio »

db-name should be replaced with serverdb_sts1 as the example in the wiki.

serverdb_sts1.driver = com.mysql.jdbc.Driver
serverdb_sts1.url = jdbc:mysql://serverdns.com/serverdb_sts1
serverdb_sts1.user = brekeke_sts1_rw
serverdb_sts1.password = SecuredPassword

Now you got it.
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

That worked, thanks!!

how can i do a SELECT to see how many active calls a SIP Registration currently has,
i want to limit them to 24 calls
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by ambrosio »

Do you want to limit the number of calls each registered user?

Read this.
http://wiki.brekeke.com/wiki/Limit-conc ... gh-a-route
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

This is a Version 2.4.8.6 Deployment
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by ambrosio »

The version 2.4.8.6 is pretty stable but old..
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

is it possible to setup concurrent calls on this version ?
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by ambrosio »

It seems there are no such API sets in ver 2.
Post Reply