[OpenSIPS-Users] OpenSIPS 3.0.2 - 'IF' statement doesn't evaluating correctly

Callum Guy callum.guy at x-on.co.uk
Thu Aug 20 08:22:11 EST 2020


Excellent, I'm not clear on exactly how the type conversion system
works on OpenSIPs but I'm glad this resolved the confusion!

>From my few visits to the source I recall that most of the script
variables are custom types which have both a string and integer
property but I'm not clear how it chooses which one to use for
conditional statements etc

On Thu, 20 Aug 2020 at 07:35, Igor Pavlov <igor.pavlov1987 at gmail.com> wrote:
>
> Thanks a lot for {s.int} ! I forgot that my dialog value is string. Transforming to int helped.
>
>
> ср, 19 авг. 2020 г. в 02:33, Callum Guy <callum.guy at x-on.co.uk>:
>>
>> Have you matched the dialog before running this check? Just wondering
>> if one of those values is stale, do the durations match up with
>> reality for the example calls?
>>
>> Also maybe rule out type issues with $(dlg_val(dialog_min_time){s.int})
>>
>> On Tue, 18 Aug 2020 at 17:35, Igor Pavlov <igor.pavlov1987 at gmail.com> wrote:
>> >
>> > Hi all, I have found the strange behavior of evaluating boolean value in 'if' statement. Here is the part of my routing script, it handles the BYE msg (I removed real logic and left only xlog).
>> >
>> > if ($DLG_lifetime < $dlg_val(dialog_min_time)) {
>> >     xlog("L_DBG","[$ci] Dialog lifetime less then dialog_min_time ; duration: $DLG_lifetime ; $dlg_val(dialog_min_time)");
>> > } else {
>> >     xlog("L_DBG","[$ci] Dialog lifetime greater then dialog_min_time ; duration: $DLG_lifetime ; $dlg_val(dialog_min_time)");
>> > }
>> >
>> > The '$dlg_val(dialog_min_time)' setup during INVITE handling, after create_dialog().
>> >
>> > Under load I see that '$DLG_lifetime < $dlg_val(dialog_min_time)' is not evaluating correctly. Here is some logs:
>> >
>> > opensips[1589]: [56276459-0-1637911800 at 1.1.1.48] BYE from 2.2.2.143:5060, dialog_min_time: 30, duration: 161, status: 5
>> > opensips[1589]: [56276459-0-1637911800 at 1.1.1.48] Dialog lifetime less then dialog_min_time ; duration: 161 ; 30
>> >
>> > Here is DLG_lifetime = 161 and $dlg_val(dialog_min_time) = 30 (161 < 30 ???)
>> >
>> > Another example:
>> >
>> > opensips[1590]: [58514636-0-1638386270 at 1.1.1.48] BYE from 1.1.1.50:5060, dialog_min_time: 15, duration: 1212, status: 5
>> > opensips[1590]: [58514636-0-1638386270 at 1.1.1.48] Dialog lifetime less then dialog_min_time ; duration: 1212 ; 15
>> >
>> > Here is DLG_lifetime = 1212 and $dlg_val(dialog_min_time) = 15 (1212 < 15 ???)
>> >
>> > My OpenSIPS version is:
>> >
>> > version: opensips 3.0.2 (x86_64/linux)
>> > flags: STATS: On, 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: 3a8f6f137
>> > main.c compiled on 22:11:53 Jul 20 2020 with gcc 8
>> >
>> > --
>> >
>> > Best regards,
>> > Igor Pavlov
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opensips.org
>> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>> --
>>
>>
>>
>>
>>
>> *0333 332 0000  |  x-on.co.uk <https://www.x-on.co.uk>  |   **
>> <https://www.linkedin.com/company/x-on>   <https://www.facebook.com/XonTel>
>>   <https://twitter.com/xonuk> **  |  Coronavirus
>> <https://www.x-on.co.uk/service/surgery-connect/coronavirus.htm>*
>>
>>
>> THE
>> ITSPA AWARDS 2020 <http://www.itspa.org.uk/itspa-awards> AND Best ITSP -
>> Mid Market, Best Software and Best Vertical Solution are trade marks of the
>> Internet Telephony Services Providers' Association, used under licence.
>>
>>
>> X-on
>> is a trading name of Storacall Technology Ltd a limited company
>> registered in
>> England and Wales.
>>
>> Registered Office : Avaland House, 110
>> London Road, Apsley, Hemel Hempstead,
>> Herts, HP3 9SD. Company Registration
>> No. 2578478.
>>
>> The information in this e-mail is confidential and for use by
>> the addressee(s)
>> only. If you are not the intended recipient, please notify
>> X-on immediately on +44(0)333 332 0000 and delete the
>> message from your
>> computer. If you are not a named addressee you must not use,
>> disclose,
>> disseminate, distribute, copy, print or reply to this email. Views
>> or
>> opinions expressed by an individual
>> within this email may not necessarily
>>
>> reflect the views of X-on or its associated companies. Although X-on
>> routinely
>> screens for viruses, addressees should scan this email and any
>> attachments
>> for
>> viruses. X-on makes no representation or warranty as to the
>> absence of viruses
>> in this email or any attachments.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> --
>
> Best regards,
> Igor Pavlov
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-- 





*0333 332 0000  |  x-on.co.uk <https://www.x-on.co.uk>  |   ** 
<https://www.linkedin.com/company/x-on>   <https://www.facebook.com/XonTel> 
  <https://twitter.com/xonuk> **  |  Coronavirus 
<https://www.x-on.co.uk/service/surgery-connect/coronavirus.htm>*


THE 
ITSPA AWARDS 2020 <http://www.itspa.org.uk/itspa-awards> AND Best ITSP - 
Mid Market, Best Software and Best Vertical Solution are trade marks of the 
Internet Telephony Services Providers' Association, used under licence.


X-on
is a trading name of Storacall Technology Ltd a limited company 
registered in
England and Wales.

Registered Office : Avaland House, 110 
London Road, Apsley, Hemel Hempstead,
Herts, HP3 9SD. Company Registration 
No. 2578478.

The information in this e-mail is confidential and for use by 
the addressee(s)
only. If you are not the intended recipient, please notify 
X-on immediately on +44(0)333 332 0000 and delete the
message from your 
computer. If you are not a named addressee you must not use,
disclose, 
disseminate, distribute, copy, print or reply to this email. Views
or 
opinions expressed by an individual
within this email may not necessarily

reflect the views of X-on or its associated companies. Although X-on 
routinely
screens for viruses, addressees should scan this email and any 
attachments
for
viruses. X-on makes no representation or warranty as to the 
absence of viruses
in this email or any attachments.













More information about the Users mailing list