Inbound calls from DID number and sip provider

hi i have asterisk on debian 9 server and im with gotrunk sip provider
i have a phone number in gotrunk and i want everyone call that number to ring in my
main extenion 7001 (i use zoiper)

sip.conf file :
register =>




type = peer
context = from-trunk
canreinvite = no
defaultuser = USERNAME
secret = PASSWORD
fromdomain = domainname
hassip = yes
host = IP
registersip = yes

extenions.conf file:

exten => 7001,1,Answer()
exten => 7001,2,Dial(SIP/7001,60)
exten => 7001,3,Playback(vm-nobodyavail)
exten => 7001,4,VoiceMail(7001@main)
exten => 7001,5,Hangup()

exten => 7002,1,Answer()
exten => 7002,2,Dial(SIP/7002,60)
exten => 7002,3,Playback(vm-nobodyavail)
exten => 7002,4,VoiceMail(7002@main)
exten => 7002,5,Hangup()

exten => 7003,1,Answer()
exten => 7003,2,Dial(SIP/7003,60)
exten => 7003,3,Playback(vm-nobodyavail)
exten => 7003,4,VoiceMail(7003@main)
exten => 7003,5,Hangup()

exten => 8001,1,VoicemailMain(7001@main)
exten => 8001,2,Hangup()

;outbound calls
exten => 8002,1,VoicemailMain(7002@main)
exten => 8002,2,Hangup()
exten => _*x.#,1,NoOp(#### [internal] ####)
exten => _*x.#,n,Set(CALLERID(num)=MY PHONE NUMBER)
exten => _*x.#,n,MixMonitor(${UNIQUEID}.wav,ab)
exten => _*X.#,n,Dial(SIP/gotrunk/${EXTEN:1})

;inbound calls
exten => _[0-9].,1,NoOp(#### [from-trunk] ####)
exten => _[0-9].,n,Dial(SIP/7001)
exten => _[0-9].,n,Hangup()

i Followed the User Manual of gotrunk

still not getting inbound calls

Which error messages do you get? Does your PBX register with the provider?

That said, I’ve seen a lot of outdated recipes from providers in the past and chan_sip has been replaced with the PJSIP stack meanwhile.

I haven’t looked at your configuration, but the first thing I would do is confirm that you are receiving packets from gotrunk. Something like:

sudo tcpdump -A -i any -s 0 port 5060

will give you a clue.

Next, I’d watch the Asterisk console to see if packets are making it past your firewall. (tcpdump sees packets before iptables.)

sudo asterisk -r
pbx11*CLI> pjsip set logger on

Next, I’d see what Asterisk does with the call:

sudo asterisk -r
pbx11*CLI> core set debug 3
pbx11*CLI> core set verbose 3

Good luck!


it send the packets with the did phone number

pbx11*CLI> pjsip set logger on
no output

Also need

pjsip set logger verbose on

pjsip …
Of course, you do not get any output. Your configuration is for the deprecated chan_sip stack, whereas pjsip set logger, etc refers to the newer PJSIP stack. There used to be a similar command to get similar SIP traces from chan_sip, but I can’t remember what it was.

You should probably start with the checking the registration status.

refresh status
105 Registered

This looks like another one! If you are going to succeed with Asterisk, you need to configure from first principles, as what you get from providers and other cook book examples is generally plain wrong.

In this case, if the provider is implementing the register according to the RFC, the incoming extension will be s, not a number, as that is the default contact user address that Asterisk uses.

Also, it is very unlikely that they will authenticate themselves to you, so you need to configure for outbound only authentication. With immediately pre-deprecation versions of chan_sip, the best way of doing that was by replacing secret by remotesecret.

It is likely that you will need fromuser for outbound calls. (Actually you won’t, as this has been set by the Caller ID.)

hassip: bogus
registersip: bogus
defaultuser: not meaningful for non-dynamic host, and even then rarely needed
canreinvite: deprecated version of name

There is nothing unusual in their user guide that would suggest there would be a ny reason not to use chan_pjsip.

Lower case x is not a special character.

. can only be the last character in a pattern.

Lower x works fine. I’ve been using it for a very long time:

  '_011x.' =>       1. verbose(1,[${EXTEN}@${CONTEXT}])           [extensions.conf:323]
  '_1nxxnxxxxxx' => 1. verbose(1,[${EXTEN}@${CONTEXT}])           [extensions.conf:1491]
  '_8378xx' =>      1. verbose(1,[${EXTEN}@${CONTEXT}])           [extensions.conf:303]
  '_testxx' =>      1. verbose(1,[${EXTEN}@${CONTEXT}])           [extensions.conf:307]
  '_x' =>           1. verbose(1,[${EXTEN}@${CONTEXT}])           [extensions.conf:297]

Theirs so little information about incoming calls configuration and problem fixing for asterisk on the internet :thinking: so here’s how i fixed it :robot::

It was the issue in sip.conf

and in the extenions.conf

Thank you all for the help :boom:

defaultuser should do nothing here.

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