Inbound dial from sip provider

I want to call from a mobile phone with the DID number provided by a sip provider into my asterisk server. I can make an outbound call from the asterisk server to my mobile phone just fine.

[ SBC (asterisk 172.16.5.58) ] <--- [ PSTN ]

Following are my configuration files
sip.conf

[general]
register=user:password@sip provider url/user

; outbound settings. I can call to pstn with exten = _.,1, Dial(SIP/${EXTEN}@Hosted01)
[user]
username=user
type=user
secret=password
context=from-trunk-sip-Hosted01

[Hosted01]
type=friend
username=user
secret=xxx
port=xxx
insecure=port,invite
nat=force_rport,comedia
host=<sip provider@sip provider.com>
context=from-trunk-sip-Hosted01
fromuser=user
sendrpid=yes
trustrpid=yes
canreinvite=yes
fromdomain=<sip provider@sip provider.com>
dtmfmode=rfc2833
allow=alaw
allow=ulaw

; inbound settings
[provider]
type=peer
username=xxx
secret=xxx
insecure=port,invite
nat=force_rport,comedia
host=<sip provider@sip provider.com>
context=from-sip-external-Hosted01

extensions.conf

[from-trunk-sip-Hosted01]
exten = 1000,1,Answer()
same = n,Wait(1)
same = n,Playback(hello-world)
same = n,Hangup()

sip show peers shows

CLI> sip show peers
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description                      
Hosted01/user             xxx.xx.xxx.xx                               Yes        Yes            5060     OK (1 ms) 
phone3/phone3             yy.yy.yy.yy                              D  Yes        Yes            4007     OK (7 ms)                                    
phone4/phone4             yy.yy.yy.yy                              D  Yes        Yes            4007     OK (5 ms)                                    
provider                  xxx.xx.xxx.xx                               Yes        Yes            5060     OK (1 ms)                    

Both redacted (xxx.xx.xxx.xx) IPs are the same.

I expect when I call the DID on my mobile phone, I will get a hello-world response. However, I am getting a busy line.

note: there are two asterisk servers on 172.16.5.56 at two different ports connected with a trunk each. phone3 and phone4 are connected with Jami softphone in the office, and I can make a call from the softphone to this SBC.

Log with sip set debug on and core set verbose 500 as attached.inbound-002.txt (23.8 KB)

I’ll look in more detail later, but initial impressions are:

Why do you have NAT workarounds configured when you are note behind NAT (you don’t have the mandatory options for that case)?

Why are you using type=friend, rather than type=peer? Why type=user? (These are especially strange as they are in a section labelled as outgoing, but would only be relevant for incoming calls.)

Why are you using chan_sip, when chan_pjspip is the one with official support?

canreinvite is deprecated in favour of directmedia, which suggests you have used an obsolete configuration example.

It is very uncommon for service providers to support direct media, so canreinvite=yes is likely to cause one way audio problems, or simply be ineffective.

Why are you making port checking insecure; that suggests copying a configuration without understanding it. Such configurations are often designed to make the setup make calls without tweaking, but at the expense of security.

You should merge the inbound and outbound sections, making the type peer (there is no reason to use friend, or user).

Unless the provider ignores part of the registration, all incoming calls will be directed to extension “user” (and there should be log messages warning you of this), as you have explicitly requested the provider to do that in your register line. (I’m not sure if you can avoid forcing the user part of the request URI, when you have to register, so you need to find out how the provider actually forwards the destination number that they received. I suspect that is normally done in the To header (basically most provider based services kludge direct in dialing, and DID has come to mean something different in the VoIP world from its traditional meaning).

1000 doesn’t seem right for a direct in dialing number; I’d expect most, or all of the full international number, although that may also be an area in which things are kludged.

I don’t see any incoming call attempts in the provided log.

Why do you have NAT workarounds configured when you are note behind NAT (you don’t have the mandatory options for that case)?
Why are you using type=friend, rather than type=peer? Why type=user? (These are especially strange as they are in a section labelled as outgoing, but would only be relevant for incoming calls.)
canreinvite is deprecated in favour of directmedia, which suggests you have used an obsolete configuration example.
It is very uncommon for service providers to support direct media, so canreinvite=yes is likely to cause one way audio problems, or simply be ineffective.
Why are you making port checking insecure;

I inherit these settings from an installation not made by myself which comes from a freepbx distro installation - I am not using freepbx moving forward. Outgoing calls work with this Hosted01 context so I left them untouched. Nat settings were carried over when I copy pasted settings from NATted asterisk servers.

Why are you using chan_sip, when chan_pjspip is the one with official support?

It is on chan_sip because of a business decision. I will look into converting to chan_pjsip in the future.

1000 doesn’t seem right for a direct in dialing number; I’d expect most, or all of the full international number, although that may also be an area in which things are kludged.

You are right! I have now changed it to:

[from-trunk-sip-Hosted01]
exten = 02xxxxxxx,1,Answer()
same = n,Wait(1)
same = n,Playback(zombies)
same = n,Hangup()

exten = _.,1,Answer()
same = n,Wait(1)
same = n,Playback(hello-world)
same = n,Hangup()

I don’t see any incoming call attempts in the provided log.

My bad, I had the asterisk listen on a different port because 5060 is being bombarded with hacking attempts and pollutes the logs.

I have updated the sip.conf with:

[general]

[Hosted01]
disallow=all
username=user
;type=friend
type=peer
secret=password
qualify=yes
port=port number
musiconhold=framed
;insecure=port,invite
insecure=invite
;nat=force_rport,comedia
nat=no
host=<sip provider.com>
fromuser=user
sendrpid=yes
trustrpid=yes
;canreinvite=yes
directmedia=nonat
fromdomain=<sip provider.com>
dtmfmode=rfc2833
allow=alaw
allow=ulaw
context=from-trunk-sip-Hosted01

I also deleted the provider context in sip.conf.

I can see the trunk connection in the registry…

sbc01*CLI> sip show registry
Host               dnsmgr Username       Refresh State                Reg.Time                 
<sip-provider-url> Y      user           105 Registered           Wed, 21 Oct 2020 00:57:46
1 SIP registrations.

…and with sip show peers, along with its two trunks into two internal servers.

sbc01*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description                      
56-peer-5060              172.16.5.56                                 Yes        Yes            5060     OK (1 ms)                                    
56-peer-5260              172.16.5.56                                 Yes        Yes            5260     OK (1 ms)                                    
Hosted01/25772350001      sip-ipaddr                                  No         No             5060     OK (1 ms)  

Nothing in the logs except re-registration to the sip provider.

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