I will need a bit help with my extension.conf. What I have is realtime asterisk with mysql. In database table sipfriends I’m saving numbers like:
853322
854653
853424
In this case 85 is prefix. The problem is that the number can come in international format like +85. So, when the caller dial 1234 to check his voicemail I need first to remove the + and/or anything else in front of the prefix 85.
My extension.conf has this so far.
[general]
static=yes
writeprotect=no
autofallthrough=no
clearglobalvars=no
priorityjumping=no
[lookupdundi]
switch => DUNDi/priv
[internal]
exten => 1234,1,NoOp()
exten => _[+a-z0-9].,2,Set(SAFE_EXTEN=${FILTER(0-9,${CALLERID(num)})})
exten => 1234,2,Set(LANG=${ODBC_LANG(${CALLERID(num)})})
include => dundiextens
exten => _[+a-z0-9].,1,Set(SAFE_EXTEN=${FILTER(0-9,${CALLERID(num)})})
same => n,Voicemail(${SAFE_EXTEN}@VoiceMail)
same => n,Playback(Goodbye)
same => n,Hangup
include => lookupdundi
switch => Realtime
[incomingdundi]
exten =>_[+a-z0-9].,1,Set(SAFE_EXTEN=${FILTER(0-9,${CALLERID(num)})})
same => n,Voicemail(${SAFE_EXTEN}@VoiceMail)
same => n,Playback(Goodbye)
same => n,Hangup
What I can’t understand is where to put this line exten =>_[+a-z0-9].,1,Set(SAFE_EXTEN=${FILTER(0-9,${CALLERID(num)})}) . Currently if I make call from “+8512345” I’ve got
Call from ‘’ (xxx.xxx.xxx.xxx:5060) to extension ‘+8512345’ rejected because extension not found in context ‘default’.
because in database the number is saved as “8512345”.
But when I save number in database like +8512345 it’s working and vice versa. That’s what I want to accomplish. My number in database is 8512345 when call is received with + in front of number to remove it and look for the “clean” number without + in database.
Scenario 1:
Again currently number is saved like: 8512345
I simulate call from: +8512345
Receiving above error
Scenario 2:
Number is saved like: +8512345
I simulate call from: +8512345
Call is successful
So, I want to save numbers without +. In this case when number with + is trying to make a call I want to remove this + first.
I’ve never used ARA, so I suppose there could be a problem handling “+”. However, your error message would be a secondary error, in that case, the the key error would say not found in the context that was actually associated with the peer.
[incomingdundi]
exten => _[a-z].,1,Set(SAFE_EXTEN=${FILTER(0-9,${EXTEN})})
same => n,Voicemail(${SAFE_EXTEN}@VoiceMail)
same => n,Playback(Goodbye)
same => n,Hangup
when sip user “8512345” call voicemail number “abc1234” the above SAFE_EXTEN function remove “abc” prefix. I want to do the same BEFORE database lookup if that sip user exists there.