Need help routing calls with Asterisk

Hi all,

We have following scenario

We connect our asterisk server to a VoIP provider for sending and receiving calls. For this we have 2 sip accounts as below [sip.conf]

[provider_outbound]
type=peer
insecure=very
nat=no
canreinvite=no
username=your_name
secret=your_asterisk_password
host=sbc.provider.com
context=provider_outbound

[provider_inbound]
type=peer
insecure=very
nat=no
canreinvite=no
username=your_name
secret=your_asterisk_password
host=95.xxx.xxx.xxx
context=provider_inbound

in [extensions.conf] we have

exten => _NXXNXXXXXX,1,Dial(SIP/provider/00xxxxx${EXTEN})

by using this we are able to send receive calls using a simple sip phone with locally registered sip account.

Now we want to connect a mobile operators soft switch (Huawei MSOFTX3000V1R08C03) so that I can use our asterisk for dialing and receiving calls via same provider.

I have heard some people said to use OpenSER for this purpose. Need suggestion from you guys if I can use Asterisk simply or have to integrate OpenSER with Asterisk.

Cheers,
Nasir

You are using an obsolete version of Asterisk; current versions would reject insecure=very and you would not be able to receive incoming calls. Please indicate which version you are using.

If the Huawei interfaces with SIP, there should be no need to add a proxy. Proxies are normally combined with Asterisk when load balancing is needed.

Also, I would replace the provider_outbound context with provider_inbound.

Dear David,

Thanks you for quick reply.I am using asterisk 1.6.2.24. I will change insecure setting. Problem is that Huawei soft switch block random RTP ports which come to their soft switch when call is established due to which there are audio issues so we wanted to deploy an intermediate gateway having static ip which will then route the RTP through itself.

I didn’t get your point regarding provider_inbound because there are both provider_inbound and provider_outbound specified…

I was also looking to install freeswitch or opensips. I have experience with E1/SS7 with telcos but new in VoIP so Please guide what would be good in this case.

Thanks,
Nasir

Contexts are only used for inbound traffic. Often a single peer entry will work for both, but if you you do have two entries, both of which are configured to accept inbound calls (although one from an explicit IP address and the other from a domain name that may or may not map to the same address), an attacker could make inbound calls on your outbound entry, so you want to make sure that the context it uses cannot make any chargeable calls, I assume that your inbound context is like that. I don’t know what is in your outbound context. Either it is redundant, or it is likely to be the context for locally originated calls, which would, normally, be able to make chargeable calls.

Dear David,

Sorry for late reply as it was weekend here. As mentioned in my original post our provider gave us two separate trunks for inbound and outbound calls termination. The issue is not the security or dialing in-out. Main issue is faced when Huawei switch receives RTP from different IP addresses for different calls. Because Huawei soft switch is configured to allow only one IP address for security reason hence result is one way audio. That is why we were trying to INSERT our asterisk box in between with static IP so that, in some way, when calls are connected our asterisk’s static ip is routed to Huawei soft switch which will be white listed.

I hope you understand my point, if further detail is required then please let me know as I really want to implement this because the operator at Huawei soft switch is not willing to allow multiple addresses for security reason.

Cheers,
Nasir

The RTP should come from the same address as the SIP. It sounds like you have a problem with your routers ,not with Asterisk. The exception is if you enable directmedia (canreinvite= on older versions).

check with the below url. huawei softswitch ignore few parameters on the SDP.

lists.digium.com/pipermail/aster … 19060.html

@David: You mean the IP of the sip provider? As provided in my sip.conf, provider has provided us a fix ip for in/out calls. Does it mean problem is with the provider end? I am confused :frowning:

@Rajkumar4334: Thanks for the help, I will check this too

Unless you enable direct media, the RTP should come from the address of the Asterisk box, as should the SIP from Asterisk. Asterisk does not mind about varying RTP addresses.

As per the settings provided by sip provider, directrtp is not allowed as we can see below nat=no, canreinvite=no

[provider_inbound]
type=peer
insecure=very
nat=no
canreinvite=no

so I am planning to insert my asterisk box in-between and use RTP through my asterisk as there will be no other operation server by my asterisk box except relaying RTP, so that Operator will always see the RTP IP of my box… is this doable?

insecure=very is not supported in current versions of Asterisk; you must explicitly list what you want to make insecure. remotesecret=, with no secret=, is a better way of doing what insecure=invite does. canreinvite is deprecated.

Without directmedia, and assuming your router doesn’t mess things up, the ITSP will see the Asterisk box address on the RTP.

Hi david,

I have managed to insert my asterisk box in between and now all calls will be going through it. Operator is going to do testing now a days and I will update the test results soon.

Thanks,
Nasir

Hi there,

I want to land sip calls from one server to another so I have connected them together. Both are on fix ip but call is always landing in general context on incoming server. Below is the configuration of the incoming server.

[general]
port=5060
bindaddr=0.0.0.0
context=appdemo
qualify=yes
disable=all
allow=alaw
allow=ulaw
allow=gsm
dtmfmode=rfc2833
srvlookup=yes
alwaysauthreject = yes

[myuser]
type=peer
fromuser=myuser
secret=welcome
insecure=invite
context=inbound
directrtpsetup=no
host=203.223.37.50
disallow=all
allow=ulaw
allow=alaw
allow=g729
allow=g723

while on the server which is sending calls, this is the setup:

[general]
port=5060
bindaddr=0.0.0.0
qualify=no
disable=all
allow=alaw
allow=ulaw
allow=gsm
dtmfmode=rfc2833
srvlookup=yes
context=default

[myuser]
type=peer
insecure=port
nat=no
canreinvite=no
username=spectracom
secret=welcome
fromuser=spectracom
host=203.223.37.51
context=inbound
disallow=all
allow=gsm
allow=ulaw
allow=alaw
allow=g729

[abc]
type=friend
qualify=yes
secret=123
context=spec_out
host=dynamic

extensions.conf has
[spec_out]
exten => _X.,1,Dial(SIP/myuser/${EXTEN})

I call using abc sip account but call goes to general context on the remote server while it should land in “myuser”. Anything I am doing wrong? Please help.

As I think I need to use type=user at the receiving end?

Much better would be to treat this as a single trunk and route on the dialed digits.

any example will be highly appreciated as I am novic in voip field. Also if you can point to any good text in this regard? thanks