[asterisk-dev] pjsip / asterisk 14+: Sometimes outbound calls are forbidden by provider

Michael Maier m1278468 at mailbox.org
Fri May 24 07:23:34 CDT 2019

On 24.05.19 at 13:14 Joshua C. Colp wrote:
> On Fri, May 24, 2019, at 6:02 AM, Michael Maier wrote:
>> Hello!
>> some people are facing a problem regarding forbidden outbound calls to 
>> the ISP. They start an outbound call, which is rejected by the
>> provider. Debugging revealed the reason: The IP used for the outbound 
>> INVITE is different from the IP used for the REGISTER. That's why the
>> ISP forbids the outbound call.
>> Background:
>> A SRV lookup gives 3 hosts each with different priority. At the start 
>> time, Asterisk takes the IP with the highest priority for the
>> REGISTER. REGISTER timeout is 660s.
>> Some time later, lets say 300s, an outbound call is started, which is 
>> rejected by ISP (forbidden), because of wrong destination (REGISTER IP
>> != INVITE IP).
>> My question:
>> Is it possible, that asterisk performs a DNS lookup before it sends the 
>> INVITE to the ISP for the outgoing call? At this moment, the DNS
>> reports changed priorities or the REGISTERed IP isn't there at all any 
>> more and therefore, Asterisk uses another IP for the outgoing INVITE?
> Yes, this is how it works. The outbound registration and calling aren't associated at all. When an INVITE is done then another resolution occurs along with picking an IP address.

Unfortunately, this doesn't work, if the REGISTER to the existing old IP isn't re-registered to the new IP before the INVITE is performed.

I forgot to mention one more difficulty: There is more than one number registered to the same destination which may have differing
reREGISTER point of times.

Therefore, the process should be like this?

- Outbound call is started
- DNS lookup is performed
- Check for difference of REGISTER IP (of this dedicated outgoing number) and INVITE IP
  -> Difference detected? Yes:
	-> Stop REGISTER for this number (or leave it if there is an ongoing call using this
	-> Start REGISTER for this number with new IP
- Start INVITE to new IP


More information about the asterisk-dev mailing list