I'm trying to setup custom aliases out of a sql db that will sometimes need to fork and need some help realizing how I can assign q values and process them correctly. I'm using kam 1.5.
Let's assume I query for our main support line and return 3 URIs from the db along with a separate column for the q.
Sip:us-support@mycomp.com q=1.0
Sip:uk-support@mycomp.com q=1.0
Sip:in-support@mycomp.com q=0.90
Based on the values I'd want to parallel fork on the first two to send this to my UK and US support line, if that fails cancel the first two branches and route to India. Just to see if I was on the right track I tried adding them as branches using $br, which from what I understand is the only way to add branches from avps/variables. I added them by appending ;q=1.0 on the end of the URI like you would see in a Contact header but I don't think that's valid. Calls to $(branch(q) return <null> so it obviously doesn't take.
If I were to just fork sequentially I could just load them into avps and call it in a failure route, but how do I handle a combination of the two? Am I wrong in trying to specify the q along with the URI?
I noticed serialize_branches was removed in 1.4, which is what I use in production today in 1.3 - do I need to use the replacements in TM to order them and add the branches?
Thanks in advance.
-------------------------------------------------------------------------- This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
Robert McGilvray writes:
I noticed serialize_branches was removed in 1.4, which is what I use in production today in 1.3 - do I need to use the replacements in TM to order them and add the branches?
serialize_branches is replaced in 1.5 by tm functions t_load_contacts()/t_next_contacts(). you call t_load_contacts() after you have your uris (including their q values) in the destination set.
i don't use alias db and thus don't know about that.
-- juha
I guess that's the part where I'm getting stuck. How do I go about adding my URIs with the proper q values to the dset? I'm not using alias_db, just sqlops with a custom statement that returns the URI/Q as columns.
-----Original Message----- From: Juha Heinanen [mailto:jh@tutpro.com] Sent: Thursday, July 02, 2009 1:41 AM To: Robert McGilvray Cc: users@lists.kamailio.org Subject: [Kamailio-Users] forking on URIs from DB
Robert McGilvray writes:
I noticed serialize_branches was removed in 1.4, which is what I use
in
production today in 1.3 - do I need to use the replacements in TM to order them and add the branches?
serialize_branches is replaced in 1.5 by tm functions t_load_contacts()/t_next_contacts(). you call t_load_contacts() after you have your uris (including their q values) in the destination set.
i don't use alias db and thus don't know about that.
-- juha
-------------------------------------------------------------------------- This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
Robert McGilvray writes:
I guess that's the part where I'm getting stuck. How do I go about adding my URIs with the proper q values to the dset?
have you tried append_branch with q value, something like this:
append_branch("sip:foo@bar;q=0.5");
if that does not work and no-one else on the mailing list has a better suggestion, open a new feature request on sr tracker.
i myself get q values into destination set using lookup or enum_query function.
-- juha
This works
append_branch("sip:3800@example.com", "0.90");
My next issue is that append_branch doesn't accept avps or pv as input parameters. Does anyone know the syntax (if there is one) to duplicate the above statement using assignments to $br?
I've tried a few combinations of assigning ;q=0.90 onto the end of the URI without success. If possible I'd prefer not to use the hack of modifying the ruri back and forth.
-----Original Message----- From: Juha Heinanen [mailto:jh@tutpro.com] Sent: Thursday, July 02, 2009 8:38 AM To: Robert McGilvray Cc: users@lists.kamailio.org Subject: RE: [Kamailio-Users] forking on URIs from DB
Robert McGilvray writes:
I guess that's the part where I'm getting stuck. How do I go about adding my URIs with the proper q values to the dset?
have you tried append_branch with q value, something like this:
append_branch("sip:foo@bar;q=0.5");
if that does not work and no-one else on the mailing list has a better suggestion, open a new feature request on sr tracker.
i myself get q values into destination set using lookup or enum_query function.
-- juha
-------------------------------------------------------------------------- This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
accodring to doc it should be also possible to assign directly, e.g.: uri in $avp(firsturi) and Q in $avp(firstq):
$br = $avp(firsturi) + ";q=" + $avp(firstq);
regards klaus
http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:devel#request_s_fi...
Juha Heinanen schrieb:
Robert McGilvray writes:
I guess that's the part where I'm getting stuck. How do I go about adding my URIs with the proper q values to the dset?
have you tried append_branch with q value, something like this:
append_branch("sip:foo@bar;q=0.5");
if that does not work and no-one else on the mailing list has a better suggestion, open a new feature request on sr tracker.
i myself get q values into destination set using lookup or enum_query function.
-- juha
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
In the 1.5 code it doesn't look like it's possible to assign the q via pv assignment. The pv_set_branch function calls append_branch with Q_UNSPECIFIED.
if (append_branch( msg, &val->rs, 0, 0, Q_UNSPECIFIED, 0, msg->force_send_socket)!=1 )
Thanks for the help.
-----Original Message----- From: Klaus Darilion [mailto:klaus.mailinglists@pernau.at] Sent: Thursday, July 02, 2009 9:23 AM To: Juha Heinanen Cc: Robert McGilvray; users@lists.kamailio.org Subject: Re: [Kamailio-Users] forking on URIs from DB
accodring to doc it should be also possible to assign directly, e.g.: uri in $avp(firsturi) and Q in $avp(firstq):
$br = $avp(firsturi) + ";q=" + $avp(firstq);
regards klaus
http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:devel#request_ s_first_branch
Juha Heinanen schrieb:
Robert McGilvray writes:
I guess that's the part where I'm getting stuck. How do I go about adding my URIs with the proper q values to the dset?
have you tried append_branch with q value, something like this:
append_branch("sip:foo@bar;q=0.5");
if that does not work and no-one else on the mailing list has a better suggestion, open a new feature request on sr tracker.
i myself get q values into destination set using lookup or enum_query function.
-- juha
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
-------------------------------------------------------------------------- This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.