Hi all,<br><br>I am a beginner in openser and I really appreciate the help I have been getting from this group. I am setting up an interop with a PSTN gateway with intermittent success. I will try to explain my setup below.
<br><br>&nbsp;&nbsp;  <br><br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; redirect server<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; / &nbsp;&nbsp; &nbsp; /<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; / &nbsp;&nbsp; &nbsp; / 3<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /&nbsp; &nbsp;&nbsp;&nbsp; /&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5<br>
asterisk -----&gt;&nbsp; openser (v1.2.1)&nbsp; -----&gt; pstnGateway ------&gt; PSTN (cell phone)<br><br><br>Calls are generated from asterisk (step 1) with a 3-digit prefix (say, 999) on the ANI to identify a particular group of calls, and sent to openser (
v1.2.1). Openser checks the from_uri; detects the 999 prefix, strips the leading 3 digits and forwards the INVITE to the redirect server (step 2). The redirect server responds with a 301, containing the location of the pstnGateway (step 3). Openser sends an INVITE to address in the 301 to the pstnGateway (step 4) and the call gets completed (step 5) 
<br><br>This setup works intermittently. I sometimes have to restart openser before it works again. When it works, I get a 100 trying message back from the PSTN gateway, but when it fails, I see a number of invites sent from openser to the gateway without getting a 100 trying message back. And the invite times out with a 408 message. After a few seconds, the PSTN number actually rings, but I get dead air.
<br><br>My configuration is as below:<br><br>**********************************************************<br>loadmodule &quot;uac_redirect.so&quot;<br>loadmodule &quot;uac.so&quot;<br><br># ----------------- setting module-specific parameters ---------------
<br><br># -- mi_fifo params --<br>modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/etc/openser_fifo&quot;)<br>modparam(&quot;rr&quot;, &quot;enable_full_lr&quot;, 1)<br>modparam(&quot;tm&quot;, &quot;wt_timer&quot;, 30)
<br>modparam(&quot;tm&quot;, &quot;fr_inv_timer&quot;, 120)<br>modparam(&quot;tm&quot;, &quot;fr_timer&quot;, 2)<br>modparam(&quot;dispatcher&quot;, &quot;list_file&quot;, &quot;/etc/openser/dispatcher.list&quot;)<br>modparam(&quot;dispatcher&quot;, &quot;flags&quot;, 2)
<br>modparam(&quot;dispatcher&quot;, &quot;dst_avp&quot;, &quot;$avp(i:271)&quot;)<br>modparam(&quot;dispatcher&quot;, &quot;grp_avp&quot;, &quot;$avp(i:272)&quot;)<br>modparam(&quot;dispatcher&quot;, &quot;cnt_avp&quot;, &quot;$avp(i:273)&quot;)
<br>modparam(&quot;uac&quot;,&quot;from_restore_mode&quot;,&quot;auto&quot;)<br><br># main routing logic<br>route {<br>&nbsp;&nbsp;&nbsp; if (!mf_process_maxfwd_header(&quot;16&quot;))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot; Reply: 483 - Too Many Hops\n&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp; if ( msg:len &gt; max_len )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot; Reply: 513 - Message Too Big\n&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;513&quot;, &quot;Message too big&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>&nbsp;&nbsp;&nbsp; };<br><br>&nbsp;&nbsp;&nbsp; if (loose_route())<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; record_route();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t_relay();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>&nbsp;&nbsp;&nbsp; };<br><br>
&nbsp;&nbsp;&nbsp; record_route(); <br><br># Outgoing route route(1);<br>&nbsp;&nbsp;&nbsp; route(1);<br>&nbsp;<br>}<br><br><br># ROUTE 1 - OUTGOING CALLS<br>route[1] {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Check prefix - if the ANI of the tenant starts with 999<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # and the total number of digits is more than 12
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((from_uri=~&quot;^sip:999.*&quot;)&amp;&amp;$(fu{s.len}) &gt; 12)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # replace both display and uri<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # Strip out the leading 999 digits before sending it to redirect server
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uac_replace_from(&quot;$(fU{s.substr,3,0})&quot;,&quot;sip:$(fU{s.substr,3,0})@$fd&quot;);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Check for re-directs<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t_on_failure(&quot;4&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;RequestUri:[$ru] FromUri:[$fu] forwarding to redirect server...\n&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ds_select_dst(&quot;6&quot;, &quot;0&quot;); # forward to redirect server<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t_relay();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br><br>###############################################################################
<br># Process Replies <br>###############################################################################<br>onreply_route[1]<br>{<br>&nbsp;&nbsp;&nbsp; if( status =~ &quot;18[0-9]&quot; )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Reset the flag<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t_on_failure(&quot;0&quot;);
<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>#=============================================<br># Default redirect handler - PSTN gateway inter-op<br>#=============================================<br>failure_route[4]<br>{<br>&nbsp;&nbsp;&nbsp; get_redirects(&quot;*&quot;);
<br>&nbsp;&nbsp;&nbsp; t_relay();<br>}<br><br>*********************************************************************************************<br><br>Below is a snippet of my logs when the call fails.<br><br>-----Call 1<br>Aug 28 19:53:27&nbsp; [12103]: [INVITE] [from: asterisk] [calling: 15552121212] [caller: 99915553131313]
<br>Aug 28 19:53:27&nbsp; [12103]: RequestUri:[sip:15552121212@openser] FromUri:[sip:99915553131313@asterisk] forwarding to redirect server...<br>Aug 28 19:53:35&nbsp; [12103]: [ACK] [from: asterisk] [calling: 15552121212] [caller: 99915553131313]
<br>Aug 28 19:53:35&nbsp; [12103]: ERROR:uac:replace_from: decline FROM replacing in sequential request in auto mode (has TO tag)<br>Aug 28 19:53:35&nbsp; [12103]: RequestUri:[sip:15552121212@openser] FromUri:[sip:99915553131313@asterisk
] forwarding to redirect server...<br>Aug 28 19:53:41&nbsp; [12107]: [BYE] [from: redirectServer] [calling: 99915553131313] [caller: 15552121212]<br><br>-----Call 2<br>Aug 28 19:53:53&nbsp; [12105]: [INVITE] [from: asterisk] [calling: 15552121212] [caller: 99915553131313]
<br>Aug 28 19:53:53&nbsp; [12105]: RequestUri:[sip:15552121212@openser] FromUri:[sip:99915553131313@asterisk] forwarding to redirect server...<br>Aug 28 19:53:56&nbsp; [12105]: ERROR:tm:w_t_relay: t_forward_nonack failed<br><br><br>
Thanks and many regards,<br><br>Tolu<br>