<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Which direction is the one way audio in &#8211; from the Phone
to the PSTN or Vice-Versa &#8211; I assume audio outbound is OK and it&#8217;s
the audio returning to the phone from the PSTN you&#8217;re missing?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Do you&nbsp; have symmetrical RTP set in the Line settings
(under NAT) on the SNOM?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Is Kamailio inside or outside the NAT?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Neill...;o)<o:p></o:p></span></p>

<div>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=314
 style='width:235.8pt'>
 <tr>
  <td colspan=2 style='border:none;border-top:solid #CCCCCC 1.0pt;padding:6.0pt 6.0pt 6.0pt 6.0pt'>
  <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="95%"
   style='width:95.0%'>
   <tr>
    <td width="50%" valign=top style='width:50.0%;padding:0cm 0cm 0cm 0cm'>
    <p class=MsoNormal style='mso-line-height-alt:9.0pt'><b><span
    style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Neill
    Wilkinson</span></b><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
    color:#1F497D'><br>
    Principal Consultant<br>
    &nbsp; <o:p></o:p></span></p>
    <p class=MsoNormal style='mso-line-height-alt:9.0pt'><span
    style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Aeonvista
    Ltd - opening up new ideas<o:p></o:p></span></p>
    </td>
   </tr>
  </table>
  </td>
 </tr>
 <tr>
  <td style='border:none;border-top:solid #CCCCCC 1.0pt;padding:1.2pt 0cm 0cm 0cm'>
  <p class=MsoNormal><span style='font-size:6.0pt;font-family:"Arial","sans-serif";
  color:#1F497D'>&nbsp;<o:p></o:p></span></p>
  </td>
  <td style='border:none;border-top:solid #CCCCCC 1.0pt;padding:1.2pt 0cm 0cm 0cm'>
  <p class=MsoNormal align=right style='text-align:right'><span
  style='font-size:6.0pt;font-family:"Arial","sans-serif";color:#1F497D'>&nbsp;<o:p></o:p></span></p>
  </td>
 </tr>
