1
votes

We have a many services in our company, each one must display a different number in his outgoing calls. We use a Asterisk SIP server.

Our SIP provider asks us to make our Asterisk server send a prefix before the outgoing number.

for exemple, for a normal call from the extension 1200, the SIP server send the number 0033123456789. we want to make it adding a prefix for calls from each extension, for exemple : add the prefix 400 before calls from the extension 1200 to send 40033123456789. add the prefix 401 before calls from the extension 1201 to send 40133123456789. ... etc. Can you help please ?

Many thanks.

Regards.

1

1 Answers

0
votes

There might be several ways to achieve what you need, if calls from all extensions hit same context(context start with [some-context-name]), then you might achieve it in following way:

[some-context-name]
exten => _00X.,1,ExecIf($["${CALLERID(num)}" = "1200"]?Dial(SIP/mytrunk/400${EXTEN:2}))
exten => _00X.,1,ExecIf($["${CALLERID(num)}" = "1201"]?Dial(SIP/mytrunk/401${EXTEN:2}))

Additionally you might have separate context per extension or you might implement all of this inside AGI script.