<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div>On Wed, 2021-11-03 at 16:25 -0300, Joshua C. Colp wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>On Wed, Nov 3, 2021 at 3:31 PM Kingsley Tart <<a href="mailto:kingsley@dns99.co.uk">kingsley@dns99.co.uk</a>> wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>Hi,</div><div><br></div><div>When dialling a remote SIP host with PJSIP, is it possible either</div><div>within the dialplan or via the AMI to find out the IP address of the</div><div>remote host?</div></blockquote><div><br></div><div>The CHANNEL dialplan function[1] provides functionality for pjsip to get the remote address.</div><div><br></div><div>[1] <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+19+Function_CHANNEL">https://wiki.asterisk.org/wiki/display/AST/Asterisk+19+Function_CHANNEL</a> </div><div><br></div></blockquote><div><br></div><div>Thanks, that looks perfect. What is the syntax? I have tried a few things but none work:</div><div><br></div><pre>exten => s,n,Set(tmp=CHANNEL(PJSIP,remote_addr))</pre><pre>exten => s,n,Set(tmp=CHANNEL(PJSIP/remote_addr))</pre><pre>exten => s,n,Set(tmp=${CHANNEL(PJSIP,remote_addr)})</pre><pre>exten => s,n,Set(tmp=${CHANNEL(PJSIP/remote_addr)})</pre><pre>exten => s,n,Set(tmp=CHANNEL(pjsip,remote_addr))</pre><pre>exten => s,n,Set(tmp=CHANNEL(pjsip/remote_addr))</pre><pre>exten => s,n,Set(tmp=${CHANNEL(pjsip,remote_addr)})</pre><pre>exten => s,n,Set(tmp=${CHANNEL(pjsip/remote_addr)})</pre><pre>exten => s,n,Set(tmp=CHANNEL(remote_addr))</pre><pre>exten => s,n,Set(tmp=CHANNEL(remote_addr))</pre><pre>exten => s,n,Set(tmp=${CHANNELremote_addr)})</pre><pre>exten => s,n,Set(tmp=${CHANNEL(remote_addr)})</pre><div><br></div><div><br></div><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:5] Set("PJSIP/btipx-00000005", "tmp=CHANNEL(PJSIP,remote_addr)") in new stack</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:6] Set("PJSIP/btipx-00000005", "tmp=CHANNEL(PJSIP/remote_addr)") in new stack</pre><pre>[Nov 4 11:41:20] WARNING[11722][C-00000003]: func_channel.c:463 func_channel_read: Unknown or unavailable item requested: 'PJSIP,remote_addr'</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:7] Set("PJSIP/btipx-00000005", "tmp=") in new stack</pre><pre>[Nov 4 11:41:20] WARNING[11722][C-00000003]: func_channel.c:463 func_channel_read: Unknown or unavailable item requested: 'PJSIP/remote_addr'</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:8] Set("PJSIP/btipx-00000005", "tmp=") in new stack</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:9] Set("PJSIP/btipx-00000005", "tmp=CHANNEL(pjsip,remote_addr)") in new stack</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:10] Set("PJSIP/btipx-00000005", "tmp=CHANNEL(pjsip/remote_addr)") in new stack</pre><pre>[Nov 4 11:41:20] WARNING[974]: pjsip/dialplan_functions.c:834 channel_read_pjsip: No transport information for channel PJSIP/btipx-00000005</pre><pre>[Nov 4 11:41:20] WARNING[11722][C-00000003]: func_channel.c:463 func_channel_read: Unknown or unavailable item requested: 'pjsip,remote_addr'</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:11] Set("PJSIP/btipx-00000005", "tmp=") in new stack</pre><pre>[Nov 4 11:41:20] WARNING[11722][C-00000003]: func_channel.c:463 func_channel_read: Unknown or unavailable item requested: 'pjsip/remote_addr'</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:12] Set("PJSIP/btipx-00000005", "tmp=") in new stack</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:13] Set("PJSIP/btipx-00000005", "tmp=CHANNEL(remote_addr)") in new stack</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:14] Set("PJSIP/btipx-00000005", "tmp=CHANNEL(remote_addr)") in new stack</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:15] Set("PJSIP/btipx-00000005", "tmp=") in new stack</pre><pre>[Nov 4 11:41:20] WARNING[11722][C-00000003]: func_channel.c:463 func_channel_read: Unknown or unavailable item requested: 'remote_addr'</pre><pre> -- Executing [<a href="mailto:s@register-answer">s@register-answer</a>:16] Set("PJSIP/btipx-00000005", "tmp=") in new stack</pre><pre><br></pre><div><br></div><div><span><pre>-- <br></pre><div style="width: 71ch;">Cheers,</div><div style="width: 71ch;">Kingsley.</div></span></div></body></html>