Is it possible to get the MAC address of a SIP endpoint programatically within an asterisk dialplan?
For example, could I have a user dial an extension and have it read back the mac address of the phone? Or IP address? I’m thinking particularly from a SIP endpoint.
Most likely the end point does not use domain name in its URI. Try (untested)
exten => s,1,NoOp(caller from ${SIPURI})
exten => s,n,SayDigits(${CUT(SIPURI,@,2)})
If for some reason the end point sets its own URI with domain name, AGI will be necessary. To get MAC address, use arp in an AGI. (I don’t think you can have have MAC outside LAN wire.)
exten => 516,1,Noop(${SIPCALLID})
exten => 516,n,Set(FR=${SIP_HEADER(From):6})
exten => 516,n,Set(FR=${CUT(FR,<,2)})
exten => 516,n,Set(FR=${CUT(FR,@,1)})
exten => 516,n,Set(FR=${CUT(FR,:,2)})
exten => 516,n,Set(IP=${SIP_HEADER(Via):8})
exten => 516,n,Set(IP=${CUT(IP,P,2)})
exten => 516,n,Set(IP=${CUT(IP,b,1)})
exten => 516,n,Noop(${IP})
exten => 516,n,Set(UA=${SIP_HEADER(User-Agent):12})
exten => 516,n,Noop(${UA})
exten => 516,n,flite(Your caller i d is ${FR} and i p address is ${IP} Your user agent is a ${UA})
you could cut up the IP address into defined digits to tidy it up a bit