Hello all,
I'm very rusty when it comes to variables :(
There's a part of my config where i load a parameter from usr_preferences to know whether i should append a branch and call him to a fixed IP as well as to their current location. I tried doing this on the REQUEST_ROUTE and append a branch like:
# This will check if the TO user is an office user if (avp_db_load("$to", "$avp(office)")) { if ( $avp(gsm)==1 ) { xlog("L_ERR","[REQUEST_ROUTE]: [$rm] callid: $ci from=$fU to=$tU should be ($avp(gsm)) branched - Appending branch\n"); append_branch("sip:$tU@1.2.3.4:5060"); } }
And later when the script hits the RELAY, the branch is actually sent, BUT from the *PRIVATE IP.* I tried adding:
force_send_socket(67.215.186.219:5060);
Right after the "append_branch" to set the socket from where to send, but kamailio is still sending from the private ip.
Any ideas?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
Hi,
1. force_send_socket() is essentially deprecated in favour of mutating $fs:
$fs = 'udp:67.215.186.219:5060';
2. Do you have an exact matching[1] listener for this outgoing interface?
[1] Transport, IP, port.
Thanks for replying!
Yes I have
children=2 listen=udp:10.10.0.209:5060 listen=udp:MY_PUBLIC_IP:5060
tried:
# This will check if the TO user is a office user if (avp_db_load("$to", "$avp(gsmoffice")) { if ( $avp(office)==1 ) { xlog("L_ERR","[REQUEST_ROUTE]: [$rm] callid: $ci Call from=$fU to=$tU is a Office USER ($avp(office)) - Appending branch\n"); #append_branch("sip:$tU@1.2.3.4:5060"); $fs = 'udp:MY_PUBLIC_IP:5060'; } }
But no INVITE is ever sent out... with force_send_socket it would only use the private...
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Mon, Oct 8, 2018 at 1:31 AM Alex Balashov abalashov@evaristesys.com wrote:
Hi,
- force_send_socket() is essentially deprecated in favour of mutating
$fs:
$fs = 'udp:67.215.186.219:5060';
- Do you have an exact matching[1] listener for this outgoing
interface?
[1] Transport, IP, port.
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Sorry, mispasted:
if (avp_db_load("$to", "$avp(office)")) { if ( $avp(office)==1 ) { xlog("L_ERR","[REQUEST_ROUTE]: [$rm] callid: $ci DAVID Call from=$fU to=$tU is a Office USER ($avp(office)) - Appending branch\n"); append_branch("sip:$tU@1.2.3.4:5080"); $fs = 'udp:MY_PUBLIC_IP:5060'; } }
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Mon, Oct 8, 2018 at 1:55 AM David Villasmil < david.villasmil.work@gmail.com> wrote:
Thanks for replying!
Yes I have
children=2 listen=udp:10.10.0.209:5060 listen=udp:MY_PUBLIC_IP:5060
tried:
# This will check if the TO user is a office user if (avp_db_load("$to", "$avp(gsmoffice")) { if ( $avp(office)==1 ) { xlog("L_ERR","[REQUEST_ROUTE]: [$rm] callid: $ci Call
from=$fU to=$tU is a Office USER ($avp(office)) - Appending branch\n"); #append_branch("sip:$tU@1.2.3.4:5060"); $fs = 'udp:MY_PUBLIC_IP:5060'; } }
But no INVITE is ever sent out... with force_send_socket it would only use the private...
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Mon, Oct 8, 2018 at 1:31 AM Alex Balashov abalashov@evaristesys.com wrote:
Hi,
- force_send_socket() is essentially deprecated in favour of mutating
$fs:
$fs = 'udp:67.215.186.219:5060';
- Do you have an exact matching[1] listener for this outgoing
interface?
[1] Transport, IP, port.
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
I think this is related to the fact that the client is TCP and i'm trying to send to UDP. I just changed the client to UDP and the branch got sent properly from the public ip in udp...
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Mon, Oct 8, 2018 at 2:07 AM David Villasmil < david.villasmil.work@gmail.com> wrote:
Sorry, mispasted:
if (avp_db_load("$to", "$avp(office)")) { if ( $avp(office)==1 ) { xlog("L_ERR","[REQUEST_ROUTE]: [$rm] callid: $ci DAVID
Call from=$fU to=$tU is a Office USER ($avp(office)) - Appending branch\n"); append_branch("sip:$tU@1.2.3.4:5080"); $fs = 'udp:MY_PUBLIC_IP:5060'; } }
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Mon, Oct 8, 2018 at 1:55 AM David Villasmil < david.villasmil.work@gmail.com> wrote:
Thanks for replying!
Yes I have
children=2 listen=udp:10.10.0.209:5060 listen=udp:MY_PUBLIC_IP:5060
tried:
# This will check if the TO user is a office user if (avp_db_load("$to", "$avp(gsmoffice")) { if ( $avp(office)==1 ) { xlog("L_ERR","[REQUEST_ROUTE]: [$rm] callid: $ci Call
from=$fU to=$tU is a Office USER ($avp(office)) - Appending branch\n"); #append_branch("sip:$tU@1.2.3.4:5060"); $fs = 'udp:MY_PUBLIC_IP:5060'; } }
But no INVITE is ever sent out... with force_send_socket it would only use the private...
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Mon, Oct 8, 2018 at 1:31 AM Alex Balashov abalashov@evaristesys.com wrote:
Hi,
- force_send_socket() is essentially deprecated in favour of mutating
$fs:
$fs = 'udp:67.215.186.219:5060';
- Do you have an exact matching[1] listener for this outgoing
interface?
[1] Transport, IP, port.
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi Alex,
You said that force_send_socket() is deprecated. Could you give me a reference as i did not see this information.
Thanks
Mathias
Le 08/10/2018 à 02:27, Alex Balashov a écrit :
Hi,
- force_send_socket() is essentially deprecated in favour of mutating
$fs:
$fs = 'udp:67.215.186.219:5060';
- Do you have an exact matching[1] listener for this outgoing
interface?
[1] Transport, IP, port.
It was a point of view rather than an official position, since force_send_socket doesn't accept PVs and is an old core function.
-- Sent from mobile. Apologies for brevity and errors.
-----Original Message----- From: Mathias mathias@celea-consulting.fr To: sr-users@lists.kamailio.org Sent: Mon, 08 Oct 2018 2:28 AM Subject: Re: [SR-Users] force_send_socket
Hi Alex,
You said that force_send_socket() is deprecated. Could you give me a reference as i did not see this information.
Thanks
Mathias
Le 08/10/2018 à 02:27, Alex Balashov a écrit :
Hi,
- force_send_socket() is essentially deprecated in favour of mutating
$fs:
$fs = 'udp:67.215.186.219:5060';
- Do you have an exact matching[1] listener for this outgoing
interface?
[1] Transport, IP, port.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Le 08/10/2018 à 02:27, Alex Balashov a écrit :
Hi,
- force_send_socket() is essentially deprecated in favour of mutating
$fs:
$fs = 'udp:67.215.186.219:5060';
According to wiki, $fs cannot deprecate force_send_socket.
In force_send_socket, proto can be left out:
force_send_socket
Force to send the message from the specified socket (it _must_ be one of the sockets specified with the “listen” directive). If the protocol doesn't match (e.g. UDP message “forced” to a TCP socket) the closest socket of the same protocol is used.
wheres:
$fs - Forced socket
$fs - reference to the forced socket for message sending (if any) in the form proto:ip:port
-- Juha
OK, I touched off a controversy with my use of the word "deprecated" that I did not intend, as the implied intellectual or policy commitment to that word is not really strong. :-)
What I meant through that particular choice of words is that there is, among those with some lengthy experience with the OpenSER pedigree, a recognised set of core functions and ancient modules which correspond to a different era of SER/OpenSER, and are not complementary to the ways of doing things that are concomitant with the present generation of the system.
Examples from modules include most of the `avpops` module functions, as well as the `usr_preferences` table - both take us back to a time before generic SQL queries and arbitrary data sources were a first-class aspect of Kamailio, as with the `sqlops` module, `htable`, etc.
In the core, there are lots of functions such as strip(), prefix(), rewritehostport(), and, in my view, force_send_socket(). These functions don't take PV arguments, and are superceded by the more flexible direct manipulation of the RURI, the destination set, and $fs, along with the wealth of transformations available nowadays, which can be chained.
Not everyone shares this exact set of tacit assumptions, I imagine, and I think that's what got folk exercised when I said "deprecated". These functions will surely remain for backward compatibility.
-- Alex
On Mon, Oct 08, 2018 at 02:07:23PM +0300, Juha Heinanen wrote:
Le 08/10/2018 à 02:27, Alex Balashov a écrit :
Hi,
- force_send_socket() is essentially deprecated in favour of mutating
$fs:
$fs = 'udp:67.215.186.219:5060';
According to wiki, $fs cannot deprecate force_send_socket.
In force_send_socket, proto can be left out:
force_send_socket
Force to send the message from the specified socket (it _must_ be one of the sockets specified with the “listen” directive). If the protocol doesn't match (e.g. UDP message “forced” to a TCP socket) the closest socket of the same protocol is used.
wheres:
$fs - Forced socket
$fs - reference to the forced socket for message sending (if any) in the form proto:ip:port
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Alex Balashov writes:
In the core, there are lots of functions such as strip(), prefix(), rewritehostport(), and, in my view, force_send_socket(). These functions don't take PV arguments, and are superceded by the more flexible direct manipulation of the RURI, the destination set, and $fs, along with the wealth of transformations available nowadays, which can be chained.
It would be nice if $fs would supersede force_send_socket, i.e, allow proto to be missing. I haven't tried myself.
If proto is mandatory in $fs then its use is more cumbersome than that of force_send_socket.
-- Juha
Am Montag, 8. Oktober 2018, 13:24:22 CEST schrieb Alex Balashov:
OK, I touched off a controversy with my use of the word "deprecated" that I did not intend, as the implied intellectual or policy commitment to that word is not really strong. :-) [..] Not everyone shares this exact set of tacit assumptions, I imagine, and I think that's what got folk exercised when I said "deprecated". These functions will surely remain for backward compatibility.
Hello Alex,
to add something more on the general level:
If we have old core functions (in a class like this one) that can be replaced completely with a new PV assigment or similar function, then we should indeed deprecate them with a log warning and then remove them completely later.
It is probably confusing especially for newcomers to Kamailio to have several functions with different semantics and syntax.
Best regards,
Henning
Henning,
I personally agree with this. But perhaps there are different points of view out there - about how multiple ways to do a thing represents a thriving marketplace of ideas. After all, there is a reason Perl evolved the way it did, surely...
-- Sent from mobile. Apologies for brevity and errors.
-----Original Message----- From: Henning Westerholt hw@kamailio.org To: sr-users@lists.kamailio.org Cc: Alex Balashov abalashov@evaristesys.com Sent: Mon, 08 Oct 2018 3:47 PM Subject: Re: [SR-Users] force_send_socket
Am Montag, 8. Oktober 2018, 13:24:22 CEST schrieb Alex Balashov:
OK, I touched off a controversy with my use of the word "deprecated" that I did not intend, as the implied intellectual or policy commitment to that word is not really strong. :-) [..] Not everyone shares this exact set of tacit assumptions, I imagine, and I think that's what got folk exercised when I said "deprecated". These functions will surely remain for backward compatibility.
Hello Alex,
to add something more on the general level:
If we have old core functions (in a class like this one) that can be replaced completely with a new PV assigment or similar function, then we should indeed deprecate them with a log warning and then remove them completely later.
It is probably confusing especially for newcomers to Kamailio to have several functions with different semantics and syntax.
Best regards,
Henning