[OpenSIPS-Users] ACC module with JSON events

SamyGo govoiper at gmail.com
Sun Feb 25 13:14:35 EST 2018


Hi Jarrod,
So I see that you're creating your own CDR like variables, exactly what I
want to avoid, how about call duration?
I want to avoid manual intervention and the way I'm thinking is that it'll
be "event_JSONRPC" job to fetch params from E_ACC_CDR and sent a JSON out.
Simple.

Thanks for your help, much appreciated.

Regards,
Sammy


On Fri, Feb 23, 2018 at 11:01 PM, Jarrod Baumann <jarrod at unixc.org> wrote:

> modparam("acc", "evi_extra", "json=$avp(json_acc)")
>
> startup_route {
>   if (!subscribe_event("E_ACC_CDR", "rabbitmq:user:pass at host/queue")) {
>     xlog("L_ERR","Cannot subscribe RabbitMQ to E_ACC_CDR\n");
>   }
> }
>
> route["set_acc_variables"] {
>   $json(acc) := "{}";
>   $json(acc/from_user)      = $avp(ani);
>   $json(acc/to_user)        = $avp(dnis);
>   ...
>   $avp(json_acc)            = $json(acc); #deserialize for raising the
> event
> }
>
> Obviously there are other parameters involved for the acc module but this
> should provide the gist for using aqmp or any other method you want once
> you deserialize the json object.  You can catch this in a worker and
> serialize it to json using any language you want.
>
> On Friday, February 23, 2018, SamyGo <govoiper at gmail.com> wrote:
>
>> Thanks Razvan, will open a feature request.
>> Jarrod Can you elaborate the steps involved please?
>>
>> So, I don't have anything against XML right now but my XML receiver side
>> is a bit of difficulty in terms of parsing the XML structure (Its done but
>> not in a way I like it) - JSON will make it far easier.
>>
>> Regards,
>> Sammy
>>
>> On Fri, Feb 23, 2018 at 10:49 AM, Jarrod Baumann <jarrod at unixc.org>
>> wrote:
>>
>>> I build the JSON data with cdr and convert to a string for throwing
>>> events. Then whatever collects your CDR can serialize it again. This works
>>> well and is probably similar to what XML is doing.
>>>
>>> On Thu, Feb 22, 2018 at 10:14 PM SamyGo <govoiper at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm using ACC module to trigger accounting events which land up in
>>>> event_xmlrpc and ultimately shipped to remote CDR collection server. The
>>>> sent data is obviously an XML - now, can I have an event_json like module
>>>> so data is sent as JSON or is there any other way I can achieve the same ?
>>>>
>>>> Regards
>>>> Sammy
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20180225/debe794c/attachment.html>


More information about the Users mailing list