Sip Trunk to Dyndns host

Hi Experts,

I have SIP Trunk from my Freepbx 2.11.0.42 to a Goip1 gsm gateway. goip runs on ADSL connection at remote location with dynamic IP address. SIP server has public IP address and its NATed. I have made dyndns host for adsl connection running at remote location where goip gsm gateway connected and configure SIP trunk as follows;

host=gsmgateway.dyndns.org
context=from-trunk
username=
secret=
type=peer
nay=yes
dtmfmode=rfc2833

In GSM Gateway side configured Trunk GW as SIP server public IP
and Authentication settings.
with this setup I can make outgoing calls via gsm gateway.

But issue start when ADSL Public IP get changed my trunk get disconnect and its showing previous Public ip with [UNREACHBLE] status in “sip show peers” list.
its its not re-registring the trunk unless I run “SIP RELOAD” command.

I have change trunk peer details in FreePBX as host=dynamic .
with peer as dynamic, SIP trunk not getting registered at all. I have tried adding and chaining peer detail in trunk but no luck.

So my two questions are

  1. is there any workaround or additional configuration required to set host=dynamic and make this work without stay disconnected when ADSL public ip got changed.

  2. if not how can i make freepbx to tell to re-register sip trunk if it got disconnect. or at least a method i can make a schedule to run SIP Reload command in every hour.

Thanks in Advance and sorry if this question is duplicating another post.

Janaka

Janaka,
I also use a pstn gateway with SIP over the internet to a freepbx for one of my clients

I am not familiar with your gateways exact settings because my gateway is a Cisco device, however

You will need to program your pstn gateway (not freepbx) to have a shorter SIP registration setting for example 300s (5min). Check the settings on the gateway, for the Cisco SPA8800 it is under the Line tab --> Proxy and Registration --> then next to where i have the subscriber info is “Register Expires”

Try setting that to 300

Thanks for Reply.

I do understand the point. but unfortunately my GoIP1 GSM Gateway(from hybertone) doesn’t have such a option.
Because of that I were thinking to make it from FreePBX side. FreePBX detect Trunk failure and display as trunk “UNREACHABLE”. since it doesn’t know other side is a dynamic IP mapped to host name(dynamic DNS), its not doing anything after that.

How could I run a schedule script in CentOS to reload CHAN SIP in every hour?. so freepbx will able to re-establish sip trunk if its already disconnected!!!

Thanks
Janaka

The easiest way is to simply turn off registration for your device and trunk altogether, and just have both point directly to one another using the dyndns address.

That means telling your GSM gateway that registration is not required and that it can sent calls to your Asterisk system by sending the calls to its dyndns address, and that incoming calls can be validated using the username and password. You can then eliminate the registration string on the trunk settings.

If that’s not possible, you might try configuring your GSM gateway to register TO your PBX system. If you can do that, then set your PEER details to host=dynamic and delete your register string, and add the following to your PEER details:

maxexpiry=30

(That will set the registration timeout to 30 seconds).

If that’s not possible, then you might consider turning off qualify packets by adding

qualify=no

to your Trunk’s PEER details. This will prevent qualification packets from being sent and having the trunk marked as inactive. I’m not sure whether it will solve your problem, but its worth a try. You can delete it if it doesn’t work.

There are some settings that can go in the PEER details that may force registration renewals more frequently. I haven’t tested these (or even looked them up to determine if they do what you want), but you might try them:

session-timers: refuse
session-expires: 30

Thanks for the information,

yes will have a try with your guide and post the result here.

Thanks
Janaka

I have tried with MaxExpiry=30. with host=dynamic. but then after trunk went offline and even i restart chan sip it didn’t came up. and sip registry start showing as follow. checked with qualify=no. it changed the trunk status to “unmonitoring”. so changing above settings din’t workout. :frowning:

GOIP (Unspecified) D N 0

Thanks
Janaka

Hi Janaka,

Did you find solution for you GoIP issue, I have same problem.

HI Rob Sorry for Delay,

I couldn’t find a solution for above issue from freepbx side. as a workaround I have decide to run a scheduled task to reload SIP. (so it will discover new public IP mapped to dyndns host name.
Follow below article ;

Thanks
Janaka