* You are viewing Posts Tagged ‘exten’

Rejecting A Call As If The Extension Does Not Exist.

I’m trying to address a problem with users transferring to invalid destinations.

In my sip peer I’m setting both __FORWARD_CONTEXT and __TRANSFER_CONTEXT to a context with a extension defined below to set some CDR variables before the call is transferred.

exten => _X.,1,Progress()
exten => _X.,n,Gosub(do-billing,s,1${EXTEN}))
exten => _X,n,Goto(customer-internal,${EXTEN},1)

Now if my user Dials an invalid extension, Say ’9595′ from their sip phone they get back an ‘Address Incomplete’ message from their phone because it’s not a valid extension defined in my dialplan.

If my user Transfers a call to ’9595′ the call gets transferred and then hung up on as there’s no ’9595′ destination.

I’d like to reject the calls in my customer-foward context that do not exist in my customer-internal context.

I’ve tried doing something like:

exten => _X.,1,Progress()
same => n,ExecIf($[${DIALPLAN_EXISTS(customer-internal,${EXTEN},1)} 0]?Hangup(28))

But that’s still accepting the call as the _X makes it a Valid extension.

I’m looking for suggestions or ideas on a better way to do this.

Callerid Overwrite

Hi all, I’m having issues with overwrite caller id, when I call someone my caller id should be “mycompanyinc” but instead my id shows up as my extension number 101.

this is what i have in sip.conf
type=friend context=sipphones call-limit

Problem With Call Transfer From One Server To Another Server

Dear All,

I have pri with E1 facility that have 30 line and 100 pri number which is provided by service provider.Number started like 23568561,23568562,23568563
and so on. Service provider provide last four digit number for did mapping like 4561,4562,4563.

exten => 8561,1,Dial(SIP/4001@,120,tT)
exten => 8561,n,hangup()

exten => 8562,1,Dial(SIP/4001@,120,tT)
exten => 8562,n,hangup()

Call comes into first server successful.But problem with second server when call came into second server i got following error:

* chan_sip.c:20063 handle_request_invite: Call from ” to extension ’4001′
rejected because extension not found.*

In one more scenario:

when i create one extension and call forwarding with this extension that time I’m able to transfer call successful the code is given below:

exten => 5001,1,Dial(SIP/4001@,120,tT)
exten => 5001,n,hangup()

Regards Akhilesh

Checking Messages From Outside The Network

Hello Everyone,

I am using the following dialplan to allow users to check their messages from PSTN world:

; Internal Routing exten => _1XX,1,Dial(SIP/${EXTEN}, 10)
exten => _1XX,n,Wait(1)
exten => _1XX,n,Answer exten => _1XX,n,Wait(1)
exten => _1XX,n,Voicemail(${EXTEN},us)
exten => _1XX,n,Hangup

The problem is that when the user presses `*#` to check his/her messages, it adds an additional message, even if there were no messages to begin with. I hope I am explaining this correctly. Can the dialplan be improved so that there is no additional message added when the owner is trying to check their mail box.

Kind Regards,


Dedicated Hangup Extension H


We have a Kamailio SIP Proxy in front of our Asterisk cluster for incoming calls from our carrier.

The sip.conf looks like this:

type=friend host=
context=incoming disallow=all allow=alaw

All calls hit the incoming extension. In the extensions.conf we have multiple extensions configured, but now I have to add one which uses the special h extension to perform a CURL action whenever the user hangs up. The problem is that once I’ve registered a h extension, it is executed for all extensions in the incoming context.

exten => _X.,1,Playback(invalid)
exten => _X.,n,Hangup

exten => 1000,1,Playback(welcome)
exten => 1000,n,Read(dtmfinput,,,,,15)
exten => 1000,n,Hangup

exten => h,1,Set(response=${CURL(http://sample.company.local/PostHandler.ashx,var1=${dtmfinput}&var2=1000)})

Is it possible to give each extension its own h extension? If not, is there another way to do this?

Blocking Spammer By CallerID “name”

I have a subroutine to block spammer by CALLERID(number)

exten => 4,1,GotoIf(${BLACKLIST()}?blacklisted,s,1)
exten => 4,n,Set(goaway=${CALLERID(number):0:2})
exten => 4,n,GotoIf($["${goaway}" = "V4" ]?blacklisted,s,1)
exten => 4,n,GotoIf($["${goaway}" = "V3" ]?blacklisted,s,1)

but I just got another spammer (automated calls) who rotates his callerID number that starts with valid area code so blocking by prefix is not practical but it seems to me he uses the same (or few same) caller name like:

“Brit. Columbia “” <16047726633>”
“KHAN SHARON “” <16042984429>”
“Brit. Columbia “” <16042231781>“

So I was thinking the same subroutine can be used to block by CALLERID(name), isn’t it:

exten => 4,n,Set(goaway2=${CALLERID(name):0:11})
exten => 4,n,GotoIf($["${goaway2}" = "Brit. Colum" ]?blacklisted,s,1)
exten => 4,n,GotoIf($["${goaway2}" = "KHAN SHARON" ]?blacklisted,s,1)

The spammer is soliciting lowering credit card interest charges etc. anybody know who it is :-/