How to make caller both join ConfBridge and execute EAGI?

Hey there,

I’ve been working with Asterisk for a while now and was able to achieve what I wanted so far.
However, now I’m a bit stumped as I’m faced with a situation where I’d have to make a caller do two things at once.
But as I’ve learned, a channel in Asterisk can only do one thing at the same time in a dialplan.

The situation is the following (using PJSIP, if that makes a difference):
I need a call to an extension join another endpoint (which auto-answers) to a ConfBridge, make the calling user join the Confbridge as well and lastly make the calling user execute an EAGI() command to pass the audio to an application on the same filesystem as Asterisk.

The idea is the following:

  1. Caller (an existing endpoint in PJSIP) makes a call to an extension in the dialplan. Works fine, of course.
  2. Use Originate to join another endpoint to a bridge (via ConfBridge). Works fine. Originate returns successfully.
  3. Use ConfBridge on the caller to join them to the bridge as well. Also works fine, BUT…
  4. Use EAGI(/usr/bin/magicapplication,"-magicargument 42"). This never gets executed due to ConfBridge blocking.

An abbridged version of the dialplan looks somewhat like this:

exten => testextension,1,Verbose(Starting testextension...)
same => n,Originate(PJSIP/otherendpoint,exten,default,join_other_to_confbridge,1)
same => n,ConfBridge(1234,my_bridge,my_user)
same => n,Set(EAGI_AUDIO_FORMAT=slin16)
same => n,Set(AGIEXITONHANGUP=yes)
same => n,EAGI(/usr/bin/magicapplication,"-someparam")

Switching the ConfBridge and EAGI commands around leads to the EAGI working fine, but ConfBridge never being executed as now EAGI is the one blocking.

I do, however, need to have both. The “magicapplication” is not something I have control over, but part of our internal infrastructure that needs to have the call audio fed to it via the dialplan.

I’m sure there must be some way to achieve this, but in my searching so far, I did not find any examples of something similar being done.
Local channels have been mentioned, but even after reading up on them, I still don’t understand what exactly they are, how they are different from e.g. a channel created by an endpoint calling an extension or how they could help me achieve this.

What I’d need is really a basic example showcasing how a user can both join a confbridge and have the audio passed on via EAGI. Or something else that does enable a user to “do two things at once”.

While functions themselves are fairly well documented for Asterisk, I’m someone who learns radically better looking at example code and not really from just reading function documentation which for me usually lacks context necessary for understanding.

Can you explain what you are trying to achieve with this (without making any referene to specific Asterisk applications. It’s difficult for me to work that out from abstract descriptions and broken dialplans.

Maybe in different words:
I need two users in a call*, while also forwarding the audio from that call to an application until the call ends.

*(actually more than two later on, hence the ConfBridge and not just a Dial)

Oh, another point that might be important: We are using Asterisk 15 and there is currently no plan to upgrade, unless it was absolutely necessary to achieve the functionality.

If this is speech to text, I think a lot of people have tried that.

One option would be to add a local channel to the application as a member of the conference, although I’m not sure how you would get it out at the end. Otherwise, use ChanSpy.

It isn’t. Can’t really explain it much as it’s an NDA issue, but I don’t think it really matters for this problem what exactly it does. It’s just something that “has to be there” :wink:

I will give that a go.
About the “get it out at the end”: Is there a command that force closes a conference and throws all participants out? Otherwise, maybe making the local channel non-marked and leave-on-marked-exit could work?

Is there a good example for using it? Just looking at the function documentation, I’m not sure how it should be used in my case.

I did end up using ChanSpy.

First I set the SPYGROUP in the main channel that I want to listen to.
And then, in the same main channel, I Originated the other endpoint into an extension that calls ChanSpy using that spygroup.

Pretty simple calls, really:

;In the main channel's extension
same => n,Set(SPYGROUP=12345)

;In the extension that the other endpoint gets Originated into
same => n,ChanSpy(,qg(12345)E)

With that done, the main channel was able to continue its normal flow, ending in the EAGI().

I was not able to have the main channel (or a Local channel spawned from that main channel) in a ConfBridge while also doing an EAGI().

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.