Re: [asterisk-users] [asterisk-app-dev] ARI Node JS Bridge.addChannel

2019-01-07 Thread Matt Riddell


> On Jan 7, 2019, at 12:25, Joshua C. Colp  wrote:
> 
> On Mon, Jan 7, 2019, at 1:23 PM, Matt Riddell wrote:
>> Hiya,
>> 
>> I would have expected this to show the channels in the bridge inside 
>> the anonymous function - it shows the bridge is empty though?
>> 
>>var bridge = ari.Bridge();
>>bridge.create({
>>type: 'holding',
>>name: event.application+" bridge"
>>}, function(err, bridge) {
>>bridge.addChannel({
>>channel: incoming.id
>>}, function(err) {
>>console.log("Added to bridge")
>>console.log(bridge.channels).   ; 
>> <——— This Line
>>console.log(err);
>>});
>> 
> 
> I believe you are accessing the snapshot, essentially, of the bridge at the 
> time it was created in which case there would be no channels. You would need 
> to retrieve an up to date snapshot to get the current state.

Yeah cool that worked:

ari.bridges.get({bridgeId: bridge.id}, function (err, newBridge) {
console.log("New Bridge: "+newBridge.channels)
});
___
asterisk-app-dev mailing list
asterisk-app-...@lists.digium.com
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] [asterisk-app-dev] ARI Node JS Bridge.addChannel

2019-01-07 Thread Matt Riddell


> On Jan 7, 2019, at 12:25, Joshua C. Colp  wrote:
> 
> On Mon, Jan 7, 2019, at 1:23 PM, Matt Riddell wrote:
>> Hiya,
>> 
>> I would have expected this to show the channels in the bridge inside 
>> the anonymous function - it shows the bridge is empty though?
>> 
>>   var bridge = ari.Bridge();
>>   bridge.create({
>>   type: 'holding',
>>   name: event.application+" bridge"
>>   }, function(err, bridge) {
>>   bridge.addChannel({
>>   channel: incoming.id
>>   }, function(err) {
>>   console.log("Added to bridge")
>>   console.log(bridge.channels).   ; 
>> <——— This Line
>>   console.log(err);
>>   });
>> 
> 
> I believe you are accessing the snapshot, essentially, of the bridge at the 
> time it was created in which case there would be no channels. You would need 
> to retrieve an up to date snapshot to get the current state.

Yeah cool that worked:

ari.bridges.get({bridgeId: bridge.id}, function (err, newBridge) {
console.log("New Bridge: "+newBridge.channels)
});
___
asterisk-app-dev mailing list
asterisk-app-...@lists.digium.com
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] [asterisk-app-dev] ARI Node JS Bridge.addChannel

2019-01-07 Thread Joshua C. Colp
On Mon, Jan 7, 2019, at 1:23 PM, Matt Riddell wrote:
> Hiya,
> 
> I would have expected this to show the channels in the bridge inside 
> the anonymous function - it shows the bridge is empty though?
> 
> var bridge = ari.Bridge();
> bridge.create({
> type: 'holding',
> name: event.application+" bridge"
> }, function(err, bridge) {
> bridge.addChannel({
> channel: incoming.id
> }, function(err) {
> console.log("Added to bridge")
> console.log(bridge.channels).   ; 
> <——— This Line
> console.log(err);
> });
> 

I believe you are accessing the snapshot, essentially, of the bridge at the 
time it was created in which case there would be no channels. You would need to 
retrieve an up to date snapshot to get the current state.

-- 
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org

___
asterisk-app-dev mailing list
asterisk-app-...@lists.digium.com
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] [asterisk-app-dev] ARI Node JS Bridge.addChannel

2019-01-07 Thread Matt Riddell
Hiya,

I would have expected this to show the channels in the bridge inside the 
anonymous function - it shows the bridge is empty though?

var bridge = ari.Bridge();
bridge.create({
type: 'holding',
name: event.application+" bridge"
}, function(err, bridge) {
bridge.addChannel({
channel: incoming.id
}, function(err) {
console.log("Added to bridge")
console.log(bridge.channels).   ; <——— This 
Line
console.log(err);
});

Reason being, I’m creating a queue need to move channels between bridges 
depending on agent/customer status etc

Cheers,

Matt Riddell
___
asterisk-app-dev mailing list
asterisk-app-...@lists.digium.com
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users