Description

Chaining the transformations {uri.param,received} and {uri.host} does not work if the address is IPv6. It works for IPv4 addresses.

Reproduction

We tested this with the following code:

if ($du != $null) {
    $var(received_uri)=$(du{uri.param,received});
    if ($var(received_uri)!="") {
        $var(subscriber_host)=$(var(received_uri){uri.host});
    }
    $var(test_tmp)=$(du{uri.param,received}{uri.host});
    xlog("L_ERR", "WURST subscriber_host=$var(subscriber_host) test_tmp=$var(test_tmp) du=$du received_uri=$var(received_uri)");
    }
}


#### Log Messages

For IPv6 this gives us:

"module": "pv", "file": "pv_trans.c", "line": 1545, "function": "tr_eval_uri", "logprefix": ", "callid": "1-91@1.2.4.16", "x-telco-capture-id": """, "message": "invalid uri [ab:cdef:dead:beef]:1234]\n"

"module": "core", "file": "core/lvalue.c", "line": 351, "function": "lval_pvar_assign", "logprefix": ", "callid": "1-91@1.2.4.16", "x-telco-capture-id": """, "message": "non existing right pvar\n"

"module": "core", "file": "core/lvalue.c", "line": 411, "function": "lval_assign", "logprefix": ", "callid": "1-91@1.2.4.16", "x-telco-capture-id": """, "message": "assignment failed at pos: (1432,19-1432,53)\n"

"module": "xlog", "file": "xlog.c", "line": 278, "function": "", "logprefix": ", "callid": "1-91@1.2.4.16", "x-telco-capture-id": """, "message": "WURST subscriber_host=[2001:db8:0123:4567:89ab:cdef:dead:beef] test_tmp=0 du=sip:1.2.4.129;lr;received=sip[2001:db8:0123:4567:89ab:cdef:dead:beef]:1234 received_uri=sip:[2001:db8:0123:4567:89ab:cdef:dead:beef]:1234"

"module": "xlog", "file": "xlog.c", "line": 278, "function": "", "logprefix": ", "callid": "1-91@1.2.4.16", "x-telco-capture-id": """, "message": "determineSubscribeIpFamily: contacts worked path=0 ip=[2001:db8:0123:4567:89ab:cdef:dead:beef] af=6"


For IPv4 it works:
`{ "idx": 8, "pid": 577, "level": "ERROR", "module": "xlog", "file": "xlog.c", "line": 278, "function": "", "logprefix": ", "callid": "1-91@1.2.4.16", "x-telco-capture-id": "<null>"", "message": "WURST subscriber_host=12.34.56.78 test_tmp=12.34.56.78 du=sip:1.2.4.149;lr;received=sip:12.34.56.78:1234 received_uri=sip:12.34.56.78:1234" }
`


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3794@github.com>