Forums Read-only archive

MySQL Query in Dial Plan

12 posts · Brekeke SIP Server Forum

Izzyg Original post
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
What's the exception message?

Did you follow wiki?
http://wiki.brekeke.com/wiki/Execute-SQ ... m-Dialplan
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
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
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
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
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
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
This is a Version 2.4.8.6 Deployment
ambrosio
The version 2.4.8.6 is pretty stable but old..
Izzyg
is it possible to setup concurrent calls on this version ?
ambrosio
It seems there are no such API sets in ver 2.