SMconfjoin
Previous Topic  Next Topic 

Synopsis:

        SMconfjoin(conf_id,vox_chan_out[,Type(1-listen only),[vox_chan_in,OutAgc,OutVol,InAGC,InVol])


Arguments:

       conf_id The conference ID

       vox_chan_out   The voice channel whose output side will carry the conference audio

       [Type] Set to 0 for full duplex (default) or 1 for listen only

            [vox_chan_in] The voice channel whose input side will be inserted into the conference (by default same as vox_chan_out)

       [OutAgc] Set to 1 (default) to enable automatic gain control on the output from the conference

       [OutVol] Set to the output volume in DB (0 by default)

       [InAGC] Set to 1 (default) to enable automatic gain control on the input to the conference

       [InVol] - Set to the output volume in DB (0 by default)


Description:   This function allows the transmit side of the voice channel specified by  vox_chan_out to carry the audio output from the conference.        Since the transmit side of a voice channel is automatically 'nailed' to the external H.100 or SCBUS timeslot then another device (such as a port on on E1 network channel) can then 'listen' to this timeslot to receive the output from the conference.         


The optional type argument can specify whether the conference is to be joined in 'listen only' mode (in which case the vox_chan_in argument is ignored) or the type is set to 0 then the conference in joined in 'full duplex' mode in which case the vox_chan_in defines the channel whose output will be inserted into the conference.


By default the optional vox_chan_in argument is set to the same voice channel as specified by vox_chan_outbut it can be a different voice channel if required.


The optional OutAgc argument can be set to 1 (default) if automatic gain control (AGC) is to be enabled on the conference output to vox_chan_out, or 0 to disable AGC on the output from the conference.


The optional OutVol can be set to the volume of the output from the conference in DB (default 0).


The optional InAgc argument can  be set to 1 (default) if automatic gain control (AGC) is to be enabled on the conference input from vox_chan_in, or 0 to disable AGC on the input to the conference.


The optional InVol can be set to the volume of the input to the conference in DB (default 0).


Below is an example:


    #  Assume that a call has been received and accepted on port and chan of the network card.      

    # Cause jump to onsignal if hanghup occurs.

    CCuse(port,chan);

    vox_chan=1;


    # Now make a full duplex switch between the network chan and the prosody chan

    CClisten(port,chan,SMgetslot(vox_chan));

    SMlisten(vox_chan,CCgetslot(port,chan);


    # The inbound caller will hear this welcome message first

    SMplay(vox_line,"welcome.vox");


    ## Create a conference on module 0.

    conf_id=SMconfstart(0);

    if(conf_id < 0)

       errlog("Error creating conference on module 0");

       stop;

    end


    ## Add Vox channel to conference..

    x=SMconfjoin(conf_id,vox_chan);

    if(x < 0)

       errlog("Error joining conference id=",conf_id," err=",x);

       stop;

    end


    # Two more conference channels

    vox_chan2=2;

    vox_chan3=3;


    # Two spare voice channels to play prompts

    vox_chan4=4;

    vox_chan5=5;



    ## add these Vox channels to conference..

    x=SMconfjoin(conf_id,vox_chan2);

    if(x < 0)

       errlog("Error joining conference id=",conf_id," err=",x);

       stop;

    end


    x=SMconfjoin(conf_id,vox_chan3);

    if(x < 0)

       errlog("Error joining conference id=",conf_id," err=",x);

       stop;

    end


    # Make these two channels listen to vox channels 4 and 5

    # Since anything that vox_chan, vox_chan2 and vox_chan3 listen to will automatically be inserted into the conference

    SMlisten(vox_chan2,SMgetslot(vox_chan4));

    SMlisten(vox_chan3,SMgetslot(vox_chan5));


    # Now loop playing prompts on channels 4 and 5 which will then be inserted into the conference as channels 2 and 3 are listening to them..

    # only a hangup by inbound caller will interrupt this loop

    while(1)

           # Play in non-blocking mode  (single shot)

           SMmode(vox_chan4);

           SMmode(vox_chan5);

           # These two prompts will be mixed together in the conference and heard by the inbound caller

           SMplay(vox_chan4,"Prompt1.vox");

           SMplay(vox_chan4,"Prompt2.vox");

            # wait for both channels to finish

            while(not SMstate(vox_chan4) and not SMstate(vox_chan5))

                  sleep(30);

              endwhile

    endwhile

… etc


onsignal

       # Abort play on channels 4 and 5

       SMabort(vox_chan4);

       SMabort(vox_chan5);

      # kill the conference

       confend(conf_id);


       .. etc

endonsignal



Returns:   Returns 0 if successful or a negative error code.