[asterisk-users] Getting 'username' of sip peer
Jared Smith
jsmith at digium.com
Wed May 26 12:50:14 CDT 2010
On Wed, 2010-05-26 at 22:48 +0530, Deepesh D wrote:
> When a call is made from any of these peers I want to get the username
> of the peer.
> for eg:- If a call is being made from 'TestSIPUser' then I want to be
> able to get the value 'testuser'
I can think of two ways of doing this. The first is to use the
SIPCHANINFO() dialplan function, like this:
exten=>123,1,Verbose(0,The call came from ${SIPCHANINFO(peername)})
The other option is to use the "setvar=variable=value" setting in the
peer definition in sip.conf. For example, if you add
"setvar=USERID=jsmith" in a user/peer/friend definition, Asterisk would
automagically create a channel variable named USERID with a value of
jsmith every time this device made a call into Asterisk.
--
Jared Smith
Sr. Trainer
Digium, Inc.
More information about the asterisk-users
mailing list