I'm attempting to run an existing SER config file under a recent build of sip-router. I get a syntax error on the t_on_failure("noroute") call that exists in my config file. The specific error is "bad expression: type mismatch (str instead of int)". I presume this means sip-router does not support named failure route labels. Is that correct?
Thanks,Steve
---
ISC Networking & Telecommunications 3401 Walnut Street, Suite 221A Philadelphia, PA 19104 215-573-8396 215-898-9348 (fax)
Hello,
On 4/30/10 7:58 PM, Steven C. Blair wrote:
I'm attempting to run an existing SER config file under a recent build of sip-router. I get a syntax error on the t_on_failure("noroute") call that exists in my config file. The specific error is "bad expression: type mismatch (str instead of int)". I presume this means sip-router does not support named failure route labels. Is that correct?
no, t_on_failure("xyz") can take string parameter -- actually it was always string, but converted to int in past versions. The error is in an expression like statement. Can you paste the snippet where you get the error (several lines before and after).
Cheers, Daniel
Thanks,Steve
ISC Networking & Telecommunications
3401 Walnut Street, Suite 221A
Philadelphia, PA 19104
215-573-8396
215-898-9348 (fax)
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
The error is produced within the following block per the config file syntax check "-c".
if (method=="INVITE" && !@to.tag) { t_on_failure("FAILURE_ROUTE"); }
From: Daniel-Constantin Mierla [mailto:miconda@gmail.com] Sent: Friday, April 30, 2010 2:09 PM To: Steven C. Blair Cc: sr-users@lists.sip-router.org Subject: Re: [SR-Users] t_on_failure to named failure route
Hello,
On 4/30/10 7:58 PM, Steven C. Blair wrote:
I'm attempting to run an existing SER config file under a recent build of sip-router. I get a syntax error on the t_on_failure("noroute") call that exists in my config file. The specific error is "bad expression: type mismatch (str instead of int)". I presume this means sip-router does not support named failure route labels. Is that correct?
no, t_on_failure("xyz") can take string parameter -- actually it was always string, but converted to int in past versions. The error is in an expression like statement. Can you paste the snippet where you get the error (several lines before and after).
Cheers, Daniel
Thanks,Steve
---
ISC Networking & Telecommunications 3401 Walnut Street, Suite 221A Philadelphia, PA 19104 215-573-8396 215-898-9348 (fax)
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.orgmailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
On 4/30/10 8:11 PM, Steven C. Blair wrote:
The error is produced within the following block per the config file syntax check "-c".
if (method=="INVITE" && !@to.tag) {
t_on_failure("FAILURE_ROUTE"); }
not using selects in this way but via PV framework, but I think the problem is '!@to.tag' since the select is returning string.
Try to use 'strempty(@to.tag)'.
Alternative with PV is $tt==$null or via sipuri module function has_totag()
Cheers. Daniel
*From:* Daniel-Constantin Mierla [mailto:miconda@gmail.com] *Sent:* Friday, April 30, 2010 2:09 PM *To:* Steven C. Blair *Cc:* sr-users@lists.sip-router.org *Subject:* Re: [SR-Users] t_on_failure to named failure route
Hello,
On 4/30/10 7:58 PM, Steven C. Blair wrote:
I'm attempting to run an existing SER config file under a recent build of sip-router. I get a syntax error on the t_on_failure("noroute") call that exists in my config file. The specific error is "bad expression: type mismatch (str instead of int)". I presume this means sip-router does not support named failure route labels. Is that correct?
no, t_on_failure("xyz") can take string parameter -- actually it was always string, but converted to int in past versions. The error is in an expression like statement. Can you paste the snippet where you get the error (several lines before and after).
Cheers, Daniel
Thanks,Steve
ISC Networking & Telecommunications
3401 Walnut Street, Suite 221A
Philadelphia, PA 19104
215-573-8396
215-898-9348 (fax)
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla *http://www.asipto.com/ *http://twitter.com/miconda *http://www.linkedin.com/in/danielconstantinmierla
I'm migrating from an older version of SER to sip-router. A syntax check of my config file produces a few errors. The most confusing is :
0(27980) WARNING: <core> [cfg.y:3364]: warning in config file /home/blairs/ser-penn.cfg, line 1270, column 22-23: non constant rvalue in ip comparison
Line 1270 is the following if statement:
if (to_ip==$g.gw_ip && !isflagset(FLAG_PSTN_ALLOWED) && !isflagset(FLAG_TOTAG) && method != "ACK" && method != "CANCEL")
I do not see anything mentioned in config_migration.txt which explains this warning. Does anyone have any thoughts on how to correct this error?
Thanks,steve
On Monday 14 June 2010, Steven C. Blair wrote:
I’m migrating from an older version of SER to sip-router. A syntax check of my config file produces a few errors. The most confusing is :
0(27980) WARNING: <core> [cfg.y:3364]: warning in config file /home/blairs/ser-penn.cfg, line 1270, column 22-23: non constant rvalue in ip comparison
Line 1270 is the following if statement:
if (to_ip==$g.gw_ip && !isflagset(FLAG_PSTN_ALLOWED) && !isflagset(FLAG_TOTAG) && method != "ACK" && method != "CANCEL")
I do not see anything mentioned in config_migration.txt which explains this warning. Does anyone have any thoughts on how to correct this error?
Hi Steven,
for the term "rvalue", its somewhat described e.g. here: http://en.wikipedia.org/wiki/Value_(computer_science)
The error message probably means that the $g.gw_ip can not compared against the to_ip variable.
Do you get also this first error:
0(8530) : <core> [cfg.y:3396]: parse error in config file sip- router/test/unit/foo.cfg, line 5, column 6-10: to_ip allowed only in onsend_routes 0(8530) WARNING: <core> [cfg.y:3376]: warning in config file sip- router/test/unit/foo.cfg, line 5, column 21: non constant rvalue in ip comparison
Then i think we know the problem from the first log message. :) If you just want to compare against the To domain header, you could use the appropriate pseudo-variable or the proper select.
Cheers,
Henning
On Jun 14, 2010 at 13:29, Steven C. Blair blairs@isc.upenn.edu wrote:
I'm migrating from an older version of SER to sip-router. A syntax check of my config file produces a few errors. The most confusing is :
0(27980) WARNING: <core> [cfg.y:3364]: warning in config file /home/blairs/ser-penn.cfg, line 1270, column 22-23: non constant rvalue in ip comparison
Line 1270 is the following if statement:
if (to_ip==$g.gw_ip && !isflagset(FLAG_PSTN_ALLOWED) && !isflagset(FLAG_TOTAG) && method != "ACK" && method != "CANCEL")
I do not see anything mentioned in config_migration.txt which explains this warning. Does anyone have any thoughts on how to correct this error?
You could safely ignore it. It was there just as a suggestion that comparing ips with non constant expressions ($g.gw_ip in this case) is not the fastest thing to do. I'll remove it.
Andrei
->
Am 15.06.2010 12:53, schrieb Andrei Pelinescu-Onciul:
On Jun 14, 2010 at 13:29, Steven C. Blairblairs@isc.upenn.edu wrote:
I'm migrating from an older version of SER to sip-router. A syntax check of my config file produces a few errors. The most confusing is :
0(27980) WARNING:<core> [cfg.y:3364]: warning in config file /home/blairs/ser-penn.cfg, line 1270, column 22-23: non constant rvalue in ip comparison
Line 1270 is the following if statement:
if (to_ip==$g.gw_ip&& !isflagset(FLAG_PSTN_ALLOWED) && !isflagset(FLAG_TOTAG) && method != "ACK"&& method != "CANCEL")
I do not see anything mentioned in config_migration.txt which explains this warning. Does anyone have any thoughts on how to correct this error?
You could safely ignore it. It was there just as a suggestion that comparing ips with non constant expressions ($g.gw_ip in this case) is not the fastest thing to do. I'll remove it.
Andrei, how will the comparison be done? IP-based or string-based.
e.g. if the string 01.01.01.01 is compared against 1.1.1.1, will it be identical?
What about IPv6 addresses?
thanks klaus
On Jun 15, 2010 at 14:43, Klaus Darilion klaus.mailinglists@pernau.at wrote:
->
Am 15.06.2010 12:53, schrieb Andrei Pelinescu-Onciul:
On Jun 14, 2010 at 13:29, Steven C. Blairblairs@isc.upenn.edu wrote:
I'm migrating from an older version of SER to sip-router. A syntax check of my config file produces a few errors. The most confusing is :
0(27980) WARNING:<core> [cfg.y:3364]: warning in config file /home/blairs/ser-penn.cfg, line 1270, column 22-23: non constant rvalue in ip comparison
Line 1270 is the following if statement:
if (to_ip==$g.gw_ip&& !isflagset(FLAG_PSTN_ALLOWED) && !isflagset(FLAG_TOTAG) && method != "ACK"&& method != "CANCEL")
I do not see anything mentioned in config_migration.txt which explains this warning. Does anyone have any thoughts on how to correct this error?
You could safely ignore it. It was there just as a suggestion that comparing ips with non constant expressions ($g.gw_ip in this case) is not the fastest thing to do. I'll remove it.
Andrei, how will the comparison be done? IP-based or string-based.
If the value is not constant then string based. If it's constant then: ip based if possible/ip, if not try string based and if that fails too try comparing with DNS(target) and if this also fails try revDNS(to_ip) with string(target).
e.g. if the string 01.01.01.01 is compared against 1.1.1.1, will it be identical?
If 01.01.01.01 is the result of a non-constant expression, then no.
What about IPv6 addresses?
Same as above.
I guess I know now why I have left that warning :-)
Andrei
On Jun 15, 2010 at 17:07, Andrei Pelinescu-Onciul andrei@iptel.org wrote:
On Jun 15, 2010 at 14:43, Klaus Darilion klaus.mailinglists@pernau.at wrote:
->
Am 15.06.2010 12:53, schrieb Andrei Pelinescu-Onciul:
On Jun 14, 2010 at 13:29, Steven C. Blairblairs@isc.upenn.edu wrote:
I'm migrating from an older version of SER to sip-router. A syntax check of my config file produces a few errors. The most confusing is :
0(27980) WARNING:<core> [cfg.y:3364]: warning in config file /home/blairs/ser-penn.cfg, line 1270, column 22-23: non constant rvalue in ip comparison
Line 1270 is the following if statement:
if (to_ip==$g.gw_ip&& !isflagset(FLAG_PSTN_ALLOWED) && !isflagset(FLAG_TOTAG) && method != "ACK"&& method != "CANCEL")
I do not see anything mentioned in config_migration.txt which explains this warning. Does anyone have any thoughts on how to correct this error?
You could safely ignore it. It was there just as a suggestion that comparing ips with non constant expressions ($g.gw_ip in this case) is not the fastest thing to do. I'll remove it.
Andrei, how will the comparison be done? IP-based or string-based.
If the value is not constant then string based. If it's constant then: ip based if possible/ip, if not try string based and if that fails too try comparing with DNS(target) and if this also fails try revDNS(to_ip) with string(target).
e.g. if the string 01.01.01.01 is compared against 1.1.1.1, will it be identical?
If 01.01.01.01 is the result of a non-constant expression, then no.
I was wrong, it will be identical, because of the DNS part. string comparison will fail, but then it will try to compare: ip(1.1.1.1) with DNS(01.01.01.01)=1.1.1.1.
Anyway I changed the code now and it won't attempt string comparisons anymore, it will try first to convert the other side to ip or a network/mask format. The only exception is for ~=, e.g. src_ip ~= "10.[12]..*" where regex matches will be used.
What about IPv6 addresses?
Same as above.
I guess I know now why I have left that warning :-)
Andrei
2010/6/15 Klaus Darilion klaus.mailinglists@pernau.at:
What about IPv6 addresses?
IPv6 addresses must me converted to in6_addr struct prior to match them, as there can be different representations for the same IPv6 address.
For example, take a look to this code:
/** * Convert an IPv6 address as hexadecimal without ":" separator (32 characters) * into in6_addr structure. * * \return Returns 0 on failure, or 1 on error. */ int hex2ipv6(const char *text, struct in6_addr *ip) { #ifdef LINUX # define READ(text, index) sscanf((text), "%08" SCNx32, (uint32_t *) &ip->s6_addr32[index]) #else # define READ(text, index) sscanf((text), "%08" SCNx32, (uint32_t *) &ip->__u6_addr.__u6_addr32[index]) #endif /* Copy text */ char copy[33]; if (strlen(text) != 32) return 0; SECURE_STRNCPY(copy, text, sizeof(copy));
if (READ(copy + 8 * 3, 3) != 1) return 0; copy[8 * 3] = 0;
if (READ(copy + 8 * 2, 2) != 1) return 0; copy[8 * 2] = 0;
if (READ(copy + 8 * 1, 1) != 1) return 0; copy[8] = 0;
if (READ(copy + 8 * 0, 0) != 1) return 0; return 1; #undef READ }
/** * Compare two IPv6 addresses. * * \return 1 on equality, 0 otherwise. */ int ipv6_equal(const struct in6_addr *ipa, const struct in6_addr *ipb) { return memcmp(ipa, ipb, sizeof(struct in6_addr)) == 0; }
Extracted from here: http://software.inl.fr/trac/browser/mirror/edenwall/nufw/trunk/nufw/src/libs...