Calls from certain providers are being blocked

I have a fresh install of the distro and configured my trunk and extensions according to my trunk provider. But I’ve noticed that the PBX blocks calls from certain mobile providers. I have not been able to identify the problem so here’s the asterisk log from one of the blocked calls:

Setting global variable ‘SIPDOMAIN’ to ‘XXXXXXX’
– Executing [XXXXXXX@from-sip-external:1] NoOp(“PJSIP/anonymous-00000044”, “Received incoming SIP connection from unknown peer to XXXXXXX”) in new stack
– Executing [XXXXXXX@from-sip-external:2] Set(“PJSIP/anonymous-00000044”, “DID=XXXXXXX”) in new stack
– Executing [XXXXXXX@from-sip-external:3] Goto(“PJSIP/anonymous-00000044”, “s,1”) in new stack
– Goto (from-sip-external,s,1)
– Executing [s@from-sip-external:1] GotoIf(“PJSIP/anonymous-00000044”, “1?setlanguage:checkanon”) in new stack
– Goto (from-sip-external,s,2)
– Executing [s@from-sip-external:2] Set(“PJSIP/anonymous-00000044”, “CHANNEL(language)=en”) in new stack
– Executing [s@from-sip-external:3] GotoIf(“PJSIP/anonymous-00000044”, “0?noanonymous”) in new stack
– Executing [s@from-sip-external:4] Goto(“PJSIP/anonymous-00000044”, “from-trunk,XXXXXXX,1”) in new stack
– Goto (from-trunk,XXXXXXX,1)
– Executing [XXXXXXX@from-trunk:1] Set(“PJSIP/anonymous-00000044”, “__DIRECTION=INBOUND”) in new stack
– Executing [XXXXXXX@from-trunk:2] Gosub(“PJSIP/anonymous-00000044”, “sub-record-check,s,1(in,XXXXXXX,dontcare)”) in new stack
– Executing [s@sub-record-check:1] GotoIf(“PJSIP/anonymous-00000044”, “0?initialized”) in new stack
– Executing [s@sub-record-check:2] Set(“PJSIP/anonymous-00000044”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [s@sub-record-check:3] Set(“PJSIP/anonymous-00000044”, “NOW=1550777860”) in new stack
– Executing [s@sub-record-check:4] Set(“PJSIP/anonymous-00000044”, “__DAY=21”) in new stack
– Executing [s@sub-record-check:5] Set(“PJSIP/anonymous-00000044”, “__MONTH=02”) in new stack
– Executing [s@sub-record-check:6] Set(“PJSIP/anonymous-00000044”, “__YEAR=2019”) in new stack
– Executing [s@sub-record-check:7] Set(“PJSIP/anonymous-00000044”, “__TIMESTR=20190221-193740”) in new stack
– Executing [s@sub-record-check:8] Set(“PJSIP/anonymous-00000044”, “__FROMEXTEN=unknown”) in new stack
– Executing [s@sub-record-check:9] Set(“PJSIP/anonymous-00000044”, “__MON_FMT=wav”) in new stack
– Executing [s@sub-record-check:10] NoOp(“PJSIP/anonymous-00000044”, “Recordings initialized”) in new stack
– Executing [s@sub-record-check:11] ExecIf(“PJSIP/anonymous-00000044”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [s@sub-record-check:12] Set(“PJSIP/anonymous-00000044”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [s@sub-record-check:13] ExecIf(“PJSIP/anonymous-00000044”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [s@sub-record-check:14] GotoIf(“PJSIP/anonymous-00000044”, “2?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [s@sub-record-check:17] GotoIf(“PJSIP/anonymous-00000044”, “1?sub-record-check,in,1”) in new stack
– Goto (sub-record-check,in,1)
– Executing [in@sub-record-check:1] NoOp(“PJSIP/anonymous-00000044”, “Inbound Recording Check to XXXXXXX”) in new stack
– Executing [in@sub-record-check:2] Set(“PJSIP/anonymous-00000044”, “FROMEXTEN=unknown”) in new stack
– Executing [in@sub-record-check:3] ExecIf(“PJSIP/anonymous-00000044”, “10?Set(FROMEXTEN=3212159636)”) in new stack
– Executing [in@sub-record-check:4] Gosub(“PJSIP/anonymous-00000044”, “recordcheck,1(dontcare,in,XXXXXXX)”) in new stack
– Executing [recordcheck@sub-record-check:1] NoOp(“PJSIP/anonymous-00000044”, “Starting recording check against dontcare”) in new stack
– Executing [recordcheck@sub-record-check:2] Goto(“PJSIP/anonymous-00000044”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [recordcheck@sub-record-check:3] Return(“PJSIP/anonymous-00000044”, “”) in new stack
– Executing [in@sub-record-check:5] Return(“PJSIP/anonymous-00000044”, “”) in new stack
– Executing [XXXXXXX@from-trunk:3] Set(“PJSIP/anonymous-00000044”, “CHANNEL(tonezone)=us”) in new stack
– Executing [XXXXXXX@from-trunk:4] Set(“PJSIP/anonymous-00000044”, “__FROM_DID=XXXXXXX”) in new stack
– Executing [XXXXXXX@from-trunk:5] Set(“PJSIP/anonymous-00000044”, “returnhere=1”) in new stack
– Executing [XXXXXXX@from-trunk:6] Gosub(“PJSIP/anonymous-00000044”, “app-blacklist-check,s,1()”) in new stack
– Executing [s@app-blacklist-check:1] GotoIf(“PJSIP/anonymous-00000044”, “0?blacklisted”) in new stack
– Executing [s@app-blacklist-check:2] Set(“PJSIP/anonymous-00000044”, “CALLED_BLACKLIST=1”) in new stack
– Executing [s@app-blacklist-check:3] Return(“PJSIP/anonymous-00000044”, “”) in new stack
– Executing [XXXXXXX@from-trunk:7] Set(“PJSIP/anonymous-00000044”, “CDR(did)=XXXXXXX”) in new stack
– Executing [XXXXXXX@from-trunk:8] GotoIf(“PJSIP/anonymous-00000044”, “0?”) in new stack
– Executing [XXXXXXX@from-trunk:9] ExecIf(“PJSIP/anonymous-00000044”, “1 ?Set(CALLERID(name)=3212159636)”) in new stack
– Executing [XXXXXXX@from-trunk:10] Set(“PJSIP/anonymous-00000044”, “__MOHCLASS=”) in new stack
– Executing [XXXXXXX@from-trunk:11] Answer(“PJSIP/anonymous-00000044”, “”) in new stack
> 0x7ff22c0550f0 – Strict RTP learning after remote address set to: IPIPIPIP:50004
== Spawn extension (from-trunk, XXXXXXX, 11) exited non-zero on ‘PJSIP/anonymous-00000044’
– Executing [h@from-trunk:1] Macro(“PJSIP/anonymous-00000044”, “hangupcall,”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“PJSIP/anonymous-00000044”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] ExecIf(“PJSIP/anonymous-00000044”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [s@macro-hangupcall:4] NoOp(“PJSIP/anonymous-00000044”, " monior file= ") in new stack
– Executing [s@macro-hangupcall:5] AGI(“PJSIP/anonymous-00000044”, “attendedtransfer-rec-restart.php,”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/attendedtransfer-rec-restart.php
– <PJSIP/anonymous-00000044>AGI Script attendedtransfer-rec-restart.php completed, returning 0
– Executing [s@macro-hangupcall:6] Hangup(“PJSIP/anonymous-00000044”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 6) exited non-zero on ‘PJSIP/anonymous-00000044’ in macro ‘hangupcall’
== Spawn extension (from-trunk, h, 1) exited non-zero on ‘PJSIP/anonymous-00000044’

I need help on identifying why this specific call was blocked. When I call from another mobile phone, the call gets forwarded to the IVR without a problem.

The call is being treated as anonymous, so the SIP invite is not coming from a peer that is already set up as a trunk.

Thanks for the fast reply.

I’ve set “Allow Anonymous Inbound SIP Calls” in my general SIP settings to “yes”. IS there another place where I must set this as to be able to receive such calls?

You should not do this as it will let anyone attempt to send calls to and through your PBX. You should have a PJSIP trunk for your providers that matches the IPs they will send calls from.

Thanks for your concern. This box is not visible from the internet. It has a direct connection towards my local trunk provider. My main concern is that FreePBX is still blocking said calls even with this setting enabled and I need to receive calls from that trunk.

But now that we are on this subject, How many “host=” strings can I add to my trunk config? Additionally, How can I determine the originating IP from this call as to add it to my settings?

Then all your inbound calls should be coming from that provider. If they use multiple IPs to send calls to you, then you need to match them in your peers. So let’s cover some things.

  1. Are these Chan_SIP trunks? If that is the case they can support 1 host/IP per trunk. So if they have 5 IPs they can send calls from, you need five Chan_SIP trunks for it.

  2. What port is Chan_SIP listening on? Because the debug you provided showed calls hitting the PJSIP driver, which is what listens on 5060 (unless you changed it around). So if you didn’t setup your provider to send calls to the proper port, that could be your issue. Chan_SIP uses 5160 not 5060.

  3. How can you have a local trunk provider but then calls from certain mobile providers don’t work? They would, like all your other calls go through your local trunk provider that is supplying your DIDs. Otherwise they are trying to send calls directly to your PBX which means you have more than one provider and it’s visible to the Internet.

So what is the setup here?

Thanks for the insights. The problem was that I configured a CHAN_SIP trunk, when it should have been PJSIP.

After switching the type of trunk, I could disable anonymous sip clients and receive calls without a problem.

More correctly, the problem was your provider was not configured to send calls to the correct port on your PBX.

1 Like

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