I forgot to say that I use opensips 3.01 migrated from 2.4.
version: opensips 3.0.1 (x86_64/linux)
flags: STATS: On, EXTRA_DEBUG, DISABLE_NAGLE, USE_MCAST, SHM_MMAP,
PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC,
FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: 675a10e2f
main.c compiled on 16:29:47 Mar 31 2020 with gcc 6.3.0
On 2/09/2020 12:35, johan wrote:
As you can see I use dialpan to strip 0,00 or + from fU result is
$var(fU).
I seem to get strange and incomprehensible results :
Sep 1 09:41:58 hendrix /data/opensips/sbin/opensips[6327]:
callid=7ocl48d3Gi: Route[normalizeforoutbound]: we change rU +3315 to
E.164; as the call is outbound, base is fU 33757935187
Sep 1 09:41:58 hendrix /data/opensips/sbin/opensips[6327]:
callid=7ocl48d3Gi: Route[normalizeforoutbound]: we drop 0,00,+ from
33757935187, result is var(fU)
Sep 1 09:41:58 hendrix /data/opensips/sbin/opensips[6327]:
callid=7ocl48d3Gi: Route[normalizeforoutbound]: result dp_translate
var(fU) +32460200570
As you can see in the script snippet, $var(fU) is not initialized.
So : would initialization of var(fU) to '' solve my issue.
As a more general question : when does a variable goes excatly out of
scope ?
dialplan:
*************************** 1. row ***************************
id: 4
dpid: 1
pr: 1
match_op: 1
match_exp: ^(00|\+|0).*
match_flags: 0
subst_exp: ^(00|\+|0)(.*)
repl_exp: \2
timerec: NULL
disabled: 0
attrs:
script :
route[normalizeforoutbound]
{
xlog("callid=$ci: Route[normalizeforoutbound]: we change rU $rU to
E.164; as the call is outbound, base is fU $fU");
xlog("callid=$ci: Route[normalizeforoutbound]: we drop 0,00,+ from
$fU, result is var(fU)");
$var(i)=1;
dp_translate($(var(i){s.int}),"$fU",$var(fU));
if ($var(fU)==NULL or $var(fU)=='' or $var(fU)=='<null>')
{
xlog("callid=$ci: Route[normalizeforoutbound]: result
dp_translate var(fU) $var(fU) == NULL -> from header fU $fU has
correct format, we use fU $fU in query");
avp_db_query("SELECT country,channels FROM subscriber where
username like '%$fU'","$avp(countryoutbound);$avp(channels)");
xlog("callid=$ci: Route[normalizeforoutbound]: SELECT
country,channels FROM subscriber where username like '%$fU' ->
avp(countryoutbound) $avp(countryoutbound), avp(channels)
$avp(channels) ");
}
else
{
xlog("callid=$ci: Route[normalizeforoutbound]: result
dp_translate var(fU) $var(fU) -> from header fu $fU has incorrect
format, we use var(fU) $var(fU) in query");
avp_db_query("SELECT country,channels FROM subscriber where
username like '%$var(fU)'","$avp(countryoutbound);$avp(channels)");
xlog("callid=$ci: Route[normalizeforoutbound]: SELECT
country,channels FROM subscriber where username like '%$var(fU)' ->
avp(countryoutbound) $avp(countryoutbound), avp(channels)
$avp(channels) ");
}
output:
Sep 1 09:41:58 hendrix /data/opensips/sbin/opensips[6327]:
callid=7ocl48d3Gi: Route[normalizeforoutbound]: we change rU +3315 to
E.164; as the call is outbound, base is fU 33757935187
Sep 1 09:41:58 hendrix /data/opensips/sbin/opensips[6327]:
callid=7ocl48d3Gi: Route[normalizeforoutbound]: we drop 0,00,+ from
33757935187, result is var(fU)
Sep 1 09:41:58 hendrix /data/opensips/sbin/opensips[6327]:
callid=7ocl48d3Gi: Route[normalizeforoutbound]: result dp_translate
var(fU) +32460200570 -> from header fu 33757935187 has incorrect
format, we use var(fU) +32460200570 in query
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users