Configuring A2B to support Trunking & Outbound CallerID

The purpose of this is to

  • Have each extension dial long distance via the A2Billing module.
  • Have A2Billing configured as a Custom Trunk
  • Have FreePBX transmit to A2Billing the Outbound CallerID for the Extension instead of the SIP Extension number via the macro-dialout-trunk.
  • Ensure that A2Billing will not ask for the number to dial when you have already dialed it.
  • Make it all work seemlessly.

Since the coding is not working in this forum, please goto the following URL for more assistance
http//forum.asterisk2billing.org/viewtopic.php?t=2127 original topic
http//www.freepbx.org/trac/ticket/1968 active patch

Here is what I have done to fix up A2Billing and FreePBX to work together via the macro-dialout-trunk so that you can create custom trunks for a2billing pass-thru.

1 Goto FreePBX, Setup, Trunks, Create Custom Trunk.
2 In the Custom Trunk String enter without the quotes "A2B/$OUTNUM$"
3 Save it and you will see a new route called 2B/$OUTNUM$ it is fine just a glitch with FreePBX.
3 Goto Outbound Routes, Create or Modify your Long Distance route and point it to AMPA2B/$OUTNUM$
4 Now Edit Extensions.conf and look for macro-dialout-trunk and find the line called

[CODE]
exten => s,n(skipoutnum),Dial(${pre_num4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})

Replace that line with the code below (which will preserve the original line so you know what you changed)

; Modified to support outbound calling for A2B
; original line exten => s,n(skipoutnum),Dial(${pre_num4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
; added function
exten => s,n(skipoutnum),GotoIf($["${pre_num}" = “AMPA2B/”]?a2bdialskipoutnumnormal) ; Checks for A2B custom trunk and dials it.
exten => s,n(a2bdial),DeadAGI(a2billing.php|1) ; Dials out via the a2billing.php script.
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(skipoutnumnormal),Dial(${pre_num4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
; end of modified additions
[/CODE]
5 Save extensions.conf
6 We now need to edit a2billing.conf. Goto the agi-conf1 or which agi-conf# you will be using and find use_dnid=
add the following code below it.

; if YES then it will use the AGI_DNID instead of AGI_Extension for supporting dialout. switch_extension_for_dnid=YES
7 save a2billing.conf
8 Goto your Asterisk CLI and issue a reload request.
9 Now we are done with FreePBX.
10 goto /var/lib/asterisk/agi-bin and edit a2billing.php
11 look for a line that says

[CODE]
$A2B->dnid = $agi->request[‘agi_extension’];

Replace that line with the following line (No worries, I placed that line into the code for preservation.

           // Added check for agi_extension or agi_dnid for dialout number
           // original line replaced was
           // $A2B->dnid = $agi->request['agi_extension'];
           //
           if ($A2B->agiconfig['switch_extension_for_dnid']==1)
              $A2B->dnid = $agi->request['agi_dnid'];
              else
              $A2B->dnid = $agi->request['agi_extension'];
           // End of modifications

[/CODE]
11 Save a2billing.php
12 now pick up your phone and try dialing. It will now go though A2billing for accounting purposes.

I implement this on FreePBX 2.3.1.14 and Asterisk 1.4. I got an problem of losing the ring-back tone on dialing out from a Trixbox extension. But all things work when I call in from the a2b calling card IVR. Does anyone experience the same problem?