Using IP address as extension

Hi all,

I really hope you can help me with this. I’m working on some test deployments right now.

Here is my setup basically:

  • Got 2 phones (100, 101) registered on my Asterisk Server (,
  • Got a Trunk to a GSM Gateway,
  • Then I’m forced to use a SIP capable device which I can’t register or authenticate on my Asterisk Server (140).

Almost everything is working fine:

  • I can call everyone from 100 and 101.
  • I can call 100 and 101 on P2P from 140 by dialing their IP addresses. Obviously, I’m not using Asterisk for that. It’s fine by me.

The issue is when I’m trying to call a GSM phone behind the trunk because they don’t have IP addresses.

So my idea was to call the asterisk server directly, and having his IP addresses redirected to a single GSM phone behind the trunk.
However when I try to call from 140 I get this error:

chan_sip.c22695 handle_request_invite: Call from ‘140’ ( to extension ‘’ rejected because extension not found in context ‘internal’

My first thought was that’s because extension.conf doesn’t not handle the dots from the IP address as an extension…

However do you have any idea how to have extension.conf process this? As it doesn’t process the required lines in the file?

I have my sip.conf configured as below:





As for my extensions.conf:

exten => 100,1,Answer()
exten => 100,2,Dial(SIP/100,60)
exten => 100,3,Hangup

exten => 101,1,Answer()
exten => 101,2,Dial(SIP/101,60)
exten => 101,3,Hangup

exten => 140,1,Answer()
exten => 140,2,Dial(SIP/140,60)
exten => 140,3,Hangup()

exten => _9X.,1,Dial(SIP/${EXTEN:1}@trunk)
exten => _9X.,2,Hangup()

exten =>,1,Dial(SIP/9********@trunk)
exten =>,2,Hangup()

Where ****** are the digits from my phone number like for example: 91234567890 etc…

Best Regards.

You shouldn’t be using chan_sip; it’s removal from the GIT master is imminent.

You shouldn’t be using type=friend, and certainly not in an internal context with no authentication, whether by omission, or by the use of insecure. Anyone pretending to be extension 140, or extension “trunk”, from whatever IP, can make calls on your “trunk” and charge them to you.

Although it is a strange thing to do, I don’t understand why your dotted quad extension number doesn’t work, unless you forgot to reload the dialplan, after changing it.

It is worth learning “same=>” and the “n” priority, as they make dialplans easier to maintain.

Your “_9X.” rule is the one that would normally be used to call mobile phones.

None of your Answer’s are necessary, and they could cause external callers to be billed for failed calls.

I’d suggest using dialplan show to see what has actually been loaded, and to test you funny extension.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.