</table>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> users-bounces@lists.kamailio.org
[mailto:users-bounces@lists.kamailio.org] <b>On Behalf Of </b>Ross Beer<br>
<b>Sent:</b> 31 July 2008 12:50<br>
<b>To:</b> users@lists.kamailio.org<br>
<b>Subject:</b> [Kamailio-Users] NAT Problems<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>I am having problems with a NAT device. I
have an asterisk server that is hosted on a public&nbsp;IP and when I connect
my Snom phones to it directly audio passes correctly both ways. When I
introduce Kamailio 1.3 into the mix I get one way audio.<br>
&nbsp;<br>
I have fixed the SDP and contacts etc and everything appears to be ok with the
sip packet. I would be very grateful for any ideas what the problem could be.<br>
&nbsp;<br>
Outgoing calls from Kamailio&nbsp;-&gt; asterisk -&gt; PSTN work fine.<br>
&nbsp;<br>
Thank you for your help in advance, it is much appreciated.<br>
&nbsp;<br>
&nbsp;<br>
=================== config =======================<br>
&nbsp;<br>
</span><span lang=EN style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>if
(!mf_process_maxfwd_header(&quot;10&quot;)) {<br>
sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>
exit;<br>
};<br>
if (msg:len &gt;= 2048 ) {<br>
sl_send_reply(&quot;513&quot;, &quot;Message too big&quot;);<br>
exit;<br>
};<br>
# NAT detection<br>
force_rport();<br>
if(nat_uac_test(&quot;3&quot;))<br>
{<br>
<br>
fix_nated_contact();<br>
}<br>
if (!method==&quot;REGISTER&quot;)<br>
{<br>
record_route();<br>
}<br>
if (loose_route()) {<br>
append_hf(&quot;P-hint: rr-enforced\r\n&quot;); <br>
route(1);<br>
};<br>
if (!uri==myself) {<br>
append_hf(&quot;P-hint: outbound\r\n&quot;); <br>
route(1);<br>
};<br>
if (uri==myself) {<br>
if (method==&quot;REGISTER&quot;) <br>
{<br>
if (!www_authorize(&quot;&quot;, &quot;subscriber&quot;)) {<br>
www_challenge(&quot;&quot;, &quot;0&quot;);<br>
exit;<br>
};<br>
<br>
<br>
if (isflagset(5)) <br>
{<br>
# set branch flag -- when someone will call this user<br>
# the INVITE will have branch flag 6 set after lookup(&quot;location&quot;)<br>
setbflag(6);<br>
&nbsp;<br>
};<br>
<br>
fix_nated_contact();<br>
fix_nated_register();<br>
consume_credentials();<br>
save(&quot;location&quot;);<br>
exit;<br>
};<br>
if (!lookup(&quot;location&quot;)) {<br>
sl_send_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>
exit;<br>
};<br>
append_hf(&quot;P-hint: usrloc applied\r\n&quot;); <br>
};<br>
<br>
if(method==&quot;MESSAGE&quot;)<br>
{<br>
if (!lookup(&quot;location&quot;))<br>
{<br>
sl_send_reply(&quot;404&quot;, &quot;User Offline&quot;);<br>
exit;<br>
}<br>
route(4);<br>
}<br>
<br>
if (method==&quot;REGISTER&quot;)<br>
{<br>
save(&quot;location&quot;);<br>
}<br>
&nbsp;<br>
route(1);<br>
}<br>
&nbsp;<br>
route[1] {<br>
if (subst_uri('/(sip:.*);nat=yes/\1/')){<br>
setbflag(6);<br>
};<br>
if (isflagset(5)||isbflagset(6)) {<br>
route(3);<br>
}<br>
t_on_reply(&quot;1&quot;);<br>
if (!t_relay()) {<br>
sl_reply_error();<br>
};<br>
exit;<br>
}<br>
&nbsp;<br>
route[3] {<br>
if (is_method(&quot;BYE&quot;)) <br>
{<br>
unforce_rtp_proxy();<br>
} <br>
else if (is_method(&quot;INVITE&quot;))<br>
{<br>
fix_nated_sdp(&quot;3&quot;);<br>
&nbsp;<br>
};<br>
if (isflagset(5))<br>
{<br>
search_append('Contact:.*sip:[^&gt;[:cntrl:]]*', ';nat=yes');<br>
}<br>
t_on_reply(&quot;1&quot;);<br>
}<br>
route[4]<br>
{<br>
if (!t_relay()) <br>
{<br>
sl_reply_error();<br>
};<br>
exit;<br>
}<br>
&nbsp;<br>
&nbsp;<br>
failure_route[2] {<br>
if (isbflagset(6) || isflagset(5)) <br>
{<br>
unforce_rtp_proxy();<br>
}<br>
}<br>
onreply_route[1] <br>
{<br>
fix_nated_contact();<br>
if (((isflagset(5) || isbflagset(6)) &amp;&amp;
status=~&quot;(183)|(2[0-9][0-9])&quot;) || is_method(&quot;INVITE&quot;)) <br>
{<br>
fix_nated_sdp(&quot;2&quot;);<br>
force_rport();<br>
&nbsp;<br>
}<br>
search_append('Contact:.*sip:[^&gt;[:cntrl:]]*', ';nat=yes');<br>
}<br>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>
==================== SIP PACKETS ===========================<br>
INVITE sip:10001*202@**** IP ****;line=e25l7qyi SIP/2.0<br>
Record-Route: &lt;sip:*** IP ***;lr=on;ftag=as0a2e0c2e&gt;<br>
Via: SIP/2.0/UDP *** IP ***;branch=z9hG4bKb0a1.cf08f082.0<br>
v: SIP/2.0/UDP *** IP ***:5060;branch=z9hG4bK2bc03835;rport=5060<br>
f: &quot;Name&quot; &lt;sip:*** DOMAIN ***&gt;;tag=as0a2e0c2e<br>
t: &lt;sip:10001*202@** DOMAIN **&gt;<br>
m: &lt;sip:number@**IP**&gt;<br>
i: 74391cce38d7c7f7549c863a651b8f81@*** DOMAIN ****<br>
CSeq: 102 INVITE<br>
User-Agent: asterisk<br>
Max-Forwards: 69<br>
Date: Thu, 31 Jul 2008 11:38:39 GMT<br>
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY<br>
k: replaces<br>
c: application/sdp<br>
l: 422<br>
P-hint: usrloc applied<br>
<br>
v=0<br>
o=root 5390 5390 IN IP4 194.xxx.xxx.xxx<br>
s=session<br>
c=IN IP4 194.xxx.xxx.xxx<br>
b=CT:384<br>
t=0 0<br>
m=audio 12558 RTP/AVP 0 8 3 101<br>
a=rtpmap:0 PCMU/8000<br>
a=rtpmap:8 PCMA/8000<br>
a=rtpmap:3 GSM/8000<br>
a=rtpmap:101 telephone-event/8000<br>
a=fmtp:101 0-16<br>
a=silenceSupp:off - - - -<br>
a=ptime:20<br>
a=sendrecv<br>
m=video 17918 RTP/AVP 34 103 99<br>
a=rtpmap:34 H263/90000<br>
a=rtpmap:103 h263-1998/90000<br>
a=rtpmap:99 H264/90000<br>
a=sendrecv<br>
<br>
&nbsp;<br>
////////////// PHONE REPLY ////////////////////<br>
SIP/2.0 200 Ok<br>
Via: SIP/2.0/UDP **** IP ****:5060;branch=z9hG4bK19d7ec13;rport=5060<br>
Record-Route: &lt;sip:*** IP ***;lr=on;ftag=as486f79a5&gt;<br>
From: &quot;***&nbsp;NUMBER *****&quot; &lt;sip:*** DOMAIN
*****&gt;;tag=as486f79a5<br>
To: &lt;sip:10001*202@*** DOMAIN *****&gt;;tag=jgdy33ee6n<br>
Call-ID: *** ID ***<br>
CSeq: 102 INVITE<br>
Contact: &lt;sip:*** DOMAIN ****:54686;line=e25l7qyi;nat=yes&gt;;reg-id=1<br>
User-Agent: snom370/7.3.7<br>
Allow: INVITE, ACK, CANCEL, BYE, REFER, OPTIONS, NOTIFY, SUBSCRIBE, PRACK,
MESSAGE, INFO<br>
Allow-Events: talk, hold, refer, call-info<br>
Supported: timer, replaces, from-change<br>
Content-Type: application/sdp<br>
Content-Length: 508<br>
v=0<br>
o=root 1569142945 1569142946 IN IP4 192.168.1.20<br>
s=call<br>
c=IN IP4 ** EXTERNAL IP ***<br>
t=0 0<br>
m=audio 10014 RTP/AVP 0 8 3 101<br>
a=rtpmap:0 pcmu/8000<br>
a=rtpmap:8 pcma/8000<br>
a=rtpmap:3 gsm/8000<br>
a=rtpmap:101 telephone-event/8000<br>
a=fmtp:101 0-16<br>
a=ptime:20<br>
a=alt:1 0.9 : user 9kksj== 192.168.1.20 10014<br>
a=sendrecv<br>
m=video 0 RTP/AVP 34 103 99<br>
a=rtpmap:34 H263/90000<br>
a=rtpmap:103 h263-1998/90000<br>
a=rtpmap:99 H264/90000<br>
a=alt:1 0.9 : user 9kksj== 192.168.1.20 10014<br>
a=sendrecv<br>
a=oldmediaip:192.168.1.20</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p>

<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>

<hr size=2 width="100%" align=center>

</span></div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Find
out how to make Messenger your very own TV! <a
href="http://clk.atdmt.com/UKM/go/101719648/direct/01/" target="_new">Try it
Now!</a><o:p></o:p></span></p>

</div>

</div>

</body>

</html>