Identify channel for incoming call

Asterisk 11.12.0

I have two DID’s registered that call into my asterisk system. When an incoming call is received, I need to be able determine which of the two the call is being received on. I could have each enter the dial plan in a different context, but that doesn’t seem very elegant. Is there a better way to accompolish this?

Thanks for you time.

William.

${EXTEN}

Doesn’t work. As I understand ${EXTEN} it is that value last dialed by a user.

In your inbound context ${EXTEN} will be equal to the incoming DID

exten=>_x.,1,verbose( call from DID ${EXTEN} )

I think the problem may be that, in the VoIP world, DID doesn’t really mean DID, and you cannot rely on any digits being forwarded.