[Asterisk-Users] CLUELESS NEWBIE needs help making an outbound sip call to PSTN

Rich Adamson radamson at routers.com
Fri Jun 3 06:39:09 MST 2005


> I'm going to try and ask this again and keep it short and as too the 
> point as I can while still providing enough info to be of use.
> PLEASE advise if I am going about this wrong or asking too much.
> I'm seriously doing my BEST to throughly read the docs and try a bunch of 
> things BEFORE coming here to ask and possibly annoy.
> If is documentation that explains thsi process in terms that someone new 
> can grab onto quickly I'm missing it!
> 
> OK here goes again :-)
> 
> 
> I have complied an asterisk system and got it going from scratch and all 
> works great except I cannot make an outbound sip-to-PSTN call and do not 
> fully understand how to configure it.
> 
> I've been folowing some examples and keep running into this stumbling 
> block:
> 
> As soon as I add (to sip.conf) this section:
> 
> [siprovider.com]
> type=peer
> host=sipprovider.com
> fromuser=2135551212
> secret=2135551212
> authname=2135551212
> fromdomain=siprovider.com
> 
> 
> I no longer can recieve ANY inbound calls from the PSTN via my sip 
> provider.
> 
> I've tried many variations of attempting to get this section (I think it's 
> referred to a 'sip channel) into my sip.conf all which give the same 
> result.....
> 
> All inbound calls from PSTN TO this account FAIL.
> 
> I have tried with the dialplan in context [default]
> with a test dialplan and with a 'blank' dial plan.
> 
> every way I try this, inbound calls via SIP and my SIP provider stop 
> reaching my asterisk box.
> 
> If I remove the above shown section leaving only the
> register => 2135551212:2135551212 at sipproviderexample.com
> 
> all works great and calls come in from the PSTN to my asterisk box and 
> people can get around my menu just fine and dial internal SIP extension 
> numbers.

Let's see if I can at least help out with the understanding part (and
I'm doing this from memory, and not currently using any sip providers).

First, change your context name ([siprovider.com]) to something
different to avoid confusion as to that context name and the
host=sipprovider.com statement. Might try something like [sipprovider-com].
The sipprovider.com _must_ resolve to a valid IP address using
DNS in your example above.

The register statement does nothing more then tell your provider
that your on line, and to use whatever is at the end of the
statement (/1234) as the extension number to execute in your dialplan
when sending you an inbound call. Since you have nothing at the end
of the register statement, your inbound calls must be processed via
the exten=>s approach (which you apparently are doing).

When dialing an outbound sip call (via your sip provider), the Dial()
statement can use the form:
  exten => _1XXXXXXXXXX,1,Dial(SIP/myOutContext)
where the myOutContext would look something like:
 [myOutContext]
 type=peer	; for outbound calls
 (other parameters as needed to authenticate an outbound call)

For inbound sip calls (via your sip provider), use a context something
like:
 [myInContext]
 type=user	; for inbound calls
 context=InboundSip
 (other parameters as needed to authenticate or qualify the inbound 
  call)

Look carefully at the list of valid parameters for type=user verses
type=peer in /usr/src/asterisk/configs/sip.conf.sample paying close
attention to what's listed in each colume. (Note: authname= is not
listed in the current sip.conf.sample file.)

With most itsp's, you should be able to process outbound calls by
simply using the exten => _1XXXXXXXXXX,1,Dial(SIP/myOutContext)
without the register. (This sort of varies by itsp though.) Try
it and debug that before going on to incoming calls.

Once outgoing calls are accepted, then add the [myInContext] section.

Look closely at the results from 'sip debug' when an inbound call
is placed. If there is a problem with context, authentication, etc,
the debug output will give you a pretty good clue what is not right.

Also, read the comments in the sample config file carefully. For
example: "For incoming calls only. Example: FWD (Free World Dialup)
We match on IP address of the proxy for incoming calls since we 
can not match on username (caller id)"

You might find that your outbound calls are sent to one IP address
(host=) while inbound calls come from a different IP address. That's
not uncommon for any reasonable sized itsp. So, you may need multiple
contexts in sip.conf to handle that. In any case, 'sip debug' is
your friend.

Or, you can combine the above into a single type=friend context like:
 [broadvoice]  ; this is referenced for outgoing calls to Broadvoice.com
 type=friend
 username=3035551212   ; not needed as its in the Register statement
 secret=x65xv1234z
 host=sip.broadvoice.com
 insecure=very
 canreinvite=no
 dtmfmode=inband
 fromuser=3035551212
 fromdomain=sip.broadvoice.com
 context=from-broadvoice	; in extensions.conf
 disallow=all
 allow=ulaw
 deny=0.0.0.0/0.0.0.0
 permit=147.135.8.129/255.255.255.0
 permit=147.135.0.129/255.255.255.0
 permit=147.135.4.128/255.255.255.0

that includes elements from both type=user and type=friend, securing
(somewhat) you inbound calls by insisting they originate from selected
class-c networks owned by your itsp (permit=).

There really isn't any single way (or best way) to define the above
contexts as each itsp _may_ have different requirements. Keep in mind
that your itsp may not be using asterisk at all.

Rich





More information about the asterisk-users mailing list