<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Just be careful with selects as they are a construct imported from SER as part of the sip-router integration of 2010 (what a fascinating time to have been alive!)<div><br></div><div>Like some other SER constructs, they are not widely used and so I am not sure what the maintenance and support commitment to them is on a go-forward basis. I’m not saying it’s not there or that nobody uses selects—others can clarify—but it’s notable that they are not in the core docs (as far as I know). For trivial operations which do not require the more extensive and nuanced flexibility of selects, you might consider a more “Kamailio-native” way: transformations.</div><div><br></div><div><a href="https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#urihost">https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#urihost</a></div><div><br></div><div>That is to say:</div><div><br></div><div>  $(ct{uri.host})</div><div><br></div><div>— Alex</div><div><div><div><div><br><div dir="ltr">—<div>Sent from mobile, with due apologies for brevity and errors.</div></div><div dir="ltr"><br><blockquote type="cite">On Nov 18, 2019, at 8:27 AM, Michael Iedema <michael@kapsulate.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><span>Hi Sergiu,</span><br><span></span><br><blockquote type="cite"><span>@contact.uri.hostport might be what you are looking for.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>For more:</span><br></blockquote><blockquote type="cite"><span>http://www.kamailio.org/wiki/cookbooks/devel/selects</span><br></blockquote><span></span><br><span></span><br><span>That worked perfectly, thanks!</span><br><span></span><br><span>For the other beginners out there, here are two snippets for posterity:</span><br><span></span><br><span>== TO LOG ==</span><br><span></span><br><span>xlog("L_INFO", "contact.uri.host = $sel(@contact.uri.host)\n”);</span><br><span>xlog("L_INFO", "contact.uri.port = $sel(@contact.uri.port)\n”);</span><br><span></span><br><span></span><br><span>== TO COMPARE ==</span><br><span></span><br><span>#!define PORT_SERVICE_A 5062</span><br><span></span><br><span>if ( @contact.uri.port == PORT_SERVICE_A ) {</span><br><span>  xlog(“L_INFO", “Service A: sent $rm\n");</span><br><span>}</span><br><span></span><br><span></span><br><span></span><br><span>Regards,</span><br><span>-Michael</span><br><span></span><br><span></span><br><span></span><br><blockquote type="cite"><span>On Nov 12, 2019, at 14:50, Sergiu Pojoga <pojogas@gmail.com> wrote:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Hi Michael,</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>@contact.uri.hostport might be what you are looking for.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>For more:</span><br></blockquote><blockquote type="cite"><span>http://www.kamailio.org/wiki/cookbooks/devel/selects</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Cheers.</span><br></blockquote><blockquote type="cite"><span>--Sergiu</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>On Tue, Nov 12, 2019 at 8:32 AM Michael Iedema <michael@kapsulate.com> wrote:</span><br></blockquote><blockquote type="cite"><span>Hello everyone,</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I have a potentially silly beginners question: how can I parse the contact port field and act on it in my routing logic?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I know that the $ct variable contains the entire contact header and I can print it in an xlog() call. However, I’d like to do something like the following in my routing logic:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>. . . SIP CONTENT</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Contact: <sip:someaccount@192.168.86.104:5062>;expires=1800</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>. . . CONFIG LOGIC</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>#!define PORT_SERVICE1 5061</span><br></blockquote><blockquote type="cite"><span>#!define PORT_SERVICE2 5062</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>route {</span><br></blockquote><blockquote type="cite"><span>    if ( src_port == PORT_SERVICE1 ) {</span><br></blockquote><blockquote type="cite"><span>        xlog(“L_INFO”, “Received $rm from SERVICE1\n”);</span><br></blockquote><blockquote type="cite"><span>    } else if ( src_port == PORT_SERVICE2 ) {</span><br></blockquote><blockquote type="cite"><span>        xlog(“L_INFO”, “Received $rm from SERVICE2\n”);</span><br></blockquote><blockquote type="cite"><span>    }</span><br></blockquote><blockquote type="cite"><span>}</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I realize that src_port is not the correct value to compare against. I want to compare against the originating contact’s port value.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>How can I extract the port field from $ct?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Many thanks in advance and apologies for the beginners question. I’ve googled for what I think I’m trying to do without any real results on functions or tokenizers, etc. I’m using Kamailio 5.3.0.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Regards,</span><br></blockquote><blockquote type="cite"><span>-Michael</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>_______________________________________________</span><br></blockquote><blockquote type="cite"><span>Kamailio (SER) - Users Mailing List</span><br></blockquote><blockquote type="cite"><span>sr-users@lists.kamailio.org</span><br></blockquote><blockquote type="cite"><span>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</span><br></blockquote><blockquote type="cite"><span>_______________________________________________</span><br></blockquote><blockquote type="cite"><span>Kamailio (SER) - Users Mailing List</span><br></blockquote><blockquote type="cite"><span>sr-users@lists.kamailio.org</span><br></blockquote><blockquote type="cite"><span>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</span><br></blockquote><span></span><br><span></span><br><span>_______________________________________________</span><br><span>Kamailio (SER) - Users Mailing List</span><br><span>sr-users@lists.kamailio.org</span><br><span>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</span><br></div></blockquote></div></div></div></div></body></html>