[asterisk-users] Dial(PJSIP/xx) - finding the IP address it connected to

Kingsley Tart kingsley at dns99.co.uk
Thu Nov 4 06:43:26 CDT 2021


On Wed, 2021-11-03 at 16:25 -0300, Joshua C. Colp wrote:
> On Wed, Nov 3, 2021 at 3:31 PM Kingsley Tart <kingsley at dns99.co.uk>
> wrote:
> > Hi,
> > 
> > When dialling a remote SIP host with PJSIP, is it possible either
> > within the dialplan or via the AMI to find out the IP address of
> > the
> > remote host?
> 
> The CHANNEL dialplan function[1] provides functionality for pjsip to
> get the remote address.
> 
> [1] 
> https://wiki.asterisk.org/wiki/display/AST/Asterisk+19+Function_CHANNEL
>  
> 

Thanks, that looks perfect. What is the syntax? I have tried a few
things but none work:

exten => s,n,Set(tmp=CHANNEL(PJSIP,remote_addr))exten =>
s,n,Set(tmp=CHANNEL(PJSIP/remote_addr))exten =>
s,n,Set(tmp=${CHANNEL(PJSIP,remote_addr)})exten =>
s,n,Set(tmp=${CHANNEL(PJSIP/remote_addr)})exten =>
s,n,Set(tmp=CHANNEL(pjsip,remote_addr))exten =>
s,n,Set(tmp=CHANNEL(pjsip/remote_addr))exten =>
s,n,Set(tmp=${CHANNEL(pjsip,remote_addr)})exten =>
s,n,Set(tmp=${CHANNEL(pjsip/remote_addr)})exten =>
s,n,Set(tmp=CHANNEL(remote_addr))exten =>
s,n,Set(tmp=CHANNEL(remote_addr))exten =>
s,n,Set(tmp=${CHANNELremote_addr)})exten =>
s,n,Set(tmp=${CHANNEL(remote_addr)})

    -- Executing [s at register-answer:5] Set("PJSIP/btipx-00000005",
"tmp=CHANNEL(PJSIP,remote_addr)") in new stack    -- Executing [
s at register-answer:6] Set("PJSIP/btipx-00000005",
"tmp=CHANNEL(PJSIP/remote_addr)") in new stack[Nov  4 11:41:20]
WARNING[11722][C-00000003]: func_channel.c:463 func_channel_read:
Unknown or unavailable item requested: 'PJSIP,remote_addr'    --
Executing [s at register-answer:7] Set("PJSIP/btipx-00000005", "tmp=") in
new stack[Nov  4 11:41:20] WARNING[11722][C-00000003]:
func_channel.c:463 func_channel_read: Unknown or unavailable item
requested: 'PJSIP/remote_addr'    -- Executing [s at register-answer:8]
Set("PJSIP/btipx-00000005", "tmp=") in new stack    -- Executing [
s at register-answer:9] Set("PJSIP/btipx-00000005",
"tmp=CHANNEL(pjsip,remote_addr)") in new stack    -- Executing [
s at register-answer:10] Set("PJSIP/btipx-00000005",
"tmp=CHANNEL(pjsip/remote_addr)") in new stack[Nov  4 11:41:20]
WARNING[974]: pjsip/dialplan_functions.c:834 channel_read_pjsip: No
transport information for channel PJSIP/btipx-00000005[Nov  4 11:41:20]
WARNING[11722][C-00000003]: func_channel.c:463 func_channel_read:
Unknown or unavailable item requested: 'pjsip,remote_addr'    --
Executing [s at register-answer:11] Set("PJSIP/btipx-00000005", "tmp=") in
new stack[Nov  4 11:41:20] WARNING[11722][C-00000003]:
func_channel.c:463 func_channel_read: Unknown or unavailable item
requested: 'pjsip/remote_addr'    -- Executing [s at register-answer:12]
Set("PJSIP/btipx-00000005", "tmp=") in new stack    -- Executing [
s at register-answer:13] Set("PJSIP/btipx-00000005",
"tmp=CHANNEL(remote_addr)") in new stack    -- Executing [
s at register-answer:14] Set("PJSIP/btipx-00000005",
"tmp=CHANNEL(remote_addr)") in new stack    -- Executing [
s at register-answer:15] Set("PJSIP/btipx-00000005", "tmp=") in new
stack[Nov  4 11:41:20] WARNING[11722][C-00000003]: func_channel.c:463
func_channel_read: Unknown or unavailable item requested:
'remote_addr'    -- Executing [s at register-answer:16] Set("PJSIP/btipx-
00000005", "tmp=") in new stack

-- 
Cheers,
Kingsley.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20211104/2e700d1f/attachment.html>


More information about the asterisk-users mailing list