Search code examples
asteriskvoip

Asterisk pre-emption and callers in a channel


I would like to have pre-emption calls in Asterisk. I think there is no Asterisk support for this feature so i'm trying to implement it following a simliar algorithm like the one showed in this thread: Asterisk - Pre-emption calls

So I'm having problems in this step:

  • check if B in call with lower priority caller( ASTDB or REALTIME or fastagi script).

I know how to check if B is in a call using for example DEVICE_STATE(device) cmd, but i can't achieve to know who is the other caller in order to see his priority.

So, How can I know if one users is in a call and who is the other caller inside this call?

Thanks a lot.


Solution

  • You can read variables of any channel using

    SHARED(varname[,channel])
      -= Info about function 'SHARED' =- 
    
    [Synopsis]
    Gets or sets the shared variable specified. 
    
    [Description]
    Implements a shared variable area, in which you may share variables between
    channels.
    The variables used in this space are separate from the general namespace
    of the channel and thus ${SHARED(foo)} and ${foo}  represent two completely
    different variables, despite sharing the same name.
    Finally, realize that there is an inherent race between channels operating
    at the same time, fiddling with each others' internal variables, which is
    why this special variable namespace exists; it is to remind you that variables
    in the SHARED namespace may change at any time, without warning.  You should
    therefore take special care to ensure that when using the SHARED namespace,
    you retrieve the variable and store it in a regular channel variable before
    using it in a set of calculations (or you might be surprised by the
    result).
    

    Sure you have set variables first. You can set in variables or in ASTDB name of current speaking channel using in-call macro

    General complexity of any solution like you want is above average, need person with at least 1-2 year of extensive experience with *.