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
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
[asterisk-dev] Running channels through dialplan on attended transfer
pbx_builtin_setvar_helper(b_channel, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(b_channel, ATTENDEDTRANSFERER2, to_transfer_target_name); ast_channel_unlock(b_channel); ast_app_exec_sub(NULL, b_channel, "attended_target_connect,s,1", 1); ast_channel_unref(b_channel); } } } } return 0; } -- Nikša Baldun Vox Diversa 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
[asterisk-dev] Test
Sorry for spamming, but my messages are not getting through to the list so I am testing with a simple email. -- _ -- 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
[asterisk-dev] Running channels through dialplan on attended transfer
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". 2. Do I have to set autoservice_chan parameter in ast_app_exec_sub? I don't know what autoservice is. The function follows (I call it from two_bridge_attended_transfer and ast_bridge_transfer_attended functions). /*! * \internal * \brief Set variables on channels involved in attended transfer and run them through dialplan. * * \param to_transferee The channel that is bridged to the transferee * \param to_transfer_target The channel that dialed the transfer target(s) * \param transferee_channels A two-channel container containing the transferer and transferee * \param to_target_bridge The bridge between to_transfer_target and the transfer_target (NULL if transfer_target did not answer yet) * * \retval 0 on success. * \retval -1 on error. */ static int ast_bridge_transfer_attended_to_dialplan(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target, struct ao2_container *transferee_channels, struct ast_bridge *to_target_bridge) { RAII_VAR(struct ao2_container *, target_channels, NULL, ao2_cleanup); RAII_VAR(struct ast_channel *, transferee, NULL, ao2_cleanup); RAII_VAR(struct ast_channel *, transfer_target, NULL, ao2_cleanup); const char *to_transferee_name; const char *to_transfer_target_name; const char *transferee_name; const char *dialed_channels; transferee = get_transferee(transferee_channels, to_transferee); if (!transferee) return -1; if (to_target_bridge) { target_channels = ast_bridge_peers_nolock(to_target_bridge); if (!target_channels) return -1; transfer_target = get_transferee(target_channels, to_transfer_target); } else { transfer_target = NULL; } to_transferee_name = ast_strdupa(ast_channel_name(to_transferee)); to_transfer_target_name = ast_strdupa(ast_channel_name(to_transfer_target)); transferee_name = ast_strdupa(ast_channel_name(transferee)); dialed_channels = pbx_builtin_getvar_helper(to_transfer_target, "DIALEDCHANNELS"); pbx_builtin_setvar_helper(to_transferee, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(to_transferee, ATTENDEDTRANSFERER2, to_transfer_target_name); pbx_builtin_setvar_helper(to_transfer_target, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(to_transfer_target, ATTENDEDTRANSFERER2, to_transfer_target_name); pbx_builtin_setvar_helper(transferee, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(transferee, ATTENDEDTRANSFERER2, to_transfer_target_name); ast_app_exec_sub(NULL, transferee, "attended_transferee_connect,s,1", 0); if (transfer_target) { pbx_builtin_setvar_helper(transfer_target, ATTENDEDTRANSFEREE, transferee_name); pbx_builtin_setvar_helper(transfer_target, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(transfer_target, ATTENDEDTRANSFERER2, to_transfer_target_name); ast_app_exec_sub(NULL, transfer_target, "attended_target_connect,s,1", 0); } else { if (!ast_strlen_zero(dialed_channels)) { char *b_channel_names = ast_strdupa(dialed_channels); char *b_channel_name; while ((b_channel_name = strtok_r(b_channel_names, " ", _channel_names))) { struct ast_channel *b_channel = ast_channel_get_by_name(b_channel_name); if (b_channel) { pbx_builtin_setvar_helper(b_channel, ATTENDEDTRANSFEREE, transferee_name); pbx_builtin_setvar_helper(b_channel, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(b_channel, ATTENDEDTRANSFERER2, to_transfer_target_name); ast_app_exec_sub(NULL, b_channel, "attended_target_connect,s,1", 0); ast_channel_unref(b_channel); } } } } return 0; } -- Nikša Baldun -- _ -- 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
[asterisk-dev] Running channels through dialplan on attended transfer
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". 2. Do I have to set autoservice_chan parameter in ast_app_exec_sub? I don't know what autoservice is. The function follows (I call it from two_bridge_attended_transfer and ast_bridge_transfer_attended functions). /*! * \internal * \brief Set variables on channels involved in attended transfer and run them through dialplan. * * \param to_transferee The channel that is bridged to the transferee * \param to_transfer_target The channel that dialed the transfer target(s) * \param transferee_channels A two-channel container containing the transferer and transferee * \param to_target_bridge The bridge between to_transfer_target and the transfer_target (NULL if transfer_target did not answer yet) * * \retval 0 on success. * \retval -1 on error. */ static int ast_bridge_transfer_attended_to_dialplan(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target, struct ao2_container *transferee_channels, struct ast_bridge *to_target_bridge) { RAII_VAR(struct ao2_container *, target_channels, NULL, ao2_cleanup); RAII_VAR(struct ast_channel *, transferee, NULL, ao2_cleanup); RAII_VAR(struct ast_channel *, transfer_target, NULL, ao2_cleanup); const char *to_transferee_name; const char *to_transfer_target_name; const char *transferee_name; const char *dialed_channels; transferee = get_transferee(transferee_channels, to_transferee); if (!transferee) return -1; if (to_target_bridge) { target_channels = ast_bridge_peers_nolock(to_target_bridge); if (!target_channels) return -1; transfer_target = get_transferee(target_channels, to_transfer_target); } else { transfer_target = NULL; } to_transferee_name = ast_strdupa(ast_channel_name(to_transferee)); to_transfer_target_name = ast_strdupa(ast_channel_name(to_transfer_target)); transferee_name = ast_strdupa(ast_channel_name(transferee)); dialed_channels = pbx_builtin_getvar_helper(to_transfer_target, "DIALEDCHANNELS"); pbx_builtin_setvar_helper(to_transferee, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(to_transferee, ATTENDEDTRANSFERER2, to_transfer_target_name); pbx_builtin_setvar_helper(to_transfer_target, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(to_transfer_target, ATTENDEDTRANSFERER2, to_transfer_target_name); pbx_builtin_setvar_helper(transferee, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(transferee, ATTENDEDTRANSFERER2, to_transfer_target_name); ast_app_exec_sub(NULL, transferee, "attended_transferee_connect,s,1", 0); if (transfer_target) { pbx_builtin_setvar_helper(transfer_target, ATTENDEDTRANSFEREE, transferee_name); pbx_builtin_setvar_helper(transfer_target, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(transfer_target, ATTENDEDTRANSFERER2, to_transfer_target_name); ast_app_exec_sub(NULL, transfer_target, "attended_target_connect,s,1", 0); } else { if (!ast_strlen_zero(dialed_channels)) { char *b_channel_names = ast_strdupa(dialed_channels); char *b_channel_name; while ((b_channel_name = strtok_r(b_channel_names, " ", _channel_names))) { struct ast_channel *b_channel = ast_channel_get_by_name(b_channel_name); if (b_channel) { pbx_builtin_setvar_helper(b_channel, ATTENDEDTRANSFEREE, transferee_name); pbx_builtin_setvar_helper(b_channel, ATTENDEDTRANSFERER1, to_transferee_name); pbx_builtin_setvar_helper(b_channel, ATTENDEDTRANSFERER2, to_transfer_target_name); ast_app_exec_sub(NULL, b_channel, "attended_target_connect,s,1", 0); ast_channel_unref(b_channel); } }
Re: [asterisk-dev] SIP subscription with expires=0
According to the RFC, yes: In addition to being a request to unsubscribe, a SUBSCRIBE message with "Expires" of 0 also causes a fetch of state; see section 3.3.6. I'll report a bug. Thanks for your reply. On 25. 10. 2021. 09:25, Olle E. Johansson wrote: A subscription with expire:0 should get at least ONE notify, right? I’ve just that to check the status without setting up a dialog. It is not invalid. Report this as a bug. /O 25 okt. 2021 kl. 09:22 skrev Nikša Baldun : Hello, I see the following in res_pjsip_pubsub.c: if (expires_header->ivalue == 0) { ast_debug(1, "Subscription request from endpoint %s rejected. Expiration of 0 is invalid\n", ast_sorcery_object_get_id(endpoint)); pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 400, NULL, NULL, NULL); return PJ_TRUE; } However, according to RFC 2365, value 0 is perfectly valid, and should have the effect of ending the subscription. A natural consequence of this scheme is that a SUBSCRIBE with an "Expires" of 0 constitutes a request to unsubscribe from an event. Or is my understanding wrong? Is there some other way to unsubscribe? Best regards, Nik -- _ -- 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
[asterisk-dev] SIP subscription with expires=0
Hello, I see the following in res_pjsip_pubsub.c: if (expires_header->ivalue == 0) { ast_debug(1, "Subscription request from endpoint %s rejected. Expiration of 0 is invalid\n", ast_sorcery_object_get_id(endpoint)); pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 400, NULL, NULL, NULL); return PJ_TRUE; } However, according to RFC 2365, value 0 is perfectly valid, and should have the effect of ending the subscription. A natural consequence of this scheme is that a SUBSCRIBE with an "Expires" of 0 constitutes a request to unsubscribe from an event. Or is my understanding wrong? Is there some other way to unsubscribe? Best regards, Nik -- _ -- 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
[asterisk-dev] A question about attended transfers
Hello, I am writing a patch which allows running channels involved in attended transfer through dialplan. (transferee) <-> (to_transferee)(to_transfer_target) <-> (transfer_target(s)) Am I correct in the following assumptions: - When attended transfer is executed, "to_transferee" channel is going to be hung up and forgotten about - The "transferee" channel is going to be masqueraded into "to_transfer_target" channel. So there is no point in running "transferee" channel through dialplan, because it will inherit properties of "to_transfer_target" channel. I am unsure what exactly happens on masquerade. Are all channel properties transferred, like dynamic features, call and pickup groups, volume etc? Best regards, Nik -- _ -- 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
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 <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, -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <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
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 <mailto:i...@voxdiversa.hr>> 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 <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <http://lists.digium.com/mailman/listinfo/asterisk-dev> -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <http://lists.digium.com/mailman/listinfo/asterisk-dev> -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <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
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 <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 <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <http://lists.digium.com/mailman/listinfo/asterisk-dev> -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <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
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 <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 <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <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
[asterisk-dev] Detecting B-leg channels
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
Re: [asterisk-dev] ODBC and commas
OK, false alarm (sort of). I am using AEL, which apparently always wraps the right side of assignment in $[], which messes things up. This doesn't work with commas in db field: HASH(result)="${ODBC_FETCH(${odbc_id})}"; but this does: Set(HASH(result)=${ODBC_FETCH(${odbc_id})}); It seems that AEL native syntax can't be used with ODBC_FETCH. Perhaps this helps someone in the future. On 15. 08. 2021. 16:06, Nikša Baldun wrote: Tried QUOTE() where? I don't see where it can be applied. On 15. 08. 2021. 09:29, Dennis Buteyn wrote: On 8/13/21 9:51 AM, Nikša Baldun wrote: Hello, does anyone know, what is the recommended way to handle commas with func_odbc? There is a parameter “escapecommas” in func_odbc.conf, but regardless of its value, having a comma in DB field breaks ODBC_FETCH function. The text after the comma is assigned to the next field instead of the current one. Best regards. Have you tried QUOTE()? -- Dennis Buteyn Xorcom Ltd -- _ -- 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] ODBC and commas
Tried QUOTE() where? I don't see where it can be applied. On 15. 08. 2021. 09:29, Dennis Buteyn wrote: On 8/13/21 9:51 AM, Nikša Baldun wrote: Hello, does anyone know, what is the recommended way to handle commas with func_odbc? There is a parameter “escapecommas” in func_odbc.conf, but regardless of its value, having a comma in DB field breaks ODBC_FETCH function. The text after the comma is assigned to the next field instead of the current one. Best regards. Have you tried QUOTE()? -- Dennis Buteyn Xorcom Ltd -- _ -- 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
[asterisk-dev] ODBC and commas
Hello, does anyone know, what is the recommended way to handle commas with func_odbc? There is a parameter “escapecommas” in func_odbc.conf, but regardless of its value, having a comma in DB field breaks ODBC_FETCH function. The text after the comma is assigned to the next field instead of the current one. 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
Re: [asterisk-dev] Missing queue dialplan functions
Not having received any input on this, and being pressed for time, I went for the simplest route and modified QUEUE_MEMBER. I'll submit the patch when I find the time. Meanwhile, it is available on request. Nik On 14. 02. 2021. 09:16, Nikša Baldun wrote: How would AGI help one to get this information, apart from parsing text output and log files? On 14. 02. 2021. 07:52, JP Loh wrote: Is AGI not an option? On Sun, Feb 14, 2021 at 1:44 AM Nikša Baldun <mailto:i...@voxdiversa.hr>> wrote: Hello, there is currently no way (AFAIK) to get a list of all queues from dialplan, and also no way to get a pause reason for a member. I am going to add a couple of dialplan functions for that. The first one should obviously be called QUEUE_LIST and accept no parameters. For the second one, I am not sure whether it would be better to add a new function or modify QUEUE_MEMBER. I am leaning towards new function, because I would like to get both pause status and reason in one function call, and also I would like to make the queuename parameter optional. So perhaps QUEUE_PAUSE_STATUS([queuename],interface) which returns ,. The alternative is to add new option to QUEUE_MEMBER (called "pause_reason" or similar). Nik -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <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] Missing queue dialplan functions
How would AGI help one to get this information, apart from parsing text output and log files? On 14. 02. 2021. 07:52, JP Loh wrote: Is AGI not an option? On Sun, Feb 14, 2021 at 1:44 AM Nikša Baldun <mailto:i...@voxdiversa.hr>> wrote: Hello, there is currently no way (AFAIK) to get a list of all queues from dialplan, and also no way to get a pause reason for a member. I am going to add a couple of dialplan functions for that. The first one should obviously be called QUEUE_LIST and accept no parameters. For the second one, I am not sure whether it would be better to add a new function or modify QUEUE_MEMBER. I am leaning towards new function, because I would like to get both pause status and reason in one function call, and also I would like to make the queuename parameter optional. So perhaps QUEUE_PAUSE_STATUS([queuename],interface) which returns ,. The alternative is to add new option to QUEUE_MEMBER (called "pause_reason" or similar). Nik -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com <http://www.api-digital.com> -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev <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
[asterisk-dev] Missing queue dialplan functions
Hello, there is currently no way (AFAIK) to get a list of all queues from dialplan, and also no way to get a pause reason for a member. I am going to add a couple of dialplan functions for that. The first one should obviously be called QUEUE_LIST and accept no parameters. For the second one, I am not sure whether it would be better to add a new function or modify QUEUE_MEMBER. I am leaning towards new function, because I would like to get both pause status and reason in one function call, and also I would like to make the queuename parameter optional. So perhaps QUEUE_PAUSE_STATUS([queuename],interface) which returns ,. The alternative is to add new option to QUEUE_MEMBER (called "pause_reason" or similar). Nik -- _ -- 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] Dialplan pre-bridge handlers
Joshua, thank you for an insightful and helpful comment. My situation is not limited to MixMonitor issue, but it is a major obstacle, so the code you provided could prove to be very useful. One can - probably - keep proper call state by using shared variable space, but just as you said, it's kludgy and unreadable. If you feel compelled to write more comments than code, something is wrong. 21. 07. 2020. u 18:04, Joshua Elson je napisao/la: In a general sense, this kind of functionality would indeed be helpful. We've run into a number of circumstances where stuff as simple as setting a channel variable on a known channel (particularly when you're directly operating on Local/ abstractions) would be helpful. I've seen far too many people using SHELL with AMI calls in these out of band scripts that are quite risky to do this. Using SHARED + MASTER_CHANNEL can - sometimes - get you where you need to go, but it's particularly kludgy, doesn't work in all circumstances, and doesn't make for very readable code. I've run into the exact issue - needing to do stuff with MixMonitor on other channels - quite a few times. Never got around to cleaning this up to submit, but attached patch adds a MuteMixMonitor application that takes as its first argument a Channel ID. Nikša - if your situation is limited to just the MixMonitor issue, you could pretty easily modify existing start/stop apps or add a new one to do what you need. On Tue, Jul 21, 2020 at 3:31 AM Nikša Baldun <mailto:i...@voxdiversa.hr>> wrote: I suspected there might be a catch. So far, our dabbling in Asterisk code consists of some patches, mostly for our internal use, and a small Asterisk module. It didn't take us long to figure out how to make a module, even with limited documentation, but this looks an order of magnitude more difficult. On 21. 07. 2020. 10:58, Joshua C. Colp wrote: On Tue, Jul 21, 2020 at 3:52 AM Nikša Baldun mailto:i...@voxdiversa.hr>> wrote: Thanks for the reply, Joshua. It would definitely be useful. I took a look at FreePBX code to see how they handle call recordings in my example scenario, and apparently they call a PHP script from dialplan, which then controls recording via AMI connection. An awful lot of effort, not to mention a performance hit. I am guessing they wouldn't do it if there was any other way. I am not surprised that this functionality does not exist, I know that Asterisk development is difficult, but I am surprised there was no talk about it. I might take a crack at this myself if my schedule clears up. I am thinking, pre-bridge handlers already exist, and methodology for pushing handlers onto a channel already exists. So one could figure it out with some effort. Or am I being naive? Each provider of such functionality does its own parsing, handling of any other channel, but does call a common function. The pushing of handlers isn't generic or anything, so it would have to be copied. -- Joshua C. Colp Asterisk Technical Lead Sangoma Technologies Check us out at www.sangoma.com <http://www.sangoma.com> and www.asterisk.org <http://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 -- _ -- 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] Dialplan pre-bridge handlers
I suspected there might be a catch. So far, our dabbling in Asterisk code consists of some patches, mostly for our internal use, and a small Asterisk module. It didn't take us long to figure out how to make a module, even with limited documentation, but this looks an order of magnitude more difficult. On 21. 07. 2020. 10:58, Joshua C. Colp wrote: On Tue, Jul 21, 2020 at 3:52 AM Nikša Baldun <mailto:i...@voxdiversa.hr>> wrote: Thanks for the reply, Joshua. It would definitely be useful. I took a look at FreePBX code to see how they handle call recordings in my example scenario, and apparently they call a PHP script from dialplan, which then controls recording via AMI connection. An awful lot of effort, not to mention a performance hit. I am guessing they wouldn't do it if there was any other way. I am not surprised that this functionality does not exist, I know that Asterisk development is difficult, but I am surprised there was no talk about it. I might take a crack at this myself if my schedule clears up. I am thinking, pre-bridge handlers already exist, and methodology for pushing handlers onto a channel already exists. So one could figure it out with some effort. Or am I being naive? Each provider of such functionality does its own parsing, handling of any other channel, but does call a common function. The pushing of handlers isn't generic or anything, so it would have to be copied. -- Joshua C. Colp Asterisk Technical Lead Sangoma Technologies Check us out at www.sangoma.com <http://www.sangoma.com> and www.asterisk.org <http://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] Dialplan pre-bridge handlers
Thanks for the reply, Joshua. It would definitely be useful. I took a look at FreePBX code to see how they handle call recordings in my example scenario, and apparently they call a PHP script from dialplan, which then controls recording via AMI connection. An awful lot of effort, not to mention a performance hit. I am guessing they wouldn't do it if there was any other way. I am not surprised that this functionality does not exist, I know that Asterisk development is difficult, but I am surprised there was no talk about it. I might take a crack at this myself if my schedule clears up. I am thinking, pre-bridge handlers already exist, and methodology for pushing handlers onto a channel already exists. So one could figure it out with some effort. Or am I being naive? On 20. 07. 2020. 16:29, Joshua C. Colp wrote: On Fri, Jul 17, 2020 at 6:04 AM Nikša Baldun <mailto:i...@voxdiversa.hr>> wrote: Hello, I have been using Asterisk for years, and the one thing that I believe is sorely missing, but I can't find any mention of it on the Internet, and that is pushable pre-bridge handlers. In current setup, there are following limitations: 1. Pre-bridge handler can only be attached to the B-leg channel, not the A-leg channel. 2. The handler will only be executed before a bridge resulting from Dial application, but a channel can be bridged multiple times during its lifetime (by SIP attended transfer, for example). So, for example, if I want to turn call recording on/off depending on who the channel is bridged to, there is no way to do that via dialplan (that I know of). There is a possibility to attach hangup handlers to any channel by using CHANNEL(hangup_handler_push), but no similar feature for pre-bridge handlers, which are much more important, IMO. So, has there been any discussion among developers about this topic? I can't say I've heard anyone request or discuss such a thing anywhere. That being said it sounds at face value like it could be useful. -- Joshua C. Colp Asterisk Technical Lead Sangoma Technologies Check us out at www.sangoma.com <http://www.sangoma.com> and www.asterisk.org <http://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] Dialplan pre-bridge handlers
Documentation says that StopMixMonitor "Stops the audio recording that was started with a call to MixMonitor() on the current channel", and I don't see a way to run Joe's channel through dialplan. Perhaps I am not understanding something here. Anyway, this is just one example where pushable pre-bridge handlers would be useful. It seems to me that many things would be easier/possible if they were introduced. If nobody else finds them useful, I guess I am missing something. On 17. 07. 2020. 14:45, Jim Van Meggelen wrote: Pass stopmixmonitor the mixmonitorid of Joe's channel. I'll admit it might end up being somewhat kludgy, but I figure a database can keep track of all that for you, so it's just a query at the right moment, and then passing the correct mixmonitorid in the local channel. I can tell you this: if you need new functionality built into Asterisk, that's really only going to happen if you're willing to fund the development, or you can convince Sangoma there's a business case. On Fri, Jul 17, 2020 at 8:17 AM Nikša Baldun <mailto:i...@voxdiversa.hr>> wrote: Hello Jim, thanks for the reply. Consider the following scenario: Joe calls Mary and asks to speak to Jill. Recording a call with Mary is allowed, so recording on Joe's channel is turned on. Mary makes an attended transfer to Jill. Both Mary's channels are hung up, and Joe's and Jill's channels are now bridged. Recording a call with Jill is not allowed, so StopMixMonitor should be executed on Joe's channel before bridging. How can Local channel help me do that? For the specific use case you've described, I should think a Local/ channel could be built to implement the necessary logic. In fact I'm pretty sure we do that in our Local/ channel handler for queue agents. On Fri, Jul 17, 2020 at 5:04 AM Nikša Baldun http://lists.digium.com/mailman/listinfo/asterisk-dev>> wrote: >/Hello, />//>/I have been using Asterisk for years, and the one thing that I believe />/is sorely missing, but I can't find any mention of it on the Internet, />/and that is pushable pre-bridge handlers. In current setup, there are />/following limitations: />//>/1. Pre-bridge handler can only be attached to the B-leg channel, not the />/A-leg channel. />//>/2. The handler will only be executed before a bridge resulting from Dial />/application, but a channel can be bridged multiple times during its />/lifetime (by SIP attended transfer, for example). />//>/So, for example, if I want to turn call recording on/off depending on />/who the channel is bridged to, there is no way to do that via dialplan />/(that I know of). />//>/There is a possibility to attach hangup handlers to any channel by using />/CHANNEL(hangup_handler_push), but no similar feature for pre-bridge />/handlers, which are much more important, IMO. So, has there been any />/discussion among developers about this topic? />//>/Best regards. />//>//>/-- />/_ />/-- Bandwidth and Colocation Provided by http://www.api-digital.com <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] Dialplan pre-bridge handlers
Hello Jim, thanks for the reply. Consider the following scenario: Joe calls Mary and asks to speak to Jill. Recording a call with Mary is allowed, so recording on Joe's channel is turned on. Mary makes an attended transfer to Jill. Both Mary's channels are hung up, and Joe's and Jill's channels are now bridged. Recording a call with Jill is not allowed, so StopMixMonitor should be executed on Joe's channel before bridging. How can Local channel help me do that? For the specific use case you've described, I should think a Local/ channel could be built to implement the necessary logic. In fact I'm pretty sure we do that in our Local/ channel handler for queue agents. On Fri, Jul 17, 2020 at 5:04 AM Nikša Baldun http://lists.digium.com/mailman/listinfo/asterisk-dev>> wrote: >/Hello, />//>/I have been using Asterisk for years, and the one thing that I believe />/is sorely missing, but I can't find any mention of it on the Internet, />/and that is pushable pre-bridge handlers. In current setup, there are />/following limitations: />//>/1. Pre-bridge handler can only be attached to the B-leg channel, not the />/A-leg channel. />//>/2. The handler will only be executed before a bridge resulting from Dial />/application, but a channel can be bridged multiple times during its />/lifetime (by SIP attended transfer, for example). />//>/So, for example, if I want to turn call recording on/off depending on />/who the channel is bridged to, there is no way to do that via dialplan />/(that I know of). />//>/There is a possibility to attach hangup handlers to any channel by using />/CHANNEL(hangup_handler_push), but no similar feature for pre-bridge />/handlers, which are much more important, IMO. So, has there been any />/discussion among developers about this topic? />//>/Best regards. />//>//>/-- />/_ />/-- Bandwidth and Colocation Provided by http://www.api-digital.com <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
[asterisk-dev] Dialplan pre-bridge handlers
Hello, I have been using Asterisk for years, and the one thing that I believe is sorely missing, but I can't find any mention of it on the Internet, and that is pushable pre-bridge handlers. In current setup, there are following limitations: 1. Pre-bridge handler can only be attached to the B-leg channel, not the A-leg channel. 2. The handler will only be executed before a bridge resulting from Dial application, but a channel can be bridged multiple times during its lifetime (by SIP attended transfer, for example). So, for example, if I want to turn call recording on/off depending on who the channel is bridged to, there is no way to do that via dialplan (that I know of). There is a possibility to attach hangup handlers to any channel by using CHANNEL(hangup_handler_push), but no similar feature for pre-bridge handlers, which are much more important, IMO. So, has there been any discussion among developers about this topic? 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