Asterisk determine which phone number was answered when making simultaneous calls?

1.8k views Asked by At

I am using asterisk to make a phone call to multiple numbers simultaneously using

Dial(SIP/XXXXX&SIP/YYYYY&SIP/ZZZZZ)

This will call all three numbers at once and which ever one picks up first gets connected and other are hung up.

What I am trying to work out is there anyway in the dial plan to determine which of those numbers was the one that answered?

Little bit more information:

What happens is that a call comes in from outside DID number over SIP, I look up in my database and get a list of numbers to call at once (again outside PSTN type numbers) which the system rings using above.

XXXX could be 0712345678@provider

YYYY Could be 0412345678@provider

etc

2

There are 2 answers

2
johaidi On

one way to do this is look at CDR disposition and dstchannel values, like this:

exten=>h,1,NoOp( -- ${CDR(disposition)} -- ${CDR(dstchannel)} -- )

1
Nir Simionovich On

You can use the following variables to obtain that information:

${DIALEDPEERNAME} * Dialed peer name ${DIALEDPEERNUMBER} * Dialed peer number

The first will hold the name of the peer that was used - if you are dialing to a SIP device, that is what you're looking for. If you dialed using a carrier, you will need to use the second.

Good luck.