Thanks for the pointers on recency and deprecation. I converted my logic to use the transforms and now see an error when evaluating the URI:
``` 0(7) ERROR: pv [pv_trans.c:1312]: tr_eval_uri(): invalid uri ["Test Test" <sip:hello@192.168.86.107:63258;ob>] ``` FWIW this was being handled correctly by the selects framework. The log line which triggered this action and error is: ``` xlog("L_INFO", "contact uri.host = $(ct{uri.host})\n”); ``` I can provide more debug info if this looks like a valid bug. > On Nov 18, 2019, at 15:12, Alex Balashov <abalas...@evaristesys.com> wrote: > > Ah, okay. Sorry, I didn’t know! > > And yes, the select docs are in the wiki, but they are not linked from > /w/documentation, right? I took that to insinuate deprecation. > > — > Sent from mobile, with due apologies for brevity and errors. > >> On Nov 18, 2019, at 9:07 AM, Henning Westerholt <h...@skalatan.de> wrote: >> >> >> Hello Alex, >> >> this was one of the topics we discussed (in general terms) last week in our >> development meeting. >> >> No decision to deprecate the select framework has been done so far. You are >> right in noticing that the pseudo-variables are more used and also >> frequently extended, the select framework does not get extended since some >> time. But bugs that are reported in this area should be fixed as well. >> >> Before deprecating the selects, a review needs to be done if the >> functionality can be completely replaced by PVs/transformations, some >> migration guide would be probably also necessary. >> >> You are somehow wrong about the documentation, it is also in the wiki, but >> documented without much explanations. 😉 >> >> https://www.kamailio.org/wiki/cookbooks/devel/selects >> >> Cheers, >> >> Henning >> >> -- >> Henning Westerholt – https://skalatan.de/blog/ >> Kamailio services – https://gilawa.com >> Kamailio Merchandising – https://skalatan.de/merchandising >> >> From: sr-users <sr-users-boun...@lists.kamailio.org> On Behalf Of Alex >> Balashov >> Sent: Monday, November 18, 2019 2:37 PM >> To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> >> Subject: Re: [SR-Users] Parsing Contact Port Field >> >> 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!) >> >> 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. >> >> https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#urihost >> >> That is to say: >> >> $(ct{uri.host}) >> >> — Alex >> >> — >> Sent from mobile, with due apologies for brevity and errors. >> >> >> On Nov 18, 2019, at 8:27 AM, Michael Iedema <mich...@kapsulate.com> wrote: >> >> Hi Sergiu, >> >> >> @contact.uri.hostport might be what you are looking for. >> >> For more: >> http://www.kamailio.org/wiki/cookbooks/devel/selects >> >> >> That worked perfectly, thanks! >> >> For the other beginners out there, here are two snippets for posterity: >> >> == TO LOG == >> >> xlog("L_INFO", "contact.uri.host = $sel(@contact.uri.host)\n”); >> xlog("L_INFO", "contact.uri.port = $sel(@contact.uri.port)\n”); >> >> >> == TO COMPARE == >> >> #!define PORT_SERVICE_A 5062 >> >> if ( @contact.uri.port == PORT_SERVICE_A ) { >> xlog(“L_INFO", “Service A: sent $rm\n"); >> } >> >> >> >> Regards, >> -Michael >> >> >> >> >> On Nov 12, 2019, at 14:50, Sergiu Pojoga <pojo...@gmail.com> wrote: >> >> Hi Michael, >> >> @contact.uri.hostport might be what you are looking for. >> >> For more: >> http://www.kamailio.org/wiki/cookbooks/devel/selects >> >> Cheers. >> --Sergiu >> >> On Tue, Nov 12, 2019 at 8:32 AM Michael Iedema <mich...@kapsulate.com> wrote: >> Hello everyone, >> >> I have a potentially silly beginners question: how can I parse the contact >> port field and act on it in my routing logic? >> >> >> 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: >> >> >> . . . SIP CONTENT >> >> Contact: <sip:someaccount@192.168.86.104:5062>;expires=1800 >> >> >> . . . CONFIG LOGIC >> >> #!define PORT_SERVICE1 5061 >> #!define PORT_SERVICE2 5062 >> >> route { >> if ( src_port == PORT_SERVICE1 ) { >> xlog(“L_INFO”, “Received $rm from SERVICE1\n”); >> } else if ( src_port == PORT_SERVICE2 ) { >> xlog(“L_INFO”, “Received $rm from SERVICE2\n”); >> } >> } >> >> >> I realize that src_port is not the correct value to compare against. I want >> to compare against the originating contact’s port value. >> >> How can I extract the port field from $ct? >> >> >> 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. >> >> Regards, >> -Michael >> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users