<div dir="auto">System doesn't listen to stdout, it's only for running the command. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 28, 2021, 6:22 PM Antony Stone <<a href="mailto:Antony.Stone@freeswitch.open.source.it">Antony.Stone@freeswitch.open.source.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi.<br>
<br>
I'm using FreeSwitch 1.10.7 as a client registering to other PBXs as well as a <br>
SIP server itself.<br>
<br>
I am setting the user-agent string in the SIP profile, such as:<br>
<br>
<param name="user-agent-string" value="FS $${CFGver} $${hostname}"/><br>
<br>
The variable $${CFGver}} is a version string I'm definiing in vars.xml<br>
<br>
This is working, but it gives me the FQDN of the machine as $${hostname}} and <br>
I really only want the machine name without the domain.<br>
<br>
I've found <br>
<a href="https://freeswitch.org/confluence/display/FREESWITCH/Regular+Expression" rel="noreferrer noreferrer" target="_blank">https://freeswitch.org/confluence/display/FREESWITCH/Regular+Expression</a> and <br>
<a href="https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+regex" rel="noreferrer noreferrer" target="_blank">https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+regex</a> and <br>
I've tried to use them to cut the domain off the value of $${hostname} but with <br>
no success:<br>
<br>
In vars.xml:<br>
<X-PRE-PROCESS cmd="set" data="shorthostname=${regex($${hostname}|([^\.]*).*|<br>
%1)}"/><br>
<br>
This results in the variable shorthostname being assigned the value:<br>
        %{regex(abcd.efgh.tld|([^\.]*).*|%1)}<br>
<br>
where abcd.efgh.tld is the server's FQDN.<br>
<br>
Instead of doing that in vars.xml and creating the variable shorthostname, I <br>
tried putting the regex into the SIP profile:<br>
<br>
<param name="user-agent-string" value="FS $${CFGver} ${regex($${hostname}|<br>
([^\.]*).*|%1)}"/><br>
<br>
This ends up with precisely the same result.  The ${regex(....)} function <br>
simply isn't being executed.<br>
<br>
<br>
Given that the machine's hostname is also available from the system command <br>
"hostname -s" I decided to try that instead:<br>
<br>
In vars.xml:<br>
<X-PRE-PROCESS cmd="set" data="shorthostname=${system(hostname -s)}"/><br>
<br>
Or in the SIP profile definition:<br>
<param name="user-agent-string" value="FS $${CFGver} ${system(hostname -s)}"/><br>
<br>
These both produce the output:<br>
        FS 0.65 ${system(hostname -s)}<br>
<br>
In other words, the ${system(....)} command isn't working any more than <br>
${regex(....)} did.<br>
<br>
<br>
What am I doing wrong please?<br>
<br>
<br>
How can I get the machine's short hostname into a user-agent string for <br>
registration to a server?<br>
<br>
<br>
Thanks,<br>
<br>
<br>
Antony.<br>
<br>
-- <br>
Perfection in design is achieved not when there is nothing left to add, but <br>
rather when there is nothing left to take away.<br>
<br>
 - Antoine de Saint-Exupery<br>
<br>
                                                   Please reply to the list;<br>
                                                         please *don't* CC me.<br>
<br>
_________________________________________________________________________<br>
<br>
The FreeSWITCH project is sponsored by SignalWire <a href="https://signalwire.com" rel="noreferrer noreferrer" target="_blank">https://signalwire.com</a><br>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.<br>
Build your next product on our scalable cloud platform.<br>
<br>
Join our online community to chat in real time <a href="https://signalwire.community" rel="noreferrer noreferrer" target="_blank">https://signalwire.community</a><br>
<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank" rel="noreferrer">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" rel="noreferrer noreferrer" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" rel="noreferrer noreferrer" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" rel="noreferrer noreferrer" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" rel="noreferrer noreferrer" target="_blank">https://cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank" rel="noreferrer">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" rel="noreferrer noreferrer" target="_blank">https://freeswitch.com</a></blockquote></div>