Hello, this is Jesse with Webformix.<div><br></div><div>We are managing an Asterisk installation for residential VOIP service, and we are having a problem where all inbound calls to DIDs which are assigned to us by our wholesaler but not yet assigned to a downstream customer get caught in a routing loop.</div>
<div><br></div><div>** For example: we get assigned DID block 1230-1239 and only 1230-1233 are given to our customers, then our routing logic sends inbound calls to 1234 back to upstream, which bounce back to us again, tying up all our trunks before emitting an error.</div>
<div><br></div><div>When we recognized the problem I automatically added ael commands to route all known unassigned numbers to a friendly error message, but that is a clumsy approach and the larger issue remains that if we get routed a call for a number we didn&#39;t expect — due to provisioning mistake, premature porting, or mis-routing at our wholesaler — we still need to avoid a routing loop.</div>
<div><br></div><div>** For example, we have block 1230-1239, and upstream sends us a call for 4321 for no reason at all.. we&#39;re not specifically failing that DID so we still get a routing loop.</div><div><br></div><div>
What I would like is to somehow identify all inbound calls (originating from upstream) that are not terminated inside our network, and give them the friendly error. Calls originating from our customers should get routed upstream, but calls originating upstream should not bounce back upstream without an intervening new Dial command.</div>
<div><br></div><div>** For example: we want...</div><div>upstream calls customer @ 1230, rings customer</div><div>upstream sends us call for 4321, we play an error</div><div>customer calls customer @ 1230, rings customer without bothering upstream</div>
<div>customer calls 4321, call bubbles upstream.</div><div>anyone calls customer @ 1233, which has unconditional forwarding set to 4322. Via new Dial command, call should route upstream.</div><div><br></div><div>The trouble is that, to our knowledge, all calls from local clients and all calls we get from upstream have to pass through a context we call &quot;clients&quot; that routes calls to specific local clients. Local calls can&#39;t be sent upstream until after they&#39;ve run this gauntlet, and inbound calls can&#39;t be failed until they have been matched against same patterns, but after those matches it&#39;s no longer clear how to separate the remotely sourced calls into an &amp;Unavailable() bin and send the locally sourced calls upstream.</div>
<div><br></div><div>Here is a simplified version of our configs to give you an idea of the tack we are presently taking.</div><div><br></div><div>Thanks guys! :)</div><div><br></div><div>- - Jesse Thompson</div><div>Webformix Telephone Services</div>
<div><br></div><div>--------------------------------------------------------------------</div><div><br></div><div>== sip.conf</div><div><div>[general]</div><div>context=clients; default context for all calls</div><div><br>
</div></div><div>register =&gt; <a href="mailto:skdfjh@peer.upstreamVOIP.com">skdfjh@peer.upstreamVOIP.com</a></div><div><br></div><div>[upstream]</div><div><div>type=peer</div><div>host=<a href="http://peer.upstreamVOIP.com">peer.upstreamVOIP.com</a></div>
</div><div>username=dfjhjkb</div><div>secret=redacted</div><div>context=clients; context for all inbound calls</div><div><div>call-limit=8</div></div><div><br></div><div>[residential]</div><div><div>type=friend</div><div>
host=dynamic</div></div><div><div>context=local</div></div><div><br></div><div>(SIPcust1)[residentia] ; SIP customer name</div><div>username=SIPcust1</div><div>mailbox=SIPcust1</div><div>secret=redacted</div><div><br></div>
<div>; and other sip customers</div><div><br></div><div><br></div><div>== extentions.ael</div><div>context local</div><div>{</div><div>  // Does some local cleanup, strips leading 1 off number, _N11, star codes, fun stuff</div>
<div>  includes { clients; };</div><div>}</div><div><br></div><div><div>context clients</div><div>{</div></div><div><div>  custDID1 =&gt; Dial(SIP/SIPcust1,35);</div></div><div><div>  custDID2 =&gt; Dial(SIP/SIPcust2,35);</div>
</div><div>  custDID3 =&gt; Dial(SIP/UNCforwardNumber@upstream,120); // inbound calls to forwarding customers should route back upstream</div><div>  unassignedDID =&gt; &amp;Unassigned();</div><div><br></div><div>  _NXXNXXXXXX =&gt; Dial(SIP/${EXTEN}@upstream,120); // numbers not handled here get routed upstream....</div>
<div>  // ... which is a problem if those calls originally came *from* upstream. :(</div><div>}</div><div><br></div><div><div>macro Unassigned() // Audio message played for unavailable numbers, not sure if there&#39;s a machine-friendlier error approach or not. :)</div>
<div>{</div><div>  PlayBack(ro_sit);</div><div>  PlayBack(unassigned);</div><div>  PlayBack(5413);</div><div><br></div><div>  PlayBack(ro_sit);</div><div>  PlayBack(unassigned);</div><div>  PlayBack(5413);</div><div><br></div>
<div><br></div><div>  HangUp();</div><div>}</div></div><div><br></div>