<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
On 3/16/12 4:43 PM, Stoyan Mihaylov wrote:
<blockquote
cite="mid:CAPScudYegruKZdT=U15GJWf+p5vGRzQee9zmVuW-a5TGXgo+yw@mail.gmail.com"
type="cite">In wireshark, there are 2 fields - Source and
Destination. I am curious if there are variables in Kamailio which
can show me those values.</blockquote>
<br>
are you looking for $si (source ip) and $Ri (received ip)?<br>
<blockquote
cite="mid:CAPScudYegruKZdT=U15GJWf+p5vGRzQee9zmVuW-a5TGXgo+yw@mail.gmail.com"
type="cite">
<div>System:</div>
<div>MYIP - IP of kamailio</div>
<div><a moz-do-not-send="true" href="http://sip.mydomain.com">sip.mydomain.com</a>
- address of kamailio</div>
<div><br>
</div>
<div>User (Imsdroid for Android)
->Kamailio->Asterisk->Kamailio (same) ->Other user.</div>
<div>Problem - register, voice, video, and ring are OK, but ACK
and BYE are going in dead loop - and this happens may be around
in 50% of cases - not in all cases.</div>
<div>If I am using other client (like hardware SIP phones), then I
have no problems, but it is really hard to find some client for
Android which supports video with Kamailio.</div>
<div>To solve problem, I made one function in Kamailio.cfg -
ACKBYE, which is called only within dialog. And within dialog is
called in main route.</div>
<div>
<div>route[ACKBYE] {</div>
<div>#!ifdef WITH_MYFORWARD</div>
<div>xlog("SCRIPT: AckBye $td;$si;$du;$dd\n");</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>if((($td=="<a
moz-do-not-send="true" href="http://sip.mydomain.com">sip.mydomain.com</a>")||($td=="MYIP"))&&($si=="MYIP")){</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>$du=$sht(forw=>$ft);</div>
<div>xlog("SCRIPT: AckBye2 $td;$si;$du\n");</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>return;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div>#!endif</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>return;</div>
<div>}</div>
</div>
<div>Of cource I have</div>
<div>
<div>
<span class="Apple-tab-span" style="white-space:pre"> </span>if(is_method("INVITE")){</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>ds_select_dst("1","4");</div>
<div>
<span class="Apple-tab-span" style="white-space:pre"> </span>$sht(forw=>$ft)=$du;</div>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div>This worked for long time. But then we updated client
(libraries etc), and problem appeared again - from time to time.
Calls between 2 same clients can pass 2 or 5 times, and then
problem appear.</div>
<div>Before - $td and $si showed destination and source but now
there is difference:</div>
<div>
<div>ERROR: <script>: SCRIPT: AckBye
192.168.2.251;MYIP;<null>;<null></div>
<div>$td in this case show destination, which is correct, but in
wireshark, destination and source = MYIP. </div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>ACK sip:MYIP;lr=on;nat=yes SIP/2.0</div>
<div>Via: SIP/2.0/UDP MYIP;branch=z9hG4bKcydzigwkX</div>
<div>Via: SIP/2.0/UDP MYIP;rport=5060;branch=z9hG4bKcydzigwkX</div>
<div>............................................</div>
<div>Via: SIP/2.0/UDP MYIP;rport=5060;branch=z9hG4bKcydzigwkX</div>
<div>Via: SIP/2.0/UDP
192.168.2.105:44794;branch=z9hG4bK338581244;rport=44794</div>
<div>From: <<a moz-do-not-send="true"
href="mailto:sip%3A11171@sip.MYDOMAIN.com">sip:11171@sip.MYDOMAIN.com</a>>;tag=1687441663</div>
<div>To: <<a moz-do-not-send="true"
href="mailto:sip%3A11175@192.168.2.251">sip:11175@192.168.2.251</a>>;tag=as13c57096</div>
<div>Contact:
<sip:11171@MYIP:5060;transport=udp>;+g.oma.sip-im;language="en,fr";+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel"</div>
<div>Call-ID: 4026cd88-aab9-19db-dfbe-1510baafdbb3</div>
<div>CSeq: 473985105 ACK</div>
<div>Content-Length: 0</div>
<div>Max-Forwards: 0</div>
<div>Proxy-Authorization: Digest username="11171",realm="<a
moz-do-not-send="true" href="http://sip.stribogkonsult.com">sip.stribogkonsult.com</a>",nonce="T2NZUU9jWCWxMUHSQweHXVQppHS8iFhd",uri="sip:11175@MYIP:5060",response="c5a95942af1502c208fa05d34c405907",algorithm=MD5</div>
<div>Accept-Contact:
*;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel"</div>
<div>P-Preferred-Service: urn:urn-7:3gpp-service.ims.icsi.mmtel</div>
<div>Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY,
PRACK, UPDATE, REFER</div>
<div>Privacy: none</div>
<div>P-Access-Network-Info: ADSL;utran-cell-id-3gpp=00000000</div>
<div>User-Agent: IM-client/OMA1.0 android-ngn-stack/v2.0.453
(doubango r653)</div>
</div>
</blockquote>
<br>
I suspect the client messes the Record-Route/Route set -- the ACK
R-URI shows a Route address, like there was a strict router. You
have to capture all the messages for such call (from initial INVITE
to ACK) and send them over. ngrep is a tool convenient for that, to
get it directly text suitable for sending over email.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
<a class="moz-txt-link-freetext" href="http://www.asipto.com/index.php/kamailio-advanced-training/">http://www.asipto.com/index.php/kamailio-advanced-training/</a></pre>
</body>
</html>