[asterisk-dev] Asterisk-11.5.1 Confbridge Dailout using pbx_exce new user not placed into current conference

Matthew Jordan mjordan at digium.com
Mon Apr 21 09:48:58 CDT 2014


On Mon, Apr 21, 2014 at 5:52 AM, hkc323 <hkc323 at gmail.com> wrote:
>  Task:Dialout from current running ConferenceBridge(eg.:1010101) and Add Sip
> user (eg:Sip/7001 on my newwork )
> issue:
> We i Dailout with Dial app with help of func. pbx_exec

This won't do what you want it to do.

The Dial application implicitly creates a bridge between the caller
and the called party. Since the caller is already a member of the
Conference Bridge, this has two negative effects:
(a) Neither party is in the Conference Bridge, as they are now in the
bridge created by Dial
(b) More insidiously, the caller - who is still technically tracked by
the Conference Bridge - is in a pseudo state where they are both in
the Conference (but suspended from it) as well as in the bridge
created by the Dial. Shenanigans may ensue if you attempted to
manipulate the user in the Conference while they were in such a state.

As an aside, there's no need to modify the source code to accomplish
this use case. You can do all of this using the dialplan and the
dialplan_exec menu option (and/or AMI).

> User not merge current running ConferenceBridge(eg.:1010101) but create
> other new conferenceBridge.
> (eg : Name:conference_bridge->name)
> help : how to pass conference_bridge->name into Dial App strings.?
> so that new user merge place into current running Conferencebridge.

Don't use Dial. It's the wrong tool for the job.

Instead, use Originate. But don't do this in C - use the dialplan and
AMI. There's absolutely no need to modify ConfBridge to achieve this
functionality.

> [macro-CONFDAILOUT]
> exten => s,1,Verbose("================== USER has PICKUPED OR ANSWERED so
> placed him/her into Conf no : ${ARG1} =================== ")
> ;same => n,Set(MEETME_ROOMNUM=1010101)
> ;same => n,ConfBridge(${MEETME_ROOMNUM},,,conf-admin-sub-dialout)
> same => n,ConfBridge(${ARG1},,,conf-admin-sub-dialout)
> same => n,macroexit()
>
> struct ast_app *dialapp = pbx_findapp("Dial");
> char dialstr[100];
> char confnum[8];
> ast_copy_string(confnum,conference_bridge->name,sizeof(confnum));
> ast_verb(3,"\n *************Confnum :%s ************\n",confnum);
> ast_verb(3,"\n *************&Confnum :%s ************\n",&confnum);
>
> strcpy (dialstr,"SIP");
> //strcpy (dialstr,"SIP");
> strcat (dialstr,"/");
> strcat (dialstr,Sphone);
> strcat (dialstr,",");
> strcat (dialstr,"30");
> strcat (dialstr,",");
> //for o/p:1
> strcat (dialstr,"hgM(CONFDAILOUT^&confnum)");
> //for o/p:2
> //strcat (dialstr,"hgM(CONFDAILOUT^&conference_bridge->name)");
>
> ast_verb(3,"\n=====Dialing string: '%s' =====\n", dialstr);
>
> ast_log(LOG_NOTICE,"\n=====Dialing string: '%s' =====\n", dialstr);
>
> res=pbx_exec(bridge_channel->chan,dialapp,dialstr);
> //res=pbx_exec(bridge_channel->chan,Originate,dialstr);

FYI: This is horribly unsafe. You cannot manipulate channels in a
bridge managed by the bridging framework outside of that framework.
Doing so *will* result in crashes. You certainly cannot safely invoke
dialplan applications on those channels unless they are first
suspended out of the bridging framework, and even then, some dialplan
applications - such as Dial - are just a bad idea (as previously
noted).

> ast_verb(3,"\n ========Return from pbx_exec '%i' \n",res);
> ast_log(LOG_NOTICE,"\n ======Return from pbx_exec '%i'",res);
>
> pbx_builtin_setvar_helper(bridge_channel->chan,
> "sourcemeetme",conference_bridge->name);
> ast_verb(3,"\n ====Return from  Disposition:
> '%s'\n",pbx_builtin_getvar_helper(bridge_channel->chan, "DIALSTATUS"));
>
> conference_bridge->name is [1010101]
> and &conference_bridge->name:[1010101]
> =====Dialing string: 'SIP/7001,30,hgM(CONFDAILOUT^conference_bridge->name)'
> =====
> o/p:1
> Conference Bridge Name           Users  Marked Locked?
> ================================ ====== ====== ========
> conference_bridge->name               1      0 unlocked
> 1010101                               1      1 unlocked
> o/p:2
> Conference Bridge Name           Users  Marked Locked?
> ================================ ====== ====== ========
> 1010101                               1      1 unlocked
> &confnum                              1      0 unlocked

I would suggest abandoning the C approach to this problem, and
constructing a solution that uses the dialplan applications and AMI to
control the conference. This is really all that is needed for this
problem, and the structure of ConfBridge lends itself better to this
approach.

Matt

-- 
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list