[Freeswitch-users] Nibblebill database question

David Villasmil david.villasmil.work at gmail.com
Wed Feb 13 02:26:48 MSK 2013


ok, some more info:


/etc/odbc.ini

cat /etc/odbc.ini
[freeswitch]
Driver          = /usr/lib/odbc/libmyodbc.so
SERVER          = localhost
PORT            = 3306
DATABASE        = freeswitch
OPTION          = 67108864
USER            = root
PASSWORD        = dv092171

[mydb]
Driver          = /usr/lib/odbc/libmyodbc.so
SERVER          = localhost
PORT            = 3306
DATABASE        = viking
OPTION          = 67108864
USER            = root
PASSWORD        = mypass





switch.conf.xml

    <param name="core-db-dsn" value="freeswitch:root:mypass" />




nibblebill:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="freeswitch/xml">
    <section name="configuration">
        <configuration name="nibblebill.conf" description="Nibble Billing">
            <settings>
                <param name="db_username" value="root"></param>
                <param name="db_password" value="mypass"></param>
                <param name="db_dsn" value="mydb"></param>
                <param name="db_table" value="sip_users"></param>
                <param name="db_column_cash" value="balance"></param>
                <param name="db_column_account" value="id"></param>
                <param name="global_heartbeat" value="10"></param>
                <param name="lowbal_amt" value="0"></param>
                <param name="lowbal_action" value="play ding"></param>
                <param name="nobal_amt" value="0"></param>
                <param name="nobal_action" value="hangup"></param>
                <param name="percall_max_amt" value="100"></param>
                <param name="percall_action" value="hangup"></param>
            </settings>
        </configuration>
    </section>
</document>



dialplan:



<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="freeswitch/xml">
    <section name="dialplan">
        <context name="gold">
            <extension name="dynamic_extension">
                <condition field="destination_number" expression="^001.*">
                    <action application="set"
data="continue_on_fail=NO_ROUTE_DESTINATION,UNALLOCATED_NUMBER,407"></action>
                    <action application="set"
data="sip_from_user=1002"></action>
                    <action application="set"
data="sip_auth_username=1002"></action>
                    <action application="set"
data="sip_req_user=1002"></action>
                    <action application="set"
data="hangup_after_bridge=true"></action>
                    <action application="set"
data="nibble_rate=0.0500"></action>
                    <action application="set"
data="nibble_account=1"></action>
                    <action application="set"
data="gw=${distributor(TEST_ROUTE)}"></action>
                    <action application="bridge"
data="sofia/gateway/${gw}/0013058883456"></action>
                </condition>
            </extension>
        </context>
    </section>
</document>





call goes out fine... no billing though:


2013-02-12 19:21:49.844277 [DEBUG] mod_nibblebill.c:504 22 seconds passed
since last bill time of 2013-02-12 19:21:27
2013-02-12 19:21:49.844277 [DEBUG] mod_nibblebill.c:521 Billing $0.018983
to 1 (Call: d442dc6b-a3a7-423a-8450-598d17ca43b3 / 0.000000 so far)
2013-02-12 19:21:49.844277 [DEBUG] mod_nibblebill.c:351 Doing update query
[UPDATE sip_users SET balance=balance-0.018983 WHERE ='1']
2013-02-12 19:21:49.844277 [CRIT] mod_nibblebill.c:535 Failed to log to
database!
2013-02-12 19:21:49.844277 [DEBUG] mod_nibblebill.c:378 Doing lookup query
[SELECT balance AS nibble_balance FROM sip_users WHERE ='1']
2013-02-12 19:21:49.844277 [ERR] mod_nibblebill.c:380 Error running this
query: [SELECT balance AS nibble_balance FROM sip_users WHERE ='1']


the select go fine if executed "by hand"



Thanks for your help!


David


On Tue, Feb 12, 2013 at 8:33 PM, David Villasmil <
david.villasmil.work at gmail.com> wrote:

