Who answered with Dial() multiple channels


#1

I use Dial command to dial 2 different numbers simultaneously:

Dial(SIP/NUMBER1&SIP/NUMBER2)

If one of them answers, is there any way to know which? A variable or something like that.

Can’t find any data in CDR record - CDR(dst)=s, because “s” is the context where I run Dial() command.


#2

BRIDGE_PEER


#3

Sorry, my Dial() function actually looks like this:

Dial(SIP/NUMBER1@SomeSipPeer&SIP/NUMBER2@SomeSipPeer)

Now BRIDGEPEER=SIP/SomeSipPeer-00000249, same as dstchannel from CDR, no info about number. Maybe there is a way to get number from channel name?


#4

Which asterisk Version are You using?
With Asterisk 1.8.x You could do something like (here in AEL-style):

Dial(SIP/NUMBER1@SomeSipPeer&SIP/NUMBER2@SomeSipPeer,,U(setdestpeer));

context setdestpeer {

 s =>        {
               Set(LOCAL(RealProvider)=${CUT(DIALEDPEERNUMBER,/,1)});
               Set(LOCAL(RealCalled)=${CUT(DIALEDPEERNUMBER,/,2)});
                // Make Your logic here: RealProvider contains the used peer,
                // RealCalled the Number, called
                // e.g. to set up the CDR(userfield) You could do
                Set(MASTER_CHANNEL(CDR(userfield))=${RealCalled});
                Return;
              }
}