<div dir="ltr"><div dir="ltr"><div dir="ltr">First, thanks guys for all the responses. These are great suggestions.<div><br></div><div>So my Kamailio needs to forward SIP responses back to ether client or server side, depending on where the initial SIP method originated from. Client side generally is behind NAT. When forwarding the response, I want to log the destination IP to I'm forwarding it to and which protocol it is using by using some sort of pseudovariable. The reason I want to do this is for troubleshooting purposes to show that Kamailio is sending it where it suppose to send it.</div><div><br></div><div>After trying different options, I actually ended up using the Via header to log where the responses are sending it back to:</div><div><br></div><div>$sel(via[2].host) - destination host<br></div><div>$sel(via[2].transport - protocol to use<br></div><div><br></div><div>Note that I'm not sure if this is the best and accurate option for what I'm doing, but I'm using this assuming the fact that my next hop is in via[2].<br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 3, 2019 at 4:53 AM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@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">Hello,<div><br></div><div>like Joel said, in reply_rpute or onreply_route use $si and $pr to get the source ip and protocol of the reply.</div><div><br></div><div>If you need it in failure_route, then use $T_rpl($si) and $T_rpl($pr), from the TMX module like was suggested by another response.</div><div><br></div><div>If none of these is what you want, then explain where you needed to see what is possible.</div><div><br></div><div>Cheers,</div><div>Daniel</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 3, 2019 at 7:06 AM YAS0 CANER <<a href="mailto:caner_yaso@hotmail.com" target="_blank">caner_yaso@hotmail.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 style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Oh my bad, I got now.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
on reply route , you can get some variables. Have you tried "<span style="font-size:10pt">TMX module Pseudo-Variables"</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-size:10pt"><a href="https://www.kamailio.org/wiki/cookbooks/5.2.x/pseudovariables" id="gmail-m_-7505141467164264077gmail-m_1085960188988477612LPlnk768883" target="_blank">https://www.kamailio.org/wiki/cookbooks/5.2.x/pseudovariables</a><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-7505141467164264077gmail-m_1085960188988477612divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@lists.kamailio.org</a>> on behalf of YAS0 CANER <<a href="mailto:caner_yaso@hotmail.com" target="_blank">caner_yaso@hotmail.com</a>><br>
<b>Sent:</b> Thursday, January 3, 2019 9:01 AM<br>
<b>To:</b> Sergiu Pojoga; Kamailio (SER) - Users Mailing List<br>
<b>Subject:</b> Re: [SR-Users] logging destination IP and proto on reponse</font>
<div> </div>
</div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hello,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
you can use accounting module to log them.You can append new variables,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<table style="box-sizing:border-box;border-collapse:collapse;border-spacing:0px;color:rgb(36,41,46);font-size:14px;background-color:rgb(255,255,255)">
<tbody style="box-sizing:border-box">
<tr style="box-sizing:border-box">
<td style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px">
modparam(<span style="box-sizing:border-box;color:rgb(3,47,98)"><span style="box-sizing:border-box">"</span>acc<span style="box-sizing:border-box">"</span></span>,
<span style="box-sizing:border-box;color:rgb(3,47,98)"><span style="box-sizing:border-box">"</span>log_extra<span style="box-sizing:border-box">"</span></span>,</td>
</tr>
<tr style="box-sizing:border-box">
<td style="box-sizing:border-box;padding:0px 10px;color:rgba(27,31,35,0.298);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;width:50.4px">
</td>
<td style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px">
<span style="box-sizing:border-box;color:rgb(3,47,98)"><span style="box-sizing:border-box">"</span>src_user=$fU;src_domain=$fd;src_ip=$si;<span style="box-sizing:border-box">"</span></span></td>
</tr>
<tr style="box-sizing:border-box">
<td style="box-sizing:border-box;padding:0px 10px;color:rgba(27,31,35,0.298);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;width:50.4px">
</td>
<td style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px">
<span style="box-sizing:border-box;color:rgb(3,47,98)"><span style="box-sizing:border-box">"</span>dst_ouser=$tU;dst_user=$rU;dst_domain=$rd<span style="box-sizing:border-box">"</span></span>)</td>
</tr>
</tbody>
</table>
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
</div>
<div>in addition, there is a onsend_route to help what you need.</div>
<div><br>
</div>
<div><a href="https://www.kamailio.org/wiki/cookbooks/5.2.x/core#onsend_route" id="gmail-m_-7505141467164264077gmail-m_1085960188988477612LPlnk608998" target="_blank">https://www.kamailio.org/wiki/cookbooks/5.2.x/core#onsend_route</a><br>
</div>
<div id="gmail-m_-7505141467164264077gmail-m_1085960188988477612LPBorder_GTaHR0cHM6Ly93d3cua2FtYWlsaW8ub3JnL3dpa2kvY29va2Jvb2tzLzUuMi54L2NvcmUjb25zZW5kX3JvdXRl" class="gmail-m_-7505141467164264077gmail-m_1085960188988477612x_LPBorder469509" style="width:100%;margin-top:16px;margin-bottom:16px;max-width:800px;min-width:424px">
<table id="gmail-m_-7505141467164264077gmail-m_1085960188988477612LPContainer469509" style="padding:12px 36px 12px 12px;width:100%;border:1px solid rgb(200,200,200);border-radius:2px">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td style="width:100%">
<div id="gmail-m_-7505141467164264077gmail-m_1085960188988477612LPTitle469509" style="font-size:21px;font-weight:300;margin-right:8px;font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin-bottom:12px">
<a id="gmail-m_-7505141467164264077gmail-m_1085960188988477612LPUrlAnchor469509" href="https://www.kamailio.org/wiki/cookbooks/5.2.x/core#onsend_route" style="text-decoration:none" target="_blank">cookbooks:5.2.x:core [Kamailio SIP Server Wiki]</a></div>
<div id="gmail-m_-7505141467164264077gmail-m_1085960188988477612LPDescription469509" style="font-size:14px;max-height:100px;color:rgb(102,102,102);font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin-bottom:12px;margin-right:8px;overflow:hidden">
This is the second section of the configuration file, containing the directives to load modules and set their parameters. It contains the directives loadmodule and modparam.In the default configuration file starts with the line setting the path to modules (the
assignment to mpath core parameter.. Example of content:</div>
<div id="gmail-m_-7505141467164264077gmail-m_1085960188988477612LPMetadata469509" style="font-size:14px;font-weight:400;color:rgb(166,166,166);font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif">
<a href="http://www.kamailio.org" target="_blank">www.kamailio.org</a></div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<div><br>
</div>
<div>
<h3 style="font-weight:bold;line-height:1.2;clear:left;font-size:1.125em;margin:0px 0px 0.888em;font-family:Arial,sans-serif">
onsend_route</h3>
<pre style="margin:0px 0px 1.4em;padding:0.7em 1em;font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:14px;text-align:left;background-color:rgb(251,250,249);border-radius:2px;overflow:auto;border:1px solid rgb(204,204,204)"> onsend_route <span style="color:rgb(102,204,102)">{</span>
<span style="color:rgb(177,177,0)">if</span><span style="color:rgb(102,204,102)">(</span>to_ip<span style="color:rgb(102,204,102)">==</span>1.2.3.4 <span style="color:rgb(102,204,102)">&&</span> <span style="color:rgb(102,204,102)">!</span>isflagset<span style="color:rgb(102,204,102)">(</span><span style="color:rgb(204,102,204)">12</span><span style="color:rgb(102,204,102)">)</span><span style="color:rgb(102,204,102)">)</span><span style="color:rgb(102,204,102)">{</span>
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/log.html" style="outline:none;color:rgb(43,115,183)" target="_blank"><span style="color:rgb(0,0,102)">log</span></a><span style="color:rgb(102,204,102)">(</span><span style="color:rgb(204,102,204)">1</span><span style="color:rgb(102,204,102)">,</span> <span style="color:rgb(255,0,0)">"message blocked<span style="color:rgb(0,0,153);font-weight:bold">\n</span>"</span><span style="color:rgb(102,204,102)">)</span><span style="color:rgb(102,204,102)">;</span>
drop<span style="color:rgb(102,204,102)">;</span>
<span style="color:rgb(102,204,102)">}</span>
<span style="color:rgb(102,204,102)">}</span></pre>
<br>
</div>
<div><br>
</div>
<hr style="display:inline-block;width:98%;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<div id="gmail-m_-7505141467164264077gmail-m_1085960188988477612x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@lists.kamailio.org</a>> on behalf of Sergiu Pojoga <<a href="mailto:pojogas@gmail.com" target="_blank">pojogas@gmail.com</a>><br>
<b>Sent:</b> Thursday, January 3, 2019 4:01 AM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List<br>
<b>Subject:</b> Re: [SR-Users] logging destination IP and proto on reponse</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">$sel(via[2].host) should give the 'destination' of the reply, provided that the original request wasn't from behind NAT and one single proxy in between UAs.<br>
</div>
<div dir="ltr"><br>
</div>
<div>Don't take my answer for granted, as I don't think it's complete and/or accurate.</div>
<div dir="ltr"><br>
</div>
</div>
<br>
<div class="gmail-m_-7505141467164264077gmail-m_1085960188988477612x_x_gmail_quote">
<div dir="ltr">On Wed, Jan 2, 2019 at 5:11 PM Andrew Chen <<a href="mailto:achen@fuze.com" target="_blank">achen@fuze.com</a>> wrote:<br>
</div>
<blockquote class="gmail-m_-7505141467164264077gmail-m_1085960188988477612x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hey all,
<div><br>
</div>
<div>Any way to log destination IP and proto of SIP responses? I'd tried to use majority of the pseudovars, but they all just return <null>.</div>
<div><br>
</div>
<div>Thanks.</div>
<div><br>
</div>
<div>-- <br>
<div dir="ltr" class="gmail-m_-7505141467164264077gmail-m_1085960188988477612x_x_gmail-m_5522927323885035965gmail_signature">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr" style="font-size:12.8px">Andy Chen</div>
<div dir="ltr" style="font-size:12.8px">
<div><a href="mailto:achen@thinkingphones.com" target="_blank">achen@</a><a href="http://fuze.com" target="_blank">fuze.com</a></div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">*Confidentiality Notice: The information contained in this e-mail and any</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">attachments may be confidential. If you are not an intended recipient, you</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">are hereby notified that any dissemination, distribution or copying of this</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">e-mail is strictly prohibited. If you have received this e-mail in error,</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">please notify the sender and permanently delete the e-mail and any</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">attachments immediately. You should not retain, copy or use this e-mail or</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">any attachment for any purpose, nor disclose all or any part of the</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">contents to any other person. Thank you.*</span>_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</div>
</div>
</div>
</div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-7505141467164264077gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Daniel-Constantin Mierla - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a></div><div><a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></div></div></div></div></div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr" style="font-size:12.8px">Andy Chen</div><div dir="ltr" style="font-size:12.8px"><div>Sr. Telephony Lead Engineer</div><div>415 516 5535 (M)</div><div><a href="mailto:achen@thinkingphones.com" target="_blank">achen@</a><a href="http://fuze.com" target="_blank">fuze.com</a></div><div><br></div></div></div></div></div></div>
<br>
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">*Confidentiality Notice: The information contained in this e-mail and any</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)"><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">attachments may be confidential. If you are not an intended recipient, you</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)"><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">are hereby notified that any dissemination, distribution or copying of this</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)"><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">e-mail is strictly prohibited. If you have received this e-mail in error,</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)"><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">please notify the sender and permanently delete the e-mail and any</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)"><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">attachments immediately. You should not retain, copy or use this e-mail or</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)"><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">any attachment for any purpose, nor disclose all or any part of the</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)"><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">contents to any other person. Thank you.*</span>