<div dir="ltr">Hi Nitesh<div><br></div><div>As you already know, opensips is a low level software. You have to understand several aspects of SIP, network, RTP, DNS that when you use Asterisk, most you don't need to understand deep.</div><div><br></div><div>Trying to help you, your script is way simple for you achievements. You need:</div><div>1) Check NAT on all request + all replies. This is to fix your SIP messages.</div><div><br></div><div>2) Check if you need to apply RTPPROXY on the call. You can use the "engage" function on INVITE then forget about it OR you can use manual way with "offer" function and handle all scenarios manually. For example, call the "answer" function on the 200 OK. Then delete on BYE.</div><div><br></div><div>3) Routing local calls (ATA to ATA) you need to handle the Register first with "save" function, then later handle the INVITE with the "lookup" function, both of Registrar module.</div><div><br></div><div>4) PSTN can be used as a direct route or some dynamic routing solution. Make it work first with direct routing. Need to check how authenticate works on your carrier. If IP based will be fine, if user/pass you need to make your opensips authenticate, it's a little harder.</div><div><br></div><div>5) DID - You have to create some specific INBOUND rules. Calls will be anonymous or authenticated?</div><div><br></div><div>6) Fax - Better solve other issues first.</div><div><br></div><div>Hope this gives you some direction. Look for some tutorials.</div><div><br></div><div>Regards</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 21, 2022 at 11:11 AM Nitesh Divecha <<a href="mailto:aviator.nitesh.d@gmail.com">aviator.nitesh.d@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello All, </div><div><br></div><div>I have been scratching my head for a few days now... Just to recap: </div><div><br></div><div>I'm a newbie with OpenSIPS so bear with me... I got OpenSIPS 3.3.1 (residential) running on Debian 11 with OpenSIPS Control Panel 9.3.2 and MySQL. </div><div><br></div><div>My goal is to: </div><div>1) Make two ATA's register and call each other (locally)... <b>Stopped working, I think routing logic is missing.</b></div><div>2) Make ATA to call PSTN via an outbound SIP trunk or DID provider... <b>No ACK sent to Outbound provider.</b></div><div>3) Receive inbound calls from PSTN or SIP trunk and forward it to registered ATA... <b>Getting rejected.</b></div><div>4) Able to send and receive faxes from and to PSTN... <b>Haven't even touched.</b></div><div><br></div><div>Fast forward... I did achieve a few of my goals but they stopped working... You fix one thing and you break others... </div><div><br></div><div>My current issue is OpenSIPS is not sending ACK back to the Outbound provider when I make calls to PSTN thus calls are getting dropped from the Outbound provider due to no ACK. This issue started when I implemented topology_hiding('C"), rtpproxy_offer("ro"), uac_replace_from( , "$avp(furi)").</div><div><br></div><div>Here is my code snippet: </div><div><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(52,187,200);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">####### Routing Logic ########</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9);min-height:12px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(52,187,200);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"># main request routing logic</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9);min-height:12px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">route{</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(52,187,200);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">#if ($rU=~"^\+[1-9][0-9]+$") {</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">if (dp_translate(10 ,$rU ,$rU) ) {</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">xlog("*** 2. Dial plan translate from source $avp(src) to $rU ***\n");</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9);min-height:12px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">$avp(furi) = "<a href="mailto:sip%3Aaaabbbcccc@gothamcity.com" target="_blank">sip:aaabbbcccc@gothamcity.com</a>";</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">uac_replace_from( , "$avp(furi)");</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">#strip(1);</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">if (!do_routing(0)) {</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">send_reply(500,"No PSTN Route found");</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">exit;</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">}</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(52,187,200);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures"># t_on_branch("change_from");</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">route(relay);</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">exit;</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">}</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">
<br></span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p></div><div><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">route[relay] {</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">xlog("*** 3. Entering route relay ***\n");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(52,187,200);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures"># for INVITEs enable some additional helper routes</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">if (is_method("INVITE")) {</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">topology_hiding("C");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">if(remove_hf("User-Agent")){</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">xlog("*** 4. User-Agent found and removed. ***\n");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">}</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9);min-height:12px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">if (isflagset("NAT") && has_body("application/sdp")) {</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">rtpproxy_offer("ro");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">#rtpproxy_offer();</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">}</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9);min-height:12px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">t_on_branch("per_branch_ops");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">t_on_reply("handle_nat");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">t_on_failure("missed_call");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">}</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9);min-height:12px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">if (isflagset("NAT")) {</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">add_rr_param(";nat=yes");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">}</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9);min-height:12px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">if (!t_relay()) {</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(198,156,115)"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures">send_reply(500,"Internal Error");</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">}</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(198,156,115);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"><span> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(40,254,20)">exit;</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"ProFont for Powerline";color:rgb(40,254,20);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p>
<br></div><div>Any thoughts or suggestions on what to check for ACK?</div><div><br></div><div>Cheers,</div><div>Nitesh</div><div> </div><div><br></div><div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote></div></div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>