Custom Context / Outbound Calls

I been using Asterisk for years and have always maintained sip.conf/extensions.conf manual.

I have installed and setup FreePBX for a small company in the last week. Everything is working fine…EXCEPT.
We have an AGI/Php script we need to execute when someone places an outbound call.

The script queries a remote database of the number being called and returns a ten digit number. This number is set as the outbound caller id. (There is a lookup of number being called…then referenced to zip code…then to regional number associated). This part works fine.

The PROBLEM —
I can’t figure out how to include or trigger that special context on OUTBOUND calls.

extenstion_custom.conf

[set-outbound-callerid]
exten => s,1,Answer
exten => s,n,AGI(outbound.php,${EXTEN})
exten => s,n,NoOp(Caller ID: ${OutboundCaller})


We send number to be called and it returns the number we need to set as the outbound caller id.


How do I execute this on all outbound calls?
Outbound calls to ten(10) digits numbers,

If it was an incoming AGI/Script…I would do the same thing…then map a Custom Destination to the custom context then set the inbound route to the custom destination.

This being outbound…I can’t find a way to include…or use it.
please advise.

In extensions_custom.conf, try your custom dial plan in the [macro-dialout-trunk-predial-hook] context.

1 Like

I’m not understanding how to edit an existing context to include my context…
That really is my question… I also didn’t know what context I should be including mine to.

How do I add “Include => set-outbound-callerid” to the existing macro-dialout-trunk-predial-hook ?

Hi!

Unless you added code to it in the past, there is nothing in macro-dialout-trunk-predial-hook.

You add this custom code in extensions_custom.conf.

Good luck and have a nice day!

Nick

In other words, put your custom dial plan into extensions_custom.conf, but name the context macro-dialout-trunk-predial-hook, instead of set-outbound-callerid.

ok…so no…include… Let me check the context name… Testing now.

that seems to have worked…

I got some syntax and stuff to fix, but it did call the AGI/php script on the outbound call.

Thanks Folks.

No, cause there is already one for macro-dialout-trunk-predial-hook.

Great… that is working… The DB is query for the number being called… and we are getting the regional office number.

I have that number being returned as AGI variable.

How do I set this variable to the outbound caller id ?
I would use SET in my dial plan, but I’m not sure with all the extras macros / etc that are running.

I think i got that fixed too.
Thanks Folks.