Yes, the note about the AVP name is 100% correct. Even if at the
opensips cfg level it is ok and the actual name of the AVP will be
"s:callfwd", it will not match the naming from the DB table.
So just drop the "s:" prefix in the avp name at the script level.
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
OpenSIPS Summit 2020 online
https://www.opensips.org/events/Summit-2020Distributed/
On 9/9/20 5:08 PM, Brett Nemeroff wrote:
Hello Nayani,
Your avp spec is for a much older version of OpenSIPs. I'm not sure if
that's your problem or not, but the "s:" syntax is dated for 2.4.x.
Here's the documentation you should reference for your version of
OpenSIPs:
https://opensips.org/html/docs/modules/2.4.x/avpops.html#func_avp_db_load
Also, see Bogdan's comment above, did avp_db_load return false?
Just my perspective, but for these kinds of "DB Loads", I almost
always prefer a avp_db_query over a avp_db_load. The syntax is clearer
for me, but I also just really like SQL to begin with. The original
avp_db_load syntax was more inline with how OpenSIPs/OpenSER works
from "back in the day". Would love other's feedback on that. Perhaps
avp_db_load is easier for simple matches, but I think under the hood
it's just doing a simple query anyway. avp_db_query just gives you
full access to the actual SQL if you are into that kind of thing.
-Brett
On Wed, Sep 9, 2020 at 12:25 AM Nayani Nikeshala via Users
<[email protected] <mailto:[email protected]>> wrote:
Hi!
I'm using OpenSIPS 2.4.7. With the below script, call was not
forwarded as configured. Is there any issue with my script or is
there an alternative method to do this ?
On Tuesday, September 8, 2020, 10:48:27 PM GMT+5:30, Bogdan-Andrei
Iancu <[email protected] <mailto:[email protected]>> wrote:
Hi,
What version of OpenSIPS do you use ? And your experience is that
the avp_db_load fails ?
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
OpenSIPS Summit 2020 online
https://www.opensips.org/events/Summit-2020Distributed/
On 9/7/20 1:51 PM, Nayani Nikeshala via Users wrote:
Hello,
I'm trying to do a simple blind call forwarding with the below
script added into "main request routing logic". (123 dials 789 and
789 is forwarded to 456)
if(avp_db_load("$ru","$avp(s:callfwd)")) {
$ru = $avp(s:callfwd);
xlog("forwarded to: $avp(s:callfwd)");
route(1);
exit;
}
My usr_preferences table is as below.
opensips=> select * from usr_preferences;
id | uuid | username | domain | attribute | type |value|last_modified
----+------+----------+--------+-----------+------+------------------------+---------------------
1 || 789|| callfwd|0 | sip:456@xxxxxxxxxxx| 1900-01-01 00:00:01
(1 row)
opensips=>
I have added the avpops module as below.
#AVPOPS module
loadmodule "avpops.so"
modparam("avpops",
"db_url","postgres://opensips:xxxxxxxx@localhost/opensips")
modparam("avpops","avp_table","usr_preferences")
Anyways, this script does not do the call forwarding task. Anyone
could help on this please. Could there be a problem of the
position that I have added the script in "main request routing
logic".
_______________________________________________
Users mailing list
[email protected] <mailto:[email protected]>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected] <mailto:[email protected]>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users