Re: [asterisk-dev] Detecting B-leg channels

2021-08-24 Thread Nikša Baldun
The thing is, when attended transfer happens, Asterisk connects 
previously unrelated channels without going to the dialplan. I keep a 
number of variables which help me track call state on both channels, and 
their values become obsolete on attended transfer, as channels are now 
in a completely new call. My idea was to gosub both sides to a dialplan 
context so I can refresh call state variables. But that has proven 
difficult if one of the calls is not answered. I am certain this can't 
be solved by straight dialplan, not without modifying Asterisk code. I 
haven't delved into ARI yet. I'd rather avoid it, unless it is the only 
option.


On 24. 08. 2021. 20:51, Kevin Harwell wrote:
What's the overall scenario you are trying to solve? Perhaps there is 
another way to do what you want to do without even modifying Asterisk 
code? For example, maybe this is something an ARI application could 
handle, or even straight dialplan using a combination of app_dial, 
pre-dial handlers, and such.


On Mon, Aug 23, 2021 at 5:29 AM Nikša Baldun > wrote:


Hello,

I am trying to modify bridge.c (function
ast_bridge_transfer_attended)
in order to send channels involved in SIP attended transfer to the
dialplan. If both transferee and transfer target are bridged, that is
relatively easy. However, if transfer target is ringing, I don't know
how to find B-leg channels (there could be multiple, I suppose).
So the
question is, having a reference to A-leg channel, how to obtain a
list
of B-leg channels?

Best regards,


-- 
_

-- 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] Detecting B-leg channels

2021-08-24 Thread Nikša Baldun
Yes, I suspected as much. I've seen that app_dial keeps a list of 
outbound channels, but doesn't store it anywhere. So that's a dead end, 
pretty much.


On 24. 08. 2021. 20:45, George Joseph wrote:



On Tue, Aug 24, 2021 at 12:20 PM Nikša Baldun > wrote:


I have checked it, and that led me to bridge.c. Perhaps I wasn't
clear enough. These are the channels involved in attended transfer:

(transferee) <> (transferer1) (transferer2) <> (transfer target)

Transferee and transfer target are not readily available in
res_pjsip_refer.c, but I can get them in bridge.c, as long as both
calls are bridged. But transfer target may be in ringing state,
and in that case there is no bridge whose members I can check.
Also, there could be multiple ringing channels. So in that case, I
need a way to get all ringing channels which belong to
transferrer2 channel. I was wondering if there is an existing
method for that, or do I have to devise my own.

The only idea which comes to mind is to iterate over all channels
in the system and compare their LinkedId to transferer2 UniqueId.

Please don't do that. :)

So, Alice (transferee) is on an existing call (channel transferer1), 
she transfers to Bob (transfer target), Asterisk sets up channel 
transferer2 to call Bob and Bob is ringing but hasn't answered yet.  
Right?   Optionally, Alice transfers to a "ring group" which causes 
Asterisk to create multiple outbound channels, correct?    The only 
place I can think of that knows about this is app_dial.


On 24. 08. 2021. 19:38, George Joseph wrote:



On Tue, Aug 24, 2021 at 11:22 AM Nikša Baldun mailto:i...@voxdiversa.hr>> wrote:

Hello,

I am using chan_pjsip.

Check res_pjsip_refer.c  you may be able to intercept both
channels there.

On 24. 08. 2021. 18:55, George Joseph wrote:



On Mon, Aug 23, 2021 at 4:29 AM Nikša Baldun
mailto:i...@voxdiversa.hr>> wrote:

Hello,

I am trying to modify bridge.c (function
ast_bridge_transfer_attended)
in order to send channels involved in SIP attended
transfer to the
dialplan. If both transferee and transfer target are
bridged, that is
relatively easy. However, if transfer target is ringing,
I don't know
how to find B-leg channels (there could be multiple, I
suppose). So the
question is, having a reference to A-leg channel, how to
obtain a list
of B-leg channels?

Best regards,


Which channel driver are you using?


-- 
_

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



-- 
_

-- 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] Detecting B-leg channels

2021-08-24 Thread Nikša Baldun
I have checked it, and that led me to bridge.c. Perhaps I wasn't clear 
enough. These are the channels involved in attended transfer:


(transferee) <> (transferer1) (transferer2) <> (transfer target)

