<div dir="ltr"><div>Just rectifying about the $snd variable. While the wiki tells that $snd == $sndfrom, I discovered that the $snd == $sndto.</div><div>So in my case, the $sndfrom(ip) gives me the local socket the message is being sent.</div><div>However this only works from the onsend_route. I wasn't using this route at all, so now I need to check whether a call to rtpengine_offer will properly work from it.....<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 22 Nov 2019 at 10:01, Patrick Wakano <<a href="mailto:pwakano@gmail.com">pwakano@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>Yes David, we have all sorts of weird things (specially legacy installations where creativity really shined....). Also, in some private network architectures my external interface may not have a public IP at all....<br></div><div>Anyway, I first thought about applying some logic on the destination IP, but it is only reliable if I know my routing table, and this task Kamailio already performs when relaying.... The easiest way for now seems to save the info in the DB, so I explicit tell from which socket each GW is reachable....</div><div><br></div><div>And for curiosity I attempted the $snd() variables but they don't have the socket information.... the $snd(ip) has the destination IP, not my local socket as the doc may suggest.....The $branch variable (<a href="http://www.kamailio.org/wiki/cookbooks/5.2.x/pseudovariables#branch_name_-_branch_attributes" target="_blank">http://www.kamailio.org/wiki/cookbooks/5.2.x/pseudovariables#branch_name_-_branch_attributes</a>) was promising but I couldn't figure out when it is set. In my branch_routes it is always null......</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 22 Nov 2019 at 09:15, David Villasmil <<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@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><div dir="auto">Hello,</div><div dir="auto"><br></div><div dir="auto">Interesting challenge you’ve got.</div><div dir="auto"><br></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)"> It may fail in cases where my kernel routing table has some rule where a private IP is reachable via my external interface but different GW for example</span><br></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)"><br></span></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)">In this case then, the $du will be a rfc1918 ip but the outgoing interface will be a public ip?</span></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)"><br></span></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)">Have you tried $send(name) ?</span></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)"><br></span></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)">The docs state: </span></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)"><br></span></div><div dir="auto"><span style="border-color:rgb(0,0,0);color:rgb(0,0,0)"><h2 id="gmail-m_5808404448112618008gmail-m_6479090962357029383send_address_attributes" style="padding:0px;line-height:1.2;clear:left;margin:0px 0px 0.666em;font-family:Arial,sans-serif;color:rgb(51,51,51)">Send Address Attributes</h2><div style="font-size:16px;margin:0px;padding:0px;font-family:Arial,sans-serif;color:rgb(51,51,51)" dir="auto"></div><h3 id="gmail-m_5808404448112618008gmail-m_6479090962357029383sndfrom_name" style="padding:0px;line-height:1.2;clear:left;font-size:1.125em;margin:0px 0px 0.888em;font-family:Arial,sans-serif;color:rgb(51,51,51)">$sndfrom(name)</h3><div style="font-size:16px;margin:0px;padding:0px;font-family:Arial,sans-serif;color:rgb(51,51,51)" dir="auto"><p style="margin:0px 0px 1.4em;padding:0px;font-family:Arial,sans-serif"><strong style="font-family:Arial,sans-serif">$snd(name)</strong> - return attributes of the address from where the request is going to be sent (local socket).</p></div></span></div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 21 Nov 2019 at 22:57, Patrick Wakano <<a href="mailto:pwakano@gmail.com" target="_blank">pwakano@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>Thanks for the replies and examples! Much appreciated!</div><div><br></div><div>I was thinking of something similar to David suggestion, but I think this is not 100% reliable. It may fail in cases where my kernel routing table has some rule where a private IP is reachable via my external interface but different GW for example (multiple IPs in the same interface or more complex network architecture with VPN or direct link with some endpoint).... So given Kamailio already consults the kernel looking for the correct interface to a given destination, I thought this is actually the correct information I should use in my script. The only problem is that apparently Kamailio is not exposing this info for the script writer....</div><div>Karsten suggestion should probably work but in short this is just a way to statically save in DB the network routing information I know before hand. If this route changes (which should not happen often I agree) then I have to update the DB. And also this DB data could be replaced by some logic in my script if I had access to the chosen socket... That's exactly the purpose of having mhomed=1 in the script, I don't need to save socket info for all my GWs in DB because I am letting Kamailio automatically decide it. And it does pretty well! The only problem now is that I don't know what this decision was and I need it to implement the RTPEngine logic in my script based on the interface the INVITE will go out.</div><div><br></div><div>Happy to hear more ideas!</div><div>Thanks,<br></div><div>Kind regards,</div><div>Patrick Wakano<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 21 Nov 2019 at 20:07, Karsten Horsmann <<a href="mailto:khorsmann@gmail.com" target="_blank">khorsmann@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="auto"><div>Hi Patrick,</div><div dir="auto"><br></div><div dir="auto">If you don't use tls at this moment, the config from sbc OS is also an good example of using dispatcher with the socket params to select the right sendsock and using vars to give rtpengine the right internal / external directions. They use numbers for internal and external. To figure out where the direction is, this config use pseudo vars for receiving local socket </div><div dir="auto"><br></div><div dir="auto"><a href="https://github.com/voiceboys/sbcOS/blob/master/SbcOS/configs/voice/kamailio/kamailio.cfg#L450" target="_blank">https://github.com/voiceboys/sbcOS/blob/master/SbcOS/configs/voice/kamailio/kamailio.cfg#L450</a><br></div><div dir="auto"><br></div><div dir="auto">Cheers </div><div dir="auto">Karsten Horsmann <br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">Patrick Wakano <<a href="mailto:pwakano@gmail.com" target="_blank">pwakano@gmail.com</a>> schrieb am Do., 21. Nov. 2019, 07:11:<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 list,</div><div>Hope you are all doing well!</div><div><br></div><div>I am trying to figure out a way to retrieve the local socket the t_relay() has decided to use in a mhomed=1 env. Is there a way to do that? I couldn't find any variable other than the $snd ones that maybe have this info, but I am not using onsend_route anyway.....<br></div><div>I am after this value because this is what I can use to figure out if I need to engage RTPEngine with parameters "external, internal", "external, external", "internal, external" or "internal, internal". In my case, my server is in between two networks, and calls can traverse or can be routed back to the same interface depending on what was decide by the LCR module. Signalling is fine, but engaging the RTPEngine must be done with the correct parameters to get the correct IPs in the SDP, other else I get one way audio in the call.....<br></div><div><br></div><div>Any help is much appreciated!</div><div></div><div>Thank you!<br></div><div>Kind regards,</div><div>Patrick Wakano<br></div><div><br></div><div><br></div></div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" rel="noreferrer" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></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>
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>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</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>
</blockquote></div>