Register siptrunk to providers IMS

Dear Friends,

I am having a trouble for days to figure out how to configure sip trunk to register directly to providers IMS. I gave up on further searching and I know that this may be asked often but I am in a dead end.
What I can achieve now is to register it but there is no way I can place a call via that trunk. For incoming calls I get the connection but there is no audio while actually I should hear (and I dont know why but thats what I see in asterisk log files. Asterisk default prompt) “The number You have dialed is not in service. Please check the number and try again”. In the logfiles before playing those promts it stands like this:

[2018-10-07 21:48:24] VERBOSE[1733][C-000004d2] pbx.c: Executing [[email protected]:6] Log(“SIP/”, "WARNING,“Rejecting unknown SIP connection from"”) in new stack

TCPDUMP gives this on registration:

21:48:11.104297 IP (tos 0x60, ttl 64, id 10210, offset 0, flags [none], proto UDP (17), length 718) > [bad udp cksum 0x80dc → 0x5d83!] SIP, length: 690
Via: SIP/2.0/UDP;branch=z9hG4bK5db34251;rport
Max-Forwards: 70
From: sip:[email protected];tag=as7adaf115
To: sip:[email protected]
Call-ID: [email protected]
Supported: replaces, timer
User-Agent: FPBX-
Authorization: Digest username="[email protected]", realm=“”, algorithm=MD5, uri=“”, nonce=“C2F9B68A0763BA5B000000008DCCAA35”, response=“742a07c6caffdf66d872a347b2a3c2e6”, qop=auth, cnonce=“56d5b7f8”, nc=00000001
Expires: 120
Contact: sip:[email protected]:5160
Content-Length: 0

21:48:11.224625 IP (tos 0x60, ttl 125, id 0, offset 0, flags [none], proto UDP (17), length 727) > [udp sum ok] SIP, length: 699
SIP/2.0 200 OK
Via: SIP/2.0/UDP;received=;branch=z9hG4bK5db34251;rport=5160
From: sip:[email protected];tag=as7adaf115
To: sip:[email protected];tag=8d6a58f005e9ab4720d35c7b98378bc1
Call-ID: [email protected]
Content-Length: 0
Contact: sip:[email protected]:5160;expires=1800

The default port for chan_sip is 5160 and I cannot change it to 5060 so in this case the source port is 5160 but it seems it can work.

My chan_sip trunk configuration is like this:

PEER Details:

[email protected]

Register string:

[email protected]:PASSWORD:[email protected]@

Here are the screenshot how it was done in the huawei router given from provider:

Is there anyone who can help me with this, explain it and clear my mind about it a little bit? :slight_smile:

Best Regards.

Hello again,

I also tried this with PJSIP but I get this in asterisk log files:

[2018-10-09 08:40:14] ERROR[30868] res_sorcery_config.c: Could not create an object of type ‘registration’ with id ‘+382XXXXXXXX’ from configuration file ‘pjsip.conf’
[2018-10-09 08:40:14] ERROR[30868] res_pjsip_config_wizard.c: Unable to load config file ‘pjsip_wizard.conf’

Guys? Anyone know whats the problem? In both cases… :frowning:

Best Regards.

So IMS gave you a router that has the SIP account setup inside of it? Did you remove all that from the router?! Is this some residential service or some business service?

Hello Friend!

Thank You very much for replying to this!

Yes, IMS gave me Huawei HG8245 router where SIP line is installed. What I did is disabling VoIP WAN so the device don’t register the SIP line itself. Other step is bridging the VoIP WAN so I get VoIP WAN DHCP directly to one of LAN ports of my PBX. I have tried grandstream GXP1620 to register directly to IMS and it works like a charm but I have never achieved this with FreePBX. :frowning:

Yes, the service is a residential service but used by a company.

Best Regards.

Get a real business service. I’m not 100% about IMS but generally providers don’t like companies and PBX systems on their Residential service network. I’m pretty sure they have no obligation to support or help this. Really there is also a very good chance you are violating their TOS doing this as well

Get the proper service for what you need and then we can worry about troubleshooting this. Because they may allow IP phones (since it limits you) vs seeing PBX User Agents on their network.