Transferee and transfer target are not readily available in 
res_pjsip_refer.c, but I can get them in bridge.c, as long as both calls 
are bridged. But transfer target may be in ringing state, and in that 
case there is no bridge whose members I can check. Also, there could be 
multiple ringing channels. So in that case, I need a way to get all 
ringing channels which belong to transferrer2 channel. I was wondering 
if there is an existing method for that, or do I have to devise my own. 
The only idea which comes to mind is to iterate over all channels in the 
system and compare their LinkedId to transferer2 UniqueId.


On 24. 08. 2021. 19:38, George Joseph wrote:



On Tue, Aug 24, 2021 at 11:22 AM Nikša Baldun > wrote:


Hello,

I am using chan_pjsip.

Check res_pjsip_refer.c  you may be able to intercept both channels there.

On 24. 08. 2021. 18:55, George Joseph wrote:



On Mon, Aug 23, 2021 at 4:29 AM Nikša Baldun mailto:i...@voxdiversa.hr>> wrote:

Hello,

I am trying to modify bridge.c (function
ast_bridge_transfer_attended)
in order to send channels involved in SIP attended transfer
to the
dialplan. If both transferee and transfer target are bridged,
that is
relatively easy. However, if transfer target is ringing, I
don't know
how to find B-leg channels (there could be multiple, I
suppose). So the
question is, having a reference to A-leg channel, how to
obtain a list
of B-leg channels?

Best regards,


Which channel driver are you using?


-- 
_

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



-- 
_
-- 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] Detecting B-leg channels

2021-08-24 Thread Nikša Baldun

Hello,

I am using chan_pjsip.

On 24. 08. 2021. 18:55, George Joseph wrote:



On Mon, Aug 23, 2021 at 4:29 AM Nikša Baldun > wrote:


Hello,

I am trying to modify bridge.c (function
ast_bridge_transfer_attended)
in order to send channels involved in SIP attended transfer to the
dialplan. If both transferee and transfer target are bridged, that is
relatively easy. However, if transfer target is ringing, I don't know
how to find B-leg channels (there could be multiple, I suppose).
So the
question is, having a reference to A-leg channel, how to obtain a
list
of B-leg channels?

Best regards,


Which channel driver are you using?


-- 
_

-- 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] Detecting B-leg channels

2021-08-24 Thread George Joseph
On Tue, Aug 24, 2021 at 1:27 PM Nikša Baldun  wrote:

> The thing is, when attended transfer happens, Asterisk connects previously
> unrelated channels without going to the dialplan. I keep a number of
> variables which help me track call state on both channels, and their values
> become obsolete on attended transfer, as channels are now in a completely
> new call. My idea was to gosub both sides to a dialplan context so I can
> refresh call state variables. But that has proven difficult if one of the
> calls is not answered. I am certain this can't be solved by straight
> dialplan, not without modifying Asterisk code. I haven't delved into ARI
> yet. I'd rather avoid it, unless it is the only option.
>
I'm not sure this would work for you but ...  Have app_dial create a
channel variable on the incoming channel that has the list of channels
being dialed.

You  could also use the DB functions to store key value pairs and have
pre-dial-handlers on the outgoing channels store their IDs there keyed by
the incoming channel.




> On 24. 08. 2021. 20:51, Kevin Harwell wrote:
>
> What's the overall scenario you are trying to solve? Perhaps there is
> another way to do what you want to do without even modifying Asterisk code?
> For example, maybe this is something an ARI application could handle, or
> even straight dialplan using a combination of app_dial, pre-dial handlers,
> and such.
>
> On Mon, Aug 23, 2021 at 5:29 AM Nikša Baldun  wrote:
>
>> Hello,
>>
>> I am trying to modify bridge.c (function ast_bridge_transfer_attended)
>> in order to send channels involved in SIP attended transfer to the
>> dialplan. If both transferee and transfer target are bridged, that is
>> relatively easy. However, if transfer target is ringing, I don't know
>> how to find B-leg channels (there could be multiple, I suppose). So the
>> question is, having a reference to A-leg channel, how to obtain a list
>> of B-leg channels?
>>
>> Best regards,
>>
>>
>> --
>> _
>> -- 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
-- 
_
-- 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] Detecting B-leg channels

2021-08-24 Thread Kevin Harwell
What's the overall scenario you are trying to solve? Perhaps there is
another way to do what you want to do without even modifying Asterisk code?
For example, maybe this is something an ARI application could handle, or
even straight dialplan using a combination of app_dial, pre-dial handlers,
and such.

On Mon, Aug 23, 2021 at 5:29 AM Nikša Baldun  wrote:

