Inbound DID Billing for A2Billing

Discussion in 'General' started by dwells, Sep 29, 2010.

  1. dwells

    Joined:
    Sep 29, 2009
    Messages:
    127
    Likes Received:
    0
    Hello Everyone...
    I'm writting this as I know it's been a topic for some time, and some posts have been made, which inspired me to write this.

    Here is what I did ... in a nutshell, to be able to charge customers for Inbound DID usage per minute, using the A2Billing rate engine. This allows for tiered billing, etc...

    Billing Inbound DID's

    This document will GUIDE you through setting up Inbound DID billing through the A2Billing rate engine.
    This allows for many more options with billing groups of numbers. You can use different prefixes for different pricing tiers.
    This document also assumes that you have setup a Trunk to your provider already, and can test it works in FreePBX routing plans.

    Here's the hard part first...
    Use whatever you are comfortable with to edit /etc/asterisk/extensions_a2billing.conf
    If you aren't comfortable with that, don't read any further. Thanks.

    This is what mine looks like at the moment:
    ==============================================-START OF FILE-============================================
    [a2billing]
    ; CallingCard application
    include => vmmain
    exten => _X.,1,Answer
    exten => _X.,2,Wait,2
    exten => _X.,3,DeadAGI,a2billing.php
    exten => _X.,4,Wait,2
    exten => _X.,5,Hangup

    [vmmain]
    exten => *97,1,Answer
    exten => *97,n,Wait(1)
    exten => *97,n,VoiceMailMain(${CALLERID(num)}@default)
    exten => *97,n,Hangup

    [a2billing-business]
    exten => _X.,1,Answer
    exten => _X.,n,DeadAGI(a2billing.php|3)
    exten => _X.,n,Hangup

    [custom-a2billing-did]
    exten => _X.,1,Answer
    exten => _X.,n,DeadAGI(a2billing.php|2|did)
    exten => _X.,n,Hangup

    [macro-dialout-trunk-predial-hook]
    exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2)
    exten => s,2,MacroExit

    [custom-freepbx-a2billing]
    exten => _X.,1,DeadAGI(a2billing.php|${OUT_${DIAL_TRUNK}:8})
    exten => _X.,n,Hangup()


    =================

    [custom-a2billing]
    exten => _X.,1,Answer
    exten => _X.,n,DeadAGI(a2billing.php|1)
    exten => _X.,n,Hangup

    [a2billing-callback]
    exten => _X.,1,Answer
    exten => _X.,1,DeadAGI(a2billing.php|2|callback)
    exten => _X.,n,Hangup

    [custom-a2billing-callback]
    exten => _X.,1,Answer
    exten => _X.,1,DeadAGI(a2billing.php|2|callback)
    exten => _X.,n,Hangup

    [a2billing-cid-callback]
    exten => _X.,1,DeadAGI(a2billing.php|2|cid-callback|1
    exten => _X.,n,Hangup
    ================================================-END OF FILE-=====================================================
    Feel free to copy and paste. Copy?

    In one of the config files (probably a custom one like: extension_custom.conf) look for:
    ;some comment about the next line
    #include extensions_a2billing.conf

    If you find this line great, if not add it exactly as shown. <Save File>

    From the PBX command prompt you are probably in or able to load quickly, type:
    asterisk -rx "reload" <Press Enter>

    You can also wait until the next steps are complete as this will reload Asterisk as well...


    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    FreePBX
    These are the FreePBX admin settings to change. If it's not mentioned, leave the default setting.
    When finished making all the changes to the settings, don't forget to apply them and reload(*Not reboot) the sever.

    CUSTOM TRUNK

    Add Custom Trunk
    Trunk Description: A2BILLING
    Custom Dial String: A2B/1
    <SUBMIT SETTINGS>

    CUSTOM DESTINATION

    Add Custom Destination
    Custom Destination: custom-a2billing-did,${EXTEN},1
    Desctiption: A2B-DID
    Notes: Wholesale DID's for A2B resale pool.
    <SUBMIT CHANGES>

    Add Custom Destination
    Custom Destination: custom-a2billing,${EXTEN},1
    Desctiption: A2B-CallCard (Or A2B-Passthrough)
    Notes: This DID will ask users for their pin number to allow passthrough of a toll call. (Remote Access to CC Account)
    <SUBMIT CHANGES>

    INBOUND ROUTES

    *This one is needed for a customer to purchase per month to ring their phones
    Add Incoming Route
    Description: A2B-DID
    DID Number: YOUR NUMBER HERE (NXXNXXXXXX)
    Custom Destination: A2B-DID
    <SUBMIT CHANGES>

    *This next one is optional to allow access into your Calling Card system
    Add Incoming Route
    Description: A2B-CallCard (or whatever you named it)
    DID Number: YOUR NUMBER HERE (NXXNXXXXXX)
    Custom Destination: A2B-CallCard
    <SUBMIT CHANGES>

    <APPLY CONFIGURATION CHANGES>
    <RELOAD SERVER>

    *At this point you can call in on your toll free number leading to A2B-CallCard and you should get a prompt to "enter your complete pin number"*
    *Those destined for A2B-DID must keep all hands and feet inside until we come to a complete stop...we're still moving...*


    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


    A2Billing Admin Web (I'm Using 1.7.1)

    PROVIDERS

    Add Provider
    Provider Name: This is usualy the supplier in FreePBX for inbound DID trunk.
    Description: A brief summary about this privder *optional
    <CONFIRM DATA>

    Add Trunk
    Voip Provider: <Select new Provider>
    Label: <Enter Provider Name>
    Remove Prefix: 2 (This can actually be anything that wouldn't interfere with dial plan) *This is a working example*
    Provider Tech: %dialingnumber%
    ***In my case I allow unlimited connections for the next option; suite your own needs
    Maximum Connections: -1
    IFMaxUsed: Use Failover Trunk (In this "test" server there is no fail over anyways)
    Status: Active
    <CONFIRM DATA>

    Add Prefix
    Prefix: 2
    Destination: Inbound DID
    <CONFIRM DATA>

    *If you don't have any call plans yet, this is the time to add call plans.*
    In this documents examples we will use the Global Unlimited Call Plan we've already created. The name should say it all.

    Add Rate Card
    Tariff: <Supplier Name> ;or anything you want really...InboundDID; DIDPool; etc...
    Trunk: <Guess What Trunk Goes Here> ;*Select the Trunk we just made...
    Description: This Rate Card is for (Group Name) DID numbers.
    DNID Prefix: 2
    CallerID Prefix: All
    <CONFIRM DATA>

    This next step is the actual rate setting, to be processed by the rate engine.
    You can get as detailed with the routes as you wish, like $0.10 for the first 2 minutes,
    then 0.075 for the rest of the call... etc...

    Here is a minimum setting for 0.10/Min for the whole call:

    Add Rate
    RateCard: <Supplier Name> ;or the previous step's name used...
    Dial Prefix: 2
    Destination Prefix: 2
    Buying Rate: 0.07 ;or your buying rate for this route
    Buyrate Min Duration: 30
    Buyrate Billing Block: 30
    Selling Rate: 0.10 ;or your selling rate for this route
    Sellrate Min Duration: 30
    Sellrate billing block: 30
    Trunk: <Supplier Name> ;or ...you know...
    <CONFIRM DATA>

    Click on the Call plan you may want this to apply to...like Global Unlimited...
    In the Add a New RateCard box at the bottom of the form, click on the new Rate Card
    Now Click <Add Rate Card>
    The Form will update with the new Ratecard for that Call Plan Package
    <CONFIRM DATA>

    INBOUND DID

    Add Group
    Name: NORAM
    <CONFIRM DATA>

    Add DID
    DID: NXXNXXXXXX formatted DID
    Billing: Fixed per Month + dialout
    DID Group: NORAM
    Country: <Your Country>
    Activated: Yes
    Monthly Rate: 5 ;or whatever you charge; 0=free
    <CONFIRM DATA>

    Add Destination
    Destination: *****Ok this is the trick right here***** use the card number with prefix of 2...so if the card number is 456789 then this box should look like this 2456789
    Activated: Yes
    Priority: 1
    Voip_Call: No ****** this is also part of the trick***** No means use the rate engine we just spent all that time setting up....No means Not Free....
    <CONFIRM DATA>

    *Those destined for A2B-DID can now breath a sigh of relief. You may also test the toll free number you just assocciated to "2456789", Answer the call.*
    When you're done talking to youself, check the Call Reports; CDR's...
    I know holy crap right?
    I don't feel like editing this much further right now, I'm tired...


    Have Fun...Hope That Helps
    DWELLSY
     
  2. Terry

    Joined:
    May 25, 2007
    Messages:
    174
    Likes Received:
    0
    Dear Sir,

    This is a good topic for read
    I am used Elastix 1.6.12 and A2billing 1.7.1
    calling card and freepbx extension Billing with a2billing is working Great

    I have some questions with a2billing callback

    1 should I install some files and enable a2billing callback ?How to enable a2billing callback?
    2 how to modify a2billing callback config ?

    I hope you can tell more about a2billing callback config and your experience,thanks
     
  3. dwells

    Joined:
    Sep 29, 2009
    Messages:
    127
    Likes Received:
    0
    Hello,

    First, I would start here for installing procedure:

    Callback
    Here is a little script to install the call-back Daemon. Change the LOAD_LOC variable to reflect where you have downloaded A2Billing.

    Callback Daemon installation Script
    LOAD_LOC=/usr/local/src/a2billing

    yum -y install python-setuptools.noarch
    yum -y install MySQL-python
    easy_install sqlalchemy

    cd $LOAD_LOC/Callback/callback-daemon-py
    cp $LOAD_LOC/CallBack/callback-daemon-py/build/lib/callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
    chmod +x /etc/init.d/a2b-callback-daemon


    cd $LOAD_LOC/CallBack/callback-daemon-py/
    python setup.py build
    python setup.py bdist_egg
    easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg
    chkconfig --add a2b-callback-daemon
    service a2b-callback-daemon start
    chkconfig a2b-callback-daemon on


    This is a copy from http://www.asterisk2billing.org/cgi-bin ... stallation ;so I take no credit for this script...

    As far as usage and configuration, I think then depends on whether you are using real-time database or config file (a2billing.conf). Maybe others can elaborate a little more who actually use call back daemon.
    I do not use call back as there's no need for me, I only use inbound DIDs. Sorry that way...
     
  4. Terry

    Joined:
    May 25, 2007
    Messages:
    174
    Likes Received:
    0
    when i take this step
    easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg
    it show error message
    error: Not a URL, existing file, or requirement spec: 'dist/callback_daemon-1.0.prod_r1528-py2.4.egg'
    after check my dist files---
    callback_daemon-1.0.prod-py2.4.egg
    callback_daemon-1.0.prod_r1528-1.src.rpm
    callback_daemon-1.0.prod_r1527-py2.5.egg
    callback_daemon-1.0.prod-r1528.tar.gz
    callback_daemon-1.0.prod_r1528-1.noarch.rpm

    and try easy_install dist/callback_daemon-1.0.prod_r1527-py2.5.egg
    Error Message again
    No local packages or download links found for callback-daemon==1.0.prod-r1527
    error: Could not find suitable distribution for Requirement.parse('callback-daemon==1.0.prod-r1527'

    easy_install callback_daemon-1.0.prod_r1527-py2.5.egg
    Processing callback_daemon-1.0.prod_r1527-py2.5.egg
    Removing /usr/lib/python2.4/site-packages/callback_daemon-1.0.prod_r1527-py2.5.egg
    Copying callback_daemon-1.0.prod_r1527-py2.5.egg to /usr/lib/python2.4/site-packages
    callback-daemon 1.0.prod-r1527 is already the active version in easy-install.pth
    Installing a2b_callback_daemon script to /usr/bin

    Installed /usr/lib/python2.4/site-packages/callback_daemon-1.0.prod_r1527-py2.5.egg
    Processing dependencies for callback-daemon==1.0.prod-r1527
    Searching for callback-daemon==1.0.prod-r1527
    Reading http://cheeseshop.python.org/pypi/callback-daemon/
    error: Download error: (101, 'Network is unreachable')


    What files should i need easy-install XXXXXXXXXXXXXXXXXXXXXXXXX

    Please help thanks
     
  5. dwells

    Joined:
    Sep 29, 2009
    Messages:
    127
    Likes Received:
    0
    I might suggest that you make sure that you have everything updated.
    then look at:

    http://forum.asterisk2billing.org/viewt ... =21&t=6858
    and
    http://forum.asterisk2billing.org/viewt ... 137#p31137

    These links may help you find where the problem truely lies.

    Remember this was a guide only. The script that was listed was for a2b 1.4.x. You are running 1.7.x. I'm sure there are differences in installing...

    Read things over, then re-read them to make sure the steps you take are the ones
    for you own distro. Dont be afraid to ask BEFORE you copy and paste commands.
     
  6. Terry

    Joined:
    May 25, 2007
    Messages:
    174
    Likes Received:
    0
    Dear Sir,
    I am use this step by step manual
    yum -y install python-setuptools mysql-python python-psycopg2
    cd /usr/src/a2billing/CallBack/callback-daemon-py
    cp dist/callback_daemon-1.0.prod-r1528.tar.gz /tmp
    cd /tmp
    wget http://sourceforge.net/projects/sqlalch ... z/download
    tar -xvzf SQLAlchemy-0.5.7.tar.gz
    cd SQLAlchemy-0.5.7
    python setup.py install
    cd ..
    tar -xvfz callback_daemon-1.0.prod-r1528.tar.gz
    cd callback_daemon-1.0.prod-r1528
    python setup.py build
    python setup.py bdist_egg
    easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg

    cd /usr/src/a2billing/CallBack/callback-daemon-py/callback_daemon/
    cp a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
    chmod +x /etc/init.d/a2b-callback-daemon

    chkconfig --add a2b-callback-daemon
    service a2b-callback-daemon start (### I'm stuck here ###)
    chkconfig a2b-callback-daemon on

    and check here
    viewtopic.php?f=33&t=7711&p=31137#p31137
    #I managed to resolved the problem for installing callback-daemon on centos, version 1.7.1 of a2billing. (this should work for other back dated version)

    #I am assuming you've retrieved the trunk package using svn and stored all the files under /usr/local/src/a2billing/
    #Also your a2billing.conf file is stored here --> /etc/a2billing.conf else take note of the additional steps marked in red

    #goto target directory
    (1) cd /usr/local/src/a2billing/CallBack/callback-daemon-py/dist/

    #untar the r1528 file to create callback_daemon-1.0.prod-r1528 directory
    (2) tar -xvf callback_daemon-1.0.prod-r1528.tar.gz

    #Go down into the newly untared directory
    (3) cd callback_daemon-1.0.prod-r1528

    #excute the following python commands as per a2billing doc site
    (4) python setup.py build
    (5) python setup.py bdist_egg
    #additional steps to correct the path for the a2billing.conf file
    (5b) vi callback_daemon/a2b_callback_daemon.py
    (5c) replace the path to which your a2billing.conf resides in your system, the line should be --> CONFIG_FILE =
    #execute the installation
    (6) easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg

    #install the init script and daemon service (still at your current directory level)
    (7) cp build/lib/callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
    (8) chmod +x /etc/init.d/a2b-callback-daemon
    (9) chkconfig --add a2b-callback-daemon
    (10) chkconfig a2b-callback-daemon on

    # finally start the service u can either use the init script or service command
    (11a) service a2b-callback-daemon start
    (11b) /etc/init.d/a2b-callback-daemon start


    #hopefully this solves your problem :

    I only check my
    CONFIG_FILE = '/etc/a2billing.conf'
    No error message during install
    But this seems callback no function
    Where can I make sure my install is correct

    Below is my log

    Connected to Asterisk 1.4.26.1 currently running on 59-120-153-120 (pid = 2659)
    Verbosity is at least 3
    -- Executing [88668@from-sip-external:1] NoOp("SIP/5060-b7218db0", "Received incoming SIP connection from unknown peer to 88668") in new stack
    -- Executing [88668@from-sip-external:2] Set("SIP/5060-b7218db0", "DID=88668") in new stack
    -- Executing [88668@from-sip-external:3] Goto("SIP/5060-b7218db0", "s|1") in new stack
    -- Goto (from-sip-external,s,1)
    -- Executing [s@from-sip-external:1] GotoIf("SIP/5060-b7218db0", "1?from-trunk|88668|1") in new stack
    -- Goto (from-trunk,88668,1)
    -- Executing [88668@from-trunk:1] Macro("SIP/5060-b7218db0", "exten-vm|novm|88668") in new stack
    -- Executing [s@macro-exten-vm:1] Macro("SIP/5060-b7218db0", "user-callerid") in new stack
    -- Executing [s@macro-user-callerid:1] Set("SIP/5060-b7218db0", "AMPUSER=0229875980") in new stack
    -- Executing [s@macro-user-callerid:2] GotoIf("SIP/5060-b7218db0", "0?report") in new stack
    -- Executing [s@macro-user-callerid:3] ExecIf("SIP/5060-b7218db0", "1|Set|REALCALLERIDNUM=0229875980") in new stack
    -- Executing [s@macro-user-callerid:4] Set("SIP/5060-b7218db0", "AMPUSER=") in new stack
    -- Executing [s@macro-user-callerid:5] Set("SIP/5060-b7218db0", "AMPUSERCIDNAME=") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("SIP/5060-b7218db0", "1?report") in new stack
    -- Goto (macro-user-callerid,s,10)
    -- Executing [s@macro-user-callerid:10] GotoIf("SIP/5060-b7218db0", "0?continue") in new stack
    -- Executing [s@macro-user-callerid:11] Set("SIP/5060-b7218db0", "__TTL=64") in new stack
    -- Executing [s@macro-user-callerid:12] GotoIf("SIP/5060-b7218db0", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,19)
    -- Executing [s@macro-user-callerid:19] NoOp("SIP/5060-b7218db0", "Using CallerID "0229875980" <0229875980>") in new stack
    -- Executing [s@macro-exten-vm:2] Set("SIP/5060-b7218db0", "RingGroupMethod=none") in new stack
    -- Executing [s@macro-exten-vm:3] Set("SIP/5060-b7218db0", "VMBOX=novm") in new stack
    -- Executing [s@macro-exten-vm:4] Set("SIP/5060-b7218db0", "EXTTOCALL=88668") in new stack
    -- Executing [s@macro-exten-vm:5] Set("SIP/5060-b7218db0", "CFUEXT=") in new stack
    -- Executing [s@macro-exten-vm:6] Set("SIP/5060-b7218db0", "CFBEXT=") in new stack
    -- Executing [s@macro-exten-vm:7] Set("SIP/5060-b7218db0", "RT=""") in new stack
    -- Executing [s@macro-exten-vm:8] Macro("SIP/5060-b7218db0", "record-enable|88668|IN") in new stack
    -- Executing [s@macro-record-enable:1] GotoIf("SIP/5060-b7218db0", "1?check") in new stack
    -- Goto (macro-record-enable,s,4)
    -- Executing [s@macro-record-enable:4] AGI("SIP/5060-b7218db0", "recordingcheck|20101016-112631|1287199591.6") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
    recordingcheck|20101016-112631|1287199591.6: Inbound recording not enabled
    -- AGI Script recordingcheck completed, returning 0
    -- Executing [s@macro-record-enable:5] MacroExit("SIP/5060-b7218db0", "") in new stack
    -- Executing [s@macro-exten-vm:9] Macro("SIP/5060-b7218db0", "dial||tr|88668") in new stack
    -- Executing [s@macro-dial:1] GotoIf("SIP/5060-b7218db0", "1?dial") in new stack
    -- Goto (macro-dial,s,3)
    -- Executing [s@macro-dial:3] AGI("SIP/5060-b7218db0", "dialparties.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
    dialparties.agi: Starting New Dialparties.agi
    == Parsing '/etc/asterisk/manager.conf': Found
    == Parsing '/etc/asterisk/manager_additional.conf': Found
    == Parsing '/etc/asterisk/manager_custom.conf': Found
    == Manager 'admin' logged on from 127.0.0.1
    dialparties.agi: Caller ID name is '0229875980' number is '0229875980'
    dialparties.agi: Methodology of ring is 'none'
    -- dialparties.agi: Added extension 88668 to extension map
    -- dialparties.agi: Extension 88668 cf is disabled
    -- dialparties.agi: Extension 88668 do not disturb is disabled
    dialparties.agi: ExtensionState: 4
    dialparties.agi: Extension 88668 has ExtensionState: 4
    -- dialparties.agi: Checking CW and CFB status for extension 88668
    -- dialparties.agi: dbset CALLTRACE/88668 to 0229875980
    -- dialparties.agi: Filtered ARG3: 88668
    == Manager 'admin' logged off from 127.0.0.1
    -- AGI Script dialparties.agi completed, returning 0
    -- Executing [s@macro-dial:7] Dial("SIP/5060-b7218db0", "SIP/88668||tr") in new stack
    == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-dial:8] Set("SIP/5060-b7218db0", "DIALSTATUS=CHANUNAVAIL") in new stack
    -- Executing [s@macro-dial:9] GosubIf("SIP/5060-b7218db0", "0?CHANUNAVAIL|1") in new stack
    -- Executing [s@macro-exten-vm:10] GotoIf("SIP/5060-b7218db0", "0?exit|return") in new stack
    -- Executing [s@macro-exten-vm:11] Set("SIP/5060-b7218db0", "SV_DIALSTATUS=CHANUNAVAIL") in new stack
    -- Executing [s@macro-exten-vm:12] GosubIf("SIP/5060-b7218db0", "0?docfu|1") in new stack
    -- Executing [s@macro-exten-vm:13] GosubIf("SIP/5060-b7218db0", "0?docfb|1") in new stack
    -- Executing [s@macro-exten-vm:14] Set("SIP/5060-b7218db0", "DIALSTATUS=CHANUNAVAIL") in new stack
    -- Executing [s@macro-exten-vm:15] NoOp("SIP/5060-b7218db0", "Voicemail is novm") in new stack
    -- Executing [s@macro-exten-vm:16] GotoIf("SIP/5060-b7218db0", "1?s-CHANUNAVAIL|1") in new stack
    -- Goto (macro-exten-vm,s-CHANUNAVAIL,1)
    -- Executing [s-CHANUNAVAIL@macro-exten-vm:1] NoOp("SIP/5060-b7218db0", "IVR_RETVM: IVR_CONTEXT: ") in new stack
    -- Executing [s-CHANUNAVAIL@macro-exten-vm:2] GotoIf("SIP/5060-b7218db0", "0?exit|1") in new stack
    -- Executing [s-CHANUNAVAIL@macro-exten-vm:3] PlayTones("SIP/5060-b7218db0", "congestion") in new stack
    -- Executing [s-CHANUNAVAIL@macro-exten-vm:4] Congestion("SIP/5060-b7218db0", "10") in new stack
    == Spawn extension (macro-exten-vm, s-CHANUNAVAIL, 4) exited non-zero on 'SIP/5060-b7218db0' in macro 'exten-vm'
    == Spawn extension (from-trunk, 88668, 1) exited non-zero on 'SIP/5060-b7218db0'
    -- Executing [h@from-trunk:1] NoOp("SIP/5060-b7218db0", "Catch-All DID Match - Found h - You probably want a DID for this.") in new stack
    -- Executing [h@from-trunk:2] Goto("SIP/5060-b7218db0", "ext-did|s|1") in new stack
    -- Goto (ext-did,s,1)
    -- Executing [s@ext-did:1] Set("SIP/5060-b7218db0", "__FROM_DID=s") in new stack
    -- Executing [s@ext-did:2] Gosub("SIP/5060-b7218db0", "app-blacklist-check|s|1") in new stack
    -- Executing [s@app-blacklist-check:1] LookupBlacklist("SIP/5060-b7218db0", "") in new stack
    -- Executing [s@app-blacklist-check:2] GotoIf("SIP/5060-b7218db0", "0?blacklisted") in new stack
    -- Executing [s@app-blacklist-check:3] Return("SIP/5060-b7218db0", "") in new stack
    -- Executing [s@ext-did:3] ExecIf("SIP/5060-b7218db0", "0 |Set|CALLERID(name)=0229875980") in new stack
    -- Executing [s@ext-did:4] Set("SIP/5060-b7218db0", "__CALLINGPRES_SV=allowed_not_screened") in new stack
    -- Executing [s@ext-did:5] SetCallerPres("SIP/5060-b7218db0", "allowed_not_screened") in new stack
    -- Executing [s@ext-did:6] Goto("SIP/5060-b7218db0", "a2billing-cid-callback|s|1") in new stack
    -- Goto (a2billing-cid-callback,s,1)
    59-120-153-120*CLI>


    My a2billing is working , only test with a2billing callback function is failed
    Even web function is failed ,too

    Any one support is appreciated ,Thanks
     
  7. dsncanada

    Joined:
    Sep 19, 2010
    Messages:
    2
    Likes Received:
    0
    The following method worked for me on centos5.5 and a2b 1.8.1

    ** for call back daemon setup **

    yum -y install python-setuptools.noarch
    yum -y install MySQL-python
    yum -y install python-sqlalchemy0.5
    easy_install sqlalchemy
    LOAD_LOC=/usr/local/src/a2billing
    cd $LOAD_LOC/CallBack/callback-daemon-py
    cp callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
    chmod +x /etc/init.d/a2b-callback-daemon
    cp dist/callback_daemon-1.0.prod-r1528.tar.gz /tmp
    cd /tmp
    tar xvfz callback_daemon-1.0.prod-r1528.tar.gz
    cd callback_daemon-1.0.prod-r1528
    python setup.py build
    python setup.py bdist_egg
    easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg
    chkconfig --add a2b-callback-daemon
    service a2b-callback-daemon start
    chkconfig a2b-callback-daemon on


    Hope this help you or someone else.

    Please note that I had to install 'yum -y install python-sqlalchemy0.5' before issuing the command 'easy_install sqlalchemy' then everything worked.
     
  8. mostafa33

    Joined:
    May 25, 2010
    Messages:
    121
    Likes Received:
    0
    i tried the above steps but i face a voice error message "the number you has dialed is not in service"
     
  9. mahan77

    Joined:
    Aug 26, 2010
    Messages:
    3
    Likes Received:
    0
    Problem with your dial plan
     
  10. adnauseum

    Joined:
    Aug 14, 2012
    Messages:
    10
    Likes Received:
    0
    Hi there,
    I am wondering if you can tell me what has to be done to just be able to see cost/sell in cdr output of incoming calls from ITSP -> a2billing server like one does with outbound calls. There is no need to actually charge any card. Inbound calls all have the same cost/minute.

    Thanks in advance for your help.
     
  11. dwells

    Joined:
    Sep 29, 2009
    Messages:
    127
    Likes Received:
    0
    Hi,

    I think the first thing you want to do is set rates for the numbers(or patterns). I use a 2 prefix in front of all inbound DID's, then remove it later.
    In your case you can set cost rates, but 0 (Zero) charges. Call proper dial plan stuff (DeadAGI(a2billing.php|2|did))

    Just for funzies, here is my working conf...you can look up agi-conf stuff here too. I think I posted before about it. It was a long time ago....
    This also allows me to offer Basic and Enhanced Voicemail systems, and charge more for enhanced...etc... as well as other fun things.
    There is plenty of SEARCHABLE topics on this stuff...

    I don't use ALL of it for customers but it's nice to know it's there, ready within A2B.
    I use the Elastix interface to manage accounts (On top of calling cards) for residential and businesses (static accounts that won't run out etc..)
    I use these contexts in the accounts they register to. (instead of from-internal) and add their account number there too.

    It just depends on what and where you want to see things.

    Hope this helps. Or sparks something somewhere... To me...this is gold right here. Enjoy.
    ============================================================================================================================================

    [a2billing]
    ; CallingCard application
    include => vmmain
    exten => _X.,1,Answer
    exten => _X.,2,Wait,2
    exten => _X.,3,DeadAGI,a2billing.php
    exten => _X.,4,Wait,2
    exten => _X.,5,Hangup

    [a2billing-enhanced]
    ; CallingCard application with enhanced features
    include => a2b-enhancements
    include => from-internal
    exten => _X.,1,Answer
    exten => _X.,2,Wait,2
    exten => _X.,3,DeadAGI,a2billing.php
    exten => _X.,4,Wait,2
    exten => _X.,5,Hangup

    [a2billing-friend]
    ; CallingCard application with call friend opt on - 9
    include => vmmain
    exten => _X.,1,Answer
    exten => _X.,2,Wait,2
    exten => _X.,3,DeadAGI(a2billing.php|2)
    exten => _X.,4,Wait,2
    exten => _X.,5,Hangup

    [a2billing-business]
    exten => _X.,1,Answer
    exten => _X.,n,DeadAGI(a2billing.php|3)
    exten => _X.,n,Hangup

    [custom-a2billing-did]
    exten => _X.,1,Answer
    exten => _X.,n,DeadAGI(a2billing.php|2|did)
    exten => _X.,n,Hangup

    [macro-dialout-trunk-predial-hook]
    exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2)
    exten => s,2,MacroExit

    [custom-freepbx-a2billing]
    exten => _X.,1,DeadAGI(a2billing.php|${OUT_${DIAL_TRUNK}:8})
    exten => _X.,n,Hangup()


    ============================================================================================================================================


    [custom-a2billing]
    exten => _X.,1,Answer
    exten => _X.,n,DeadAGI(a2billing.php|1)
    exten => _X.,n,Hangup

    [a2billing-callback]
    exten => _X.,1,Answer
    exten => _X.,1,DeadAGI(a2billing.php|2|callback)
    exten => _X.,n,Hangup

    [custom-a2billing-callback]
    exten => _X.,1,Answer
    exten => _X.,1,DeadAGI(a2billing.php|2|callback)
    exten => _X.,n,Hangup

    [a2billing-cid-callback]
    exten => _X.,1,DeadAGI(a2billing.php|2|cid-callback|1
    exten => _X.,n,Hangup

    ============================================================================================================================================
    ;extras and enhancements

    [vmmain]
    exten => *97,1,Answer
    exten => *97,n,Wait(1)
    exten => *97,n,VoiceMailMain(${CALLERID(num)})
    exten => *97,n,Hangup

    [a2b-wake-up]
    exten => *62,1,Answer
    exten => *62,2,AGI(wakeup.php)
    exten => *62,3,Hangup

    [a2b-enhancements]
    include => ext-group
    include => grps
    include => ext-meetme
    include => app-cf-busy-off
    include => app-cf-busy-off-any
    include => app-cf-busy-on
    include => app-cf-off
    include => app-cf-off-any
    include => app-cf-on
    include => app-cf-unavailable-off
    include => app-cf-unavailable-on
    include => app-cf-toggle
    include => ext-cf-hints
    include => app-callwaiting-cwoff
    include => app-callwaiting-cwon
    include => app-dnd-toggle
    include => ext-dnd-hints
    include => app-fmf-toggle
    include => ext-findmefollow
    include => fmgrps
    include => app-calltrace
    include => app-echo-test
    include => app-speakextennum
    include => app-speakingclock
    include => app-vmmain
    include => ext-local
    include => weather-wakeup
    exten => h,1,Hangup
     
  12. adnauseum

    Joined:
    Aug 14, 2012
    Messages:
    10
    Likes Received:
    0
    Hi,
    I saw your script below before when searching for a way to get inbound costs (buy/sell) when looking at CDRs. Again, the only thing I am trying to do is see the buy/sell values in CDRs for now because we don't actually charge per minute. Really the only thing we use Elastix for is to have a one URL place to view all clients CDR's showing us our costs and revenue generated (based on values put into rate cards).

    Just want to confirm with you the following to be sure I understand what you've written.

    1) make rate cards for all the DIDs with values for buy/sell

    2) ?

    Once we make rate card(s) for DIDs, where does the next step come in where it cause it to show up on CDRs?

    Thanks for your help.
     
  13. dwells

    Joined:
    Sep 29, 2009
    Messages:
    127
    Likes Received:
    0
    Hi again,

    Go back to PAGE 1 of this post, and re-read ALL the steps...It will get you in the right place at least. It is very literally a step-by-step of how to setup inbound DID billing. (It even mentions free).
    This will show up in your CDR's and account into your profitability calcs.

    As an example, when done ALL the steps (which is a pain in the arse; especially when trying to figure all this out without a post like this...that's why I did it :))

    You will see something like this in your A2B CDR logs... 11. is standard OUT call 12. is INBOUND DID Call (With Costs and Charges | You charge 0...I don't)
    Obviously I blanked out Particular info...

    11. 2013-04-13 10:20:45 XXXXX 1519XXXXXXX 1519XXXXXXX Canada - 519 0.004 USD 0.016 USD 07:46 295XXXXXXX VISP ANSWER STANDARD 0.031 USD 0.125 USD 75.00% 300.00%
    12. 2013-04-13 21:30:10 519XXXXXXX 2XXXX@from-internal 2XXXX@from-internal Inbound DID 0.070 USD 0.090 USD 00:58 650XXXXXXX VITELITY ANSWER DIDCALL 0.070 USD 0.100 USD 30.00% 42.86%

    I hope that's what you mean, and that this info helps.

    regards,
    dwellsy
     

Share This Page