Map SIP (name@domain) to extension


#1

Hi,

I can’t seem to find this… suppose I need to map sip address e.g., sip:username@domain to an extension, is this possible? Any pointers on how this can be done?

Thanks!


#2

You’ll have to explain more about what you’re trying to do than that!

You don’t map SIP user names to extensions exactly. How to do what you want to do depends on whether you’re talking about incoming calls or outgoing calls - or what…

Have a read through documentation at http://www.voip-info.org/tiki-index.php?page=Asterisk


#3

Sorry if it wasnt clear.

I was referring to incoming calls to asterisk. That is, suppose if someone calls user@mydomain and the call gets to my asterisk server. If this user@mydomain is a legitimate user in my network, how would asterisk route the call to the user in my network.

Thanks


#4

In sip.conf there should be the following statement

context=default ; Default context for incoming calls

when a sip call comes in that’s not from a service that asterisk has registered with (as defined in sip.conf), asterisk will pass the call to the extension specified by the caller in (in the above case) the [default] context in extensions.conf .

In the [default] context extensions.conf, you would have to have defined an extension called “user” (in your example), which would map to a real phone somewhere. For example:

exten => user,1,Dial(SIP/somephone,20,r)
exten => user,2,Voicemail(uuser)
exten => user,3,Hangup

or something like that. If, say, “user” already had an extension number 4426 defined in extensions.conf, you could do something like:

exten => user,1,Goto(4426,1)

which more or less has the effect of making “user” an alias for extension 4426.


#5

Thanks WillKemp.

1 more clarification before I go try this out…

The incoming SIP call will be a fully qualified address e.g., john@domain.tld.

in the extensions.conf, should I specify the fully qualified address or just the user name only. e.g.,

exten => john,1,Dial(SIP/1234,20,r)

or

exten => john@domain.tld, 1,Dial(SIP/1234,20,r)


#6

Yes, the domain part must be mapped to the IP address of the asterisk server in the DNS.

[quote]in the extensions.conf, should I specify the fully qualified address or just the user name only. e.g.,

exten => john,1,Dial(SIP/1234,20,r)

or

exten => john@domain.tld, 1,Dial(SIP/1234,20,r)[/quote]
Just the name only. The domain part of the address is completely irrelevant once the connection has arrived at the host.

Of course, one day it may not be so irrelevant - when the protocol has developed to allow virtual hosts to be catered for, like http did.