> Hello,
>
> Is uncommenting the "custom sql" lines mandatory?? it doesn't seem so, i
> do see nibblebill trying to do it's job:
>
> 2013-02-12 19:32:07.784156 [DEBUG] mod_nibblebill.c:351 Doing update query
> [UPDATE sip_users SET balance=balance-0.027683 WHERE id='1']
> 2013-02-12 19:32:07.784156 [CRIT] mod_nibblebill.c:535 Failed to log to
> database!
> 2013-02-12 19:32:07.784156 [DEBUG] mod_nibblebill.c:378 Doing lookup query
> [SELECT balance AS nibble_balance FROM sip_users WHERE id='1']
> 2013-02-12 19:32:07.784156 [ERR] mod_nibblebill.c:380 Error running this
> query: [SELECT balance AS nibble_balance FROM sip_users WHERE id='1']
>
>
> On Tue, Feb 12, 2013 at 8:23 PM, David Villasmil <
> david.villasmil.work at gmail.com> wrote:
>
>> No, there's nothing related to db:
>>
>> 2013-02-12 19:23:04.823909 [CONSOLE] switch_loadable_module.c:1348
>> Successfully Loaded [mod_nibblebill]
>> 2013-02-12 19:23:04.823909 [NOTICE] switch_loadable_module.c:254 Adding
>> Application 'nibblebill'
>> 2013-02-12 19:23:04.823909 [NOTICE] switch_loadable_module.c:298 Adding
>> API Function 'nibblebill'
>>
>>
>>
>>
>> On Tue, Feb 12, 2013 at 8:04 PM, Avi Marcus <avi at avimarcus.net> wrote:
>>
>>> Last I saw, if you load/reload mod_nibblebill, it logs which DSN it's
>>> using to fs_cli / freeswitch.log.
>>>
>>> -Avi
>>>
>>> On Tue, Feb 12, 2013 at 9:00 PM, David Villasmil <
>>> david.villasmil.work at gmail.com> wrote:
>>>
>>>> Yes, it does have the option, but it doesn't seem to be using a
>>>> different one... I must've missed something...
>>>>
>>>>
>>>> On Tue, Feb 12, 2013 at 7:53 PM, Avi Marcus <avi at avimarcus.net> wrote:
>>>>
>>>>> All modules that touch the DB (I think!) have their own configuration
>>>>> that allows you pick the database.
>>>>> mod_nibblebill does indeed has a param name="db_dsn" option so yes,
>>>>> it will honor that.
>>>>>
>>>>> -Avi
>>>>>
>>>>> On Tue, Feb 12, 2013 at 8:11 PM, David Villasmil <
>>>>> david.villasmil.work at gmail.com> wrote:
>>>>>
>>>>>> Hello guys,
>>>>>>
>>>>>> I have created 2 dsns, one for freeswitch core "freeswitch" and one
>>>>>> for nibblebill ("whatever").
>>>>>> Is it possible to use different dsns in core and nibblebill? or does
>>>>>> nibblebill uses the same dsn as the core??
>>>>>>
>>>>>> thanks
>>>>>>
>>>>>> David
>>>>>>
>>>>>>
>>>>>> _________________________________________________________________________
>>>>>> Professional FreeSWITCH Consulting Services:
>>>>>> consulting at freeswitch.org
>>>>>> http://www.freeswitchsolutions.com
>>>>>>
>>>>>> 
>>>>>> 
>>>>>>
>>>>>> Official FreeSWITCH Sites
>>>>>> http://www.freeswitch.org
>>>>>> http://wiki.freeswitch.org
>>>>>> http://www.cluecon.com
>>>>>>
>>>>>> FreeSWITCH-users mailing list
>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>> UNSUBSCRIBE:
>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>> http://www.freeswitch.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________________________________
>>>>> Professional FreeSWITCH Consulting Services:
>>>>> consulting at freeswitch.org
>>>>> http://www.freeswitchsolutions.com
>>>>>
>>>>> 
>>>>> 
>>>>>
>>>>> Official FreeSWITCH Sites
>>>>> http://www.freeswitch.org
>>>>> http://wiki.freeswitch.org
>>>>> http://www.cluecon.com
>>>>>
>>>>> FreeSWITCH-users mailing list
>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>> UNSUBSCRIBE:
>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>> http://www.freeswitch.org
>>>>>
>>>>>
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> 
>>>> 
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://wiki.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:
>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130213/c7d6e985/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list