Due to some forwards when I call to this extension in the trace I see this: +6640010203
What I want to do is to remove one zero(0) after +664. Should become +664010203
I can’t use LEN function here because the extensions could be different lengths. So I think the only possibility is to replace +66400 with +664 since this is always like this.
There are several examples of doing this in the sample configuration file. The special case sub-string notation when accessing variables is exactly for this sort of case.
exten => _+6640010203,1,Set(SAFE_EXTEN=${EXTEN:-6})
same => n,Set(FULL_NUMBER=+664${SAFE_EXTEN})
same => n,Voicemail(${FULL_NUMBER}@VoiceMail)
same => n,Playback(Goodbye)
same => n,Hangup
Not sure if this is optimal way to be done but somehow is works.
But here it is done with direct number e.g. +6640010203 for the test. How can I change this number with extensions from database? I mean to search in database for the extension.
I mean because of the LENGTH I don’t know how long is the extension ( it can be 13, 14 or even 15 numbers ) I can’t do like