How do you get a pjsip endpoint ip address?

I am transferring my dialplan to the new pjsip channel driver and I cannot find the built in variable that will give me the ip address of the current endpoint.

I was using this variable before but it is not recognized anymore by asterisk when using PJSIP:

${CHANNEL(peerip)}

By the way, where can I find all the builtin variables available for a channel with PJSIP?

Howdy,

The IP address you want is of the contact associated with the AOR that’s associated with the endpoint.

So, use the PJSIP_AOR dial plan function, e.g.:

PJSIP_AOR(101,contact)

and you’ll get something like

101;@sip:101@10.1.2.3:5060;ob

Check out the PJSIP_ functions from:
wiki.asterisk.org/wiki/display/ … +Functions

Cheers

As well the CHANNEL specific arguments for PJSIP are documented at wiki.asterisk.org/wiki/display/ … on_CHANNEL

Thanx a lot! Here is a complete example working for me:

It is a bit more work than before it’s ok.

exten => *63,1,NoOp()
same => n,Verbose(${CHANNEL(endpoint)})
same => n,Set(IP=${PJSIP_AOR(${CHANNEL(endpoint)},contact)})
same => n,Set(IP=${CUT(IP,:,2)})
same => n,Set(IP=${CUT(IP,@,2)})
same => n,Verbose(My IP Is ${IP})
same => n,Hangup()

Can I use PJSIP_AOR() outside of a dialplan context, like at an asterisk -r console prompt?