Changing exten within dialplan


#1

Hi!

I have several sources for incoming extensions. They may be signalled as

xxxxxx
0720 xxxxxx
0123 0720 xxxxxx
1001 xxxxxx
1001 0720 xxxxxx
1001 0123 0720 xxxxxx

So my idea is, to normalize all incoming extensions before processing them any further. Something like

exten => _1001.,1,Set(EXTEN=${EXTEN:4}
exten => _01230720.,1,Set(EXTEN=${EXTEN:8}
exten => _0720.,1,Set(EXTEN=${EXTEN:4}

or

exten => _1001.,1,StripMSD(4)
exten => _01230720.,1,StripMSD( 8 )
exten => _0720.,1,StripMSD(4)

But neither solution works. If I set EXTEN, it’s obviously not the extension that is being processed. The Solution with StripMSD simply does nothing. The call goes nowhere.

I believe I need a function between StripMSD() and WaitExten().

If somebody has an idea…?

Thank you,
Thomas


#2

are you sure the extensions are reaching these steps ? do you have a NoOP(${EXTEN}) statement at the start of the context to show on the console/log the number reaching the context ?

StripMSD should do the job, but you’ll need a priority for the “stripped” extension number at n+1


#3

Hi Again!

I solved the problem. I changed my extensions.conf to just four lines:

[default] exten => _[0-9].,1,AGI(extensions.agi,${EXTEN}) exten => _[0-9].,2,Hangup exten => _[0-9].,102,Congestion
and wrote a simple perl AGI script that does all the computing. There I can fiddle with the extension variable to my liking and cantell exactly, which matches are taking place befor others.

It works great! For any growing or complex dialplan this is the solution I can recommend.

Thomas