Re: [asterisk-dev] Help with AOC (Advice Of Charge) - price info on outbound calls
Thanks Matthew, now it is clear to me. Currently we (me and my colleagues) don't have time for creating a patch, but hopefully one day in near future we'll provide it. Marin Odrljin maxcom d.o.o. Croatia > Unfortunately, AOC events don't have a JSON representation and aren't > published to a Stasis topic that goes to ARI applications. > > In aoc_publish_blob, you can see that we only publish the various AOC > events to the Manager topic (via ast_manager_get_topic): > > msg = stasis_message_create(msg_type, aoc_event); > ao2_ref(aoc_event, -1); > > stasis_publish(ast_manager_get_topic(), msg); > > That pretty much limits AOC events to AMI today. > > If you wanted this in ARI, you could pretty easily provide a patch to > do so. You'd need to: > > * Change the topic that the messages are published to one that is > received by ARI. Assuming there is a channel involved, the easiest of > these is the channel topic. If there is no channel, you could publish > it to the generic 'all channels' topic. (Not all AOC events have a > channel, so you'd need to make sure it goes to some topic that makes > sense when that's the case.) > > * Provide a JSON representation of the message. That means defining a > .to_json callback here which formats the message into JSON: > > STASIS_MESSAGE_TYPE_DEFN( > aoc_s_type, > .to_ami = aoc_s_to_ami); > > STASIS_MESSAGE_TYPE_DEFN( > aoc_d_type, > .to_ami = aoc_d_to_ami); > > STASIS_MESSAGE_TYPE_DEFN( > aoc_e_type, > .to_ami = aoc_e_to_ami); > > * Add the JSON representation of the message to the Swagger > specification (events.json) so that things get validated correctly. > > > For what it's worth, the data models wiki page shows the various > events that can be received: > > https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+REST+Data+Models > > -- > Matthew Jordan > Digium, Inc. | CTO > 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA > Check us out at: http://digium.com & http://asterisk.org > > -- > __ > ___ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-dev mailing list > To UNSUBSCRIBE or update options visit: >http://lists.digium.com/mailman/listinfo/asterisk-dev -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] Help with AOC (Advice Of Charge) - price info on outbound calls
On Wed, Nov 22, 2017 at 2:46 AM, Marin Odrljinwrote: > > Yes, that’s the way my app works all the time, there is no any AOC event sent > to ARI. I was also expecting such events are sent to Stasis since I have > found in ‘stasis.conf’ possibility to decline them: > > > > ; decline=aoc_s_type > > ; decline=aoc_d_type > > ; decline=aoc_e_type > > > > Other configuration files where AOC is mentioned are: > > - ‘manager.conf’ for AMI which probably works, but I didn’t try it > till now and would like to avoid it if possible > > - ‘chan-dahdi.conf’ where I have enabled them > > - ‘sip.conf’ for snom endpoints which I don’t need > > Unfortunately, AOC events don't have a JSON representation and aren't published to a Stasis topic that goes to ARI applications. In aoc_publish_blob, you can see that we only publish the various AOC events to the Manager topic (via ast_manager_get_topic): msg = stasis_message_create(msg_type, aoc_event); ao2_ref(aoc_event, -1); stasis_publish(ast_manager_get_topic(), msg); That pretty much limits AOC events to AMI today. If you wanted this in ARI, you could pretty easily provide a patch to do so. You'd need to: * Change the topic that the messages are published to one that is received by ARI. Assuming there is a channel involved, the easiest of these is the channel topic. If there is no channel, you could publish it to the generic 'all channels' topic. (Not all AOC events have a channel, so you'd need to make sure it goes to some topic that makes sense when that's the case.) * Provide a JSON representation of the message. That means defining a .to_json callback here which formats the message into JSON: STASIS_MESSAGE_TYPE_DEFN( aoc_s_type, .to_ami = aoc_s_to_ami); STASIS_MESSAGE_TYPE_DEFN( aoc_d_type, .to_ami = aoc_d_to_ami); STASIS_MESSAGE_TYPE_DEFN( aoc_e_type, .to_ami = aoc_e_to_ami); * Add the JSON representation of the message to the Swagger specification (events.json) so that things get validated correctly. For what it's worth, the data models wiki page shows the various events that can be received: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+REST+Data+Models -- Matthew Jordan Digium, Inc. | CTO 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at: http://digium.com & http://asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] Help with AOC (Advice Of Charge) - price info on outbound calls
Yes, that’s the way my app works all the time, there is no any AOC event sent to ARI. I was also expecting such events are sent to Stasis since I have found in ‘stasis.conf’ possibility to decline them: ; decline=aoc_s_type ; decline=aoc_d_type ; decline=aoc_e_type Other configuration files where AOC is mentioned are: - ‘manager.conf’ for AMI which probably works, but I didn’t try it till now and would like to avoid it if possible - ‘chan-dahdi.conf’ where I have enabled them - ‘sip.conf’ for snom endpoints which I don’t need Have you tried the subscribe to all events[1] option in ARI? If not give that a try and see if the event(s) show up. [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Events+REST+API -- Kevin Harwell Digium, Inc. | Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at: http://digium.com & http://asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] Help with AOC (Advice Of Charge) - price info on outbound calls
On Mon, Nov 20, 2017 at 8:51 AM, Marin Odrljinwrote: > Hi everybody, > > > > I have already asked this question on 'asterisk-app-dev' list and on > community site https://community.asterisk.org/t/get-aoc-information-via- > ari/72532 but unfortunatelly there was no any reply in last few weeks, so > my last chance is to hope that anyone from this list could know anything > about AOC. Sorry if someone of you have already seen it there and I'm too > boring with it. > > > > On some of our ISDN trunks at the end of the outbound calls, we are > getting pricing info from the carrier. I would like to read it with ARI. > From the AOC documentation (https://wiki.asterisk.org/ > wiki/display/AST/Advice+of+Charge) it seems like it is possible to get it > only via AMI only or am I wrong? Does anyone has an idea if it could be > read somehow else except AMI, e.g. channel variables which can be passed to > or read via ARI? If I already use ARI, I wouldn’t like to connect to AMI as > well just because of getting AOC. > > > > If that's not possible, what would be the best way to implement it? > > > > > > Thanks for any suggestion. > > Marin > Have you tried the subscribe to all events[1] option in ARI? If not give that a try and see if the event(s) show up. [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Events+REST+API -- Kevin Harwell Digium, Inc. | Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at: http://digium.com & http://asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev