Just for reference in case someone needs it in the future, when a special character is not working directly as a parameter in a transformation, try to set it in a variable and then use the variable in the transformation, like:
$var(s) = '#';
$var(v) = $(rU{s.select,0,$var(s)});
Not all transformations accept variables, but most of them do.
Cheers,
Daniel
Thanks for letting us know, good that you found the issue.
You might want to switch your mailman subscription from digest mode to normal mode - that makes it easier to participate in discussions.
Cheers,
Henning
Am 11.01.20 um 17:16 schrieb Sam Ware:
Sorry to have bothered everyone. But the following is the correct usage. I had a typo a line above that was showing as being in this line.
$avp(techprefix) = $(rU{s.select,0,#});
On Sat, Jan 11, 2020 at 9:00 AM Sam Ware <sam.ware@gmail.com> wrote:
Alex,
I get the following error
ERROR: <core> [core/pvapi.c:1127]: pv_parse_spec2(): wrong char [
ERROR: bad config file (1 errors)
CRITICAL: <core> [core/cfg.y:3537]: yyerror_at(): parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 462, column 23-40: Can't get from cache: $(rU{s.select,0,#)
David,I did try escaping and get the same error.
$avp(techprefix) = $(rU{s.select,0,\#});
additionally, I think I initially tried it double quoted.
$avp(techprefix) = $(rU{s.select,0,"#"});
Resulted in:ERROR: <core> [core/pvapi.c:1127]: pv_parse_spec2(): wrong char [
ERROR: bad config file (1 errors)
CRITICAL: <core> [core/cfg.y:3537]: yyerror_at(): parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 462, column 23-42: Can't get from cache: $(rU{s.select,0,"#")
Here is the entire block.
if ($rU =~ "[\*\#]") {xlog("L_INFO", "[$ci] -> $rU appears to have a tech prefix, processing...\n");if ($rU =~ "\*") {$avp(techprefix) = $(rU{s.select,0,*});## Reset the RURI user to the non-tech prefix'ed value$rU = $(rU{s.select,1,*});## Overwrite the message source variable with "sourceip-techprefix"$var(messagesource) = $_s($si-$avp(techprefix));} else if ($rU =~ "\#") {$avp(techprefix) = $(rU{s.select,0,#)});## Reset the RURI user to the non-tech prefix'ed value$rU = $(rU{s.select,1,#});## Overwrite the message source variable with "sourceip-techprefix"$var(messagesource) = $_s($si-$avp(techprefix));}}
On Sat, Jan 11, 2020 at 5:00 AM <sr-users-request@lists.kamailio.org> wrote:
Send sr-users mailing list submissions to
sr-users@lists.kamailio.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
or, via email, send a message with subject or body 'help' to
sr-users-request@lists.kamailio.org
You can reach the person managing the list at
sr-users-owner@lists.kamailio.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of sr-users digest..."
Today's Topics:
1. Re: Kamailio in Docker Compile Error (Sergey Safarov)
2. Re: Kamailio in Docker Compile Error (Sam Ware)
3. Kamailio 5.2.2 IMS -enum_query question (Woscek, Martin W.)
4. String Transformation Question (Sam Ware)
5. Re: String Transformation Question (Alex Balashov)
6. Re: String Transformation Question (David Villasmil)
---------- Forwarded message ----------
From: Sergey Safarov <s.safarov@gmail.com>
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Cc:
Bcc:
Date: Fri, 10 Jan 2020 14:38:02 +0300
Subject: Re: [SR-Users] Kamailio in Docker Compile Error
please try kamailio-ci:5.3.2-alpine
I will fix error about kamailio-ci:5.3.1-alpine.
On Fri, Jan 10, 2020 at 1:53 PM Asgaroth <00asgaroth00@gmail.com> wrote:
Hi,
I see that the kamailio-ci:5.3.1-alpine tag exists, but was getting an error when trying to pull it 2 days ago, 5.3.0- alpine works fine.
Unfortunately I cannot post the actual docker pull error right now (in airport, on my phone)
_______________________________________________On Fri 10 Jan 2020, 08:32 Sergey Safarov, <s.safarov@gmail.com> wrote:
yum -y install yum-utils yum-config-manager --add-repo http://rpm.kamailio.org/centos/kamailio.repo yum install kamailio
Also you can use this docker image
_______________________________________________On Fri, Jan 10, 2020 at 10:58 AM Daniel-Constantin Mierla <miconda@gmail.com> wrote:
_______________________________________________Hello,
try to install which and pkg-config tools.
Cheers,
Daniel
On 10.01.20 02:21, Sam Ware wrote:
I am attempting to create my own docker image on Centos 7. During the build, I get the following error message during the "make all" phase.----------------------------------------------------------------------CC (gcc) [kamailio] core/cfg.tab.o
LD (gcc) [kamailio] kamailio
make[1]: which: Command not found
make[1]: which: Command not found
make[1]: which: Command not found
make[1]: which: Command not found
make[1]: which: Command not found
make[1]: which: Command not found
CC (gcc) [M db_mysql.so] km_dbase.o
km_dbase.c:36:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>
^
compilation terminated.
make[1]: *** [km_dbase.o] Error 1
make: *** [modules] Error 1------------------------------------------------------------------------
I checked and the mysql.h exists in the /usr/include/mysql directory.
Any thoughts?
FYI, here is my Dockerfile
FROM centos:7
MAINTAINER “Sam D Ware” sware@o1.com
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in ; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done);
RUN rm -rf /lib/systemd/system/multi-user.target.wants/ \
&& rm -rf /etc/systemd/system/.wants/ \
&& rm -rf /lib/systemd/system/local-fs.target.wants/ \
&& rm -f /lib/systemd/system/sockets.target.wants/udev \
&& rm -f /lib/systemd/system/sockets.target.wants/initctl \
&& rm -rf /lib/systemd/system/basic.target.wants/ \
&& rm -f /lib/systemd/system/anaconda.target.wants/*
VOLUME [ “/sys/fs/cgroup”]
RUN yum -y install epel-release
RUN yum -y update
RUN yum -y install git-core gcc gcc-c++ flex bison mysql-devel
RUN yum -y install mariadb-devel hiredis hiredis-devel curl nss make
WORKDIR /usr/local/src/
RUN git clone --depth 1 --no-single-branch https://github.com/kamailio/kamailio kamailio
WORKDIR /usr/local/src/kamailio/
RUN git checkout -b 5.3 origin/5.3
RUN make cfg
COPY modules.lst /usr/local/src/kamailio/src/
RUN make all
RUN make install
RUN groupadd kamailio
RUN adduser --system -g kamailio --shell /bin/false -c "Kamailio" --home /var/run/kamailio kamailio
RUN cp /usr/local/src/kamailio/pkg/kamailio/obs/kamailio.sysconfig /etc/sysconfig/kamailio
COPY kamailio.service /etc/systemd/system/kamailio.service
RUN yum clean all; systemctl enable kamailio
CMD ["/usr/sbin/init"]
--
Sam D Ware
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com
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
---------- Forwarded message ----------
From: Sam Ware <sam.ware@gmail.com>
To: miconda@gmail.com
Cc: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Bcc:
Date: Fri, 10 Jan 2020 07:23:46 -0600
Subject: Re: [SR-Users] Kamailio in Docker Compile Error
Thanks Daniel,
That got me past that hurdle. It was the "which". Looks like the pkg-config tools was already install; probably a preq for one of the other pkgs.
Sam
On Fri, Jan 10, 2020 at 1:58 AM Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,
try to install which and pkg-config tools.
Cheers,
Daniel
On 10.01.20 02:21, Sam Ware wrote:
I am attempting to create my own docker image on Centos 7. During the build, I get the following error message during the "make all" phase.----------------------------------------------------------------------CC (gcc) [kamailio] core/cfg.tab.o
LD (gcc) [kamailio] kamailio
make[1]: which: Command not found
make[1]: which: Command not found
make[1]: which: Command not found
make[1]: which: Command not found
make[1]: which: Command not found
make[1]: which: Command not found
CC (gcc) [M db_mysql.so] km_dbase.o
km_dbase.c:36:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>
^
compilation terminated.
make[1]: *** [km_dbase.o] Error 1
make: *** [modules] Error 1------------------------------------------------------------------------
I checked and the mysql.h exists in the /usr/include/mysql directory.
Any thoughts?
FYI, here is my Dockerfile
FROM centos:7
MAINTAINER “Sam D Ware” sware@o1.com
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in ; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done);
RUN rm -rf /lib/systemd/system/multi-user.target.wants/ \
&& rm -rf /etc/systemd/system/.wants/ \
&& rm -rf /lib/systemd/system/local-fs.target.wants/ \
&& rm -f /lib/systemd/system/sockets.target.wants/udev \
&& rm -f /lib/systemd/system/sockets.target.wants/initctl \
&& rm -rf /lib/systemd/system/basic.target.wants/ \
&& rm -f /lib/systemd/system/anaconda.target.wants/*
VOLUME [ “/sys/fs/cgroup”]
RUN yum -y install epel-release
RUN yum -y update
RUN yum -y install git-core gcc gcc-c++ flex bison mysql-devel
RUN yum -y install mariadb-devel hiredis hiredis-devel curl nss make
WORKDIR /usr/local/src/
RUN git clone --depth 1 --no-single-branch https://github.com/kamailio/kamailio kamailio
WORKDIR /usr/local/src/kamailio/
RUN git checkout -b 5.3 origin/5.3
RUN make cfg
COPY modules.lst /usr/local/src/kamailio/src/
RUN make all
RUN make install
RUN groupadd kamailio
RUN adduser --system -g kamailio --shell /bin/false -c "Kamailio" --home /var/run/kamailio kamailio
RUN cp /usr/local/src/kamailio/pkg/kamailio/obs/kamailio.sysconfig /etc/sysconfig/kamailio
COPY kamailio.service /etc/systemd/system/kamailio.service
RUN yum clean all; systemctl enable kamailio
CMD ["/usr/sbin/init"]
--
Sam D Ware
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com
--
Sam D Ware
---------- Forwarded message ----------
From: "Woscek, Martin W." <mwoscek@mitre.org>
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Cc:
Bcc:
Date: Fri, 10 Jan 2020 16:57:29 +0000
Subject: [SR-Users] Kamailio 5.2.2 IMS -enum_query question
Hi,
I am trying to invoke unum lookups from calls to enum_query() ,is_from_user_enum() and enum_pv_query().
However we are not seeing any enum lookups over the wire using wireshark.
In the Kamailio.cfg the following are set:
loadmodule "enum"
modparam("enum", "domain_suffix", "mydnsserver.org.")
modparam("enum", "i_enum_suffix", " mydnsserver.org.")
sample use in our Kamailio.cfg file:
if(!enum_query("mydnsserver.org.")) {
xlog(“….);
#do something
} else {
Xlog(“….”)
#do something else
}
I do see NAPTR lookups being done by the other Kamailio IMS processes initially when it starts up so I know it has connectivity to the DNS server, but none for the invoked enum queries.
We are running Kamailio 5.2.2.
Thanks,
Martin
---------- Forwarded message ----------
From: Sam Ware <sam.ware@gmail.com>
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Cc:
Bcc:
Date: Fri, 10 Jan 2020 17:22:17 -0600
Subject: [SR-Users] String Transformation Question
We are receiving traffic with a tech prefix. We want to be able to use a # (hash tag) for the separator for the tech prefix and the remote user ($rU). I was using the s.select transformation before when using * for separator, but I get an error because it appears that it being interpreted as a comment. Any suggestions?
Example:## How I was doing it with the *$avp(techprefix) = $(rU{s.select,0,*});
## How I tried and got an error for the hash tag
--$avp(techprefix) = $(rU{s.select,0,#});
Sam D Ware
---------- Forwarded message ----------
From: Alex Balashov <abalashov@evaristesys.com>
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Cc:
Bcc:
Date: Fri, 10 Jan 2020 18:24:44 -0500
Subject: Re: [SR-Users] String Transformation Question
What’s the error?
—Sent from mobile, with due apologies for brevity and errors.
On Jan 10, 2020, at 6:23 PM, Sam Ware <sam.ware@gmail.com> wrote:
We are receiving traffic with a tech prefix. We want to be able to use a # (hash tag) for the separator for the tech prefix and the remote user ($rU). I was using the s.select transformation before when using * for separator, but I get an error because it appears that it being interpreted as a comment. Any suggestions?_______________________________________________
Example:## How I was doing it with the *$avp(techprefix) = $(rU{s.select,0,*});
## How I tried and got an error for the hash tag
--$avp(techprefix) = $(rU{s.select,0,#});
Sam D Ware
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
---------- Forwarded message ----------
From: David Villasmil <david.villasmil.work@gmail.com>
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Cc:
Bcc:
Date: Fri, 10 Jan 2020 23:24:51 +0000
Subject: Re: [SR-Users] String Transformation Question
Have you tried scaping it? Never done it, tho--
On Fri, 10 Jan 2020 at 23:23, Sam Ware <sam.ware@gmail.com> wrote:
We are receiving traffic with a tech prefix. We want to be able to use a # (hash tag) for the separator for the tech prefix and the remote user ($rU). I was using the s.select transformation before when using * for separator, but I get an error because it appears that it being interpreted as a comment. Any suggestions?
Example:## How I was doing it with the *$avp(techprefix) = $(rU{s.select,0,*});
## How I tried and got an error for the hash tag
$avp(techprefix) = $(rU{s.select,0,#});_______________________________________________--
Sam D Ware
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
sr-users mailing list
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Sam D Ware
--
Sam D Ware
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.com Kamailio Merchandising - https://skalatan.de/merchandising/
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com