Im not violating anything. I already checked… Yes, they dont support this but I know it can work. Can You help me figure it out? It is absolutely not blocked by ISP.
By the way, the business service here means 10 or more numbers which is mostly not needed by small and medium companies.

Best Regards.

You need to show your configurations for this. Generally PJSIP won’t even start properly if the config is messed up in any way.

The configuration for CHAN_SIP is in the first message. CHAN_PJSIP worked (tried to authorise but my server uri was misconfigured) but I did several changes few times and then stopped working. How to copy PJSIP settings?

Best Regards.


Here they come:

Thanks friend.

You are REGISTERing with IMS, most of those settings under Advanced should be left blank so FreePBX can set them properly.

Leave the From User/Domain. Clear out the AOR settings, Server URI, Contact User and Client URI. Try again.

Hello Tom Ray,

It doesnt work with that kind of settings… Too many pjsip errors in that case. :frowning:

Now I achieved something. It can send the registration request again but I always get BAD REQUEST.

Here it is:

20:06:38.017443 IP (tos 0x60, ttl 64, id 15770, offset 0, flags [DF], proto UDP (17), length 619) > [bad udp cksum 0x80a8 -> 0xe3b4!] SI P, length: 591
REGISTER sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP;rport;branch=z9hG4bKPjaa671a53-4aef-4 6d0-a533-4cd696523abe
From: sip:[email protected];tag=4a43b45d-818e-4d0b-be41-65703 7cff62c
To: sip:[email protected]
Call-ID: 5ef4d1a3-e323-4aa9-9495-333be824c49c
CSeq: 19636 REGISTER
Contact: sip:[email protected]:5060;line=swnczyn
Expires: 1800
Max-Forwards: 70
User-Agent: FPBX-
Content-Length: 0

20:06:38.029440 IP (tos 0x60, ttl 125, id 0, offset 0, flags [none], proto UDP ( 17), length 431) > [udp sum ok] SIP, length: 403
SIP/2.0 400 Bad Request 000461982
Via: SIP/2.0/UDP;received=;branch=z9hG4bKP jaa671a53-4aef-46d0-a533-4cd696523abe;rport=5060
From: sip:[email protected];tag=4a43b45d-818e-4d0b-be41-65703 7cff62c
To: sip:[email protected];tag=f9bbbd4c05fa43a5c0d3666b56aaac1 2
Call-ID: 5ef4d1a3-e323-4aa9-9495-333be824c49c
CSeq: 19636 REGISTER
Content-Length: 0

In normal successful registration here stands +382XXXXXXXX instead of this.
And also register but if I put only that in server uri than it wont even try to register. Currently, i put there sip:[email protected]:5060

It really bends my mind… :frowning:

BTW, it seems that FPBX now is not changing the configuration, no matter what I put there or change. For example, I have the + mark now in every field but I still don’t see it in sip registration request. Any thoughts?

You might need to add the Contact User, they may be rejecting it do to that. You may want to contact IMS and find out why they are sending a 400 Bad Request back to you. If they tell you why, that can tell you what you fix.

Thanks, Tom Ray.

I already tried what You suggested but still nothing. With chansip i managed to get it register and I can place a call to the registered number but no audio and it also doesnt ring any extension even if I have inbound route ANY/ANY (any did and any cid).

OK, please contact IMS and find out why they are sending the 400 Bad Request. We can guess all day as to why they are doing it, they can actually tell you.

Yes. In the end, thats the only option. I will post here when I make it work.

Thanks a lot for the conversation and help.

Best Regards.

Look, being that I am/have been a service provider for a very, very long time. I can tell you there is no shame in contact the provider and saying “Hey I’m having an issue, can you see why X is happening?” it can generally be the fastest route to the answer with the simple/basic stuff checks out on your end.

So something not only is it the “only option” it is the “best option” instead of wasting hours guessing.

Well, maybe with Your provider. :slight_smile: In my case it is a bit complicated. Our provider has outsourced all technical knowledge. It is a slow procedure to get real technical help from them. Unfortunately…

Anyway, I appreciate Your help! I owe You a drink. Thanks, friend. :wink:

I’m gonna go out on a limb. Someone else had a service like this and the router was rejecting the connection because it was coming from an “Asterisk” user agent. They could connect with a phone just fine, but the box wouldn’t let them connect an Asterisk-based system at all.