Configure SIP trunck

Hi,

I want to add a sip trunk I have a provider with it I can reach the others numbers (make outgoing calls)
should i just add the below config on the sip.conf ?

[My_provider]
type=friend
host=my_ip_address
context=users

No.

type=friend has security issues.

That is the wrong IP address to supply.

Contexts called users are typically used for people trusted to be able to make chargeable calls; you don’t want outsiders to be able to do that.

Also I am not aware of any ITSPs that don’t require outgoing calls to be authenticated.

so how can i make the good config ? :slight_smile:

By understanding what the options actually mean.

Most people just ask the trunk provider, but that tends to result in configurations that use deprecated options and achieve works first time at the expense of security.

There is a lot of information here: http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/OutsideConnectivity_id291235.html#OutsideConnectivity_id291268

1 Like

Thank you David551 it’s work but i have issue :

  • I can call any one but with silence for the both users the end and the near far.

Are you behind NAT? If so then Asterisk has to be configured to know it is behind NAT, and if the remote users are behind NAT then they have to be configured in Asterisk for that or else you will get no audio (or one way audio).

Yes I’m

I made NAT=yes in Sip.conf but I get a same issue

That only tells chan_sip that a device is behind NAT.

Is your Asterisk also behind NAT? If so then you need to forward ports, configure the “externip” option, and configure the “localnet” option. Otherwise your phones will be trying to send to the private IP address of Asterisk, which won’t work.

I think it is a big problem for newbies that there is this parameter called nat=, as they think that it is all they need for outgoing NAT when it is really more about when Asterisk is outside and the phone is inside.

I’m pretty certain that it gets overused, particularly in terms of sub-options that may not be relevant.

Having yes options for set valued parameters also causes newbies not to think about what the parameter really does.

This was taken into account when creating the chan_pjsip channel driver, there is no “nat” option there although a few people have expressed an interest in it. There are specific individual options which each turn on specific behavior, but together can be made to be equivalent to “nat”.

Thank you for the feedback
I’ll give more details about my networking
My Asterisk has two networks cards one for internally network (which has all soft phones ) the second network is wired with a router 4G LTE which connected with SIM card directly to SIP server (GSM provider)
so my internally network on the 10.XX.XX.XX and the router has 10.150.1.XX and SIM has 172.103.12.11 (is WAN for me)
The provider communicates with router (172.103.12.11) not with my IP asterisk then the router sends the data to Asterisk

The 172 address is probably your external IP.

Why have you partitioned your local network in this way?

In any case, you will, almost certainly need directmedia=no, directmedia=nonat, on the ITSP side.

1 Like

Thank you for the helping , now it’s work fine the issue wan in the router before asterisk system ,the router didn’t forward anything to asterisk