MAC Address From a calling endpoint?

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.


i thought i had an AGI somewhere that did this :[code]<?php


function my_ip(&$agi, $peer)
$ip = ‘unknown’;
$asm = $agi->new_AsteriskManager();
$peer = $asm->command(“sip show peer $peer”);

  if(!strpos($peer['data'], ':'))
    echo $peer['data'];
    $data = array();
    foreach(explode("\n", $peer['data']) as $line)
      $a = strpos('z'.$line, ':') - 1;
      if($a >= 0) $data[trim(substr($line, 0, $a))] = trim(substr($line, $a + 1));

    $ip = explode(' ', trim($data['Addr->IP']));
    $ip = $ip[0];
$agi->text2wav("Your IP address is $ip");

think it came from here originally :

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.)

Make it

exten => s,n,Set(URI=${CUT(SIPURI,@,2)}) exten => s,n,SayDigits(${CUT(URI,:,1)})
just in case.

Hi try

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