Changing the dialed number?

Hello.

i have a big problem.

I hope someone will help me.

i had something like that :

[local]
exten => 0,1,Dial(Zap/4)

this call the number on zap/4 from a local telephone when 0 is dialed.

But what i want to do, is that if the caller dial a number wich is 06xxxxxxxx after the 0, asterisk dials 86xxxxxxxx instead of 06xxxxxxxx

do you know how i can do that ?

I am triyng since yesterday with no result.

Thank you very much.

nobody know how to do that ?

There are many different ways to dial calls the way you want.

The answer would depend on how you primarily dial calls.

I use macros to dial my calls. It allows more control. If you used macros to dial your calls, your macro might look like this:

[default]
exten => 06xxxxxxxx,1,Macro(dialoutside)

[macro-dialoutside]
exten => s,1,Dial(${TRUNK}/${MACRO_EXTEN})
exten => s,2,Congestion
exten => s,103,Busy

In the above example, a dialed number is refered to in the macro as the variable ${MACRO_EXTEN}. ${MACRO_EXTEN} is a predefined Asterisk variable. Using variables in your macros you can modify dialed digits and other controls as you need them to be. If you also used macros and variables, you would create a macro such as this to dial your calls:

[macro-dialoutside]
exten => s,1,SetVar(CALLER_DIALED=${MACRO_EXTEN:1:9})
exten => s,2,Dial(${TRUNK}/8${CALLER_DIALED})
exten => s,3,Congestion
exten => s,104,Busy

Here you see an example of how to modify dialed digits without using the deprecated StripMSD() and StripLSD(). These commands are considered obsolete, and should be removed from any .conf files.

In the above example, the string of variable ${MACRO_EXTEN} is modified by moving to offset 1, taking the next 9 digits, and copying them into a variable called ${CALLER_DIALED}. Starting at offset 0 would have included the first digit, offset 1 skips to the second digit, and offset 2 to the third digit, etc… This strips the first digit from the digits the caller dialed.

On the next line, an 8 is dialed, and then the rest of the digits that the caller dialed are sent.

For more information about using and modifying variables, please click here:

voip-info.org/tiki-index.php … +variables

Thank you very much.

As i am very very new to asterisk, i’ll try to understant that exactly tonight and i’ll try to do it tommorrow in my asterisk.

just a little question. i don’t find the var ${TRUNK} in the documentation. Can you tell me what it is ?

thank you for your help.

${TRUNK} is another way of saying something like:

ZAP/g1

or in your case zap/4

–John

Oh yes, that was an oversight on my part.

In your globals section you might have something like this:

[globals]

TRUNK=Zap/4

That way, anywhere you would have normally written ZAP/4, you can substitute ${TRUNK}.

thank you for all your help.

i will try that tomorrow morning and i will tell you.

Thank you.

it works perfectly.

thank you dufus.