Unable to receive incoming calls on a trunk with outboundproxy

Hello guys,

I am running Asterisk 13.35.0. I have configured a SIP account as a Trunk, because I want to use it’s DID number.

The settings from the provider look like this:
Username: some-username
Password: some-password@
Host: domain.com
Outbound Proxy: sip.domain.com
Port: 5060
Fromuser: I don’t know if its correct, but I put some-username
Fromdomain: I don’t know if its correct, but I put domain.com

The register string looks like this:
some-username@domain.com:some-password@@sip.domain.com:5060/some-username

Config looks like this

[trunk-name]
user=some-username
username=some-username
secret=some-password@
disallow=all
allow=g729,gsm,opus,alaw,ulaw
directmedia=no
context=billing
dtmfmode=RFC2833
insecure=port,invite
nat=force_rport,comedia
qualify=yes
type=peer
host=domain.com
fromdomain=domain.com
fromuser=some-username
sendrpid=no
outboundproxy = sip.domain.com

[trunk-name1](trunk-name);
host=the-ip-of-domain.com (calls appear to come from it, the IPs of proxy and domain are different)

sip show registry says this:

sip.domain.com:5060                     N      some-usernam       105 Registered           Sun, 20 Mar 2022 16:05:11

However, when I try to call the DID number, I get an error:

[2022-03-20 16:06:38] NOTICE[29542][C-00002e47] chan_sip.c: Failed to authenticate device <sip:MY-CALLER-PHONE-NUMBER@domain.com>;tag=6524E8C1-623742FE000016EC-0A009700 for INVITE, code = -1

sngrep reports a 401 unauthorized and a 403 forbidden error code for the invite string.

I didn’t test outbound calls yet. Any ideas what to do?

My regular trunks work perfectly fine. The difference with them is the presence of proxy.

P.S. I know Asterisk 13 is EOL and using chan_sip seems frowned upon here, but I can’t really upgrade at the moment/change the software stack, as it would require a significant investment and too much time. If you can’t/don’t want to help me due to this fact that’s completely fine, I still appreciate your time reading.
Thanks.

Tip to troubleshooting, try compare the authentication in your REGISTRE with your INVITE

Yes, the invite is not containing my username. They send the header with caller-id@domain.com . I unfortunately cannot remedy this - it is just how their system works.

I suspect they are not sending from the first DNS record’s for domain.com (I’m guessing that domain.com was really supposed to be example.com, although I never understand why people obfuscate the ITSP, as the ITSP name is important information).

The correct solution to this is to use chan_pjsip and include match lines for all the possible addresses and address ranges from which they can send.

The ITSP is vmobile.eu - it is a local provider. Is there no way to get this working with chan_sip?

P.S. I forgot to say that it claims the “trunk-name1” peer unreachable. I guess this is because registration requires the proxy to work. “trunk-name” is fine.

The workarounds for chan_sip are to either create peer entries for very address they use, or to enable allowguest.

Thanks. I have changed host on

[trunk-name1](trunk-name);
host=the-ip-of-domain.com

to

[trunk-name1](trunk-name);
host=the-ip-of-sip.domain.com

and now both peers show reachable.

However I get a new error:

[2022-03-20 22:56:43] NOTICE[29542][C-000033eb] chan_sip.c: Call from 'some-username' (ip-of-sip.domain.com:5060) to extension 'some-username' rejected because extension not found in context 'my-context'.

The username that the provider gave me doesn’t exist in my own pbx’s extensions. I have inbound route to an existing extension. Perhaps, here I need to tweak SIP URI or something?

UPDATE: If I change the registration string to:
some-username@domain.com:some-password@@sip.domain.com:5060/my-local-active-extension

I am now able to receive incoming calls. The error however still appears in the logs.

That doesn’t make sense. If the error didn’t go away, one would expect it to change to say “to extension ‘my-local-active-extension’” and the call to fail. You can’t have a situation with that error message and the corresponding call being handled.

I know. It is funny thing. This provider is really strange to work with, but I am getting two DIDs for less than 3 USD/yearly so I can’t really complain. Their support doesn’t have much idea and denied giving me a proper trunk anyway.

The SIP URI they provide is some-username@domain.com , but unfortunately, as this is not a trunk, but just a SIP account I am unable to change it or tell it to ring something else on my asterisk box.

If I can’t figure it, I guess I will just let it pop an error on every call and leave it as-is.

With Groundwire, everything works fine - but I thought it would be nice to unify those two DIDs under one extension on my own PBX.

EDIT: You are a genius! I decided to restart Asterisk, just as try-out and the error went away! Now calls are being handled and no error in console anymore. Thanks, many many thanks! Your help was invaluable!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.