# Dynamic dialplan - how to get peer definition as variable

#1

Hello,

i’m trying to configure a dynamic dialplan for asterisk. Therefor i need access to the names of peer definitions in sip.conf of a calling sip peer.

example:

``````sip.conf

[alice]
context=from-internal
type=friend
.
.
.
and so on
``````

If peer alice is calling i can use some predefined variables from asterisk like \${CALLERID} in extensions.conf. But it seems that none of these (http://www.voip-info.org/wiki-Asterisk+variables) represents this peer definition name of the calling peer. Are there some more variables or asterisk applications/functions to get the name of the calling peer?

Andreas

#2

\${CALLERID(name)}
\${CALLERID(number)}

Also have a look at the “-o” switch, since the CALLERID behavior changed in 1.2.?.. and the “-o” means “old format”.

#3

Thanks RichardHH,
but i think that’s not what i’m looking for. I need to get the peer definition of sip.conf (in my eaxample “alice” if that peer is calling). \${CALLERID(name)} is the value defined via callerid=Alice <100> in alice’s peer definition in sip.conf. But i’m trying to get access to peer definition name (alice for [alice] peer definition) for calling peer.

I hope you could understand what i’m trying to say