Hi, I've aupdated the opensips 1.9 after upgrade it stopped working and giving this error.
CRITICAL:db_mysql:wrapper_single_mysql_real_query: driver error (1054): Unknown column 'attr' in 'field list' Jan 27 04:56:55 debiansip01 /sbin/opensips[3728]: ERROR:core:db_do_query: error while submitting query - [select username,contact,expires,q,cal lid,cseq,flags,cflags,user_agent,received,path,socket,methods,last_modified, sip_instance,attr from aliases ] Jan 27 04:56:55 debiansip01 /sbin/opensips[3728]: ERROR:usrloc:preload_udomain: db_query (1) failed Jan 27 04:56:55 debiansip01 /sbin/opensips[3728]: ERROR:usrloc:child_init: child(1): failed to preload domain 'aliases' Jan 27 04:56:55 debiansip01 /sbin/opensips[3728]: ERROR:core:init_mod_child: failed to initializing module usrloc, rank 1 Jan 27 04:56:55 debiansip01 /sbin/opensips[3728]: ERROR:core:main_loop: init_child failed for UDP listener Pls help -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Sunday, February 2, 2014 4:30 PM To: [email protected] Subject: Users Digest, Vol 67, Issue 3 Send Users mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit http://lists.opensips.org/cgi-bin/mailman/listinfo/users or, via email, send a message with subject or body 'help' to [email protected] You can reach the person managing the list at [email protected] When replying, please edit your Subject line so it is more specific than "Re: Contents of Users digest..." Today's Topics: 1. Re: check if ip address belongs to ip and subnet subscriber (Edwin) 2. Re: check if ip address belongs to ip and subnet subscriber (Stefano Pisani) 3. Re: check if ip address belongs to ip and subnet subscriber (Edwin) 4. Re: check if ip address belongs to ip and subnet subscriber (Stefano Pisani) 5. Re: check if ip address belongs to ip and subnet subscriber (Edwin) ---------------------------------------------------------------------- Message: 1 Date: Sat, 1 Feb 2014 08:44:26 -0800 (PST) From: Edwin <[email protected]> Subject: Re: [OpenSIPS-Users] check if ip address belongs to ip and subnet subscriber To: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset=us-ascii This helped a bit, so I came up with: $var(sourceip_net) = $(avp(sourceip_mask){ip.pton}) & $(avp(sourceip){ip.pton}); $var(si_net) = $(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}); if($var(sourceip_net) == $var(si_net)) { xlog("L_INFO", " ip $si belongs to $au\n"); } else { xlog("L_INFO", " ip $si does not belong to $au\n"); sl_send_reply("403", "Forbidden"); exit; } But I like to write i like this: if( [ $(avp(sourceip_mask){ip.pton}) & $(avp(sourceip){ip.pton}) ] == [ $(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}) ] ) { xlog("L_INFO", " ip $si belongs to $au\n"); } else { xlog("L_INFO", " ip $si does not belong to $au\n"); sl_send_reply("403", "Forbidden"); exit; } But this gives an error (column 121-123: syntax error, column 121-123: bad command!) -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/check-if-ip-address-be longs-to-ip-and-subnet-subscriber-tp7589375p7589398.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ------------------------------ Message: 2 Date: Sat, 01 Feb 2014 17:50:40 +0100 From: Stefano Pisani <[email protected]> Subject: Re: [OpenSIPS-Users] check if ip address belongs to ip and subnet subscriber To: OpenSIPS users mailling list <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed why you are using "[]"? use "()" instead. Il 01/02/2014 17.44, Edwin ha scritto: > This helped a bit, so I came up with: > > $var(sourceip_net) = $(avp(sourceip_mask){ip.pton}) & > $(avp(sourceip){ip.pton}); > $var(si_net) = $(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}); > > if($var(sourceip_net) == $var(si_net)) { > xlog("L_INFO", " ip $si belongs to $au\n"); } else { > xlog("L_INFO", " ip $si does not belong to $au\n"); > sl_send_reply("403", "Forbidden"); > exit; > } > > But I like to write i like this: > > if( [ $(avp(sourceip_mask){ip.pton}) & $(avp(sourceip){ip.pton}) ] == > [ > $(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}) ] ) { > xlog("L_INFO", " ip $si belongs to $au\n"); } else { > xlog("L_INFO", " ip $si does not belong to $au\n"); > sl_send_reply("403", "Forbidden"); > exit; > } > > But this gives an error (column 121-123: syntax error, column 121-123: > bad > command!) > > > > -- > View this message in context: > http://opensips-open-sip-server.1449251.n2.nabble.com/check-if-ip-addr > ess-belongs-to-ip-and-subnet-subscriber-tp7589375p7589398.html > Sent from the OpenSIPS - Users mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > [email protected] > http://lists.opensips.org/cgi-bin/mailman/listinfo/users ------------------------------ Message: 3 Date: Sat, 1 Feb 2014 09:15:57 -0800 (PST) From: Edwin <[email protected]> Subject: Re: [OpenSIPS-Users] check if ip address belongs to ip and subnet subscriber To: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset=us-ascii I tried () also, but this resulted in an error too ): For the [] part i followed the docs: http://www.opensips.org/Documentation/Script-Operators Arithmetic expressions can be used in condition expressions via test operator ' [ ... ] '. But I'm not the expert here, any help is appreciated! -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/check-if-ip-address-be longs-to-ip-and-subnet-subscriber-tp7589375p7589400.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ------------------------------ Message: 4 Date: Sat, 01 Feb 2014 18:37:48 +0100 From: Stefano Pisani <[email protected]> Subject: Re: [OpenSIPS-Users] check if ip address belongs to ip and subnet subscriber To: OpenSIPS users mailling list <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed if( ( $(avp(sourceip_mask){ip.pton}) & $(avp(sourceip){ip.pton}) ) == ( $(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}) ) ) { xlog("L_INFO", " ip $si belongs to $au\n"); } else { xlog("L_INFO", " ip $si does not belong to $au\n"); sl_send_reply("403", "Forbidden"); exit; } Why you do not use directly the net address? Why do you need to do ($(avp(sourceip_mask){ip.pton}) & $(avp(sourceip){ip.pton})) each time if the result is always the same? Put the result in your db instead of sourceip. if( ($(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}) ) == $avp(sourceip_net) ) ... Il 01/02/2014 18.15, Edwin ha scritto: > I tried () also, but this resulted in an error too ): > > For the [] part i followed the docs: > http://www.opensips.org/Documentation/Script-Operators > Arithmetic expressions can be used in condition expressions via test > operator ' [ ... ] '. > > But I'm not the expert here, any help is appreciated! > > > > -- > View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/check-if-ip-address-be longs-to-ip-and-subnet-subscriber-tp7589375p7589400.html > Sent from the OpenSIPS - Users mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > [email protected] > http://lists.opensips.org/cgi-bin/mailman/listinfo/users ------------------------------ Message: 5 Date: Sat, 1 Feb 2014 14:03:28 -0800 (PST) From: Edwin <[email protected]> Subject: Re: [OpenSIPS-Users] check if ip address belongs to ip and subnet subscriber To: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset=us-ascii Stefano, In fact you have a point. And probably I will put the network address in the database. But still, I hate it when I don't understand why a logical comparison doesn't work like I expect it to do. In this case the output of $(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}) should be the same as $avp(sourceip_net) and it gives a error. So, or it is a 'bug' or I do it wrong (sometimes the docs are a little bit to summier...) Is it possible to put == between to ip.xxx statements? -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/check-if-ip-address-be longs-to-ip-and-subnet-subscriber-tp7589375p7589402.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ------------------------------ _______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users End of Users Digest, Vol 67, Issue 3 ************************************ _______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
