[OpenSIPS-Users] Compare $fU to drouting prefix

Callum Guy callum.guy at x-on.co.uk
Sat Apr 18 07:51:39 EST 2020


That'll do it..

On Fri, 17 Apr 2020 at 16:00, Mark Farmer <farmorg at gmail.com> wrote:

> OK, fixed it.
>
> Turned out to be this breaking it by overwriting $acc_extra(customer_id)
> with a blank value.
>
> ...
> else $acc_extra(Call_Flow) = "Internal";
>                 $acc_extra(customer_id) = $var(rule_attrs);
> ...
>
> Changed it to:
>
> ...
> else if (isflagset(TPTY_PBX) || isflagset(PBX_TPTY)) {
>                 $acc_extra(Call_Flow) = "Internal";
>                 $acc_extra(customer_id) = $var(rule_attrs);
> ...
>
> And all works nicely :)
>
> Thanks for the help!
> Mark.
>
>
> On Fri, 17 Apr 2020 at 14:08, Mark Farmer <farmorg at gmail.com> wrote:
>
>> Thats what I thought :)
>>
>> This is getting quite odd now.
>> I am adding 2 extra fields, Call_Flow & customer_id. The odd thing is
>> that Call_Flow is working perfectly in all cases.
>> customer_id works fine for the latter 2 scenarios but in the first
>> scenario the customer_id data is never added to the database.
>>
>> I have this configured for the acc module:
>> modparam("acc", "extra_fields", "db: from_usr; to_usr; customer_id;
>> Call_Flow")
>>
>> The variable is set earlier on:
>> ...
>> do_routing("3",,,"$var(custID)");
>> ...
>>
>> And I am doing all of the accounting in a dedicated route:
>>
>> route[ACCEXTRA] {
>>         do_accounting("db","cdr");
>>         xlog("CUSTOM_LOG: Adding extra accounting: from_usr: $fU
>> customer_id: $var(rule_attrs) $var(custID)"); *# variable is
>> visible here*
>>         $acc_extra(from_usr) = $fU;
>>         $acc_extra(to_usr) = $tU;
>>         if (isflagset(PBX_PSTN) || isflagset(TPTY_PSTN)) {
>>                 xlog("CUSTOM_LOG: Customer ID = $var(custID)"); *#
>> variable is visible here*
>>                 $acc_extra(Call_Flow) = "Outbound";
>>                 $acc_extra(customer_id) = $var(custID);
>>                 xlog("CUSTOM_LOG: $$acc_extra(customer_id) =
>> $acc_extra(customer_id)"); *# variable is visible here*
>>         } else if (isflagset(PSTN_TPTY) || isflagset(PSTN_PBX)) {
>>                 $acc_extra(Call_Flow) = "Inbound";
>>                 $acc_extra(customer_id) = $var(rule_attrs);
>>         } else $acc_extra(Call_Flow) = "Internal";
>>                 $acc_extra(customer_id) = $var(rule_attrs);
>> }
>>
>>
>> On Fri, 17 Apr 2020 at 13:50, Bogdan-Andrei Iancu <bogdan at opensips.org>
>> wrote:
>>
>>> Mark,
>>>
>>> You can populate the $acc_extra() from whatever other variable or string
>>> operations. Most probably your issue is in other place, in regards to the
>>> acc logic.
>>>
>>> Regards,
>>>
>>> Bogdan-Andrei Iancu
>>>
>>> OpenSIPS Founder and Developer
>>>   https://www.opensips-solutions.com
>>>
>>> On 4/17/20 1:40 PM, Mark Farmer wrote:
>>>
>>> Thanks Bogdan, that's mostly working now.
>>>
>>> My issue now is with passing that identifier into acc_extra() as a
>>> variable which does not seem to be working.
>>> Using xlog() I can see that the variable is populated right before
>>> calling acc_extra()
>>>
>>> ...
>>> if (isflagset(PBX_PSTN) || isflagset(TPTY_PSTN)) {
>>>                 xlog("CUSTOM_LOG: Customer ID = $var(custID)");
>>>                 $acc_extra(customer_id) = $var(custID);
>>> ...
>>> do_accounting("db","cdr");
>>> }
>>>
>>> Does acc_extra() not accept variables as input?
>>>
>>> Thanks again!
>>> Mark.
>>>
>>>
>>>
>>>
>>> On Fri, 17 Apr 2020 at 09:15, Bogdan-Andrei Iancu <bogdan at opensips.org>
>>> wrote:
>>>
>>>> Hey Mark,
>>>>
>>>> It is not nice, but you can do:
>>>>
>>>> $var(tmp) = $rU;
>>>> $rU = $fU
>>>> do_routing();
>>>> $rU = $var(tmp);
>>>>
>>>> Regards,
>>>>
>>>> Bogdan-Andrei Iancu
>>>>
>>>> OpenSIPS Founder and Developer
>>>>   https://www.opensips-solutions.com
>>>>
>>>> On 4/17/20 11:13 AM, Mark Farmer wrote:
>>>>
>>>> Hi Bogdan, I will try to explain better.
>>>>
>>>> In rule_attrs I have a customer identifier which is used by acc to add
>>>> the identifier into the CDR database.
>>>> This works fine for calls from PSTN which are routed to another SIP
>>>> gateway but calls from that gateway routed to PSTN can come from multiple
>>>> customers and there is no way to identify which. So I'd like to match the
>>>> incoming $fU to the rule that would match $rU in the from PSTN scenario in
>>>> order to retrieve the rule_attrs (the customer identifier) from that rule.
>>>>
>>>> Does that make sense?
>>>>
>>>> Many thanks and regards
>>>> Mark.
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, 16 Apr 2020 at 16:55, Bogdan-Andrei Iancu <bogdan at opensips.org>
>>>> wrote:
>>>>
>>>>> Hi Mark,
>>>>>
>>>>> What kind of matching you want to do between $fU and the dr prefixes ?
>>>>> You want to do the same as what drouting() does with $rU ?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Bogdan-Andrei Iancu
>>>>>
>>>>> OpenSIPS Founder and Developer
>>>>>   https://www.opensips-solutions.com
>>>>>
>>>>> On 4/16/20 6:14 PM, Mark Farmer wrote:
>>>>>
>>>>> Hi everyone
>>>>>
>>>>> I am looking for a way to compare $fU in INVITE to the matching
>>>>> drouting() prefix of another group and retrieve the rule_attrs from that
>>>>> rule.
>>>>>
>>>>> At the moment I am thinking I'll have to run a custom DB query so I
>>>>> have 2 questions:
>>>>>
>>>>> 1. Is there a better way to do this?
>>>>> 2. If not, what is the best way to run custom DB queries?
>>>>>
>>>>> I have been reading through the drouting() documentation but that
>>>>> hasn't helped.
>>>>>
>>>>> OpenSIPS 2.4.7
>>>>>
>>>>> Many thanks!
>>>>> Mark.
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Mark Farmer
>>>> farmorg at gmail.com
>>>>
>>>>
>>>>
>>>
>>> --
>>> Mark Farmer
>>> farmorg at gmail.com
>>>
>>>
>>>
>>
>> --
>> Mark Farmer
>> farmorg at gmail.com
>>
>
>
> --
> Mark Farmer
> farmorg at gmail.com
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

-- 


 <https://www.x-on.co.uk/service/surgery-connect/coronavirus.htm>


*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.










-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200418/24a7ccfd/attachment-0001.html>


More information about the Users mailing list