> Hello,
>
> I am trying to modify bridge.c (function ast_bridge_transfer_attended)
> in order to send channels involved in SIP attended transfer to the
> dialplan. If both transferee and transfer target are bridged, that is
> relatively easy. However, if transfer target is ringing, I don't know
> how to find B-leg channels (there could be multiple, I suppose). So the
> question is, having a reference to A-leg channel, how to obtain a list
> of B-leg channels?
>
> Best regards,
>
>
> --
> _
> -- 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] Detecting B-leg channels

2021-08-24 Thread George Joseph
On Tue, Aug 24, 2021 at 12:20 PM Nikša Baldun  wrote:

> I have checked it, and that led me to bridge.c. Perhaps I wasn't clear
> enough. These are the channels involved in attended transfer:
>
> (transferee) <> (transferer1) (transferer2) <> (transfer target)
>
> Transferee and transfer target are not readily available in
> res_pjsip_refer.c, but I can get them in bridge.c, as long as both calls
> are bridged. But transfer target may be in ringing state, and in that case
> there is no bridge whose members I can check. Also, there could be multiple
> ringing channels. So in that case, I need a way to get all ringing channels
> which belong to transferrer2 channel. I was wondering if there is an
> existing method for that, or do I have to devise my own.
>
The only idea which comes to mind is to iterate over all channels in the
> system and compare their LinkedId to transferer2 UniqueId.
>
Please don't do that. :)

So, Alice (transferee) is on an existing call (channel transferer1), she
transfers to Bob (transfer target), Asterisk sets up channel transferer2 to
call Bob and Bob is ringing but hasn't answered yet.  Right?   Optionally,
Alice transfers to a "ring group" which causes Asterisk to create multiple
outbound channels, correct?The only place I can think of that knows
about this is app_dial.



> On 24. 08. 2021. 19:38, George Joseph wrote:
>
>
>
> On Tue, Aug 24, 2021 at 11:22 AM Nikša Baldun  wrote:
>
>> Hello,
>>
>> I am using chan_pjsip.
>>
> Check res_pjsip_refer.c  you may be able to intercept both channels there.
>
>
>
>> On 24. 08. 2021. 18:55, George Joseph wrote:
>>
>>
>>
>> On Mon, Aug 23, 2021 at 4:29 AM Nikša Baldun  wrote:
>>
>>> Hello,
>>>
>>> I am trying to modify bridge.c (function ast_bridge_transfer_attended)
>>> in order to send channels involved in SIP attended transfer to the
>>> dialplan. If both transferee and transfer target are bridged, that is
>>> relatively easy. However, if transfer target is ringing, I don't know
>>> how to find B-leg channels (there could be multiple, I suppose). So the
>>> question is, having a reference to A-leg channel, how to obtain a list
>>> of B-leg channels?
>>>
>>> Best regards,
>>>
>>>
>> Which channel driver are you using?
>>
>>
>>
>>>
>>> --
>>> _
>>> -- 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
>
>
> --
> _
> -- 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] Detecting B-leg channels

2021-08-24 Thread George Joseph
On Tue, Aug 24, 2021 at 11:22 AM Nikša Baldun  wrote:

> Hello,
>
> I am using chan_pjsip.
>
Check res_pjsip_refer.c  you may be able to intercept both channels there.



> On 24. 08. 2021. 18:55, George Joseph wrote:
>
>
>
> On Mon, Aug 23, 2021 at 4:29 AM Nikša Baldun  wrote:
>
>> Hello,
>>
>> I am trying to modify bridge.c (function ast_bridge_transfer_attended)
>> in order to send channels involved in SIP attended transfer to the
>> dialplan. If both transferee and transfer target are bridged, that is
>> relatively easy. However, if transfer target is ringing, I don't know
>> how to find B-leg channels (there could be multiple, I suppose). So the
>> question is, having a reference to A-leg channel, how to obtain a list
>> of B-leg channels?
>>
>> Best regards,
>>
>>
> Which channel driver are you using?
>
>
>
>>
>> --
>> _
>> -- 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
-- 
_
-- 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] Detecting B-leg channels

2021-08-24 Thread George Joseph
On Mon, Aug 23, 2021 at 4:29 AM Nikša Baldun  wrote:

> Hello,
>
> I am trying to modify bridge.c (function ast_bridge_transfer_attended)
> in order to send channels involved in SIP attended transfer to the
> dialplan. If both transferee and transfer target are bridged, that is
> relatively easy. However, if transfer target is ringing, I don't know
> how to find B-leg channels (there could be multiple, I suppose). So the
> question is, having a reference to A-leg channel, how to obtain a list
> of B-leg channels?
>
> Best regards,
>
>
Which channel driver are you using?



>
> --
> _
> -- 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