gue wrote:
i don't fully understand your needs/question
Assumptions:
- call is coming from something like an ATA through a sip.conf setup
- sip.conf setup has context = from-internal
- you have a outbound route defined to match 011., 1., 225.
- outbound route uses the "custom trunk" which passes the call to the a2b context
- a2b context passes the call to a2b agi
Assuming this is the case the callerID that will be sent out with the call will come from the ATA [as defined in the ATA display name or sometimes the username] or as specified in the sip.conf [callerid="name" <number>] for the ATA. In Freepbx you can set the callerid for the sip.conf context in the UI this way you don't have to manually put it into the sip.conf context
I don't understand what you mean by calleriD is the "extension" . The custom local trunk is just passing the call like any other channel it is not modifying the callerid
Here is the call procedure.
- call is coming from something like an ATA through a sip.conf setup
- sip.conf setup has context = from-internal
- you have a outbound route defined to match 011., 1nxxnxxxxxx
* - dialout-trunk macro should be replacing the extension number with the outbound callerid however it is not doing so cause the custom trunk was "local". This needs to be addressed as "external".
- outbound route uses the "custom trunk" which passes the call to the a2b context
- a2b context passes the call to a2b agi **with the caller id from the SIP.CONF being properly forwarded.
Therefore,
if I have an extension 2000, and an outbound callerid of "me"<15145551212> for extension 2000, then when I dial 011. or 1nxxnxxxxxx it would run the outbound route to see where it should be dialing and use the callerid of 15145551212 and not 2000 as it is doing so now.
When I used the _X. which worked, it took over the whole system and was trying to forward all calls via A2Billing and completely ignored the outbound route list. It seems that A2Billing wants an extension number instead of reading the DNIS for the call. Any way to force A2Billing to force DNIS reading for the call instead of looking for the agi_extension?
Example, I modified the macro-dialout-trunk in extensions.conf file
Code:
; Modified to support outbound calling for A2B
; original line: exten => s,n(skipoutnum),Dial(${pre_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
; added function
exten => s,n(skipoutnum),GotoIf($["${pre_num}" = "AMP:A2B/"]?a2bdial:skipoutnumnormal) ; Checks for A2B custom trunk and dials it.
exten => s,n(a2bdial),DeadAGI(a2billing.php) ; Dials out via the a2billing.php script.
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(skipoutnumnormal),Dial(${pre_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
; end of modified additions
Now the custom trunk is called A2B/$OUTNUM$
It now works somewhat. I am now stuck with the AGI_Extension since now it tries to use s instead of the dialed number (DNID) and therefore I am being asked to enter a phone number to dial out again. I need to use the AGI_DNID phone number for dialing out. Is there a way to force A2Billing to use the AGI_DNID instead of the AGI_Extension for taking the number for dialing out.
Added after 59 minutes:
Ok I think I have fixed it.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 AMP:A2B/$OUTNUM$
4: Now Edit Extensions.conf and look for macro-dialout-trunk and find the line called
Code:
exten => s,n(skipoutnum),Dial(${pre_num:4}${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_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
; added function
exten => s,n(skipoutnum),GotoIf($["${pre_num}" = "AMP:A2B/"]?a2bdial:skipoutnumnormal) ; 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_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
; end of modified additions
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.
Code:
; 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'];
Repleace 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
11: Save a2billing.php
12: now pick up your phone and try dialing. It will now go though A2billing for accounting purposes.
[/code]