Re: [asterisk-dev] Running channels through dialplan on attended transfer
On Thu, Mar 2, 2023 at 7:04 AM Nikša Baldun wrote: > I understand, but autoservice and AGI wouldn't be running on the same > channel at the same time. And I assume that once the transfer is completed, > original AGI call will be terminated. If I am wrong in that assumption, > then I am in trouble. > > It should be noted that, while you say that AGI can't run twice on the > same channel, the the second AGI call does go through and everything works > as intended. I am just worried that this will cause some problem down the > line, and I would like to avoid the debug message. > While it works you are in undefined may or may not work or continue to work territory, as it violates a fundamental aspect of things - so you do indeed need to ensure two threads are not servicing the same channel at the same time. -- Joshua C. Colp Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com and www.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] Running channels through dialplan on attended transfer
I understand, but autoservice and AGI wouldn't be running on the same channel at the same time. And I assume that once the transfer is completed, original AGI call will be terminated. If I am wrong in that assumption, then I am in trouble. It should be noted that, while you say that AGI can't run twice on the same channel, the the second AGI call does go through and everything works as intended. I am just worried that this will cause some problem down the line, and I would like to avoid the debug message. Regards, On Thursday, 02. March 2023. 10:57:23 (+01:00), Joshua C. Colp wrote: On Thu, Mar 2, 2023 at 5:50 AM Nikša Baldun wrote: Hi Joshua, thanks for the answer. Meanwhile, I've found that the debug message about competing threads happens because I am using Fast AGI, and two threads call AGI from the same channel. I assume this could potentially be resolved if I call ast_app_exec_sub AFTER the attended transfer has already been completed (and, based on your input, autoservice should be used). This is trickier to implement, but I'll try. Fundamentally two threads can't service the same channel at the same time. So autoservice and AGI can't run on the same channel at the same time, just like AGI can't run twice on the same channel at the same time. It's the equivalent of having two people tell you what to do at the same time. -- Joshua C. Colp Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com and www.asterisk.org -- Nikša Baldun VoxDiversa Sjedište: IX Trokut 1 10020 Zagreb Ured: Ilica 425 10090 Zagreb Tel.: +385 1 8000676 Web: www.voxdiversa.hr-- _ -- 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] Running channels through dialplan on attended transfer
On Thu, Mar 2, 2023 at 5:50 AM Nikša Baldun wrote: > Hi Joshua, > > thanks for the answer. Meanwhile, I've found that the debug message about > competing threads happens because I am using Fast AGI, and two threads call > AGI from the same channel. I assume this could potentially be resolved if I > call ast_app_exec_sub AFTER the attended transfer has already been > completed (and, based on your input, autoservice should be used). This is > trickier to implement, but I'll try. > Fundamentally two threads can't service the same channel at the same time. So autoservice and AGI can't run on the same channel at the same time, just like AGI can't run twice on the same channel at the same time. It's the equivalent of having two people tell you what to do at the same time. -- Joshua C. Colp Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com and www.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] Running channels through dialplan on attended transfer
Hi Joshua, thanks for the answer. Meanwhile, I've found that the debug message about competing threads happens because I am using Fast AGI, and two threads call AGI from the same channel. I assume this could potentially be resolved if I call ast_app_exec_sub AFTER the attended transfer has already been completed (and, based on your input, autoservice should be used). This is trickier to implement, but I'll try. Best regards, On Tuesday, 28. February 2023. 14:44:25 (+01:00), Joshua C. Colp wrote: On Tue, Feb 28, 2023 at 9:35 AM Nikša Baldun wrote: Hello, information available on channels involved in attended transfer is inadequate for my purposes, so I have created a function which sets some variables on these channels, and also runs transferee and transfer target through dialplan. It works, but I am unsure that I did it correctly. Two specific questions of note: 1. Do I have to lock channels before setting variables? I've seen it done in many places, but if I do, I get debug messages like: "Thread LWP 822 is blocking 'PJSIP/444-004b', already blocked by thread LWP 6204 in procedure ast_waitfor_nandfds". The pbx_builtin_setvar_helper function locks the channels underneath. 2. Do I have to set autoservice_chan parameter in ast_app_exec_sub? I don't know what autoservice is. You don't HAVE to. Autoservice is used when you want to run a potentially long running operation and still properly service (handle received audio, discarding it, amongst things) the channel. Not servicing the channel means stuff would just back up. The parameter exists for cases where 2 channels are being handled by the thread - one should execute the Gosub, one should go to autoservice to be handled. The function follows (I call it from two_bridge_attended_transfer and ast_bridge_transfer_attended functions). I can't comment on code through this mechanism, someone else may be able to. -- Joshua C. Colp Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com and www.asterisk.org -- Nikša Baldun VoxDiversa Sjedište: IX Trokut 1 10020 Zagreb Ured: Ilica 425 10090 Zagreb Tel.: +385 1 8000676 Web: www.voxdiversa.hr-- _ -- 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] Running channels through dialplan on attended transfer
On Tue, Feb 28, 2023 at 9:35 AM Nikša Baldun wrote: > Hello, > > information available on channels involved in attended transfer is > inadequate for my purposes, so I have created a function which sets some > variables on these channels, and also runs transferee and transfer target > through dialplan. It works, but I am unsure that I did it correctly. Two > specific questions of note: > > 1. Do I have to lock channels before setting variables? I've seen it done > in many places, but if I do, I get debug messages like: "Thread LWP 822 is > blocking 'PJSIP/444-004b', already blocked by thread LWP 6204 in > procedure ast_waitfor_nandfds". > The pbx_builtin_setvar_helper function locks the channels underneath. > > 2. Do I have to set autoservice_chan parameter in ast_app_exec_sub? I > don't know what autoservice is. > You don't HAVE to. Autoservice is used when you want to run a potentially long running operation and still properly service (handle received audio, discarding it, amongst things) the channel. Not servicing the channel means stuff would just back up. The parameter exists for cases where 2 channels are being handled by the thread - one should execute the Gosub, one should go to autoservice to be handled. > > The function follows (I call it from two_bridge_attended_transfer and > ast_bridge_transfer_attended functions). > I can't comment on code through this mechanism, someone else may be able to. -- Joshua C. Colp Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com and www.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